create method

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

Creates a metastore service in a project and location.

request - The metadata request object.

Request parameters:

parent - Required. The relative resource name of the location in which to create a metastore service, in the following form:projects/{project_number}/locations/{location_id}. Value must have pattern ^projects/\[^/\]+/locations/\[^/\]+$.

requestId - Optional. A request ID. Specify a unique request ID to allow the server to ignore the request if it has completed. The server will ignore subsequent requests that provide a duplicate request ID for at least 60 minutes after the first request.For example, if an initial request times out, followed by another request with the same request ID, the server ignores the second request to prevent the creation of duplicate commitments.The request ID must be a valid UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) A zero UUID (00000000-0000-0000-0000-000000000000) is not supported.

serviceId - Required. The ID of the metastore service, which is used as the final component of the metastore service's name.This value must be between 2 and 63 characters long inclusive, begin with a letter, end with a letter or number, and consist of alpha-numeric ASCII characters or hyphens.

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

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

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