diff --git a/definitions/integration.yaml b/definitions/integration.yaml index 7676d39..2afc14b 100644 --- a/definitions/integration.yaml +++ b/definitions/integration.yaml @@ -298,6 +298,8 @@ IntegrationMeta: type: string teamId: type: string + apiKey: + type: string AlertFilter: type: object diff --git a/definitions/serviceIncidentRule.yaml b/definitions/serviceIncidentRule.yaml new file mode 100644 index 0000000..ed07db1 --- /dev/null +++ b/definitions/serviceIncidentRule.yaml @@ -0,0 +1,180 @@ +################## +# REQUEST # +################## +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' + +################## +# RESPONSE # +################## +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' + +################## +# MODEL # +################## +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: + 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/parameters/serviceIncidentRule.yaml b/parameters/serviceIncidentRule.yaml new file mode 100644 index 0000000..db04084 --- /dev/null +++ b/parameters/serviceIncidentRule.yaml @@ -0,0 +1,7 @@ +ServiceIncidentId: + name: id + in: path + description: Id of the service incident rule + required: true + type: string + diff --git a/paths/serviceIncidentRule.yaml b/paths/serviceIncidentRule.yaml new file mode 100644 index 0000000..7c8add5 --- /dev/null +++ b/paths/serviceIncidentRule.yaml @@ -0,0 +1,179 @@ +/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' diff --git a/swagger.json b/swagger.json index d5b0f0f..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": { @@ -12630,402 +12896,31 @@ "in": "query", "description": "Type of the identifier that is provided as an in-line parameter. Possible values are 'id' or 'alias'", "required": false, - "type": "string", - "enum": [ - "id", - "alias" - ], - "default": "id" - }, - "CustomUserRoleIdentifier": { - "name": "identifier", - "in": "path", - "description": "Identifier of custom user role which could be user role 'id' or 'name'", - "required": true, - "type": "string" - }, - "CustomUserRoleIdentifierType": { - "name": "identifierType", - "in": "query", - "description": "Type of the identifier that is provided as an in-line parameter. Possible values are 'id' or 'name'", - "required": false, - "type": "string", - "enum": [ - "id", - "name" - ], - "default": "id" - }, - "DeprecatedChangeAlertPolicyOrderPayload": { - "type": "object", - "required": [ - "targetIndex" - ], - "properties": { - "targetIndex": { - "type": "integer", - "format": "int32", - "description": "Order of the target policy will be changed to this value. Larger values than policy count will put the target policy to last place", - "minimum": 0 - } - } - }, - "DeprecatedListAlertPoliciesResponse": { - "type": "object", - "allOf": [ - { - "$ref": "#/definitions/BaseResponse" - }, - { - "properties": { - "data": { - "type": "array", - "items": { - "$ref": "#/definitions/DeprecatedAlertPolicyMeta" - } - } - } - } - ] - }, - "DeprecatedCreateAlertPolicyResponse": { - "type": "object", - "allOf": [ - { - "$ref": "#/definitions/BaseResponse" - }, - { - "properties": { - "data": { - "$ref": "#/definitions/DeprecatedAlertPolicyMeta" - } - } - } - ] - }, - "DeprecatedGetAlertPolicyResponse": { - "type": "object", - "allOf": [ - { - "$ref": "#/definitions/BaseResponse" - }, - { - "properties": { - "data": { - "$ref": "#/definitions/DeprecatedAlertPolicy" - } - } - } - ] - }, - "DeprecatedAlertPolicyMeta": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "type": { - "type": "string", - "enum": [ - "modify", - "auto-close", - "notification-delay", - "notification-deduplication", - "notification-suppress", - "notification-renotify", - "auto-restart-notifications" - ] - }, - "order": { - "type": "integer", - "format": "int32" - }, - "enabled": { - "type": "boolean" - } - } - }, - "DeprecatedAlertPolicy": { - "type": "object", - "discriminator": "type", - "required": [ - "type" - ], - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string", - "description": "Name of the policy" - }, - "policyDescription": { - "type": "string", - "description": "Description of the policy" - }, - "filter": { - "$ref": "#/definitions/Filter", - "description": "Conditions specified in this field must be met for this policy to work" - }, - "timeRestrictions": { - "$ref": "#/definitions/TimeRestrictionInterval", - "description": "Time restrictions specified in this field must be met for this policy to work" - }, - "enabled": { - "type": "boolean", - "description": "Activity status of the alert policy" - }, - "type": { - "type": "string", - "description": "Type of the policy", - "enum": [ - "modify", - "auto-close", - "notification-delay", - "notification-deduplication", - "notification-suppress", - "notification-renotify", - "auto-restart-notifications" - ] - } - } - }, - "DeprecatedModifyAlertPolicy": { - "type": "object", - "x-discriminator-value": "modify", - "allOf": [ - { - "$ref": "#/definitions/DeprecatedAlertPolicy" - }, - { - "properties": { - "ignoreOriginalAlertActions": { - "type": "boolean" - }, - "ignoreOriginalDetails": { - "description": "If set to true, policy will ignore the original details of the alert. Default value is false", - "type": "boolean" - }, - "ignoreOriginalRecipients": { - "description": "If set to true, policy will ignore the original recipients of the alert. Default value is false", - "type": "boolean" - }, - "ignoreOriginalTags": { - "description": "If set to true, policy will ignore the original tags of the alert. Default value is false", - "type": "boolean" - }, - "ignoreOriginalTeams": { - "description": "If set to true, policy will ignore the original teams of the alert. Default value is false", - "type": "boolean" - }, - "continue": { - "description": "Will continue with other modify policies if set to true", - "type": "boolean" - }, - "alias": { - "description": "Alias of the alert. You can use {{alias}} to refer to the original alias. Default value is {{alias}}", - "type": "string" - }, - "description": { - "description": "Description of the alert. You can use {{description}} to refer to the original alert description. Default value is {{description}}", - "type": "string" - }, - "entity": { - "description": "Entity field of the alert. You can use {{entity}} to refer to the original entity. Default value is {{entity}}", - "type": "string" - }, - "message": { - "description": "Message of the alert", - "type": "string" - }, - "source": { - "description": "Source field of the alert. You can use {{source}} to refer to the original source. Default value is {{source}}", - "type": "string" - }, - "actions": { - "description": "Alert actions as a list of strings to add to the alerts original actions value. If ignoreOriginalAlertActions field is set to true, this will replace the original actions.", - "type": "array", - "items": { - "type": "string" - } - }, - "recipients": { - "description": "Recipients to add to the alerts original recipients value as a list of escalations, schedules, teams, users or the reserved word none or all. If ignoreOriginalRecipients field is set to true, this will replace the original recipients.", - "type": "array", - "items": { - "$ref": "#/definitions/Recipient" - } - }, - "tags": { - "description": "Tags to add to the alerts original tags value as a list of strings. If ignoreOriginalRecipients field is set to true, this will replace the original recipients.", - "type": "array", - "items": { - "type": "string" - } - }, - "details": { - "description": "Custom properties to add to the alerts original details value as a list of strings. If ignoreOriginalDetails field is set to true, this will replace the original details.", - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "priority": { - "type": "string", - "description": "Priority level of the alert", - "enum": [ - "P1", - "P2", - "P3", - "P4", - "P5" - ] - } - } - } - ] - }, - "DeprecatedAutoCloseAlertPolicy": { - "type": "object", - "x-discriminator-value": "auto-close", - "allOf": [ - { - "$ref": "#/definitions/DeprecatedAlertPolicy" - }, - { - "properties": { - "duration": { - "description": "Duration to wait before closing the alert", - "$ref": "#/definitions/Duration" - } - } - } - ] - }, - "DeprecatedNotificationDelayAlertPolicy": { - "type": "object", - "x-discriminator-value": "notification-delay", - "allOf": [ - { - "$ref": "#/definitions/DeprecatedAlertPolicy" - }, - { - "properties": { - "delayOption": { - "description": "Delay type", - "type": "string", - "enum": [ - "for-duration", - "next-time", - "next-weekday", - "next-monday", - "next-tuesday", - "next-wednesday", - "next-thursday", - "next-friday", - "next-saturday", - "next-sunday" - ] - }, - "duration": { - "description": "Interval to keep count of alerts for frequency based deduplication", - "$ref": "#/definitions/Duration" - }, - "untilHour": { - "description": "Should be a number between 0-23", - "type": "integer", - "format": "int32", - "minimum": 0, - "maximum": 23 - }, - "untilMinute": { - "description": "Should be a number between 0-59", - "type": "integer", - "format": "int32", - "minimum": 0, - "maximum": 59 - } - } - } - ] - }, - "DeprecatedNotificationDeduplicationAlertPolicy": { - "type": "object", - "x-discriminator-value": "notification-deduplication", - "allOf": [ - { - "$ref": "#/definitions/DeprecatedAlertPolicy" - }, - { - "properties": { - "deduplicationActionType": { - "type": "string", - "description": "Deduplication type", - "enum": [ - "value-based", - "frequency-based" - ] - }, - "count": { - "description": "Number of alerts before deduplication", - "type": "integer", - "format": "int32", - "minimum": 2, - "maximum": 100 - }, - "duration": { - "description": "Interval to keep count of alerts for frequency based deduplication", - "$ref": "#/definitions/Duration" - } - } - } - ] - }, - "DeprecatedAutoRestartNotificationsAlertPolicy": { - "type": "object", - "x-discriminator-value": "auto-restart-notifications", - "required": [ - "maxRepeatCount" + "type": "string", + "enum": [ + "id", + "alias" ], - "allOf": [ - { - "$ref": "#/definitions/DeprecatedAlertPolicy" - }, - { - "properties": { - "duration": { - "description": "Duration to wait before restarting the notification flow", - "$ref": "#/definitions/Duration" - }, - "maxRepeatCount": { - "description": "Max restart count of the notification flow", - "type": "integer", - "format": "int32" - } - } - } - ] + "default": "id" }, - "DeprecatedNotificationSuppressAlertPolicy": { - "type": "object", - "x-discriminator-value": "notification-suppress", - "allOf": [ - { - "$ref": "#/definitions/DeprecatedAlertPolicy" - } - ] + "CustomUserRoleIdentifier": { + "name": "identifier", + "in": "path", + "description": "Identifier of custom user role which could be user role 'id' or 'name'", + "required": true, + "type": "string" }, - "DeprecatedNotificationRenotifyAlertPolicy": { - "type": "object", - "x-discriminator-value": "notification-renotify", - "allOf": [ - { - "$ref": "#/definitions/DeprecatedAlertPolicy" - } - ] + "CustomUserRoleIdentifierType": { + "name": "identifierType", + "in": "query", + "description": "Type of the identifier that is provided as an in-line parameter. Possible values are 'id' or 'name'", + "required": false, + "type": "string", + "enum": [ + "id", + "name" + ], + "default": "id" }, "IncidentIdentifier": { "name": "identifier", @@ -13052,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": { @@ -15162,6 +15064,9 @@ }, "teamId": { "type": "string" + }, + "apiKey": { + "type": "string" } } }, @@ -24733,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 3c5ba5f..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 # @@ -82,9 +83,9 @@ parameters: - $ref: ./parameters/escalation.yaml - $ref: ./parameters/forwardingRule.yaml - $ref: ./parameters/customUserRole.yaml - - $ref: ./definitions/deprecatedPolicy.yaml - $ref: ./parameters/incident.yaml - $ref: ./parameters/service.yaml + - $ref: ./parameters/serviceIncidentRule.yaml ################################################################################ # RESPONSES # @@ -118,7 +119,9 @@ definitions: - $ref: ./definitions/whoIsOnCall.yaml - $ref: ./definitions/escalation.yaml - $ref: ./definitions/forwardingRule.yaml + - $ref: ./definitions/deprecatedPolicy.yaml - $ref: ./definitions/customUserRole.yaml - $ref: ./definitions/policy.yaml - $ref: ./definitions/incident.yaml - $ref: ./definitions/service.yaml + - $ref: ./definitions/serviceIncidentRule.yaml