Data Governance
Also available as:
PDF
loading table of contents...

Enum Type API

  • Base resource name: v2/types/enumdef

  • Full URL: http://<atlas-server-host:port>/api/atlas/v2/types/enumdef

Register Enum Type

Request:

POST /v2/types/enumdef 

Description:

This request is used to register one particular Enum type with the Atlas type system.

Method Signature:

@POST
@Path("/enumdef")
@Consumes(Servlets.JSON_MEDIA_TYPE)
@Produces(Servlets.JSON_MEDIA_TYPE)
public AtlasEnumDef createEnumDef(AtlasEnumDef enumDef) throws AtlasBaseException { 

Example Request:

POST /v2/types/enumdef 

Example Request Body:

{
	"name" : "creation_order",
	"typeVersion" : "1.1",
	"elementDefs" : [
		{
			"ordinal" : 1,
			"value" : "PRE"
		},
		{
			"ordinal" : 2,
			"value" : "POST"
		}
		]
}

Example Response:

{
  "category": "ENUM",
  "guid": "48bb2f42-745c-4b1b-9491-248326dbe997",
  "createTime": 1481872144316,
  "updateTime": 1481872144316,
  "version": 1,
  "name": "creation_order",
  "description": "creation_order",
  "typeVersion": "1.1",
  "elementDefs": [
    {
      "value": "PRE",
      "ordinal": 1
    },
    {
      "value": "POST",
      "ordinal": 2
    }
  ]
}
Update Enum Type Using Name

Request:

PUT /v2/types/enumdef/name/{name}

Description:

This request is used to update an Enum type that is already registered with the Atlas type system. {name} refers to the original name of the Enum type with which it was registered.

Method Signature:

@PUT
@Path("/enumdef/name/{name}")
@Consumes(Servlets.JSON_MEDIA_TYPE)
@Produces(Servlets.JSON_MEDIA_TYPE)
public AtlasEnumDef updateEnumDefByName(@PathParam("name") String name, AtlasEnumDef enumDef) throws AtlasBaseException { 

Example Request:

PUT /v2/types/enumdef/name

Example Request Body:

{
	"name" : "creation_order",
	"typeVersion" : "1.1",
	"elementDefs" : [
		{
			"ordinal" : 1,
			"value" : "PRE"
		},
		{
			"ordinal" : 2,
			"value" : "POST"
		},
		{
			"ordinal" : 3,
			"value" : "UNKNOWN"
		}
		]
}

Example Response:

{
  "category": "ENUM",
  "guid": "48bb2f42-745c-4b1b-9491-248326dbe997",
  "createTime": 1481872144316,
  "updateTime": 1481872144316,
  "version": 1,
  "name": "creation_order",
  "description": "creation_order",
  "typeVersion": "1.1",
  "elementDefs": [
    {
      "value": "PRE",
      "ordinal": 1
    },
    {
      "value": "POST",
      "ordinal": 2
    },
    {
      "value": "UNKNOWN",
      "ordinal": 3
    }
  ]
}
Update Enum Type Using GUID

Request:

PUT v2/types/enumdef/guid/{guid}

Description:

This request is used to update an Enum type that is already registered with the Atlas type system by referencing its GUID.

Method Signature:

@PUT
@Path("/enumdef/guid/{guid}")
@Consumes(Servlets.JSON_MEDIA_TYPE)
@Produces(Servlets.JSON_MEDIA_TYPE)
public AtlasEnumDef updateEnumDefByGuid(@PathParam("guid") String guid, AtlasEnumDef enumDef) throws AtlasBaseException { 

Example Request:

PUT v2/types/enumdef/guid/48bb2f42-745c-4b1b-9491-248326dbe997

Example Request Body:

{
	"name" : "creation_order",
	"typeVersion" : "1.1",
	"elementDefs" : [
		{
			"ordinal" : 1,
			"value" : "PRE"
		},
		{
			"ordinal" : 2,
			"value" : "POST"
		},
		{
			"ordinal" : 3,
			"value" : "UNKNOWN"
		}
		]
}

Example Response:

{
  "category": "ENUM",
  "guid": "48bb2f42-745c-4b1b-9491-248326dbe997",
  "createTime": 1481872144316,
  "updateTime": 1481872144316,
  "version": 1,
  "name": "creation_order",
  "description": "creation_order",
  "typeVersion": "1.1",
  "elementDefs": [
    {
      "value": "PRE",
      "ordinal": 1
    },
    {
      "value": "POST",
      "ordinal": 2
    },
    {
      "value": "UNKNOWN",
      "ordinal": 3
    }
  ]
}
Get Enum Type Definition Using Name

Request:

GET /v2/types/enumdef/name/{name}

Description:

Returns the definition of the Enum type associated with the given name.

Method Signature:

@GET
@Path("/enumdef/name/{name}")
@Produces(Servlets.JSON_MEDIA_TYPE)
public AtlasEnumDef getEnumDefByName(@PathParam("name") String name) throws AtlasBaseException { 

Example Request:

GET v2/types/enumdef/name/creation_order

Example Response:

{
  "category": "ENUM",
  "name": "creation_order",
  "typeVersion": "1.1",
  "elementDefs": [
    {
      "value": "PRE",
      "ordinal": 1
    },
    {
      "value": "POST",
      "ordinal": 2
    },
    {
      "value": "UNKNOWN",
      "ordinal": 3
    }
  ]
}
Get Enum Type Definition Using GUID

Request:

GET v2/types/enumdef/guid/{guid}

Description:

Returns the definition of the Enum type by referencing its GUID.

Method Signature:

@GET
@Path("/enumdef/guid/{guid}")
@Produces(Servlets.JSON_MEDIA_TYPE)
public AtlasEnumDef getEnumDefByGuid(@PathParam("guid") String guid) throws AtlasBaseException { 

Example Request:

GET v2/types/enumdef/guid/d0c902bf-3872-4192-9208-1e9f21e641dc

Example Response:

{
  "category": "ENUM",
  "name": "creation_order",
  "typeVersion": "1.1",
  "elementDefs": [
    {
      "value": "PRE",
      "ordinal": 1
    },
    {
      "value": "POST",
      "ordinal": 2
    },
    {
      "value": "UNKNOWN",
      "ordinal": 3
    }
  ]
}
Delete Enum Type Definition Using Name

Request:

DELETE /v2/types/enumdef/name/{name}

Description:

Deletes an Enum type from the Atlas repository by referencing its name.

Method Signature:

@DELETE
@Path("/enumdef/name/{name}")
@Produces(Servlets.JSON_MEDIA_TYPE)
public void deleteEnumDefByName(@PathParam("name") String name) throws AtlasBaseException { 

Example Request:

DELETE /v2/types/enumdef/name/creation_order
Delete Enum Type Definition Using GUID

Request:

DELETE /v2/types/enumdef/guid/{guid}

Description:

Deletes an Enum type from the Atlas repository by referencing its GUID.

Method Signature:

@DELETE
@Path("/enumdef/guid/{guid}")
@Produces(Servlets.JSON_MEDIA_TYPE)
public void deleteEnumDefByGuid(@PathParam("guid") String guid) throws AtlasBaseException { 

Example Request:

DELETE v2/types/enumdef/guid/d0c902bf-3872-4192-9208-1e9f21e641dc
Get All Enum Type Definitions

Request:

GET /v2/types/enumdef

Description:

Returns all Enum type definitions.

Method Signature:

@GET
@Path("/enumdef")
@Produces(Servlets.JSON_MEDIA_TYPE)
public AtlasEnumDefs searchEnumDefs() throws AtlasBaseException { 

Example Request:

GET /v2/types/enumdef

Example Response:

{
  "list": [
    {
      "category": "ENUM",
      "guid": "b3fd4d06-2a10-4722-9419-8210b00fddd0",
      "createTime": 1480496684400,
      "updateTime": 1480496684400,
      "version": 1,
      "name": "hive_principal_type",
      "description": "hive_principal_type",
      "typeVersion": "1.0",
      "elementDefs": [
        {
          "value": "USER",
          "ordinal": 1
        },
        {
          "value": "ROLE",
          "ordinal": 2
        },
        {
          "value": "GROUP",
          "ordinal": 3
        }
      ]
    },
    {
      "category": "ENUM",
      "guid": "2ba8a2e0-63e6-4d5c-bc26-140fa95eb241",
      "createTime": 1481884990372,
      "updateTime": 1481884990372,
      "version": 1,
      "name": "creation_order",
      "description": "creation_order",
      "typeVersion": "1.1",
      "elementDefs": [
        {
          "value": "PRE",
          "ordinal": 1
        },
        {
          "value": "POST",
          "ordinal": 2
        },
        {
          "value": "UNKNOWN",
          "ordinal": 3
        }
      ]
    },
    {
      "category": "ENUM",
      "guid": "011fe1e9-78a0-41bb-b7cf-6091a3e40424",
      "createTime": 1480496681754,
      "updateTime": 1480496681754,
      "version": 1,
      "name": "file_action",
      "description": "file_action",
      "typeVersion": "1.0",
      "elementDefs": [
        {
          "value": "NONE",
          "ordinal": 0
        },
        {
          "value": "EXECUTE",
          "ordinal": 1
        },
        {
          "value": "WRITE",
          "ordinal": 2
        },
        {
          "value": "WRITE_EXECUTE",
          "ordinal": 3
        },
        {
          "value": "READ",
          "ordinal": 4
        },
        {
          "value": "READ_EXECUTE",
          "ordinal": 5
        },
        {
          "value": "READ_WRITE",
          "ordinal": 6
        },
        {
          "value": "ALL",
          "ordinal": 7
        }
      ]
    }
  ],
  "startIndex": 0,
  "pageSize": 3,
  "totalCount": 3,
  "sortType": "NONE"
}