Skip to content

Commit

Permalink
Add services to swagger definion
Browse files Browse the repository at this point in the history
`Services` endpoint was not present on the OpsGenie API definition.
  • Loading branch information
Carlos Bouzón García committed Feb 10, 2020
1 parent 24c7883 commit 488ced9
Show file tree
Hide file tree
Showing 5 changed files with 803 additions and 0 deletions.
96 changes: 96 additions & 0 deletions definitions/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
##################
# REQUEST #
##################
CreateServicePayload:
type: object
required:
- name
properties:
name:
type: string
description: Name of the service
teamId:
type: string
description: Team id of the service.
description:
type: string
description: Description field of the service that is generally used to provide a detailed information about the service.
visibility:
type: string
enum:
- TEAM_MEMBERS
- OPSGENIE_USERS
tags:
type: array
items:
type: string

UpdateServicePayload:
type: object
required:
- name
properties:
name:
type: string
description: Name of the service
description:
type: string
description: Description field of the service that is generally used to provide a detailed information about the service.
visibility:
type: string
enum:
- TEAM_MEMBERS
- OPSGENIE-USERS

##################
# RESPONSE #
##################
GetServiceResponse:
type: object
allOf:
- $ref: '#/definitions/BaseResponse'
- properties:
data:
$ref: '#/definitions/Service'

ListServicesResponse:
type: object
allOf:
- $ref: '#/definitions/BaseResponse'
- properties:
data:
type: array
items:
$ref: '#/definitions/Service'
paging:
$ref: '#/definitions/PageDetails'

##################
# MODEL #
##################
Service:
type: object
required:
- name
properties:
id:
type: string
description: Id of the service
name:
type: string
description: Name of the service
teamId:
type: string
description: Team id of the service.
description:
type: string
description: Description field of the service that is generally used to provide a detailed information about the service.
visibility:
type: string
enum:
- TEAM_MEMBERS
- OPSGENIE_USERS
tags:
type: array
items:
type: string
6 changes: 6 additions & 0 deletions parameters/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
ServiceIdentifier:
name: identifier
in: path
description: Identifier of the service
required: true
type: string
226 changes: 226 additions & 0 deletions paths/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,226 @@
/v1/services:
post:
tags:
- service
summary: Create Service
description: Creates a new service
operationId: createService
externalDocs:
description: For more information
url: https://docs.opsgenie.com/docs/service-api#create-service
parameters:
- name: body
in: body
description: Request payload of created service
required: true
schema:
$ref: '#/definitions/CreateServicePayload'
responses:
'201':
description: Service information for created service
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
summary: List services
description: Return list of services
operationId: listServices
externalDocs:
description: For more information
url: https://docs.opsgenie.com/docs/service-api#section-list-teamcustomer-services
x-collapse-params: "ListServicesRequest"
parameters:
- $ref: '#/parameters/UserLimitParam'
- $ref: '#/parameters/UserOffsetParam'
- $ref: '#/parameters/UserSortParam'
- $ref: '#/parameters/UserOrderParam'
- $ref: '#/parameters/UserQueryParam'
responses:
'200':
description: List of filtered services
schema:
$ref: '#/definitions/ListServicesResponse'
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'
'422':
$ref: '#/responses/UnprocessableEntity'
'429':
$ref: '#/responses/TooManyRequest'
default:
$ref: '#/responses/GeneralError'

/v1/services/{identifier}:
get:
tags:
- service
summary: Get Service
description: Returns service with given 'id'
operationId: getService
externalDocs:
description: For more information
url: https://docs.opsgenie.com/docs/service-api#section-get-service
x-collapse-params: GetServiceRequest
parameters:
- $ref: '#/parameters/ServiceIdentifier'
responses:
'200':
description: Service information for given identifier
schema:
$ref: '#/definitions/GetServiceResponse'
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'

delete:
tags:
- service
summary: Delete Service
description: Delete service with given id
operationId: deleteService
externalDocs:
description: For more information
url: https://docs.opsgenie.com/docs/service-api#section-delete-service
x-collapse-params: DeleteServiceRequest
parameters:
- $ref: '#/parameters/ServiceIdentifier'
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'

patch:
tags:
- service
summary: Update Service (Partial)
description: Update service with given id
operationId: updateService
externalDocs:
description: For more information
url: https://docs.opsgenie.com/docs/service-api#section-update-service
x-collapse-params: UpdateServiceRequest
parameters:
- $ref: '#/parameters/ServiceIdentifier'
- name: body
in: body
description: Request payload of update service action
schema:
$ref: '#/definitions/UpdateServicePayload'
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'
Loading

0 comments on commit 488ced9

Please sign in to comment.