Custom action APIs
This section includes all the custom action APIs with examples.
- Create a custom action category
- Create a custom action
- Lock a custom action
- Unlock a custom action
- Get the list of custom actions
- Assign a custom action to service version (service manifest)
Custom action APIs
Create a custom action category
curl -k -X POST \
'https://${TSA_HOSTNAME}/cam/composer/api/v1/customActionCategories?ace_orgGuid=${MCM_TEAM}&tenantId=${TSA_TENANT_ID}' \
-H 'Authorization: Bearer ${TSA_BEARER_TOKEN}' \
-H 'Content-Type: application/json' \
-H 'cache-control: no-cache' \
-d {"Name": "demo-category"}
Response
{
"Name": "demo-category",
"id": "621cc8e6218004001ac4bc00",
"tenantId": "cf5c3f7d-a70d-435c-9554-55d8e3441380"
}
Create a custom action
curl -k -X POST \
'https://${TSA_HOSTNAME}/cam/composer/api/v1/CustomAction/createCustomAction?ace_orgGuid=${MCM_TEAM}&cloudOE_spaceGuid=${NAMESPACE}&tenantId=${TSA_TENANT_ID}' \
-H 'Authorization: Bearer ${TSA_BEARER_TOKEN}' \
-H 'Content-Type: application/json' \
-H 'cache-control: no-cache' \
-d @custom_action_create.json
custom_action_create.json`
{
"action": {
"type": "custom",
"name": "ind-action",
"category": "demo-category",
"description": " Independent custom action",
"input_parameters": [
{
"name": "inputurl",
"label": "inputpurl",
"customtype": "string",
"type": "string",
"immutable": false,
"hidden": false,
"required": false,
"secured": false,
"isDynamic": false,
"default": "https://jsonplaceholder.typicode.com/todos/1"
}
],
"flow": {
"conditions": [],
"templates": [],
"resthooks": [
{
"resthook": {
"title": "resthook_354d4a",
"id": "resthook98f44a65",
"headers": {
"accept": "application/json",
"Content-Type": "application/json"
},
"editable": true,
"url": "${input_parameters.inputurl}",
"method": "GET"
}
}
],
"notifications": [],
"sequence": {
"0": "resthook98f44a65"
},
"error_sequence": {}
},
"output_parameters": [
{
"name": "resthookOutput",
"label": "resthookoutput",
"customtype": "string",
"type": "string",
"immutable": true,
"hidden": false,
"required": false,
"secured": false,
"description": "",
"default": "${resthooks.resthook98f44a65.output.body}"
}
]
}
}
Response
{
"data": {
"name": "ind-action",
"ServiceEngine_InputFile": {
"action": {
"type": "custom",
"name": "ind-action",
"category": "demo-category",
"description": " Independent custom action",
"input_parameters": [
{
"name": "inputurl",
"label": "inputpurl",
"customtype": "string",
"type": "string",
"immutable": false,
"hidden": false,
"required": false,
"secured": false,
"isDynamic": false,
"default": "https://jsonplaceholder.typicode.com/todos/1"
}
],
"flow": {
"conditions": [],
"templates": [],
"resthooks": [
{
"resthook": {
"title": "resthook_354d4a",
"id": "resthook98f44a65",
"headers": {
"accept": "application/json",
"Content-Type": "application/json"
},
"editable": true,
"url": "${input_parameters.inputurl}",
"method": "GET"
}
}
],
"notifications": [],
"sequence": {
"0": "resthook98f44a65"
},
"error_sequence": {}
},
"output_parameters": [
{
"name": "resthookOutput",
"label": "resthookoutput",
"customtype": "string",
"type": "string",
"immutable": true,
"hidden": false,
"required": false,
"secured": false,
"description": "",
"default": "${resthooks.resthook98f44a65.output.body}"
}
]
}
},
"categoryId": "621cc8e6218004001ac4bc00",
"namespaceId": "cp4aiops",
"tenantId": "cf5c3f7d-a70d-435c-9554-55d8e3441380",
"creationTime": "2022-02-28T13:13:30.918Z",
"lastUpdated": "2022-02-28T13:13:30.672Z",
"status": "Unlocked",
"id": "621cca7a218004001ac4bc03",
"warning": []
}
}
Lock a custom action
curl -k -X POST \
'https://${TSA_HOSTNAME}/cam/composer/api/v1/CustomAction/<customid>/lock?ace_orgGuid=${MCM_TEAM}&cloudOE_spaceGuid=${NAMESPACE}&tenantId=${TSA_TENANT_ID}' \
-H 'Authorization: Bearer ${TSA_BEARER_TOKEN}' \
-H 'Content-Type: application/json' \
-H 'cache-control: no-cache' \
-d {}
Response:
{
"data": {
"name": "ind-action",
"ServiceEngine_InputFile": {
"action": {
"type": "custom",
"name": "ind-action",
"category": "demo-category",
"description": " Independent custom action",
"input_parameters": [
{
"name": "inputurl",
"label": "inputpurl",
"customtype": "string",
"type": "string",
"immutable": false,
"hidden": false,
"required": false,
"secured": false,
"isDynamic": false,
"default": "https://jsonplaceholder.typicode.com/todos/1"
}
],
"flow": {
"conditions": [],
"templates": [],
"resthooks": [
{
"resthook": {
"title": "resthook_354d4a",
"id": "resthook98f44a65",
"headers": {
"accept": "application/json",
"Content-Type": "application/json"
},
"editable": true,
"url": "${input_parameters.inputurl}",
"method": "GET"
}
}
],
"notifications": [],
"sequence": {
"0": "resthook98f44a65"
},
"error_sequence": {}
},
"output_parameters": [
{
"name": "resthookOutput",
"label": "resthookoutput",
"customtype": "string",
"type": "string",
"immutable": true,
"hidden": false,
"required": false,
"secured": false,
"description": "",
"default": "${resthooks.resthook98f44a65.output.body}"
}
]
}
},
"categoryId": "621cc8e6218004001ac4bc00",
"namespaceId": "cp4aiops",
"tenantId": "cf5c3f7d-a70d-435c-9554-55d8e3441380",
"creationTime": "2022-02-28T13:13:30.918Z",
"lastUpdated": "2022-02-28T13:20:01.513Z",
"status": "Locked",
"id": "621cca7a218004001ac4bc03"
}
}
Get the list of custom actions
curl -k -X GET \
-H "Authorization: Bearer ${TSA_BEARER_TOKEN}" "https://${TSA_HOSTNAME}/cam/composer/api/v1/CustomAction?tenantId=${TSA_TENANT_ID}&ace_orgGuid=${MCM_TEAM}&cloudOE_spaceGuid=${NAMESPACE}"
Response
[
{
"name": "ind-action",
"ServiceEngine_InputFile": {
"action": {
"type": "custom",
"name": "ind-action",
"category": "demo-category",
"description": " Independent custom action",
"input_parameters": [
{
"name": "inputurl",
"label": "inputpurl",
"customtype": "string",
"type": "string",
"immutable": false,
"hidden": false,
"required": false,
"secured": false,
"isDynamic": false,
"default": "https://jsonplaceholder.typicode.com/todos/1"
}
],
"flow": {
"conditions": [],
"templates": [],
"resthooks": [
{
"resthook": {
"title": "resthook_354d4a",
"id": "resthook98f44a65",
"headers": {
"accept": "application/json",
"Content-Type": "application/json"
},
"editable": true,
"url": "${input_parameters.inputurl}",
"method": "GET"
}
}
],
"notifications": [],
"sequence": {
"0": "resthook98f44a65"
},
"error_sequence": {}
},
"output_parameters": [
{
"name": "resthookOutput",
"label": "resthookoutput",
"customtype": "string",
"type": "string",
"immutable": true,
"hidden": false,
"required": false,
"secured": false,
"description": "",
"default": "${resthooks.resthook98f44a65.output.body}"
}
]
}
},
"categoryId": "621cc8e6218004001ac4bc00",
"namespaceId": "cp4aiops",
"tenantId": "cf5c3f7d-a70d-435c-9554-55d8e3441380",
"creationTime": "2022-02-28T13:13:30.918Z",
"lastUpdated": "2022-02-28T13:22:09.539Z",
"status": "Unlocked",
"id": "621cca7a218004001ac4bc03",
"serviceVersionCount": 0,
"serviceVersionNames": []
}
]
Assign a custom action to service version (service manifest)
curl -k -X POST \
'https://${TSA_HOSTNAME}/cam/composer/api/v1/ServiceManifest/<servicemanifestid>/assignCustomActions?ace_orgGuid=${MCM_TEAM}&cloudOE_spaceGuid=${NAMESPACE}&tenantId=${TSA_TENANT_ID}' \
-H 'Authorization: Bearer ${TSA_BEARER_TOKEN}' \
-H 'Content-Type: application/json' \
-H 'cache-control: no-cache' \
-d @assign_custom_actions.json
assign_custom_actions.json:
{
"custom_action_details": [
{
"customActionName": "ind-action",
"customActionId": "<custom action id>",
"customInputParams": {
"inputurl": "${svc_instance.output_parameters.todosUrl3}"
}
}
]
}
Response:
{
"version": "1.0.0.0",
"ServiceEngine_InputFile": {
"service": {
"version": "1.0.0.0",
"specVersion": "v3",
"catalog_metadata": {
"name": "assignAService",
"description": "",
"image": "serviceicon_1.svg",
"category": "dinesh",
"bullets": [],
"providerDisplayName": "IBM",
"longDescription": "",
"documentationUrl": "",
"supportUrl": "",
"bindable": false,
"updatable": "",
"systemTags": true
},
"tags": [
{
"name": "environment",
"label": "Environment",
"type": "string",
"immutable": false,
"hidden": false,
"required": true,
"secured": false,
"description": "Unique identifer added to the provisioned VMs.",
"isSystemTag": true,
"customtype": "string",
"permission": "Read-Write",
"options": [
{
"label": "Development",
"value": "dev",
"default": true
},
{
"label": "Quality Assurance",
"value": "qa",
"default": false
},
{
"label": "Production",
"value": "prod",
"default": false
},
{
"label": "Test",
"value": "test",
"default": false
}
]
},
{
"name": "Name",
"label": "Name",
"type": "string",
"immutable": true,
"hidden": false,
"required": false,
"secured": false,
"description": "Name provided for the service instance by the end user at time of request",
"isSystemTag": true,
"customtype": "string",
"permission": "Read-Only",
"default": "${svc_instance.name}"
},
{
"name": "request_group",
"label": "request_group",
"type": "string",
"immutable": true,
"hidden": false,
"required": false,
"secured": false,
"description": "The current context group id of the current user that requested the provisioning of the template. This is important because a user may be part of more than one group and this identifies the context of which group the user made the request.",
"isSystemTag": true,
"customtype": "string",
"permission": "Read-Only",
"default": "${svc_instance.group}"
},
{
"name": "request_user",
"label": "request_user",
"type": "string",
"immutable": true,
"hidden": false,
"required": false,
"secured": false,
"description": "The user id of the current user that requested the provisioning of the template.",
"isSystemTag": true,
"customtype": "string",
"permission": "Read-Only",
"default": "${svc_instance.owner}"
},
{
"name": "service_name",
"label": "service_name",
"type": "string",
"immutable": true,
"hidden": false,
"required": false,
"secured": false,
"description": "Name provided for the service instance by the end user at time of request",
"isSystemTag": true,
"customtype": "string",
"permission": "Read-Only",
"default": "${svc_instance.name}"
},
{
"name": "service_identifier",
"label": "service_identifier",
"type": "string",
"immutable": true,
"hidden": false,
"required": false,
"secured": false,
"description": "Unique identifer generated by ICAM which is mapped to the service instance of the template provisioned.",
"isSystemTag": true,
"customtype": "string",
"permission": "Read-Only",
"default": "${svc_instance.service_instance_id}"
}
],
"upgrade_from": [],
"downgrade_to": [],
"actions": [
{
"type": "provision",
"name": "Provision",
"description": "Default action for deployment of service",
"input_parameters": [],
"flow": {
"conditions": [],
"templates": [],
"resthooks": [
{
"resthook": {
"title": "resthook_cfb688",
"id": "resthook00f1e7c5",
"headers": {
"accept": "application/json",
"Content-Type": "application/json"
},
"editable": true,
"url": "https://jsonplaceholder.typicode.com/todos/2",
"method": "GET"
}
}
],
"notifications": [],
"sequence": {
"0": "resthook00f1e7c5"
},
"error_sequence": {}
},
"output_parameters": [
{
"name": "todosUrl3",
"label": "todosUrl3",
"customtype": "string",
"type": "string",
"immutable": true,
"hidden": false,
"required": false,
"secured": false,
"default": "https://jsonplaceholder.typicode.com/todos/3"
}
]
}
],
"plans": [
{
"name": "Standard",
"description": "To deploy a Standard plan",
"actions": [],
"plan_parameters": []
}
]
}
},
"service_id": "621ccec6218004001ac4bc04",
"tenantId": "cf5c3f7d-a70d-435c-9554-55d8e3441380",
"namespaceId": "",
"author": "admin",
"specVersion": "v3",
"status": "Published",
"publishedTime": "2022-02-28T13:33:08.798Z",
"tags": [
{
"name": "environment",
"label": "Environment",
"type": "string",
"immutable": false,
"hidden": false,
"required": true,
"secured": false,
"description": "Unique identifer added to the provisioned VMs.",
"isSystemTag": true,
"customtype": "string",
"permission": "Read-Write",
"options": [
{
"label": "Development",
"value": "dev",
"default": true
},
{
"label": "Quality Assurance",
"value": "qa",
"default": false
},
{
"label": "Production",
"value": "prod",
"default": false
},
{
"label": "Test",
"value": "test",
"default": false
}
]
},
{
"name": "Name",
"label": "Name",
"type": "string",
"immutable": true,
"hidden": false,
"required": false,
"secured": false,
"description": "Name provided for the service instance by the end user at time of request",
"isSystemTag": true,
"customtype": "string",
"permission": "Read-Only",
"default": "${svc_instance.name}"
},
{
"name": "request_group",
"label": "request_group",
"type": "string",
"immutable": true,
"hidden": false,
"required": false,
"secured": false,
"description": "The current context group id of the current user that requested the provisioning of the template. This is important because a user may be part of more than one group and this identifies the context of which group the user made the request.",
"isSystemTag": true,
"customtype": "string",
"permission": "Read-Only",
"default": "${svc_instance.group}"
},
{
"name": "request_user",
"label": "request_user",
"type": "string",
"immutable": true,
"hidden": false,
"required": false,
"secured": false,
"description": "The user id of the current user that requested the provisioning of the template.",
"isSystemTag": true,
"customtype": "string",
"permission": "Read-Only",
"default": "${svc_instance.owner}"
},
{
"name": "service_name",
"label": "service_name",
"type": "string",
"immutable": true,
"hidden": false,
"required": false,
"secured": false,
"description": "Name provided for the service instance by the end user at time of request",
"isSystemTag": true,
"customtype": "string",
"permission": "Read-Only",
"default": "${svc_instance.name}"
},
{
"name": "service_identifier",
"label": "service_identifier",
"type": "string",
"immutable": true,
"hidden": false,
"required": false,
"secured": false,
"description": "Unique identifer generated by ICAM which is mapped to the service instance of the template provisioned.",
"isSystemTag": true,
"customtype": "string",
"permission": "Read-Only",
"default": "${svc_instance.service_instance_id}"
}
],
"systemTags": true,
"creationTime": "2022-02-28T13:31:50.023Z",
"lastUpdated": "2022-02-28T13:33:08.798Z",
"serviceInstanceCount": 0,
"assignedCustomActions": [
{
"customActionName": "ind-action",
"customActionId": "621cca7a218004001ac4bc03",
"customInputParams": {
"inputurl": "${svc_instance.output_parameters.todosUrl3}"
}
}
],
"id": "621ccec6218004001ac4bc05",
"actions": [
{
"type": "provision",
"name": "Provision",
"description": "Default action for deployment of service",
"input_parameters": [],
"flow": {
"conditions": [],
"templates": [],
"resthooks": [
{
"resthook": {
"title": "resthook_cfb688",
"id": "resthook00f1e7c5",
"headers": {
"accept": "application/json",
"Content-Type": "application/json"
},
"editable": true,
"url": "https://jsonplaceholder.typicode.com/todos/2",
"method": "GET"
}
}
],
"notifications": [],
"sequence": {
"0": "resthook00f1e7c5"
},
"error_sequence": {}
},
"output_parameters": [
{
"name": "todosUrl3",
"label": "todosUrl3",
"customtype": "string",
"type": "string",
"immutable": true,
"hidden": false,
"required": false,
"secured": false,
"default": "https://jsonplaceholder.typicode.com/todos/3"
}
]
}
],
"plans": [
{
"name": "Standard",
"description": "To deploy a Standard plan",
"actions": [],
"plan_parameters": []
}
],
"tagId": "621c8329218004001ac4bbe2",
"warning": []
}
Additional information for the custom action to a service manifest API
-
You can follow either one of the steps to assign custom input parameters. In this case,
inputurl
values are assigned as shown:a. While assigning custom actions, you can attach the provison action output parameters of a service manifest to the custom action by using interpolation
${svc_instance.output_parameters.<o/p param>}
, which gets resolved when you try to deploy the independent custom action.Example
{ "custom_action_details": [ { "customActionName": "ind-action", "customActionId": "<custom action id>", "customInputParams": { "inputurl": "${svc_instance.output_parameters.todosUrl3}" } } ] }
b. You can directly assign the values which overrides the default values at the time of deployment of the custom action.
Example
{ "custom_action_details": [ { "customActionName": "ind-action", "customActionId": "<custom action id>", "customInputParams": { "inputurl": "http://example.com" } } ] }
-
You can assign custom actions for both publish and draft service manifest.
-
Reassigning custom actions for a service manifest overrides the previous assigned custom actions.
Unlock a custom action
You cannot unlock the custom action until it is unassigned with all the service versions associated with it.
curl -k -X POST \
'https://${TSA_HOSTNAME}/cam/composer/api/v1/CustomAction/<customid>/unlock?ace_orgGuid=${MCM_TEAM}&cloudOE_spaceGuid=${NAMESPACE}&tenantId=${TSA_TENANT_ID}' \
-H 'Authorization: Bearer ${TSA_BEARER_TOKEN}' \
-H 'Content-Type: application/json' \
-H 'cache-control: no-cache' \
-d {}
Response
{
"data": {
"name": "ind-action",
"ServiceEngine_InputFile": {
"action": {
"type": "custom",
"name": "ind-action",
"category": "demo-category",
"description": " Independent custom action",
"input_parameters": [
{
"name": "inputurl",
"label": "inputpurl",
"customtype": "string",
"type": "string",
"immutable": false,
"hidden": false,
"required": false,
"secured": false,
"isDynamic": false,
"default": "https://jsonplaceholder.typicode.com/todos/1"
}
],
"flow": {
"conditions": [],
"templates": [],
"resthooks": [
{
"resthook": {
"title": "resthook_354d4a",
"id": "resthook98f44a65",
"headers": {
"accept": "application/json",
"Content-Type": "application/json"
},
"editable": true,
"url": "${input_parameters.inputurl}",
"method": "GET"
}
}
],
"notifications": [],
"sequence": {
"0": "resthook98f44a65"
},
"error_sequence": {}
},
"output_parameters": [
{
"name": "resthookOutput",
"label": "resthookoutput",
"customtype": "string",
"type": "string",
"immutable": true,
"hidden": false,
"required": false,
"secured": false,
"description": "",
"default": "${resthooks.resthook98f44a65.output.body}"
}
]
}
},
"categoryId": "621cc8e6218004001ac4bc00",
"namespaceId": "cp4aiops",
"tenantId": "cf5c3f7d-a70d-435c-9554-55d8e3441380",
"creationTime": "2022-02-28T13:13:30.918Z",
"lastUpdated": "2022-02-28T13:20:01.513Z",
"status": "Unlocked",
"id": "621cca7a218004001ac4bc03"
}
}