Defining the import tag policy type

Procedure to define the import tags policy in a JSON payload.

About this task

You can create the import tags policies by using the policy management REST API. A sample policy that is defined in a JSON payload is shown:

{
	"pol _id": "importtags_pol",
	"action_id": "IMPORT_TAGS",
	"action_params": {
		"agent":"Import Tags",
		"source_connection":"camera_vaul t",
		"tag_file_path":"camera_lidar _semantic/A2D2_labels.csv",
		"tag_file_type":"csv"
	},
	"schedule": "NOW",
	"pol_state": "active",
	"pol_filter": "datasource=' camera_lidar_semanti c' "
}
The following table lists the action parameters for defining the import tags policy type:
Table 1. List of action parameter for an import tags policy type
Action Parameter Description
souce_connection The Cloud Object Storage (COS) or S3 connection name that is defined in IBM Spectrum® Discover for the records that the imported tags can be applied to.
tag_file_path The absolute path (bucket or object name) of the CSV file that contains the list of objects and associated tags to import.

IMPORT_TAGS is the new action_id that is defined for the import tags policies.

Procedure

  1. Send the following query request to list all the supported action IDs on IBM Spectrum Discover node:
    curl -H "Authorization:Bearer<token>"-k https://<spectrum_discover _host>:443/policyengine/ v1/action_ids
  2. Send the following query request to the IBM Spectrum Discover node to obtain the current Import Tags application schema:
    curl-H" Authorization:Bearer <token>"-k https://<spectrum_discover_host>:443/policyengine/v1/applications/ImportTags/schema?action_id=I MPORT_TAGS
  3. To define the policy, and schedule or run it immediately, use the /policyengine/v1/policies -d '<data>': POST endpoint to process the request.
    For more information, see /policyengine/v1/policies -d '<data>': POST in the Data Cataloging: REST API Guide.

Example

Send the following request to create an Import Tags policy for data source connection camera_vault that runs immediately by using the external tag file A2D2_labels.csv:

curl - k - H ' Authorization: Bearer <token>'
https: //<spectrum_discover_host>/policyengine/v1/policies-d'
	{
		"pol_id": "importtags",
		"action_id": "IMPORT_TAGS",
		"action_params": {
			"agent": "Import Tags",
			"source_connection": "camera_vault",
			"tag_file_path": "camera_lidar_semantic/A2D2_labels.csv",
			"tag_file_type": "csv"
		},
		"schedule": "NOW",
		"pol_state": "active",
		"pol _filter": "datasource='camera_lidar _semantic' "
	}
'-XPOST -H" Content-Type:application/json"

The following response is returned:

Policy 'importtags_ut'added