create method

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

Creates a CapabilityConfig under a parent Organization, Folder or Project.

Creating a CapabilityConfig triggers the creation of a Management Project if one is not supplied.

request - The metadata request object.

Request parameters:

parent - Required. The parent resource under which the CapabilityConfig will be created. Format: organizations/{organization_id} or folders/{folder_id} or projects/{project_number} Value must have pattern ^folders/\[^/\]+$.

capabilityConfigId - Required. The user-assigned ID for the CapabilityConfig, which will become the final component of the CapabilityConfig's resource name. Must be unique within the parent resource. It must be 6 to 30 lowercase ASCII letters, digits, or hyphens. It must start with a letter. Trailing hyphens are prohibited. Example: my-capability-config-123

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

  final url_ = 'v3/' + core.Uri.encodeFull('$parent') + '/capabilityConfigs';

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