create method

Future<Service> create(
  1. Service request,
  2. String serviceName, {
  3. String? $fields,
})

Creates a new service configuration (version) for a managed service.

This method only stores the service configuration. To roll out the service configuration to backend systems please call CreateServiceRollout. Only the 100 most recent service configurations and ones referenced by existing rollouts are kept for each service. The rest will be deleted eventually.

request - The metadata request object.

Request parameters:

serviceName - Required. The name of the service. See the overview for naming requirements. For example: example.googleapis.com.

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

Completes with a Service.

Completes with a commons.ApiRequestError if the API endpoint returned an error.

If the used http_1.Client completes with an error when making a REST call, this method will complete with the same error.

Implementation

async.Future<Service> create(
  Service request,
  core.String serviceName, {
  core.String? $fields,
}) async {
  final body_ = convert.json.encode(request);
  final queryParams_ = <core.String, core.List<core.String>>{
    if ($fields != null) 'fields': [$fields],
  };

  final url_ =
      'v1/services/' + commons.escapeVariable('$serviceName') + '/configs';

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