launch method

Future<LaunchTemplateResponse> launch(
  1. LaunchTemplateParameters request,
  2. String projectId,
  3. String location, {
  4. String? dynamicTemplate_gcsPath,
  5. String? dynamicTemplate_stagingLocation,
  6. String? gcsPath,
  7. bool? validateOnly,
  8. String? $fields,
})

Launch a template.

request - The metadata request object.

Request parameters:

projectId - Required. The ID of the Cloud Platform project that the job belongs to.

location - The regional endpoint to which to direct the request.

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://'.

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 location, {
  core.String? dynamicTemplate_gcsPath,
  core.String? dynamicTemplate_stagingLocation,
  core.String? gcsPath,
  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 (validateOnly != null) 'validateOnly': ['${validateOnly}'],
    if ($fields != null) 'fields': [$fields],
  };

  final url_ = 'v1b3/projects/' +
      commons.escapeVariable('$projectId') +
      '/locations/' +
      commons.escapeVariable('$location') +
      '/templates:launch';

  final response_ = await _requester.request(
    url_,
    'POST',
    body: body_,
    queryParams: queryParams_,
  );
  return LaunchTemplateResponse.fromJson(
      response_ as core.Map<core.String, core.dynamic>);
}