create method

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

Creates a new acl in the given project, location, and cluster.

request - The metadata request object.

Request parameters:

parent - Required. The parent cluster in which to create the acl. Structured like projects/{project}/locations/{location}/clusters/{cluster}. Value must have pattern ^projects/\[^/\]+/locations/\[^/\]+/clusters/\[^/\]+$.

aclId - Required. The ID to use for the acl, which will become the final component of the acl's name. The structure of acl_id defines the Resource Pattern (resource_type, resource_name, pattern_type) of the acl. acl_id is structured like one of the following: For acls on the cluster: cluster For acls on a single resource within the cluster: topic/{resource_name} consumerGroup/{resource_name} transactionalId/{resource_name} For acls on all resources that match a prefix: topicPrefixed/{resource_name} consumerGroupPrefixed/{resource_name} transactionalIdPrefixed/{resource_name} For acls on all resources of a given type (i.e. the wildcard literal "*"): allTopics (represents topic / * ) allConsumerGroups (represents consumerGroup / * ) allTransactionalIds (represents transactionalId / * )

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

Completes with a Acl.

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

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

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