From 488ced937fb1a9e4ba312f30a69ee161c296e589 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Bouz=C3=B3n=20Garc=C3=ADa?= Date: Mon, 10 Feb 2020 12:23:33 +0100 Subject: [PATCH] Add services to swagger definion `Services` endpoint was not present on the OpsGenie API definition. --- definitions/service.yaml | 96 ++++++++ parameters/service.yaml | 6 + paths/service.yaml | 226 +++++++++++++++++++ swagger.json | 472 +++++++++++++++++++++++++++++++++++++++ swagger.yaml | 3 + 5 files changed, 803 insertions(+) create mode 100644 definitions/service.yaml create mode 100644 parameters/service.yaml create mode 100644 paths/service.yaml diff --git a/definitions/service.yaml b/definitions/service.yaml new file mode 100644 index 0000000..5c08089 --- /dev/null +++ b/definitions/service.yaml @@ -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 diff --git a/parameters/service.yaml b/parameters/service.yaml new file mode 100644 index 0000000..86fa00d --- /dev/null +++ b/parameters/service.yaml @@ -0,0 +1,6 @@ +ServiceIdentifier: + name: identifier + in: path + description: Identifier of the service + required: true + type: string diff --git a/paths/service.yaml b/paths/service.yaml new file mode 100644 index 0000000..8fc1c03 --- /dev/null +++ b/paths/service.yaml @@ -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' diff --git a/swagger.json b/swagger.json index 51cea81..d5b0f0f 100644 --- a/swagger.json +++ b/swagger.json @@ -11862,6 +11862,342 @@ } } } + }, + "/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" + } + } + } } }, "parameters": { @@ -12709,6 +13045,13 @@ "tiny" ], "default": "id" + }, + "ServiceIdentifier": { + "name": "identifier", + "in": "path", + "description": "Identifier of the service", + "required": true, + "type": "string" } }, "responses": { @@ -24261,6 +24604,135 @@ } } } + }, + "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" + ] + } + } + }, + "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" + } + } + } + ] + }, + "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" + } + } + } } } } diff --git a/swagger.yaml b/swagger.yaml index ed32e75..3c5ba5f 100644 --- a/swagger.yaml +++ b/swagger.yaml @@ -55,6 +55,7 @@ paths: - $ref: ./paths/customUserRole.yaml - $ref: ./paths/policy.yaml - $ref: ./paths/incident.yaml + - $ref: ./paths/service.yaml ################################################################################ # PARAMETERS # @@ -83,6 +84,7 @@ parameters: - $ref: ./parameters/customUserRole.yaml - $ref: ./definitions/deprecatedPolicy.yaml - $ref: ./parameters/incident.yaml + - $ref: ./parameters/service.yaml ################################################################################ # RESPONSES # @@ -119,3 +121,4 @@ definitions: - $ref: ./definitions/customUserRole.yaml - $ref: ./definitions/policy.yaml - $ref: ./definitions/incident.yaml + - $ref: ./definitions/service.yaml