diff --git a/swagger.json b/swagger.json index 58a7f8c..ce7dd32 100644 --- a/swagger.json +++ b/swagger.json @@ -12198,6 +12198,272 @@ } } } + }, + "/v1/services/{identifier}/incident-rules": { + "post": { + "tags": [ + "service-incident-rule" + ], + "summary": "Create Service Incident Rule", + "description": "Creates a new service incident rule", + "operationId": "createServiceIncidentRule", + "externalDocs": { + "description": "For more information", + "url": "https://docs.opsgenie.com/docs/service-incident-rules-api#section-create-incident-rule" + }, + "x-collapse-params": "CreateServiceIncidentRuleRequest", + "parameters": [ + { + "$ref": "#/parameters/ServiceIdentifier" + }, + { + "name": "body", + "in": "body", + "description": "Request payload of CreateServiceIncidentRulePayload", + "required": true, + "schema": { + "$ref": "#/definitions/CreateServiceIncidentRulePayload" + } + } + ], + "responses": { + "201": { + "description": "Information for created service incident rule", + "schema": { + "$ref": "#/definitions/SuccessResponse" + }, + "headers": { + "X-Request-ID": { + "description": "Id of given request", + "type": "string" + }, + "X-Response-Time": { + "description": "Process time of given request", + "type": "string" + }, + "X-RateLimit-State": { + "description": "Status of rate limit", + "type": "string" + }, + "X-RateLimit-Reason": { + "description": "Source of the rate limit", + "type": "string" + }, + "X-RateLimit-Period-In-Sec": { + "description": "Time of throttle in seconds", + "type": "string" + } + } + }, + "400": { + "$ref": "#/responses/BadRequest" + }, + "401": { + "$ref": "#/responses/Unauthorized" + }, + "402": { + "$ref": "#/responses/PaymentRequired" + }, + "403": { + "$ref": "#/responses/Forbidden" + }, + "404": { + "$ref": "#/responses/NotFound" + }, + "422": { + "$ref": "#/responses/UnprocessableEntity" + }, + "429": { + "$ref": "#/responses/TooManyRequest" + }, + "default": { + "$ref": "#/responses/GeneralError" + } + } + }, + "get": { + "tags": [ + "service-incident-rule" + ], + "summary": "List Service Incident Rules", + "description": "Returns list of service incident rules", + "operationId": "listServiceRoutingRules", + "externalDocs": { + "description": "For more information", + "url": "https://docs.opsgenie.com/docs/service-incident-rules-api#section-get-incident-rules" + }, + "x-collapse-params": "ListServiceIncidentRulesRequest", + "parameters": [ + { + "$ref": "#/parameters/ServiceIdentifier" + } + ], + "responses": { + "200": { + "description": "List of Service Incident Rule informations", + "schema": { + "$ref": "#/definitions/ListServiceIncidentRulesResponse" + }, + "headers": { + "X-Request-ID": { + "description": "Id of given request", + "type": "string" + }, + "X-Response-Time": { + "description": "Process time of given request", + "type": "string" + }, + "X-RateLimit-State": { + "description": "Status of rate limit", + "type": "string" + }, + "X-RateLimit-Reason": { + "description": "Source of the rate limit", + "type": "string" + }, + "X-RateLimit-Period-In-Sec": { + "description": "Time of throttle in seconds", + "type": "string" + } + } + }, + "400": { + "$ref": "#/responses/BadRequest" + }, + "401": { + "$ref": "#/responses/Unauthorized" + }, + "402": { + "$ref": "#/responses/PaymentRequired" + }, + "403": { + "$ref": "#/responses/Forbidden" + }, + "404": { + "$ref": "#/responses/NotFound" + }, + "422": { + "$ref": "#/responses/UnprocessableEntity" + }, + "429": { + "$ref": "#/responses/TooManyRequest" + }, + "default": { + "$ref": "#/responses/GeneralError" + } + } + } + }, + "/v1/services/{identifier}/routing-rules/{id}": { + "put": { + "tags": [ + "service-incident-rule" + ], + "summary": "Update service incident rule", + "description": "Update incident rule of the service", + "operationId": "updateServiceIncidentRule", + "externalDocs": { + "description": "For more information", + "url": "https://docs.opsgenie.com/docs/service-incident-rules-api#section-update-incident-rule" + }, + "x-collapse-params": "UpdateServiceIncidentRuleRequest", + "parameters": [ + { + "$ref": "#/parameters/ServiceIdentifier" + }, + { + "$ref": "#/parameters/ServiceIncidentId" + }, + { + "name": "body", + "in": "body", + "description": "Request payload of update Service Incident Rule action", + "required": false, + "schema": { + "$ref": "#/definitions/UpdateServiceIncidentRulePayload" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/Ok" + }, + "400": { + "$ref": "#/responses/BadRequest" + }, + "401": { + "$ref": "#/responses/Unauthorized" + }, + "402": { + "$ref": "#/responses/PaymentRequired" + }, + "403": { + "$ref": "#/responses/Forbidden" + }, + "404": { + "$ref": "#/responses/NotFound" + }, + "422": { + "$ref": "#/responses/UnprocessableEntity" + }, + "429": { + "$ref": "#/responses/TooManyRequest" + }, + "default": { + "$ref": "#/responses/GeneralError" + } + } + }, + "delete": { + "tags": [ + "service-incident-rule" + ], + "summary": "Delete service incident rule", + "description": "Delete incident rule of the service", + "operationId": "deleteServiceIncidentRule", + "externalDocs": { + "description": "For more information", + "url": "https://docs.opsgenie.com/docs/service-incident-rules-api#section-delete-incident-rule" + }, + "x-collapse-params": "DeleteServiceIncidentRuleRequest", + "parameters": [ + { + "$ref": "#/parameters/ServiceIdentifier" + }, + { + "$ref": "#/parameters/ServiceIncidentId" + } + ], + "responses": { + "200": { + "$ref": "#/responses/Ok" + }, + "400": { + "$ref": "#/responses/BadRequest" + }, + "401": { + "$ref": "#/responses/Unauthorized" + }, + "402": { + "$ref": "#/responses/PaymentRequired" + }, + "403": { + "$ref": "#/responses/Forbidden" + }, + "404": { + "$ref": "#/responses/NotFound" + }, + "422": { + "$ref": "#/responses/UnprocessableEntity" + }, + "429": { + "$ref": "#/responses/TooManyRequest" + }, + "default": { + "$ref": "#/responses/GeneralError" + } + } + } } }, "parameters": { @@ -12681,6 +12947,13 @@ "description": "Identifier of the service", "required": true, "type": "string" + }, + "ServiceIncidentId": { + "name": "id", + "in": "path", + "description": "Id of the service incident rule", + "required": true, + "type": "string" } }, "responses": { @@ -24365,6 +24638,240 @@ } } } + }, + "CreateServiceIncidentRulePayload": { + "type": "object", + "required": [ + "incidentProperties" + ], + "properties": { + "conditionMatchType": { + "type": "string", + "enum": [ + "match-all", + "match-any-condition", + "match-all-conditions" + ], + "default": "match-all" + }, + "conditions": { + "type": "array", + "items": { + "$ref": "#/definitions/ServiceIncidentCondition" + } + }, + "incidentProperties": { + "$ref": "#/definitions/ServiceIncidentProperties" + } + } + }, + "UpdateServiceIncidentRulePayload": { + "type": "object", + "properties": { + "conditionMatchType": { + "type": "string", + "enum": [ + "match-all", + "match-any-condition", + "match-all-conditions" + ], + "default": "match-all" + }, + "conditions": { + "type": "array", + "items": { + "$ref": "#/definitions/ServiceIncidentCondition" + } + }, + "incidentProperties": { + "$ref": "#/definitions/ServiceIncidentProperties" + } + } + }, + "GetServiceIncidentRuleResponse": { + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/BaseResponse" + }, + { + "properties": { + "data": { + "$ref": "#/definitions/ServiceIncidentRule" + } + } + } + ] + }, + "ListServiceIncidentRulesResponse": { + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/BaseResponse" + }, + { + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/ServiceIncidentRule" + } + } + } + } + ] + }, + "ServiceIncidentRule": { + "type": "object", + "required": [ + "id" + ], + "properties": { + "id": { + "type": "string", + "description": "Id of the incident rule." + }, + "conditionMatchType": { + "type": "string", + "enum": [ + "match-all", + "match-any-condition", + "match-all-conditions" + ], + "default": "match-all" + }, + "conditions": { + "type": "array", + "items": { + "$ref": "#/definitions/ServiceIncidentCondition" + } + }, + "incidentProperties": { + "$ref": "#/definitions/ServiceIncidentProperties" + }, + "order": { + "type": "integer", + "description": "Order for the rule." + } + } + }, + "ServiceIncidentCondition": { + "Condition": null, + "type": "object", + "required": [ + "field", + "operation" + ], + "properties": { + "field": { + "type": "string", + "description": "Specifies which alert field will be used in condition. Possible values are message, description, tags, extra-properties, recipients, teams or priority", + "enum": [ + "message", + "description", + "tags", + "extra-properties", + "recipients", + "teams", + "priority" + ] + }, + "key": { + "type": "string", + "description": "If field is set as extra-properties, key could be used for key-value pair" + }, + "not": { + "type": "boolean", + "description": "Indicates behaviour of the given operation. Default value is false" + }, + "operation": { + "type": "string", + "enum": [ + "matches", + "contains", + "starts-with", + "ends-with", + "equals", + "contains-key", + "contains-value", + "greater-than", + "less-than", + "is-empty", + "equals-ignore-whitespace" + ], + "description": "It is the operation that will be executed for the given field and key." + }, + "expectedValue": { + "type": "string", + "description": "User defined value that will be compared with alert field according to the operation. Default value is empty string" + } + } + }, + "ServiceIncidentProperties": { + "type": "object", + "required": [ + "message", + "priority", + "stakeholderProperties" + ], + "properties": { + "message": { + "type": "string", + "description": "Message of the related incident rule." + }, + "tags": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Tags of the alert." + }, + "details": { + "type": "object", + "description": "Map of key-value pairs to use as custom properties of the alert.", + "additionalProperties": { + "type": "string" + } + }, + "description": { + "type": "string", + "description": "Description field of the incident rule." + }, + "priority": { + "type": "string", + "description": "Priority level of the alert. Possible values are P1, P2, P3, P4 and P5", + "enum": [ + "P1", + "P2", + "P3", + "P4", + "P5" + ] + }, + "stakeholderProperties": { + "$ref": "#/definitions/ServiceIncidentStakeholderProperties" + } + } + }, + "ServiceIncidentStakeholderProperties": { + "type": "object", + "required": [ + "message" + ], + "properties": { + "enable": { + "type": "boolean", + "description": "Option to enable stakeholder notifications.Default value is true." + }, + "message": { + "type": "string", + "description": "Message that is to be passed to audience that is generally used to provide a content information about the alert." + }, + "description": { + "type": "string", + "description": "Description that is generally used to provide a detailed information about the alert." + } + } } } } diff --git a/swagger.yaml b/swagger.yaml index aa2cfcd..da0d962 100644 --- a/swagger.yaml +++ b/swagger.yaml @@ -56,6 +56,7 @@ paths: - $ref: ./paths/policy.yaml - $ref: ./paths/incident.yaml - $ref: ./paths/service.yaml + - $ref: ./paths/serviceIncidentRule.yaml ################################################################################ # PARAMETERS # @@ -84,6 +85,7 @@ parameters: - $ref: ./parameters/customUserRole.yaml - $ref: ./parameters/incident.yaml - $ref: ./parameters/service.yaml + - $ref: ./parameters/serviceIncidentRule.yaml ################################################################################ # RESPONSES # @@ -122,3 +124,4 @@ definitions: - $ref: ./definitions/policy.yaml - $ref: ./definitions/incident.yaml - $ref: ./definitions/service.yaml + - $ref: ./definitions/serviceIncidentRule.yaml