create method

Creates a tag and assigns it to: * An Entry if the method name is projects.locations.entryGroups.entries.tags.create.

  • Or EntryGroupif the method name is projects.locations.entryGroups.tags.create. Note: The project identified by the parent parameter for the tag and the tag template used to create the tag must be in the same organization.

request - The metadata request object.

Request parameters:

parent - Required. The name of the resource to attach this tag to. Tags can be attached to entries or entry groups. An entry can have up to 1000 attached tags. Note: The tag and its child resources might not be stored in the location specified in its name. Value must have pattern ^projects/\[^/\]+/locations/\[^/\]+/entryGroups/\[^/\]+/entries/\[^/\]+$.

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

Completes with a GoogleCloudDatacatalogV1Tag.

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<GoogleCloudDatacatalogV1Tag> create(
  GoogleCloudDatacatalogV1Tag request,
  core.String parent, {
  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/' + core.Uri.encodeFull('$parent') + '/tags';

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