create method
Creates an ACL policy.
The creation is executed synchronously and the policy is available for use immediately after the RPC returns.
request - The metadata request object.
Request parameters:
parent - Required. The resource name of the cluster location using the
form: projects/{project_id}/locations/{location_id} where location_id
refers to a Google Cloud region.
Value must have pattern ^projects/\[^/\]+/locations/\[^/\]+$.
aclPolicyId - Required. The logical name of the ACL policy in the
customer project with the following restrictions: * Must contain only
lowercase letters, numbers, and hyphens. * Must start with a letter. *
Must be between 1-63 characters. * Must end with a number or a letter. *
Must be unique within the customer project / location
requestId - Optional. Idempotent request UUID. .
$fields - Selector specifying which fields to include in a partial
response.
Completes with a AclPolicy.
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<AclPolicy> create(
AclPolicy request,
core.String parent, {
core.String? aclPolicyId,
core.String? requestId,
core.String? $fields,
}) async {
final body_ = convert.json.encode(request);
final queryParams_ = <core.String, core.List<core.String>>{
'aclPolicyId': ?aclPolicyId == null ? null : [aclPolicyId],
'requestId': ?requestId == null ? null : [requestId],
'fields': ?$fields == null ? null : [$fields],
};
final url_ = 'v1/' + core.Uri.encodeFull('$parent') + '/aclPolicies';
final response_ = await _requester.request(
url_,
'POST',
body: body_,
queryParams: queryParams_,
);
return AclPolicy.fromJson(response_ as core.Map<core.String, core.dynamic>);
}