-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add service incident rule endpoint to manage service incident rules
- Loading branch information
Carlos Bouzón García
committed
Feb 28, 2020
1 parent
488ced9
commit bac34dd
Showing
6 changed files
with
904 additions
and
394 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -298,6 +298,8 @@ IntegrationMeta: | |
type: string | ||
teamId: | ||
type: string | ||
apiKey: | ||
type: string | ||
|
||
AlertFilter: | ||
type: object | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
ServiceIncidentId: | ||
name: id | ||
in: path | ||
description: Id of the service incident rule | ||
required: true | ||
type: string | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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' |
Oops, something went wrong.