create method

Future<Operation> create(
  1. RestoreTemplate request,
  2. String parent, {
  3. String? requestId,
  4. String? restoreTemplateId,
  5. String? $fields,
})

Creates a new RestoreTemplate in a given project and location.

request - The metadata request object.

Request parameters:

parent - Required. The restore template project and location in the format 'projects/{project_id}/locations/{location}'. Value must have pattern ^projects/\[^/\]+/locations/\[^/\]+$.

requestId - Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).

restoreTemplateId - Required. The ID of the restore template to create. The ID must be unique for the specified project and location.

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

Completes with a Operation.

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

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

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