create method

Future<Deployment> create(
  1. Deployment request,
  2. String parent, {
  3. String? deploymentId,
  4. String? $fields,
})

Creates a new deployment in the given app.

request - The metadata request object.

Request parameters:

parent - Required. The parent app. Format: projects/{project}/locations/{location}/apps/{app} Value must have pattern ^projects/\[^/\]+/locations/\[^/\]+/apps/\[^/\]+$.

deploymentId - Optional. The ID to use for the deployment, which will become the final component of the deployment's resource name. If not provided, a unique ID will be automatically assigned for the deployment.

$fields - Selector specifying which fields to include in a partial response.

Completes with a Deployment.

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<Deployment> create(
  Deployment request,
  core.String parent, {
  core.String? deploymentId,
  core.String? $fields,
}) async {
  final body_ = convert.json.encode(request);
  final queryParams_ = <core.String, core.List<core.String>>{
    'deploymentId': ?deploymentId == null ? null : [deploymentId],
    'fields': ?$fields == null ? null : [$fields],
  };

  final url_ = 'v1/' + core.Uri.encodeFull('$parent') + '/deployments';

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