create_tag

TbacApi.create_tag(role_id, tags_creation_obj, content_type=None, _request_timeout=None, _request_auth=None, _content_type=None, _headers=None, _host_index=0)

Creates a new Tag

Creates a new TBAC (Tag-Based Access Control) tag. Creates a corresponding Lake Formation tag with access levels (owner, editor, read-only), grants LF permissions to the caller’s IAM role, stores tag metadata in DynamoDB, and assigns owner access to the caller. If the environment uses Redshift, also creates a corresponding Redshift role. TagKey and TagValue must be lowercase alphanumeric plus underscore only (^[a-z0-9_]+$), max 24 characters each. TagKey must not be a reserved system keyword. The combination TagKey#TagValue must be unique.

Parameters:
  • role_id (str) – The role ID from the user’s session. Must have tbac.manage permission. (required)

  • tags_creation_obj (TagsCreationObj) – (required)

  • content_type (str) – Must be application/json.

  • _request_timeout (int, tuple(int, int), optional) – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.

  • _request_auth (dict, optional) – set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request.

  • _content_type (str, Optional) – force content-type for the request.

  • _headers (dict, optional) – set to override the headers for a single request; this effectively ignores the headers in the spec for a single request.

  • _host_index (int, optional) – set to override the host_index for a single request; this effectively ignores the host_index in the spec for a single request.

Return type:

CreateTagResponse

Returns:

Returns the result object.

Request and Response Examples

HTTP: POST /tags

Request

Request / response example

{
  "TagKey": "department",
  "TagValue": "engineering",
  "TagDescription": "Engineering department tag",
  "DisplayName": "Engineering"
}

Success (HTTP 200)

Tag created successfully.

Request / response example

{
  "Message": "Tag created successfully",
  "TagName": "department#engineering"
}

Errors

Documented error codes: IPV-1008, IPV-1045, TAG-1023, IPV-1018, IPV-1068, IPV-1010, GE-1034.

HTTP 400

Invalid input or unauthorized.

Required fields missing

{
  "Message": "IPV-1008 - Missing required key(s) - {'TagValue'}"
}

Empty TagKey or TagValue

{
  "Message": "IPV-1045 - TagKey and TagValue cannot be empty"
}

Reserved tag key

{
  "Message": "TAG-1023 - 'aws' is a reserved keyword in Amorphic"
}

Tag already exists

{
  "Message": "IPV-1018 - TagValue already exists"
}

Key or value exceeds 24 chars

{
  "Message": "IPV-1068 - TagKey exceeds maximum allowed length of 24 characters"
}

Invalid characters

{
  "Message": "IPV-1010 - TagKey 'My-Key' has invalid characters, Only lowercase letters, digits and underscore (_) are allowed."
}

HTTP 500

Internal server error.

Request / response example

{
  "Message": "GE-1034 - Failed to create LF tag"
}