launch method
Launch a template.
request
- The metadata request object.
Request parameters:
projectId
- Required. The ID of the Cloud Platform project that the job
belongs to.
dynamicTemplate_gcsPath
- Path to dynamic template spec file on Cloud
Storage. The file must be a Json serialized DynamicTemplateFieSpec object.
dynamicTemplate_stagingLocation
- Cloud Storage path for staging
dependencies. Must be a valid Cloud Storage URL, beginning with gs://
.
gcsPath
- A Cloud Storage path to the template from which to create the
job. Must be valid Cloud Storage URL, beginning with 'gs://'.
location
- The
regional endpoint
to which to direct the request.
validateOnly
- If true, the request is validated but not actually
executed. Defaults to false.
$fields
- Selector specifying which fields to include in a partial
response.
Completes with a LaunchTemplateResponse.
Completes with a commons.ApiRequestError if the API endpoint returned an error.
If the used http.Client
completes with an error when making a REST call,
this method will complete with the same error.
Implementation
async.Future<LaunchTemplateResponse> launch(
LaunchTemplateParameters request,
core.String projectId, {
core.String? dynamicTemplate_gcsPath,
core.String? dynamicTemplate_stagingLocation,
core.String? gcsPath,
core.String? location,
core.bool? validateOnly,
core.String? $fields,
}) async {
final _body = convert.json.encode(request);
final _queryParams = <core.String, core.List<core.String>>{
if (dynamicTemplate_gcsPath != null)
'dynamicTemplate.gcsPath': [dynamicTemplate_gcsPath],
if (dynamicTemplate_stagingLocation != null)
'dynamicTemplate.stagingLocation': [dynamicTemplate_stagingLocation],
if (gcsPath != null) 'gcsPath': [gcsPath],
if (location != null) 'location': [location],
if (validateOnly != null) 'validateOnly': ['${validateOnly}'],
if ($fields != null) 'fields': [$fields],
};
final _url = 'v1b3/projects/' +
commons.escapeVariable('$projectId') +
'/templates:launch';
final _response = await _requester.request(
_url,
'POST',
body: _body,
queryParams: _queryParams,
);
return LaunchTemplateResponse.fromJson(
_response as core.Map<core.String, core.dynamic>);
}