Cloud Services

ModernOps configuration

Tag schema using APIs
Published On Oct 10, 2024 - 9:12 AM

Tag schema using APIs

Understand the APIs used to manage tag schemas, specified by their function.
The following are detailed descriptions of the APIs used to manage tag schemas, in which you can see what functions are available for each.

Checking system health

Use the following API to check the health of your system:
  • API: /health
  • Method: GET
  • Responses:
    • Code 200 Health Check Successful
      { data : {}, message : Health Check Successful , translate_code : CS_TAG_SCHEMA_1001 , translate_params : [ string ] }

Creating a tag schema

Use this API to create a tag schema:
  • API: /api/v1/tags/schemas
  • Method: POST
  • Payload:
    { version : 1, schema_id : Only alphanumeric chars, underscore and period allowed , schema_name : string , status : Active , description : string , schema_context : { providers : [ aws , gcp ], provider_accounts : [ string ], service_type : [ string ], category : [ string ] }, tag_definitions : [ { tag_key : string , version : 0 } ] }
  • Parameter content type: application/json
  • Response Codes:
    • 201 Created tag schema {0} successfully
      { data : { schema_id : string }, message : Created tag schema {0} successfully , translate_code : CS_TAG_SCHEMA_1006 , translate_params : [ string ] }
    • 400 Invalid payload: {0}
    • 401 User {0} is unauthorized to perform the action
    • 403 The action is forbidden for user {0}
    • 409 Tag Schema {0} already exists
    • 500 Failed to create tag schema {0}

Getting a list of tag schemas

Use this API to get a list of your tag schemas:
  • API: /api/v1/tags/schemas
  • Method: GET
  • Parameters:
    • page (default is 1)
    • size (default is 10)
    • sort_by (default is created_time)
    • order_by (allowed values are 1 (ascending) and -1 (descending). Default is -1)
    • filtercontext
  • Response codes:
    • 200 Fetched tag schemas successfully
      { data : { records : [ { version : 1, schema_id : Only alphanumeric chars, underscore and period allowed , schema_name : string , status : Active , description : string , schema_context : { providers : [ aws , gcp ], provider_accounts : [ string ], service_type : [ string ], category : [ string ] }, created_time : string , updated_time : string , created_user : string , updated_user : string , tag_definitions : [ { tag_key : string , version : 0 } ] } ], count : 0, previous : string , next : string , total_count : 0 }, message : Fetched tag schemas successfully , translate_code : CS_TAG_SCHEMA_1002 , translate_params : [ string ] }
    • 401 User {0} is unauthorized to perform the action
    • 500 Failed to fetch tag schemas

Patching a specific tag schema

Use the following API to patch a tag schema:
  • API: /api/v1/tags/schemas/ (schema_id)
  • Method: PATCH
  • Parameters:
    • schema_id
    • action (available values are associate_tag and disassociate_tag)
  • Payload:
    { version : 1, schema_name : string , status : Active , description : string , schema_context : { providers : [ aws , gcp ], provider_accounts : [ string ], service_type : [ string ], category : [ string ] }, tag_definitions : [ { tag_key : string , version : 0 } ] }
  • Parameter content type: application/json
  • Response codes:
    • 200 Updated tag schema {0} successfully
      { data : { schema_id : string }, message : Updated tag schema {0} successfully , translate_code : CS_TAG_SCHEMA_1004 , translate_params : [ string ] }
    • 400 Invalid payload: {0}
    • 401 User {0} is unauthorized to perform the action
    • 403 The action is forbidden for user {0}
    • 404 Tag Schema {0} does not exist
    • 500 Failed to update tag schema {0}

Deleting a tag schema

Delete a tag schema with the following API:
  • API: /api/v1/tags/schemas/ (schema_id)
  • Method: DELETE
  • Parameter: schema_id
  • Response codes:
    • 200 Deleted tag schema {0} successfully
      { data : { schema_id : string }, message : Deleted tag schema {0} successfully , translate_code : CS_TAG_SCHEMA_1005 , translate_params : [ string ] }
    • 401 User {0} is unauthorized to perform the action
    • 403 The action is forbidden for user {0}
    • 404 Tag Schema {0} does not exist
    • 500 Failed to delete tag schema: {0}

Getting details of a tag schema

Use the following API to fetch the details of a tag schema:
  • API: /api/v1/tags/schemas/ (schema_id)
  • Method: GET
  • Parameter: schema_id
  • Response codes:
    • 200 Fetched tag schema {0} successfully
      { data : { version : 1, schema_id : Only alphanumeric chars, underscore and period allowed , schema_name : string , status : Active , description : string , schema_context : { providers : [ aws , gcp ], provider_accounts : [ string ], service_type : [ string ], category : [ string ] }, created_time : string , updated_time : string , created_user : string , updated_user : string , tag_definitions : [ { tag_key : string , version : 0 } ] }, message : Fetched tag schema {0} successfully , translate_code : CS_TAG_SCHEMA_1003 , translate_params : [ string ] }
    • 401 User {0} is unauthorized to perform the action
    • 404 Tag Schema {0} does not exist
    • 500 Failed to fetch tag schema: {0}

Creating a tag definition

Create a tag definition using the following API:
  • API: /api/v1/tags/definitions
  • Method: POST
  • Payload:
    { tag_key : string , description : string , associated_tag_schemas : [ string ], version : 1, tag_value_constraint : { range : [ 0:10 , 50:95 ], min : 0, max : 0, values : [ string ], regex : string }, tag_aliases : [ string ], value_type : String , default_value : string , mandatory : Always , conditions : { providers : [ string ], provider_accounts : [ string ], service_type : [ string ], category : [ string ] } }
  • Parameter content type: application/json
  • Response codes:
    • 201 Added tag definition {0} with version {1} successfully
      { data : { tag_key : string , description : string , associated_tag_schemas : [ string ], version : 1, tag_value_constraint : { range : [ 0:10 , 50:95 ], min : 0, max : 0, values : [ string ], regex : string }, tag_aliases : [ string ], value_type : String , default_value : string , mandatory : Always , conditions : { providers : [ string ], provider_accounts : [ string ], service_type : [ string ], category : [ string ] } }, message : Added tag definition {0} with version {1} successfully , translate_code : CS_TAG_SCHEMA_1009 , translate_params : [ string ] }
    • 400 Invalid payload: {0}
    • 401 User {0} is unauthorized to perform the action
    • 403 The action is forbidden for user {0}
    • 409 Tag Definition {0} with version {1} already exists
    • 500 Failed to create tag definition {0}

Getting a list of tag definitions

  • API: /api/v1/tags/definitions
  • Method: GET
  • Parameters:
    • page (default is 1)
    • size (default is 10)
    • sort_by (default is tag_key)
    • order_by (allowed values are 1 (ascending) and -1 (descending). Default is -1)
    • filtercontext
  • Response codes:
    • 200 Fetched tag definitions successfully
      { data : { records : [ { tag_key : string , description : string , version : 1, associated_tag_schemas : [ string ], tag_aliases : [ string ], tag_value_constraint : { range : [ 0:10 , 50:95 ], min : 0, max : 0, values : [ string ], regex : string }, value_type : String , default_value : string , mandatory : Always , conditions : { providers : [ string ], provider_accounts : [ string ], service_type : [ string ], category : [ string ] } } ], count : 0, previous : string , next : string , total_count : 0 }, message : Fetched tag definitions successfully , translate_code : CS_TAG_SCHEMA_1010 , translate_params : [ string ] }
    • 400 Invalid payload: {0}
    • 401 User {0} is unauthorized to perform the action
    • 403 The action is forbidden for user {0}
    • 500 Failed to fetch tag definitions.

Updating tag definitions

Use the following API to update tag definitions:
  • API: /api/v1/tags/definitions/{tag_key}
  • Method: PATCH
  • Parameters:
    • tag_key
    • version (default is 1)
  • Payload:
    { description : string , associated_tag_schemas : [ string ], tag_aliases : [ string ], tag_value_constraint : { range : [ 0:10 , 50:95 ], min : 0, max : 0, values : [ string ], regex : string }, value_type : String , default_value : string , mandatory : Always , conditions : { providers : [ string ], provider_accounts : [ string ], service_type : [ string ], category : [ string ] } }
  • Parameter content type: application/json
  • Response codes:
    • 200 Updated tag definition {0} with version {1} successfully
      { data : { description : string , associated_tag_schemas : [ string ], tag_aliases : [ string ], tag_value_constraint : { range : [ 0:10 , 50:95 ], min : 0, max : 0, values : [ string ], regex : string }, value_type : String , default_value : string , mandatory : Always , conditions : { providers : [ string ], provider_accounts : [ string ], service_type : [ string ], category : [ string ] } }, message : Updated tag definition {0} with version {1} successfully , translate_code : CS_TAG_SCHEMA_1007 , translate_params : [ string ] }
    • 400 Invalid payload: {0}
    • 401 User {0} is unauthorized to perform the action
    • 403 The action is forbidden for user {0}
    • 404 Tag Definition {0} with version {1} does not exist
    • 500 Failed to update tag definition {0} with version {1}

Deleting a tag definition

Delete a tag definition using the following API:
  • API: /api/v1/tags/definitions/ (tag_key)
  • Method: DELETE
  • Parameters:
    • tag_key
    • version (default is 1)
  • Response codes:
    • 200 Deleted tag definition {0} with version {1} successfully
      { data : { tag_key : string , version : 0 }, message : Deleted tag definition {0} with version {1} successfully , translate_code : CS_TAG_SCHEMA_1008 , translate_params : [ string ] }
    • 401 User {0} is unauthorized to perform the action
    • 403 The action is forbidden for user {0}
    • 404 Tag Definition {0} with version {1} does not exist
    • 500 Failed to delete tag definition: {0} with version {1}

Getting details of a tag definition

Use the following API to fetch the details of a tag definition:
  • API: /api/v1/tags/definitions/{tag_key}
  • Method: GET
  • Parameters:
    • tag_key
    • version (the default is 1)
  • Response codes:
    • 200 Fetched tag definition {0} with version {1} successfully
      { data : { tag_key : string , description : string , version : 1, associated_tag_schemas : [ string ], tag_aliases : [ string ], tag_value_constraint : { range : [ 0:10 , 50:95 ], min : 0, max : 0, values : [ string ], regex : string }, value_type : String , default_value : string , mandatory : Always , conditions : { providers : [ string ], provider_accounts : [ string ], service_type : [ string ], category : [ string ] } }, message : Fetched tag definition {0} with version {1} successfully , translate_code : CS_TAG_SCHEMA_1011 , translate_params : [ string ] }
    • 400 Invalid payload: {0}
    • 401 User {0} is unauthorized to perform the action
    • 404 Tag Definition {0} with version {1} does not exist
    • 500 Failed to get tag definition: {0} with version {1}
Do you have two minutes for a quick survey?
Take Survey