3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

OpsRampAdvent Calendar 2021

Day 12

OpsRamp APIでProcess Workflowを簡単生成

Last updated at Posted at 2021-12-11

#概要
Process WorkflowsをAPIで簡単に読み出せます。そのやり方を説明します。
基本的なRESTAPI自体の内容については省略します。
基本的な仕様については下記に細かく記載があります。
https://develop.opsramp.com/

今回は「OpsRamp 承認機能付きProcess Workflowを作成してみた。」で紹介したWorkflowで説明します。
最後まで目を通して頂けましたら、このWorkflowを皆さんの環境で簡単に再現することが出来るようになります。

#Process Workflowの取得
まずはProcess WorkflowをAPIで取得してみます。
https://develop.opsramp.com/automation/tenants-tenant-id-metadata-processes-search

こんな感じで取得できました。

(展開して下さい。)取得した内容(Body)
{
    "results": [
        {
            "name": "サービス再起動",
            "tenantId": "d8601056-bc21-4ce7-988c-40e42a1cf1c9",
            "createdDate": "2021-11-09T07:50:41+0000",
            "createdBy": "YSP POD2",
            "updatedDate": "2021-11-09T08:01:36+0000",
            "updatedBy": "YSP POD2",
            "description": "",
            "uniqueId": "PROCESS_2e1cde5e-42b2-4151-9c92-e954f1128295",
            "permissions": [],
            "enabled": true,
            "deploymentDate": "2021-11-09T08:01:37+0000",
            "category": "AUTOMATION",
            "startEvents": [
                {
                    "@type": "SignalStartEvent",
                    "uniqueId": "StartEvent_1bbp12r",
                    "name": "ServiceAlert",
                    "formName": "alert",
                    "eventOperation": "CREATED",
                    "eventCondition": "$component = \"Print Spooler\""
                }
            ],
            "activities": [
                {
                    "@type": "AgentScriptTask",
                    "uniqueId": "Task_0673quw",
                    "name": "RestartService",
                    "async": true,
                    "scriptId": "2988",
                    "scriptTarget": "$StartEvent_1bbp12r.alert.resource.uuid",
                    "runAsType": "DEFAULTUSER",
                    "inputMap": {
                        "Service_Name": "$StartEvent_1bbp12r.alert.component"
                    }
                },
                {
                    "@type": "UserTask",
                    "uniqueId": "Task_0js3tkp",
                    "name": "ObtainApproval",
                    "async": true,
                    "subject": "サービス再起動承認依頼",
                    "description": "下記サービスが停止中です、再起動のためワークフローの承認をお願いします。\n$StartEvent_1bbp12r.alert.resource.hostName\n$StartEvent_1bbp12r.alert.component",
                    "priority": "3",
                    "dueDate": "P1D",
                    "assignedToUniqueId": "USR0000032123",
                    "inputMap": {
                        "UDF0000100008": "",
                        "actions_100008": ""
                    }
                },
                {
                    "@type": "PlatformServiceTask",
                    "uniqueId": "Task_1l277i3",
                    "name": "UpdateIncident",
                    "async": false,
                    "inputMap": {
                        "description": "自動化ワークフローによりサービスの再起動を実施しました。\n承認者: $Task_0js3tkp.task.assignedTo.loginName",
                        "uuid": "$StartEvent_1bbp12r.alert.incident.uuid"
                    },
                    "serviceName": "UPDATE_INCIDENT"
                },
                {
                    "@type": "PlatformServiceTask",
                    "uniqueId": "Task_1ypw0q7",
                    "name": "AddAlertComment",
                    "async": false,
                    "inputMap": {
                        "id": "$StartEvent_1bbp12r.alert.uuid",
                        "description": "自動化ワークフローによりサービスの再起動を実施しました。\n承認者: $Task_0js3tkp.task.assignedTo.loginName"
                    },
                    "serviceName": "POST_ALERT_COMMENT"
                }
            ],
            "gateways": [
                {
                    "@type": "ExclusiveGateway",
                    "uniqueId": "ExclusiveGateway_15dlx50",
                    "name": "Get Responce",
                    "defaultSequenceFlow": "SequenceFlow_0ra58fz"
                }
            ],
            "sequenceFlows": [
                {
                    "@type": "SequenceFlow",
                    "uniqueId": "SequenceFlow_0l7yj6y",
                    "name": "null",
                    "source": "Task_1l277i3",
                    "target": "EndEvent_18g9u2l"
                },
                {
                    "@type": "SequenceFlow",
                    "uniqueId": "SequenceFlow_1vkdpjh",
                    "name": "null",
                    "source": "StartEvent_1bbp12r",
                    "target": "Task_0js3tkp"
                },
                {
                    "@type": "SequenceFlow",
                    "uniqueId": "SequenceFlow_1p5r8dd",
                    "name": "Approve",
                    "source": "ExclusiveGateway_15dlx50",
                    "target": "Task_0673quw",
                    "conditionExpression": "$Task_0js3tkp.task.UDF0000100008 = \"Approve\""
                },
                {
                    "@type": "SequenceFlow",
                    "uniqueId": "SequenceFlow_0gi8jmu",
                    "name": "null",
                    "source": "Task_1ypw0q7",
                    "target": "Task_1l277i3"
                },
                {
                    "@type": "SequenceFlow",
                    "uniqueId": "SequenceFlow_0ra58fz",
                    "name": "Deny",
                    "source": "ExclusiveGateway_15dlx50",
                    "target": "EndEvent_0c4j5qq",
                    "conditionExpression": ""
                },
                {
                    "@type": "SequenceFlow",
                    "uniqueId": "SequenceFlow_18l1gcc",
                    "name": "null",
                    "source": "Task_0js3tkp",
                    "target": "ExclusiveGateway_15dlx50"
                },
                {
                    "@type": "SequenceFlow",
                    "uniqueId": "SequenceFlow_1m4ubzk",
                    "name": "null",
                    "source": "Task_0673quw",
                    "target": "Task_1ypw0q7"
                }
            ],
            "endEvents": [
                {
                    "@type": "EndEvent",
                    "uniqueId": "EndEvent_0c4j5qq",
                    "name": "null"
                },
                {
                    "@type": "EndEvent",
                    "uniqueId": "EndEvent_18g9u2l",
                    "name": "null"
                }
            ],
            "intermediateEvents": [],
            "displayProps": "{\n    \"_declaration\": {\n        \"_attributes\": {\n            \"version\": \"1.0\",\n            \"encoding\": \"UTF-8\"\n        }\n    },\n    \"definitions\": {\n        \"_attributes\": {\n            \"xmlns\": \"http://www.omg.org/spec/BPMN/20100524/MODEL\",\n            \"xmlns:bpmndi\": \"http://www.omg.org/spec/BPMN/20100524/DI\",\n            \"xmlns:omgdc\": \"http://www.omg.org/spec/DD/20100524/DC\",\n            \"xmlns:xsi\": \"http://www.w3.org/2001/XMLSchema-instance\",\n            \"xmlns:di\": \"http://www.omg.org/spec/DD/20100524/DI\",\n            \"targetNamespace\": \"\",\n            \"xsi:schemaLocation\": \"http://www.omg.org/spec/BPMN/20100524/MODEL http://www.omg.org/spec/BPMN/2.0/20100501/BPMN20.xsd\"\n        },\n        \"process\": {\n            \"_attributes\": {\n                \"id\": \"Process_0hf3not\"\n            },\n            \"startEvent\": {\n                \"_attributes\": {\n                    \"id\": \"StartEvent_1bbp12r\",\n                    \"name\": \"ServiceAlert\"\n                },\n                \"outgoing\": {\n                    \"_text\": \"SequenceFlow_1vkdpjh\"\n                },\n                \"signalEventDefinition\": {}\n            },\n            \"sequenceFlow\": [\n                {\n                    \"_attributes\": {\n                        \"id\": \"SequenceFlow_1vkdpjh\",\n                        \"sourceRef\": \"StartEvent_1bbp12r\",\n                        \"targetRef\": \"Task_0js3tkp\"\n                    }\n                },\n                {\n                    \"_attributes\": {\n                        \"id\": \"SequenceFlow_18l1gcc\",\n                        \"sourceRef\": \"Task_0js3tkp\",\n                        \"targetRef\": \"ExclusiveGateway_15dlx50\"\n                    }\n                },\n                {\n                    \"_attributes\": {\n                        \"id\": \"SequenceFlow_1p5r8dd\",\n                        \"name\": \"Approve\",\n                        \"sourceRef\": \"ExclusiveGateway_15dlx50\",\n                        \"targetRef\": \"Task_0673quw\"\n                    }\n                },\n                {\n                    \"_attributes\": {\n                        \"id\": \"SequenceFlow_0ra58fz\",\n                        \"name\": \"Deny\",\n                        \"sourceRef\": \"ExclusiveGateway_15dlx50\",\n                        \"targetRef\": \"EndEvent_0c4j5qq\"\n                    }\n                },\n                {\n                    \"_attributes\": {\n                        \"id\": \"SequenceFlow_1m4ubzk\",\n                        \"sourceRef\": \"Task_0673quw\",\n                        \"targetRef\": \"Task_1ypw0q7\"\n                    }\n                },\n                {\n                    \"_attributes\": {\n                        \"id\": \"SequenceFlow_0gi8jmu\",\n                        \"sourceRef\": \"Task_1ypw0q7\",\n                        \"targetRef\": \"Task_1l277i3\"\n                    }\n                },\n                {\n                    \"_attributes\": {\n                        \"id\": \"SequenceFlow_0l7yj6y\",\n                        \"sourceRef\": \"Task_1l277i3\",\n                        \"targetRef\": \"EndEvent_18g9u2l\"\n                    }\n                }\n            ],\n            \"userTask\": {\n                \"_attributes\": {\n                    \"id\": \"Task_0js3tkp\",\n                    \"name\": \"ObtainApproval\"\n                },\n                \"incoming\": {\n                    \"_text\": \"SequenceFlow_1vkdpjh\"\n                },\n                \"outgoing\": {\n                    \"_text\": \"SequenceFlow_18l1gcc\"\n                }\n            },\n            \"exclusiveGateway\": {\n                \"_attributes\": {\n                    \"id\": \"ExclusiveGateway_15dlx50\",\n                    \"name\": \"Get Responce\",\n                    \"default\": \"SequenceFlow_0ra58fz\"\n                },\n                \"incoming\": {\n                    \"_text\": \"SequenceFlow_18l1gcc\"\n                },\n                \"outgoing\": [\n                    {\n                        \"_text\": \"SequenceFlow_1p5r8dd\"\n                    },\n                    {\n                        \"_text\": \"SequenceFlow_0ra58fz\"\n                    }\n                ]\n            },\n            \"scriptTask\": {\n                \"_attributes\": {\n                    \"id\": \"Task_0673quw\",\n                    \"name\": \"RestartService\"\n                },\n                \"incoming\": {\n                    \"_text\": \"SequenceFlow_1p5r8dd\"\n                },\n                \"outgoing\": {\n                    \"_text\": \"SequenceFlow_1m4ubzk\"\n                }\n            },\n            \"endEvent\": [\n                {\n                    \"_attributes\": {\n                        \"id\": \"EndEvent_0c4j5qq\"\n                    },\n                    \"incoming\": {\n                        \"_text\": \"SequenceFlow_0ra58fz\"\n                    }\n                },\n                {\n                    \"_attributes\": {\n                        \"id\": \"EndEvent_18g9u2l\"\n                    },\n                    \"incoming\": {\n                        \"_text\": \"SequenceFlow_0l7yj6y\"\n                    }\n                }\n            ],\n            \"serviceTask\": [\n                {\n                    \"_attributes\": {\n                        \"id\": \"Task_1ypw0q7\",\n                        \"name\": \"AddAlertComment\"\n                    },\n                    \"incoming\": {\n                        \"_text\": \"SequenceFlow_1m4ubzk\"\n                    },\n                    \"outgoing\": {\n                        \"_text\": \"SequenceFlow_0gi8jmu\"\n                    }\n                },\n                {\n                    \"_attributes\": {\n                        \"id\": \"Task_1l277i3\",\n                        \"name\": \"UpdateIncident\"\n                    },\n                    \"incoming\": {\n                        \"_text\": \"SequenceFlow_0gi8jmu\"\n                    },\n                    \"outgoing\": {\n                        \"_text\": \"SequenceFlow_0l7yj6y\"\n                    }\n                }\n            ]\n        },\n        \"bpmndi:BPMNDiagram\": {\n            \"_attributes\": {\n                \"id\": \"sid-74620812-92c4-44e5-949c-aa47393d3830\"\n            },\n            \"bpmndi:BPMNPlane\": {\n                \"_attributes\": {\n                    \"id\": \"sid-cdcae759-2af7-4a6d-bd02-53f3352a731d\",\n                    \"bpmnElement\": \"Process_0hf3not\"\n                },\n                \"bpmndi:BPMNShape\": [\n                    {\n                        \"_attributes\": {\n                            \"id\": \"StartEvent_1uy3dd8_di\",\n                            \"bpmnElement\": \"StartEvent_1bbp12r\"\n                        },\n                        \"omgdc:Bounds\": {\n                            \"_attributes\": {\n                                \"x\": \"257\",\n                                \"y\": \"185\",\n                                \"width\": \"36\",\n                                \"height\": \"36\"\n                            }\n                        },\n                        \"bpmndi:BPMNLabel\": {\n                            \"omgdc:Bounds\": {\n                                \"_attributes\": {\n                                    \"x\": \"246\",\n                                    \"y\": \"228\",\n                                    \"width\": \"60\",\n                                    \"height\": \"14\"\n                                }\n                            }\n                        }\n                    },\n                    {\n                        \"_attributes\": {\n                            \"id\": \"UserTask_056a4u1_di\",\n                            \"bpmnElement\": \"Task_0js3tkp\"\n                        },\n                        \"omgdc:Bounds\": {\n                            \"_attributes\": {\n                                \"x\": \"389\",\n                                \"y\": \"163\",\n                                \"width\": \"100\",\n                                \"height\": \"80\"\n                            }\n                        }\n                    },\n                    {\n                        \"_attributes\": {\n                            \"id\": \"ExclusiveGateway_15dlx50_di\",\n                            \"bpmnElement\": \"ExclusiveGateway_15dlx50\",\n                            \"isMarkerVisible\": \"true\"\n                        },\n                        \"omgdc:Bounds\": {\n                            \"_attributes\": {\n                                \"x\": \"578\",\n                                \"y\": \"178\",\n                                \"width\": \"50\",\n                                \"height\": \"50\"\n                            }\n                        },\n                        \"bpmndi:BPMNLabel\": {\n                            \"omgdc:Bounds\": {\n                                \"_attributes\": {\n                                    \"x\": \"569\",\n                                    \"y\": \"148\",\n                                    \"width\": \"71\",\n                                    \"height\": \"14\"\n                                }\n                            }\n                        }\n                    },\n                    {\n                        \"_attributes\": {\n                            \"id\": \"ScriptTask_03cv4ls_di\",\n                            \"bpmnElement\": \"Task_0673quw\"\n                        },\n                        \"omgdc:Bounds\": {\n                            \"_attributes\": {\n                                \"x\": \"553\",\n                                \"y\": \"329\",\n                                \"width\": \"100\",\n                                \"height\": \"80\"\n                            }\n                        }\n                    },\n                    {\n                        \"_attributes\": {\n                            \"id\": \"EndEvent_0c4j5qq_di\",\n                            \"bpmnElement\": \"EndEvent_0c4j5qq\"\n                        },\n                        \"omgdc:Bounds\": {\n                            \"_attributes\": {\n                                \"x\": \"741\",\n                                \"y\": \"185\",\n                                \"width\": \"36\",\n                                \"height\": \"36\"\n                            }\n                        }\n                    },\n                    {\n                        \"_attributes\": {\n                            \"id\": \"EndEvent_18g9u2l_di\",\n                            \"bpmnElement\": \"EndEvent_18g9u2l\"\n                        },\n                        \"omgdc:Bounds\": {\n                            \"_attributes\": {\n                                \"x\": \"1031\",\n                                \"y\": \"351\",\n                                \"width\": \"36\",\n                                \"height\": \"36\"\n                            }\n                        }\n                    },\n                    {\n                        \"_attributes\": {\n                            \"id\": \"ServiceTask_0za1swb_di\",\n                            \"bpmnElement\": \"Task_1ypw0q7\"\n                        },\n                        \"omgdc:Bounds\": {\n                            \"_attributes\": {\n                                \"x\": \"709\",\n                                \"y\": \"329\",\n                                \"width\": \"100\",\n                                \"height\": \"80\"\n                            }\n                        }\n                    },\n                    {\n                        \"_attributes\": {\n                            \"id\": \"ServiceTask_1t7uv6x_di\",\n                            \"bpmnElement\": \"Task_1l277i3\"\n                        },\n                        \"omgdc:Bounds\": {\n                            \"_attributes\": {\n                                \"x\": \"876\",\n                                \"y\": \"329\",\n                                \"width\": \"100\",\n                                \"height\": \"80\"\n                            }\n                        }\n                    }\n                ],\n                \"bpmndi:BPMNEdge\": [\n                    {\n                        \"_attributes\": {\n                            \"id\": \"SequenceFlow_1vkdpjh_di\",\n                            \"bpmnElement\": \"SequenceFlow_1vkdpjh\"\n                        },\n                        \"di:waypoint\": [\n                            {\n                                \"_attributes\": {\n                                    \"x\": \"293\",\n                                    \"y\": \"203\"\n                                }\n                            },\n                            {\n                                \"_attributes\": {\n                                    \"x\": \"389\",\n                                    \"y\": \"203\"\n                                }\n                            }\n                        ]\n                    },\n                    {\n                        \"_attributes\": {\n                            \"id\": \"SequenceFlow_18l1gcc_di\",\n                            \"bpmnElement\": \"SequenceFlow_18l1gcc\"\n                        },\n                        \"di:waypoint\": [\n                            {\n                                \"_attributes\": {\n                                    \"x\": \"489\",\n                                    \"y\": \"203\"\n                                }\n                            },\n                            {\n                                \"_attributes\": {\n                                    \"x\": \"578\",\n                                    \"y\": \"203\"\n                                }\n                            }\n                        ]\n                    },\n                    {\n                        \"_attributes\": {\n                            \"id\": \"SequenceFlow_1p5r8dd_di\",\n                            \"bpmnElement\": \"SequenceFlow_1p5r8dd\"\n                        },\n                        \"di:waypoint\": [\n                            {\n                                \"_attributes\": {\n                                    \"x\": \"603\",\n                                    \"y\": \"228\"\n                                }\n                            },\n                            {\n                                \"_attributes\": {\n                                    \"x\": \"603\",\n                                    \"y\": \"329\"\n                                }\n                            }\n                        ],\n                        \"bpmndi:BPMNLabel\": {\n                            \"omgdc:Bounds\": {\n                                \"_attributes\": {\n                                    \"x\": \"599\",\n                                    \"y\": \"276\",\n                                    \"width\": \"41\",\n                                    \"height\": \"14\"\n                                }\n                            }\n                        }\n                    },\n                    {\n                        \"_attributes\": {\n                            \"id\": \"SequenceFlow_0ra58fz_di\",\n                            \"bpmnElement\": \"SequenceFlow_0ra58fz\"\n                        },\n                        \"di:waypoint\": [\n                            {\n                                \"_attributes\": {\n                                    \"x\": \"628\",\n                                    \"y\": \"203\"\n                                }\n                            },\n                            {\n                                \"_attributes\": {\n                                    \"x\": \"741\",\n                                    \"y\": \"203\"\n                                }\n                            }\n                        ],\n                        \"bpmndi:BPMNLabel\": {\n                            \"omgdc:Bounds\": {\n                                \"_attributes\": {\n                                    \"x\": \"672\",\n                                    \"y\": \"185\",\n                                    \"width\": \"27\",\n                                    \"height\": \"14\"\n                                }\n                            }\n                        }\n                    },\n                    {\n                        \"_attributes\": {\n                            \"id\": \"SequenceFlow_1m4ubzk_di\",\n                            \"bpmnElement\": \"SequenceFlow_1m4ubzk\"\n                        },\n                        \"di:waypoint\": [\n                            {\n                                \"_attributes\": {\n                                    \"x\": \"653\",\n                                    \"y\": \"369\"\n                                }\n                            },\n                            {\n                                \"_attributes\": {\n                                    \"x\": \"709\",\n                                    \"y\": \"369\"\n                                }\n                            }\n                        ]\n                    },\n                    {\n                        \"_attributes\": {\n                            \"id\": \"SequenceFlow_0gi8jmu_di\",\n                            \"bpmnElement\": \"SequenceFlow_0gi8jmu\"\n                        },\n                        \"di:waypoint\": [\n                            {\n                                \"_attributes\": {\n                                    \"x\": \"809\",\n                                    \"y\": \"369\"\n                                }\n                            },\n                            {\n                                \"_attributes\": {\n                                    \"x\": \"876\",\n                                    \"y\": \"369\"\n                                }\n                            }\n                        ]\n                    },\n                    {\n                        \"_attributes\": {\n                            \"id\": \"SequenceFlow_0l7yj6y_di\",\n                            \"bpmnElement\": \"SequenceFlow_0l7yj6y\"\n                        },\n                        \"di:waypoint\": [\n                            {\n                                \"_attributes\": {\n                                    \"x\": \"976\",\n                                    \"y\": \"369\"\n                                }\n                            },\n                            {\n                                \"_attributes\": {\n                                    \"x\": \"1031\",\n                                    \"y\": \"369\"\n                                }\n                            }\n                        ]\n                    }\n                ]\n            },\n            \"bpmndi:BPMNLabelStyle\": [\n                {\n                    \"_attributes\": {\n                        \"id\": \"sid-e0502d32-f8d1-41cf-9c4a-cbb49fecf581\"\n                    },\n                    \"omgdc:Font\": {\n                        \"_attributes\": {\n                            \"name\": \"Arial\",\n                            \"size\": \"11\",\n                            \"isBold\": \"false\",\n                            \"isItalic\": \"false\",\n                            \"isUnderline\": \"false\",\n                            \"isStrikeThrough\": \"false\"\n                        }\n                    }\n                },\n                {\n                    \"_attributes\": {\n                        \"id\": \"sid-84cb49fd-2f7c-44fb-8950-83c3fa153d3b\"\n                    },\n                    \"omgdc:Font\": {\n                        \"_attributes\": {\n                            \"name\": \"Arial\",\n                            \"size\": \"12\",\n                            \"isBold\": \"false\",\n                            \"isItalic\": \"false\",\n                            \"isUnderline\": \"false\",\n                            \"isStrikeThrough\": \"false\"\n                        }\n                    }\n                }\n            ]\n        }\n    }\n}"
        }
    ],
    "totalResults": 1,
    "orderBy": "createdDate",
    "pageNo": 1,
    "pageSize": 100,
    "totalPages": 1,
    "nextPage": false,
    "previousPageNo": 0,
    "descendingOrder": true
}

#Process Workflowの作成
取得した内容で、API経由で新規作成してみます。
https://develop.opsramp.com/automation/tenants-tenant-id-metadata-processes

何も考えずに同じWorkflowのコピーを作成します。
1, まずは先程取得したWorkflowのデータから、Process Workflowの名前だけ変更します。

"name": "サービス再起動",

これを

"name": "Create Workflow via API",

こういうベタな名前に変更してみます。

2, POSTする際、ペイロードは先程取得した内容を丸コピペする。
1番で名前を変更しました、後はペイロードに取得内容を丸コピペするだけです。
(先程はSearchでGETしてきましたので、もちろんSerchのResultsの部分は消して下さいね。)
結果的に下記を丸コピペしました。
「"assignedToUniqueId":」の部分は実行対象テナントのUserIDに変更してください。

(展開して下さい。)この内容をペイロードにコピペ
{
            "name": "Create Workflow via API",
            "tenantId": "d8601056-bc21-4ce7-988c-40e42a1cf1c9",
            "createdDate": "2021-11-09T07:50:41+0000",
            "createdBy": "YSP POD2",
            "updatedDate": "2021-11-09T08:01:36+0000",
            "updatedBy": "YSP POD2",
            "description": "",
            "uniqueId": "PROCESS_2e1cde5e-42b2-4151-9c92-e954f1128295",
            "permissions": [],
            "enabled": true,
            "deploymentDate": "2021-11-09T08:01:37+0000",
            "category": "AUTOMATION",
            "startEvents": [
                {
                    "@type": "SignalStartEvent",
                    "uniqueId": "StartEvent_1bbp12r",
                    "name": "ServiceAlert",
                    "formName": "alert",
                    "eventOperation": "CREATED",
                    "eventCondition": "$component = \"Print Spooler\""
                }
            ],
            "activities": [
                {
                    "@type": "AgentScriptTask",
                    "uniqueId": "Task_0673quw",
                    "name": "RestartService",
                    "async": true,
                    "scriptId": "2988",
                    "scriptTarget": "$StartEvent_1bbp12r.alert.resource.uuid",
                    "runAsType": "DEFAULTUSER",
                    "inputMap": {
                        "Service_Name": "$StartEvent_1bbp12r.alert.component"
                    }
                },
                {
                    "@type": "UserTask",
                    "uniqueId": "Task_0js3tkp",
                    "name": "ObtainApproval",
                    "async": true,
                    "subject": "サービス再起動承認依頼",
                    "description": "下記サービスが停止中です、再起動のためワークフローの承認をお願いします。\n$StartEvent_1bbp12r.alert.resource.hostName\n$StartEvent_1bbp12r.alert.component",
                    "priority": "3",
                    "dueDate": "P1D",
                    "assignedToUniqueId": "USR0000032123",
                    "inputMap": {
                        "UDF0000100008": "",
                        "actions_100008": ""
                    }
                },
                {
                    "@type": "PlatformServiceTask",
                    "uniqueId": "Task_1l277i3",
                    "name": "UpdateIncident",
                    "async": false,
                    "inputMap": {
                        "description": "自動化ワークフローによりサービスの再起動を実施しました。\n承認者: $Task_0js3tkp.task.assignedTo.loginName",
                        "uuid": "$StartEvent_1bbp12r.alert.incident.uuid"
                    },
                    "serviceName": "UPDATE_INCIDENT"
                },
                {
                    "@type": "PlatformServiceTask",
                    "uniqueId": "Task_1ypw0q7",
                    "name": "AddAlertComment",
                    "async": false,
                    "inputMap": {
                        "id": "$StartEvent_1bbp12r.alert.uuid",
                        "description": "自動化ワークフローによりサービスの再起動を実施しました。\n承認者: $Task_0js3tkp.task.assignedTo.loginName"
                    },
                    "serviceName": "POST_ALERT_COMMENT"
                }
            ],
            "gateways": [
                {
                    "@type": "ExclusiveGateway",
                    "uniqueId": "ExclusiveGateway_15dlx50",
                    "name": "Get Responce",
                    "defaultSequenceFlow": "SequenceFlow_0ra58fz"
                }
            ],
            "sequenceFlows": [
                {
                    "@type": "SequenceFlow",
                    "uniqueId": "SequenceFlow_0l7yj6y",
                    "name": "null",
                    "source": "Task_1l277i3",
                    "target": "EndEvent_18g9u2l"
                },
                {
                    "@type": "SequenceFlow",
                    "uniqueId": "SequenceFlow_1vkdpjh",
                    "name": "null",
                    "source": "StartEvent_1bbp12r",
                    "target": "Task_0js3tkp"
                },
                {
                    "@type": "SequenceFlow",
                    "uniqueId": "SequenceFlow_1p5r8dd",
                    "name": "Approve",
                    "source": "ExclusiveGateway_15dlx50",
                    "target": "Task_0673quw",
                    "conditionExpression": "$Task_0js3tkp.task.UDF0000100008 = \"Approve\""
                },
                {
                    "@type": "SequenceFlow",
                    "uniqueId": "SequenceFlow_0gi8jmu",
                    "name": "null",
                    "source": "Task_1ypw0q7",
                    "target": "Task_1l277i3"
                },
                {
                    "@type": "SequenceFlow",
                    "uniqueId": "SequenceFlow_0ra58fz",
                    "name": "Deny",
                    "source": "ExclusiveGateway_15dlx50",
                    "target": "EndEvent_0c4j5qq",
                    "conditionExpression": ""
                },
                {
                    "@type": "SequenceFlow",
                    "uniqueId": "SequenceFlow_18l1gcc",
                    "name": "null",
                    "source": "Task_0js3tkp",
                    "target": "ExclusiveGateway_15dlx50"
                },
                {
                    "@type": "SequenceFlow",
                    "uniqueId": "SequenceFlow_1m4ubzk",
                    "name": "null",
                    "source": "Task_0673quw",
                    "target": "Task_1ypw0q7"
                }
            ],
            "endEvents": [
                {
                    "@type": "EndEvent",
                    "uniqueId": "EndEvent_0c4j5qq",
                    "name": "null"
                },
                {
                    "@type": "EndEvent",
                    "uniqueId": "EndEvent_18g9u2l",
                    "name": "null"
                }
            ],
            "intermediateEvents": [],
            "displayProps": "{\n    \"_declaration\": {\n        \"_attributes\": {\n            \"version\": \"1.0\",\n            \"encoding\": \"UTF-8\"\n        }\n    },\n    \"definitions\": {\n        \"_attributes\": {\n            \"xmlns\": \"http://www.omg.org/spec/BPMN/20100524/MODEL\",\n            \"xmlns:bpmndi\": \"http://www.omg.org/spec/BPMN/20100524/DI\",\n            \"xmlns:omgdc\": \"http://www.omg.org/spec/DD/20100524/DC\",\n            \"xmlns:xsi\": \"http://www.w3.org/2001/XMLSchema-instance\",\n            \"xmlns:di\": \"http://www.omg.org/spec/DD/20100524/DI\",\n            \"targetNamespace\": \"\",\n            \"xsi:schemaLocation\": \"http://www.omg.org/spec/BPMN/20100524/MODEL http://www.omg.org/spec/BPMN/2.0/20100501/BPMN20.xsd\"\n        },\n        \"process\": {\n            \"_attributes\": {\n                \"id\": \"Process_0hf3not\"\n            },\n            \"startEvent\": {\n                \"_attributes\": {\n                    \"id\": \"StartEvent_1bbp12r\",\n                    \"name\": \"ServiceAlert\"\n                },\n                \"outgoing\": {\n                    \"_text\": \"SequenceFlow_1vkdpjh\"\n                },\n                \"signalEventDefinition\": {}\n            },\n            \"sequenceFlow\": [\n                {\n                    \"_attributes\": {\n                        \"id\": \"SequenceFlow_1vkdpjh\",\n                        \"sourceRef\": \"StartEvent_1bbp12r\",\n                        \"targetRef\": \"Task_0js3tkp\"\n                    }\n                },\n                {\n                    \"_attributes\": {\n                        \"id\": \"SequenceFlow_18l1gcc\",\n                        \"sourceRef\": \"Task_0js3tkp\",\n                        \"targetRef\": \"ExclusiveGateway_15dlx50\"\n                    }\n                },\n                {\n                    \"_attributes\": {\n                        \"id\": \"SequenceFlow_1p5r8dd\",\n                        \"name\": \"Approve\",\n                        \"sourceRef\": \"ExclusiveGateway_15dlx50\",\n                        \"targetRef\": \"Task_0673quw\"\n                    }\n                },\n                {\n                    \"_attributes\": {\n                        \"id\": \"SequenceFlow_0ra58fz\",\n                        \"name\": \"Deny\",\n                        \"sourceRef\": \"ExclusiveGateway_15dlx50\",\n                        \"targetRef\": \"EndEvent_0c4j5qq\"\n                    }\n                },\n                {\n                    \"_attributes\": {\n                        \"id\": \"SequenceFlow_1m4ubzk\",\n                        \"sourceRef\": \"Task_0673quw\",\n                        \"targetRef\": \"Task_1ypw0q7\"\n                    }\n                },\n                {\n                    \"_attributes\": {\n                        \"id\": \"SequenceFlow_0gi8jmu\",\n                        \"sourceRef\": \"Task_1ypw0q7\",\n                        \"targetRef\": \"Task_1l277i3\"\n                    }\n                },\n                {\n                    \"_attributes\": {\n                        \"id\": \"SequenceFlow_0l7yj6y\",\n                        \"sourceRef\": \"Task_1l277i3\",\n                        \"targetRef\": \"EndEvent_18g9u2l\"\n                    }\n                }\n            ],\n            \"userTask\": {\n                \"_attributes\": {\n                    \"id\": \"Task_0js3tkp\",\n                    \"name\": \"ObtainApproval\"\n                },\n                \"incoming\": {\n                    \"_text\": \"SequenceFlow_1vkdpjh\"\n                },\n                \"outgoing\": {\n                    \"_text\": \"SequenceFlow_18l1gcc\"\n                }\n            },\n            \"exclusiveGateway\": {\n                \"_attributes\": {\n                    \"id\": \"ExclusiveGateway_15dlx50\",\n                    \"name\": \"Get Responce\",\n                    \"default\": \"SequenceFlow_0ra58fz\"\n                },\n                \"incoming\": {\n                    \"_text\": \"SequenceFlow_18l1gcc\"\n                },\n                \"outgoing\": [\n                    {\n                        \"_text\": \"SequenceFlow_1p5r8dd\"\n                    },\n                    {\n                        \"_text\": \"SequenceFlow_0ra58fz\"\n                    }\n                ]\n            },\n            \"scriptTask\": {\n                \"_attributes\": {\n                    \"id\": \"Task_0673quw\",\n                    \"name\": \"RestartService\"\n                },\n                \"incoming\": {\n                    \"_text\": \"SequenceFlow_1p5r8dd\"\n                },\n                \"outgoing\": {\n                    \"_text\": \"SequenceFlow_1m4ubzk\"\n                }\n            },\n            \"endEvent\": [\n                {\n                    \"_attributes\": {\n                        \"id\": \"EndEvent_0c4j5qq\"\n                    },\n                    \"incoming\": {\n                        \"_text\": \"SequenceFlow_0ra58fz\"\n                    }\n                },\n                {\n                    \"_attributes\": {\n                        \"id\": \"EndEvent_18g9u2l\"\n                    },\n                    \"incoming\": {\n                        \"_text\": \"SequenceFlow_0l7yj6y\"\n                    }\n                }\n            ],\n            \"serviceTask\": [\n                {\n                    \"_attributes\": {\n                        \"id\": \"Task_1ypw0q7\",\n                        \"name\": \"AddAlertComment\"\n                    },\n                    \"incoming\": {\n                        \"_text\": \"SequenceFlow_1m4ubzk\"\n                    },\n                    \"outgoing\": {\n                        \"_text\": \"SequenceFlow_0gi8jmu\"\n                    }\n                },\n                {\n                    \"_attributes\": {\n                        \"id\": \"Task_1l277i3\",\n                        \"name\": \"UpdateIncident\"\n                    },\n                    \"incoming\": {\n                        \"_text\": \"SequenceFlow_0gi8jmu\"\n                    },\n                    \"outgoing\": {\n                        \"_text\": \"SequenceFlow_0l7yj6y\"\n                    }\n                }\n            ]\n        },\n        \"bpmndi:BPMNDiagram\": {\n            \"_attributes\": {\n                \"id\": \"sid-74620812-92c4-44e5-949c-aa47393d3830\"\n            },\n            \"bpmndi:BPMNPlane\": {\n                \"_attributes\": {\n                    \"id\": \"sid-cdcae759-2af7-4a6d-bd02-53f3352a731d\",\n                    \"bpmnElement\": \"Process_0hf3not\"\n                },\n                \"bpmndi:BPMNShape\": [\n                    {\n                        \"_attributes\": {\n                            \"id\": \"StartEvent_1uy3dd8_di\",\n                            \"bpmnElement\": \"StartEvent_1bbp12r\"\n                        },\n                        \"omgdc:Bounds\": {\n                            \"_attributes\": {\n                                \"x\": \"257\",\n                                \"y\": \"185\",\n                                \"width\": \"36\",\n                                \"height\": \"36\"\n                            }\n                        },\n                        \"bpmndi:BPMNLabel\": {\n                            \"omgdc:Bounds\": {\n                                \"_attributes\": {\n                                    \"x\": \"246\",\n                                    \"y\": \"228\",\n                                    \"width\": \"60\",\n                                    \"height\": \"14\"\n                                }\n                            }\n                        }\n                    },\n                    {\n                        \"_attributes\": {\n                            \"id\": \"UserTask_056a4u1_di\",\n                            \"bpmnElement\": \"Task_0js3tkp\"\n                        },\n                        \"omgdc:Bounds\": {\n                            \"_attributes\": {\n                                \"x\": \"389\",\n                                \"y\": \"163\",\n                                \"width\": \"100\",\n                                \"height\": \"80\"\n                            }\n                        }\n                    },\n                    {\n                        \"_attributes\": {\n                            \"id\": \"ExclusiveGateway_15dlx50_di\",\n                            \"bpmnElement\": \"ExclusiveGateway_15dlx50\",\n                            \"isMarkerVisible\": \"true\"\n                        },\n                        \"omgdc:Bounds\": {\n                            \"_attributes\": {\n                                \"x\": \"578\",\n                                \"y\": \"178\",\n                                \"width\": \"50\",\n                                \"height\": \"50\"\n                            }\n                        },\n                        \"bpmndi:BPMNLabel\": {\n                            \"omgdc:Bounds\": {\n                                \"_attributes\": {\n                                    \"x\": \"569\",\n                                    \"y\": \"148\",\n                                    \"width\": \"71\",\n                                    \"height\": \"14\"\n                                }\n                            }\n                        }\n                    },\n                    {\n                        \"_attributes\": {\n                            \"id\": \"ScriptTask_03cv4ls_di\",\n                            \"bpmnElement\": \"Task_0673quw\"\n                        },\n                        \"omgdc:Bounds\": {\n                            \"_attributes\": {\n                                \"x\": \"553\",\n                                \"y\": \"329\",\n                                \"width\": \"100\",\n                                \"height\": \"80\"\n                            }\n                        }\n                    },\n                    {\n                        \"_attributes\": {\n                            \"id\": \"EndEvent_0c4j5qq_di\",\n                            \"bpmnElement\": \"EndEvent_0c4j5qq\"\n                        },\n                        \"omgdc:Bounds\": {\n                            \"_attributes\": {\n                                \"x\": \"741\",\n                                \"y\": \"185\",\n                                \"width\": \"36\",\n                                \"height\": \"36\"\n                            }\n                        }\n                    },\n                    {\n                        \"_attributes\": {\n                            \"id\": \"EndEvent_18g9u2l_di\",\n                            \"bpmnElement\": \"EndEvent_18g9u2l\"\n                        },\n                        \"omgdc:Bounds\": {\n                            \"_attributes\": {\n                                \"x\": \"1031\",\n                                \"y\": \"351\",\n                                \"width\": \"36\",\n                                \"height\": \"36\"\n                            }\n                        }\n                    },\n                    {\n                        \"_attributes\": {\n                            \"id\": \"ServiceTask_0za1swb_di\",\n                            \"bpmnElement\": \"Task_1ypw0q7\"\n                        },\n                        \"omgdc:Bounds\": {\n                            \"_attributes\": {\n                                \"x\": \"709\",\n                                \"y\": \"329\",\n                                \"width\": \"100\",\n                                \"height\": \"80\"\n                            }\n                        }\n                    },\n                    {\n                        \"_attributes\": {\n                            \"id\": \"ServiceTask_1t7uv6x_di\",\n                            \"bpmnElement\": \"Task_1l277i3\"\n                        },\n                        \"omgdc:Bounds\": {\n                            \"_attributes\": {\n                                \"x\": \"876\",\n                                \"y\": \"329\",\n                                \"width\": \"100\",\n                                \"height\": \"80\"\n                            }\n                        }\n                    }\n                ],\n                \"bpmndi:BPMNEdge\": [\n                    {\n                        \"_attributes\": {\n                            \"id\": \"SequenceFlow_1vkdpjh_di\",\n                            \"bpmnElement\": \"SequenceFlow_1vkdpjh\"\n                        },\n                        \"di:waypoint\": [\n                            {\n                                \"_attributes\": {\n                                    \"x\": \"293\",\n                                    \"y\": \"203\"\n                                }\n                            },\n                            {\n                                \"_attributes\": {\n                                    \"x\": \"389\",\n                                    \"y\": \"203\"\n                                }\n                            }\n                        ]\n                    },\n                    {\n                        \"_attributes\": {\n                            \"id\": \"SequenceFlow_18l1gcc_di\",\n                            \"bpmnElement\": \"SequenceFlow_18l1gcc\"\n                        },\n                        \"di:waypoint\": [\n                            {\n                                \"_attributes\": {\n                                    \"x\": \"489\",\n                                    \"y\": \"203\"\n                                }\n                            },\n                            {\n                                \"_attributes\": {\n                                    \"x\": \"578\",\n                                    \"y\": \"203\"\n                                }\n                            }\n                        ]\n                    },\n                    {\n                        \"_attributes\": {\n                            \"id\": \"SequenceFlow_1p5r8dd_di\",\n                            \"bpmnElement\": \"SequenceFlow_1p5r8dd\"\n                        },\n                        \"di:waypoint\": [\n                            {\n                                \"_attributes\": {\n                                    \"x\": \"603\",\n                                    \"y\": \"228\"\n                                }\n                            },\n                            {\n                                \"_attributes\": {\n                                    \"x\": \"603\",\n                                    \"y\": \"329\"\n                                }\n                            }\n                        ],\n                        \"bpmndi:BPMNLabel\": {\n                            \"omgdc:Bounds\": {\n                                \"_attributes\": {\n                                    \"x\": \"599\",\n                                    \"y\": \"276\",\n                                    \"width\": \"41\",\n                                    \"height\": \"14\"\n                                }\n                            }\n                        }\n                    },\n                    {\n                        \"_attributes\": {\n                            \"id\": \"SequenceFlow_0ra58fz_di\",\n                            \"bpmnElement\": \"SequenceFlow_0ra58fz\"\n                        },\n                        \"di:waypoint\": [\n                            {\n                                \"_attributes\": {\n                                    \"x\": \"628\",\n                                    \"y\": \"203\"\n                                }\n                            },\n                            {\n                                \"_attributes\": {\n                                    \"x\": \"741\",\n                                    \"y\": \"203\"\n                                }\n                            }\n                        ],\n                        \"bpmndi:BPMNLabel\": {\n                            \"omgdc:Bounds\": {\n                                \"_attributes\": {\n                                    \"x\": \"672\",\n                                    \"y\": \"185\",\n                                    \"width\": \"27\",\n                                    \"height\": \"14\"\n                                }\n                            }\n                        }\n                    },\n                    {\n                        \"_attributes\": {\n                            \"id\": \"SequenceFlow_1m4ubzk_di\",\n                            \"bpmnElement\": \"SequenceFlow_1m4ubzk\"\n                        },\n                        \"di:waypoint\": [\n                            {\n                                \"_attributes\": {\n                                    \"x\": \"653\",\n                                    \"y\": \"369\"\n                                }\n                            },\n                            {\n                                \"_attributes\": {\n                                    \"x\": \"709\",\n                                    \"y\": \"369\"\n                                }\n                            }\n                        ]\n                    },\n                    {\n                        \"_attributes\": {\n                            \"id\": \"SequenceFlow_0gi8jmu_di\",\n                            \"bpmnElement\": \"SequenceFlow_0gi8jmu\"\n                        },\n                        \"di:waypoint\": [\n                            {\n                                \"_attributes\": {\n                                    \"x\": \"809\",\n                                    \"y\": \"369\"\n                                }\n                            },\n                            {\n                                \"_attributes\": {\n                                    \"x\": \"876\",\n                                    \"y\": \"369\"\n                                }\n                            }\n                        ]\n                    },\n                    {\n                        \"_attributes\": {\n                            \"id\": \"SequenceFlow_0l7yj6y_di\",\n                            \"bpmnElement\": \"SequenceFlow_0l7yj6y\"\n                        },\n                        \"di:waypoint\": [\n                            {\n                                \"_attributes\": {\n                                    \"x\": \"976\",\n                                    \"y\": \"369\"\n                                }\n                            },\n                            {\n                                \"_attributes\": {\n                                    \"x\": \"1031\",\n                                    \"y\": \"369\"\n                                }\n                            }\n                        ]\n                    }\n                ]\n            },\n            \"bpmndi:BPMNLabelStyle\": [\n                {\n                    \"_attributes\": {\n                        \"id\": \"sid-e0502d32-f8d1-41cf-9c4a-cbb49fecf581\"\n                    },\n                    \"omgdc:Font\": {\n                        \"_attributes\": {\n                            \"name\": \"Arial\",\n                            \"size\": \"11\",\n                            \"isBold\": \"false\",\n                            \"isItalic\": \"false\",\n                            \"isUnderline\": \"false\",\n                            \"isStrikeThrough\": \"false\"\n                        }\n                    }\n                },\n                {\n                    \"_attributes\": {\n                        \"id\": \"sid-84cb49fd-2f7c-44fb-8950-83c3fa153d3b\"\n                    },\n                    \"omgdc:Font\": {\n                        \"_attributes\": {\n                            \"name\": \"Arial\",\n                            \"size\": \"12\",\n                            \"isBold\": \"false\",\n                            \"isItalic\": \"false\",\n                            \"isUnderline\": \"false\",\n                            \"isStrikeThrough\": \"false\"\n                        }\n                    }\n                }\n            ]\n        }\n    }\n}"
        }

これだけです。
一言簡潔なレスポンスが返ってきました。
これはProcess WorkflowのOpsRamp内での固有識別IDです。
ですので、このIDで新規作成されたということがわかります。

{
    "uniqueId": "PROCESS_88ecc791-6dc8-4b78-b4f5-1f977ba2f9f4"
}

どんな具合で出来たか見に行きます。

#作成されたProcess Workflowの確認
OpsRamp画面を確認すると、、、
出来てますねぇ。
「API User」というシステムユーザで作成されています。
0031.png

内容もばっちりです。ペイロードの中にガチャガチャとタスク同士の位置とかも入ってるようで完全再現されています。
0032.png

最初からポチポチ作成していくのより圧倒的に効率がいいです。
API経由ならコピペからのワンクリックでWorkflowが作成可能です。

以上です。

3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?