create method

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

Creates a tag template.

You must enable the Data Catalog API in the project identified by the parent parameter. For more information, see Data Catalog resource project.

request - The metadata request object.

Request parameters:

parent - Required. The name of the project and the template location region. Value must have pattern ^projects/\[^/\]+/locations/\[^/\]+$.

tagTemplateId - Required. The ID of the tag template to create. The ID must contain only lowercase letters (a-z), numbers (0-9), or underscores (_), and must start with a letter or underscore. The maximum size is 64 bytes when encoded in UTF-8.

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

Completes with a GoogleCloudDatacatalogV1TagTemplate.

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

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

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