Remediation Create Action

Remediation Create Action

This API is used for creating a new remediation action. Fields "created_on" and "last_updated" are read-only and can't be updated.

Request
URI
POST
https://{api_host}/tcsa.host.com/actions/{action_name}
COPY
Path Parameters
string
action_name
Required

action name.


Request Body
RemediationAction of type(s) application/json
Required

Show optional properties

{
    "action_name": "slack_action",
    "file_type": "PYTHON"
}
{
    "action_name": "string",
    "file_data": "string",
    "created_on": "string",
    "last_updated": "string"
}
string
action_name
Required

Name of the remediation action

file_type
Required

either PYTHON or YAML

Possible values are : PYTHON, YAML,
string
file_data
Optional

file content

string
created_on
Optional

action creation timestamp

string
last_updated
Optional

action last update timestamp

Authentication
This operation uses the following authentication methods.
Responses
201

Created

Returns RemediationAction of type(s) application/json
{
    "action_name": "slack_action",
    "created_on": "21 Nov, 2022, 00:42:45 UTC",
    "description": "slack action",
    "file_data": "import json\nfrom datetime import datetime\nfrom airflow.models import DAG\nfrom airflow.models import Variable\nfrom airflow.models.param import Param\nfrom airflow.operators.python import PythonOperator\nfrom airflow.providers.slack.operators.slack import SlackAPIPostOperator\nimport logging\nfrom Success import *\nfrom Failure import *\n\nmyParams = {\n    \"Acknowledged\": 'false',\n    \"Active\": 'true',\n    \"AuditTrail\": [\n        {\n        \"User\": \"\",\n        \"ActionType\": \"\",\n        \"SerialNumber\": 0,\n        \"Text\": \"\",\n        \"Timestamp\": 0\n        }\n    ],\n    \"Category\": \"\",\n    \"CausedBy\": [],\n    \"Causes\": [\n        \"\"\n    ],\n    \"Certainty\": 0.0,\n    \"ClassDisplayName\": \"\",\n    \"ClassName\": \"\",\n    \"ClearOnAcknowledge\": 'false',\n    \"ClosedAt\": 0,\n    \"ElementClassName\": \"\",\n    \"ElementName\": \"\",\n    \"EventDisplayName\": \"\",\n    \"EventName\": \"\",\n    \"EventState\": \"\",\n    \"EventText\": \"\",\n    \"EventType\": \"\",\n    \"FirstNotifiedAt\": 0,\n    \"Impact\": 0,\n    \"InMaintenance\": 'false',\n    \"InstanceDisplayName\": \"\",\n    \"InstanceName\": \"66999f1a-9ef1-4840-a427-b18e04998f49\",\n    \"IsProblem\": 'true',\n    \"IsRoot\": 'true',\n    \"LastChangedAt\": 0,\n    \"Name\": \"NOTIFICATION-Interface_IF-qa-npmpe5/4_Down\",\n    \"OccurrenceCount\": 1,\n    \"OpenedAt\": 0,\n    \"Owner\": \"\",\n    \"PollingID\": 0,\n    \"PollingState\": \"\",\n    \"ProcessedTimeStamp\": 0,\n    \"Severity\": 1,\n    \"Source\": \"$Source:INCHARGE-SA-PRES$\",\n    \"SourceDomainName\": \"\",\n    \"SourceEventType\": \"\",\n    \"SourceInfo\": \"\",\n    \"SourceSpecific\": \"\",\n    \"TroubleTicketID\": \"\",\n    \"UserDefined1\": \"\",\n    \"UserDefined10\": \"\",\n    \"UserDefined11\": \"\",\n    \"UserDefined12\": \"\",\n    \"UserDefined13\": \"\",\n    \"UserDefined14\": \"\",\n    \"UserDefined15\": \"\",\n    \"UserDefined16\": \"\",\n    \"UserDefined17\": \"\",\n    \"UserDefined18\": \"\",\n    \"UserDefined19\": \"\",\n    \"UserDefined2\": \"\",\n    \"UserDefined20\": \"\",\n    \"UserDefined3\": \"\",\n    \"UserDefined4\": \"\",\n    \"UserDefined5\": \"\",\n    \"UserDefined6\": \"\",\n    \"UserDefined7\": \"\",\n    \"UserDefined8\": \"\",\n    \"UserDefined9\": \"\",\n    \"tags\": {\n        \"customer\": \"\",\n        \"location\": \"\",\n        \"latitude\": \"\"\n    }\n}\n\nwith DAG(\n\tdag_id='slack_action',\n\tschedule_interval=None,\n\tstart_date=datetime(2022,5,16),\n    default_args={'slack_conn_id': 'slack_connection', 'channel': '#airflow-slack-integration'},\n    params=myParams,\n\tis_paused_upon_creation=False,\n\tcatchup=False,\n    on_success_callback =success,\n    on_failure_callback =failure\n) as dag:\n\n    # 1. send slack message with JIRA info and summary\n    task_post_slack = SlackAPIPostOperator(\n        task_id='task_post_slack',\n        text='TCSA Notification received\\n {{ params.Name }}\\n {{ params.Source }}',\n        channel='#airflow-slack-integration',\n        on_success_callback = success,\n        on_failure_callback =failure\n    )\n\n    task_post_slack",
    "file_type": "PYTHON",
    "last_updated": "21 Nov, 2022, 00:42:45 UTC"
}
string
action_name
Required

Name of the remediation action

file_type
Required

either PYTHON or YAML

Possible values are : PYTHON, YAML,
string
file_data
Optional

file content

string
created_on
Optional

action creation timestamp

string
last_updated
Optional

action last update timestamp


400

Invalid Request sent by the user

Operation doesn't return any data structure

500

Internal server error

Operation doesn't return any data structure