diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index e3131b2..95e69fc 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -30,7 +30,7 @@ jobs: - name: code qa run: make ci-code-qa - name: unit tests - run: make test + run: make ci-test test-minimal: runs-on: ubuntu-latest @@ -50,7 +50,7 @@ jobs: - name: install dependencies run: make ci-install-api - name: unit tests - run: make test + run: make ci-test publish-api: needs: @@ -133,5 +133,4 @@ jobs: - name: Publish to PyPI uses: pypa/gh-action-pypi-publish@release/v1 with: - packages-dir: waylay-sdk-alarms-types/dist - password: ${{ secrets.PYPI_TYPES_PKG_API_TOKEN }} + packages-dir: waylay-sdk-alarms-types/dist \ No newline at end of file diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index cc0240c..baea8ae 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -4,6 +4,7 @@ LICENSE.txt Makefile README.md docs/ABatchAlarmsSpecification.md +docs/AboutApi.md docs/AlarmAuditRecord.md docs/AlarmEntity.md docs/AlarmEvent.md @@ -64,16 +65,15 @@ docs/QueuedOperationSummaryAction.md docs/SO8601TimestampOrMillis.md docs/SSEventStream.md docs/SuccessOperationResultValue.md -docs/VersionApi.md docs/VersionResponse.md pyproject.toml requirements.txt test/__init__.py test/api/__init__.py +test/api/about_api_test.py test/api/alarm_events_api_test.py test/api/alarms_api_test.py test/api/alarms_batch_operations_api_test.py -test/api/version_api_test.py test/conftest.py test/openapi.py test/types/__init__.py @@ -135,3 +135,5 @@ test/types/so8601_timestamp_or_millis_stub.py test/types/ss_event_stream_stub.py test/types/success_operation_result_value_stub.py test/types/version_response_stub.py +waylay-sdk-alarms-types/README.md +waylay-sdk-alarms/README.md diff --git a/Makefile b/Makefile index 9fe441c..633454e 100644 --- a/Makefile +++ b/Makefile @@ -64,7 +64,7 @@ typecheck: install ### Run type checks code-qa: install ### perform code quality checks @${VENV_TYPES_ACTIVATE} && make exec-code-qa -test: test-types test-notypes ### Run unit tests with and without types installed +test: test-notypes test-types ### Run unit tests with and without types installed test-types: install-types ### Run unit tests with types installed @${VENV_TYPES_ACTIVATE} && make exec-test @@ -134,6 +134,8 @@ ci-install-types: ci-install-api ### Install the environment including types wit ci-install-api: _install_requirements ### Install the minimal environment with frozen requirements pip install './${API_FOLDER}[dev]' +ci-test: exec-test ### perform ci unit tests + _install_requirements: pip install --upgrade pip pip install -r requirements.txt diff --git a/README.md b/README.md index f8fb5d8..800d9a5 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,9 @@ No description provided (generated by Openapi Generator https://github.com/opena This Python package is automatically generated based on the Waylay Alarms OpenAPI specification (API version: 1.11.0) +For more information, please visit [the openapi specification](https://docs.waylay.io/openapi/public/redocly/alarms.html). -It consists of two sub-packages that are both plugins for the waylay-sdk package. +It consists of two sub-packages that are both plugins for the waylay-sdk-core package. - The `waylay-sdk-alarms` sub-package contains the Alarms api methods. - The `waylay-sdk-alarms-types` sub-package is an extension that contains the typed model classes for all path params, query params, body params and responses for each of the api methods in `waylay-sdk-alarms`. @@ -12,21 +13,20 @@ It consists of two sub-packages that are both plugins for the waylay-sdk package This package requires Python 3.9+. ## Installation -Typically this package is installed when installing the [waylay-sdk](https://github.com/waylayio/waylay-sdk-py) package to enable the service's functionality. +Typically this package is installed when installing the [waylay-sdk-core](https://pypi.org/project/waylay-sdk/) package to enable the service's functionality. When the service api methods are required, waylay-sdk-alarms is included in: -- ```pip install waylay-sdk[alarms]``` to install `waylay-sdk` along with only this service, or -- ```pip install waylay-sdk[services]``` to install `waylay-sdk` along with all services. +- ```pip install waylay-sdk-core[alarms]``` to install `waylay-sdk-core` along with only this service, or +- ```pip install waylay-sdk-core[services]``` to install `waylay-sdk-core` along with all services. When the typed models are required, both waylay-sdk-alarms and waylay-sdk-alarms-types are included in: -- ```pip install waylay-sdk[alarms,alarms-types]``` to install `waylay-sdk` along with only this service including the typed models, or -- ```pip install waylay-sdk[services,services-types]``` to install `waylay-sdk` along with all services along with the typed models. +- ```pip install waylay-sdk-core[alarms,alarms-types]``` to install `waylay-sdk-core` along with only this service including the typed models, or +- ```pip install waylay-sdk-core[services,services-types]``` to install `waylay-sdk-core` along with all services along with the typed models. ## Usage - ```python from pprint import pprint -# Import the waylay-client from the waylay-sdk package +# Import the waylay-client from the waylay-sdk-core package from waylay.sdk.client import WaylayClient from waylay.sdk.api.api_exceptions import ApiError @@ -34,30 +34,28 @@ from waylay.sdk.api.api_exceptions import ApiError waylay_client = WaylayClient.from_profile() # Note that the typed model classes for responses/parameters/... are only available when `waylay-sdk-alarms-types` is installed -from waylay.services.alarms.models.get_eventstream_event_format_parameter import GetEventstreamEventFormatParameter -from waylay.services.alarms.models.nd_json_response_stream import NdJsonResponseStream +from waylay.services.alarms.models.version_response import VersionResponse try: - # Alarm Events - # calls `GET /alarms/v1/events` - api_response = await waylay_client.alarms.alarm_events.get( - # query parameters: - query = { - 'eventFormat': 'application/cloudevents+json' - }, + # Get Service Information + # calls `GET /alarms/v1` + api_response = await waylay_client.alarms.about.get( ) - print("The response of alarms.alarm_events.get:\n") + print("The response of alarms.about.get:\n") pprint(api_response) except ApiError as e: - print("Exception when calling alarms.alarm_events.get: %s\n" % e) + print("Exception when calling alarms.about.get: %s\n" % e) ``` +For more information, please visit the [Waylay API documentation](https://docs.waylay.io/#/api/?id=software-development-kits). + ## Documentation for API Endpoints All URIs are relative to *https://api.waylay.io* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- +*AboutApi* | [**get**](docs/AboutApi.md#get) | **GET** /alarms/v1 | Get Service Information *AlarmEventsApi* | [**get**](docs/AlarmEventsApi.md#get) | **GET** /alarms/v1/events | Alarm Events *AlarmsApi* | [**create**](docs/AlarmsApi.md#create) | **POST** /alarms/v1/alarms | Create Alarm *AlarmsApi* | [**delete**](docs/AlarmsApi.md#delete) | **DELETE** /alarms/v1/alarms/{alarmId} | Delete Alarm @@ -66,7 +64,6 @@ Class | Method | HTTP request | Description *AlarmsApi* | [**update**](docs/AlarmsApi.md#update) | **PUT** /alarms/v1/alarms/{alarmId} | Update Alarm *AlarmsBatchOperationsApi* | [**get**](docs/AlarmsBatchOperationsApi.md#get) | **GET** /alarms/v1/batch/{batchId} | Get Alarms Batch Operation Status *AlarmsBatchOperationsApi* | [**start**](docs/AlarmsBatchOperationsApi.md#start) | **POST** /alarms/v1/batch | Start Alarms Batch Operation -*VersionApi* | [**get**](docs/VersionApi.md#get) | **GET** /alarms/v1 | Version ## Documentation For Models diff --git a/docs/VersionApi.md b/docs/AboutApi.md similarity index 80% rename from docs/VersionApi.md rename to docs/AboutApi.md index 933396b..eb727ab 100644 --- a/docs/VersionApi.md +++ b/docs/AboutApi.md @@ -1,26 +1,26 @@ -# waylay.services.alarms.VersionApi +# waylay.services.alarms.AboutApi All URIs are relative to *https://api.waylay.io* Method | HTTP request | Description ------------- | ------------- | ------------- -[**get**](VersionApi.md#get) | **GET** /alarms/v1 | Version +[**get**](AboutApi.md#get) | **GET** /alarms/v1 | Get Service Information # **get** > get( > headers > ) -> VersionResponse -Version +Get Service Information -Get the status and version of the service. +Get the name and version of the service. ### Example ```python from pprint import pprint -# Import the waylay-client from the waylay-sdk package +# Import the waylay-client from the waylay-sdk-core package from waylay.sdk.client import WaylayClient from waylay.sdk.api.api_exceptions import ApiError @@ -30,14 +30,14 @@ waylay_client = WaylayClient.from_profile() # Note that the typed model classes for responses/parameters/... are only available when `waylay-sdk-alarms-types` is installed from waylay.services.alarms.models.version_response import VersionResponse try: - # Version + # Get Service Information # calls `GET /alarms/v1` - api_response = await waylay_client.alarms.version.get( + api_response = await waylay_client.alarms.about.get( ) - print("The response of alarms.version.get:\n") + print("The response of alarms.about.get:\n") pprint(api_response) except ApiError as e: - print("Exception when calling alarms.version.get: %s\n" % e) + print("Exception when calling alarms.about.get: %s\n" % e) ``` ### Endpoint diff --git a/docs/AlarmEventsApi.md b/docs/AlarmEventsApi.md index 32c7b04..0d8fc80 100644 --- a/docs/AlarmEventsApi.md +++ b/docs/AlarmEventsApi.md @@ -10,7 +10,7 @@ Method | HTTP request | Description > get( > query: GetQuery, > headers -> ) -> NdJsonResponseStream +> ) -> AsyncIterator[NdJsonResponseStream] Alarm Events @@ -21,7 +21,7 @@ Opens a data stream for all Alarm Events for this tenant. ```python from pprint import pprint -# Import the waylay-client from the waylay-sdk package +# Import the waylay-client from the waylay-sdk-core package from waylay.sdk.client import WaylayClient from waylay.sdk.api.api_exceptions import ApiError @@ -62,7 +62,7 @@ Name | Type | API binding | Description | Notes Selected path param | Raw response param | Return Type | Description | Links ------------------- | ------------------ | ------------ | ----------- | ----- -Literal[""] _(default)_ | False _(default)_ | **`NdJsonResponseStream`** | | [NdJsonResponseStream](NdJsonResponseStream.md) +Literal[""] _(default)_ | False _(default)_ | **`AsyncIterator[NdJsonResponseStream]`** | | [NdJsonResponseStream](NdJsonResponseStream.md) str | False _(default)_ | **`Any`** | If any other string value for the selected path is provided, the exact type of the response will only be known at runtime. | / | True | `Response` | The raw http response object. diff --git a/docs/AlarmsApi.md b/docs/AlarmsApi.md index d02ec9e..271efb2 100644 --- a/docs/AlarmsApi.md +++ b/docs/AlarmsApi.md @@ -24,7 +24,7 @@ Create an alarm. If an `ACTIVE` or `ACKNOWLEDGED` alarm with the same `source.i ```python from pprint import pprint -# Import the waylay-client from the waylay-sdk package +# Import the waylay-client from the waylay-sdk-core package from waylay.sdk.client import WaylayClient from waylay.sdk.api.api_exceptions import ApiError @@ -92,7 +92,7 @@ Delete an Alarm. ```python from pprint import pprint -# Import the waylay-client from the waylay-sdk package +# Import the waylay-client from the waylay-sdk-core package from waylay.sdk.client import WaylayClient from waylay.sdk.api.api_exceptions import ApiError @@ -158,7 +158,7 @@ Get an alarm. ```python from pprint import pprint -# Import the waylay-client from the waylay-sdk package +# Import the waylay-client from the waylay-sdk-core package from waylay.sdk.client import WaylayClient from waylay.sdk.api.api_exceptions import ApiError @@ -227,7 +227,7 @@ Query multiple alarms using a query language. The response contains the total nu ```python from pprint import pprint -# Import the waylay-client from the waylay-sdk package +# Import the waylay-client from the waylay-sdk-core package from waylay.sdk.client import WaylayClient from waylay.sdk.api.api_exceptions import ApiError @@ -337,7 +337,7 @@ Update an alarm. ```python from pprint import pprint -# Import the waylay-client from the waylay-sdk package +# Import the waylay-client from the waylay-sdk-core package from waylay.sdk.client import WaylayClient from waylay.sdk.api.api_exceptions import ApiError diff --git a/docs/AlarmsBatchOperationsApi.md b/docs/AlarmsBatchOperationsApi.md index 2a8d3f9..6d2f074 100644 --- a/docs/AlarmsBatchOperationsApi.md +++ b/docs/AlarmsBatchOperationsApi.md @@ -22,7 +22,7 @@ Get the results of the Alarms Batch Operation. ```python from pprint import pprint -# Import the waylay-client from the waylay-sdk package +# Import the waylay-client from the waylay-sdk-core package from waylay.sdk.client import WaylayClient from waylay.sdk.api.api_exceptions import ApiError @@ -90,7 +90,7 @@ Start Alarms Batch Operation. ```python from pprint import pprint -# Import the waylay-client from the waylay-sdk package +# Import the waylay-client from the waylay-sdk-core package from waylay.sdk.client import WaylayClient from waylay.sdk.api.api_exceptions import ApiError diff --git a/openapi/alarms.openapi.yaml b/openapi/alarms.openapi.yaml index 6f8a937..a241446 100644 --- a/openapi/alarms.openapi.yaml +++ b/openapi/alarms.openapi.yaml @@ -10,7 +10,7 @@ tags: - name: Alarms - name: Alarm Events - name: Alarms Batch Operations -- name: Version +- name: About paths: /alarms/v1/alarms: post: @@ -363,10 +363,10 @@ paths: /alarms/v1: get: tags: - - Version - operationId: get_version - summary: Version - description: Get the status and version of the service. + - About + operationId: get_about + summary: Get Service Information + description: Get the name and version of the service. responses: '200': $ref: '#/components/responses/VersionResponse' diff --git a/openapi/alarms.transformed.openapi.yaml b/openapi/alarms.transformed.openapi.yaml index 7690a08..0c72b81 100644 --- a/openapi/alarms.transformed.openapi.yaml +++ b/openapi/alarms.transformed.openapi.yaml @@ -10,7 +10,7 @@ tags: - name: Alarms - name: Alarm Events - name: Alarms Batch Operations - - name: Version + - name: About paths: /alarms/v1/alarms: post: @@ -432,6 +432,7 @@ paths: x-consumes-urlencoded: false x-consumes-json: false x-consumes-other: false + x-produces-event-stream: true /alarms/v1/batch: post: operationId: start @@ -484,10 +485,10 @@ paths: /alarms/v1: get: tags: - - Version - operationId: get_version - summary: Version - description: Get the status and version of the service. + - About + operationId: get_about + summary: Get Service Information + description: Get the name and version of the service. responses: '200': $ref: '#/components/responses/VersionResponse' @@ -1261,6 +1262,7 @@ components: oneOf: - $ref: '#/components/schemas/AlarmEvent' - $ref: '#/components/schemas/CloudAlarmEvent' + x-is-event-stream: true BatchStartResponse: description: Batch Operation Started content: diff --git a/requirements.txt b/requirements.txt index 500bd25..252e690 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ pydantic ~= 2.6 typing-extensions ~= 4.9 -waylay-sdk ~= 0.0.4rc5 +waylay-sdk-core@git+https://github.com/waylayio/waylay-sdk-py@cc464ef9ee120bc54ff6381add0c92a2d06e2944 diff --git a/test/_run/alarms.openapi.yaml b/test/_run/alarms.openapi.yaml deleted file mode 120000 index 16948eb..0000000 --- a/test/_run/alarms.openapi.yaml +++ /dev/null @@ -1 +0,0 @@ -openapi/alarms.openapi.yaml.json \ No newline at end of file diff --git a/test/_run/alarms.transformed.openapi.yaml b/test/_run/alarms.transformed.openapi.yaml deleted file mode 120000 index 9fbeebf..0000000 --- a/test/_run/alarms.transformed.openapi.yaml +++ /dev/null @@ -1 +0,0 @@ -openapi/alarms.transformed.openapi.yaml.json \ No newline at end of file diff --git a/test/_run/cloudevents.schema.yaml b/test/_run/cloudevents.schema.yaml deleted file mode 120000 index ca575d0..0000000 --- a/test/_run/cloudevents.schema.yaml +++ /dev/null @@ -1 +0,0 @@ -openapi/cloudevents.schema.yaml.json \ No newline at end of file diff --git a/test/_run/openapi/alarms.openapi.yaml b/test/_run/openapi/alarms.openapi.yaml deleted file mode 100644 index 6f8a937..0000000 --- a/test/_run/openapi/alarms.openapi.yaml +++ /dev/null @@ -1,1229 +0,0 @@ -openapi: 3.0.3 -info: - title: Waylay Alarms - version: 1.11.0 - description: '' -externalDocs: - url: https://docs.waylay.io/#/api/alarms/ - description: Waylay Documentation -tags: -- name: Alarms -- name: Alarm Events -- name: Alarms Batch Operations -- name: Version -paths: - /alarms/v1/alarms: - post: - operationId: create - summary: Create Alarm - description: "Create an alarm.\n\nIf an `ACTIVE` or `ACKNOWLEDGED` alarm with\ - \ the same `source.id` and `type` exists, \nno new alarm is created. \n\n\ - Instead, the existing alarm is updated by incrementing the `count` property\ - \ \nand a new audit record of type `io.waylay.alarm.EventOccuredAgain` is\ - \ added to the history. \n\nOnly the latest 1000 `io.waylay.alarm.EventOccuredAgain`\ - \ audit records are kept in the history." - tags: - - Alarms - externalDocs: - description: Waylay Docs - url: https://docs.waylay.io/#/api/alarms/?id=create-an-alarm - requestBody: - $ref: '#/components/requestBodies/AlarmsSpecification' - responses: - '200': - $ref: '#/components/responses/SuccessCreationResponse' - '400': - $ref: '#/components/responses/ErrorResponseWithDetails' - security: &id001 - - waylayApiKeySecret: [] - get: - operationId: list - summary: Query Multiple Alarms - description: 'Query multiple alarms using a query language. - - The response contains the total number of alarms that fulfill the criteria. - - - By default, returns the first 50 alarms.' - tags: - - Alarms - externalDocs: - description: Waylay Docs - url: https://docs.waylay.io/#/api/alarms/?id=query-multiple-alarms - parameters: - - name: type - in: query - schema: - type: array - items: - $ref: '#/components/schemas/AlarmType' - explode: true - description: Filter on one or more alarm types. - - name: status - in: query - schema: - type: array - items: - $ref: '#/components/schemas/AlarmStatus' - description: Filter on one or more alarm statuses. - explode: true - - name: severity - in: query - schema: - type: array - items: - $ref: '#/components/schemas/AlarmSeverity' - description: Filter on one or more alarm severities. - explode: true - - name: source - in: query - schema: - type: array - items: - type: string - explode: true - description: 'Filter on one or more source ids. - - - At least one source id is mandatory in combination with `Accept: application/vnd.waylay.alarms.timeseries+json`' - - name: dateFrom - in: query - schema: - $ref: '#/components/schemas/UnixEpochMillis' - description: Filter on alarm timestamp (equal or above). - - name: dateTo - in: query - schema: - $ref: '#/components/schemas/UnixEpochMillis' - description: Filter on alarm timestamp (equal or below). - - name: from - in: query - schema: - $ref: '#/components/schemas/UnixEpochMillis' - description: 'Only applicable in combination with `Accept: application/vnd.waylay.alarms.timeseries+json` - - - Limits the timestamp of the Alarm Audit Records to be >= `from`' - - name: to - in: query - schema: - $ref: '#/components/schemas/UnixEpochMillis' - description: 'Only applicable in combination with `Accept: application/vnd.waylay.alarms.timeseries+json` - - - Limits the timestamp of the Alarm Audit Records to be <= `to`' - - name: creationTimeFrom - in: query - schema: - $ref: '#/components/schemas/UnixEpochMillis' - description: Filter on alarm creationTime (equal or above). - - name: creationTimeTo - in: query - schema: - $ref: '#/components/schemas/UnixEpochMillis' - description: Filter on alarm creationTime (equal or below). - - name: lastUpdatedFrom - in: query - schema: - $ref: '#/components/schemas/UnixEpochMillis' - description: Filter on alarm lastUpdateTime (equal or above). - - name: lastUpdatedTo - in: query - schema: - $ref: '#/components/schemas/UnixEpochMillis' - description: Filter on alarm lastUpdateTime (equal or below). - - name: lastTriggeredFrom - in: query - schema: - $ref: '#/components/schemas/UnixEpochMillis' - description: Filter on alarm lastTriggeredTime (equal or above). - - name: lastTriggeredTo - in: query - schema: - $ref: '#/components/schemas/UnixEpochMillis' - description: Filter on alarm lastTriggeredTime (equal or below). - - name: sort - in: query - schema: - type: string - enum: - - timestamp - - lastUpdateTime - - lastTriggeredTime - default: timestamp - description: '(Pagination) field used to sort the alarms - - - Ignored in combination with `Accept: application/vnd.waylay.alarms.timeseries+json`' - - name: order - in: query - schema: - type: string - enum: - - asc - - desc - default: desc - description: '(Pagination) sort order - - - Ignored in combination with `Accept: application/vnd.waylay.alarms.timeseries+json`' - - name: page - in: query - schema: - type: integer - default: 1 - description: "(Pagination) page Number \n\nIgnored in combination with `Accept:\ - \ application/vnd.waylay.alarms.timeseries+json`" - - name: size - in: query - schema: - type: integer - default: 50 - description: '(Pagination) size of a page - - - Ignored in combination with `Accept: application/vnd.waylay.alarms.timeseries+json`' - - name: additionalQueryParams - in: query - style: form - explode: true - schema: - type: object - additionalProperties: - anyOf: - - type: number - - type: string - - type: boolean - description: "To query the alarms based on the value of an additional property\ - \ of the alarm, \nyou can add the key of the additional property as query\ - \ parameter \nwith value the value you expect the alarm to have." - example: - task: 3425 - responses: - '200': - description: Successful Response - headers: - X-Count: - description: Total number of alarms that fulfill the criteria - schema: - type: integer - content: - application/json: - schema: - $ref: '#/components/schemas/AlarmsQueryResult' - application/vnd.waylay.alarms.timeseries+json: - schema: - title: Query alarms as a timeline - externalDocs: - description: Query alarms as a timeline - url: https://docs.waylay.io/#/api/alarms/?id=query-alarms-as-a-timeline - type: array - items: - $ref: '#/components/schemas/AlarmsTimelineItem' - '400': - $ref: '#/components/responses/ErrorResponse' - security: *id001 - /alarms/v1/alarms/{alarmId}: - get: - operationId: get_alarm - summary: Get Alarm - description: Get an alarm. - tags: - - Alarms - externalDocs: - description: Waylay Docs - url: https://docs.waylay.io/#/api/alarms/?id=get-an-alarm - parameters: - - $ref: '#/components/parameters/AlarmId' - responses: - '200': - description: Alarm Fetched - content: - application/json: - schema: - $ref: '#/components/schemas/AlarmEntity' - '404': - $ref: '#/components/responses/AlarmNotFoundResponse' - security: *id001 - put: - operationId: update - summary: Update Alarm - description: Update an alarm. - tags: - - Alarms - externalDocs: - description: Waylay Docs - url: https://docs.waylay.io/#/api/alarms/?id=update-an-alarm - parameters: - - $ref: '#/components/parameters/AlarmId' - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/AlarmUpdate' - responses: - '200': - description: Alarm Updated - content: - application/json: - schema: - $ref: '#/components/schemas/AlarmEntity' - '400': - $ref: '#/components/responses/ErrorResponseWithDetails' - '404': - $ref: '#/components/responses/AlarmNotFoundResponse' - '412': - description: Precondition Failed - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - example: - statusCode: 412 - error: Alarm is in final state - security: *id001 - delete: - operationId: delete - summary: Delete Alarm - description: Delete an Alarm. - tags: - - Alarms - externalDocs: - description: Waylay Docs - url: https://docs.waylay.io/#/api/alarms/?id=deletion-of-an-alarm - parameters: - - $ref: '#/components/parameters/AlarmId' - responses: - '204': - description: Alarm Deleted - '404': - $ref: '#/components/responses/AlarmNotFoundResponse' - security: *id001 - /alarms/v1/events: - get: - operationId: get_eventstream - summary: Alarm Events - description: Opens a data stream for all Alarm Events for this tenant. - tags: - - Alarm Events - externalDocs: - description: Waylay Docs - url: https://docs.waylay.io/#/api/alarms/?id=alarm-events - parameters: - - name: eventFormat - in: query - schema: - type: string - enum: - - application/cloudevents+json - description: "The format of events in the stream. \n\nIf specified this must\ - \ be `application/cloudevents+json` (make sure to correctly URL encode the\ - \ `+` as `%2B`)" - responses: - '200': - $ref: '#/components/responses/GetEventStreamResponse' - security: *id001 - /alarms/v1/batch: - post: - operationId: start - summary: Start Alarms Batch Operation - description: Start Alarms Batch Operation. - tags: - - Alarms Batch Operations - externalDocs: - description: Waylay Docs - url: https://docs.waylay.io/#/api/alarms/?id=batch-alarm-operations - requestBody: - $ref: '#/components/requestBodies/BatchAlarmsSpecification' - responses: - '202': - $ref: '#/components/responses/BatchStartResponse' - '400': - $ref: '#/components/responses/ErrorResponseWithDetails' - security: *id001 - /alarms/v1/batch/{batchId}: - get: - operationId: get_batchoperation - summary: Get Alarms Batch Operation Status - description: Get the results of the Alarms Batch Operation. - externalDocs: - description: Waylay Docs - url: https://docs.waylay.io/#/api/alarms/?id=batch-alarm-operations - tags: - - Alarms Batch Operations - parameters: - - $ref: '#/components/parameters/BatchId' - responses: - '200': - $ref: '#/components/responses/GetBatchOperationResponse' - '404': - $ref: '#/components/responses/BatchNotFoundResponse' - security: *id001 - /alarms/v1: - get: - tags: - - Version - operationId: get_version - summary: Version - description: Get the status and version of the service. - responses: - '200': - $ref: '#/components/responses/VersionResponse' - security: *id001 -components: - schemas: - AlarmId: - title: Alarm identifier - description: Unique alarm identifier. - type: string - example: 2c49e3bf-547b-42bc-a5e9-9193155ec03d - VersionResponse: - type: object - properties: - version: - type: string - example: 2.7.0 - name: - type: string - example: alarm-service - required: - - name - - version - ErrorResponse: - type: object - properties: - statusCode: - type: integer - title: The error code - example: 400 - error: - type: string - title: The error message - example: error in body - required: - - statusCode - - error - ErrorResponseWithDetails: - allOf: - - $ref: '#/components/schemas/ErrorResponse' - - type: object - properties: - details: - type: array - minItems: 1 - items: - type: string - description: specific error message - example: '/severity <- Could not parse severity, valid values are: CRITICAL, - MAJOR, MINOR, WARNING' - AlarmType: - type: string - description: Type of the alarm. - example: io.waylay.alarm.test - AlarmText: - type: string - description: Description of the alarm. - example: Some alarm documentation - AlarmAssignee: - type: string - description: String field to indicate an assignee for the alarm. - example: operator13 - CreateAlarm: - title: create an alarm - type: object - description: To create an alarm, you need to provide the following mandatory - inputs. - properties: - type: - $ref: '#/components/schemas/AlarmType' - text: - $ref: '#/components/schemas/AlarmText' - severity: - $ref: '#/components/schemas/AlarmSeverity' - source: - $ref: '#/components/schemas/IdObject' - status: - $ref: '#/components/schemas/AlarmStatus' - timestamp: - $ref: '#/components/schemas/ISO8601TimestampOrMillis' - assignee: - $ref: '#/components/schemas/AlarmAssignee' - additionalProperties: - title: Additional properties - description: 'Any additional properties provided upon creation will be stored - in the `additionalProperties` field - - of the created alarm.' - required: - - type - - text - - severity - - source - example: - type: io.waylay.alarm.test - text: Valve test failed - severity: CRITICAL - source: - id: 733c06ed-7919-416a-9d19-8996821be70d - task: 1e294c8b-8a7d-4770-997e-2d57fc5ad6ea - myRef: 902d4191-d1ab-47ae-8405-c33bb237f1d5 - AlarmUpdate: - title: Alarm update - type: object - description: At least one field must be specified. - properties: - severity: - $ref: '#/components/schemas/AlarmSeverity' - status: - $ref: '#/components/schemas/AlarmStatus' - assignee: - allOf: - - $ref: '#/components/schemas/AlarmAssignee' - - nullable: true - BatchAlarmEntity: - type: string - enum: - - alarm - BatchAlarm: - type: object - properties: - entity: - $ref: '#/components/schemas/BatchAlarmEntity' - action: - type: string - query: - type: object - BatchDeleteAlarm: - title: Delete alarms by query or Id's - type: object - allOf: - - $ref: '#/components/schemas/BatchAlarm' - - properties: - action: - enum: - - delete - query: - oneOf: - - $ref: '#/components/schemas/BulkQueryIds' - - $ref: '#/components/schemas/BulkQueryFilter' - required: - - entity - - action - - query - BatchUpdateAlarm: - title: Update alarm - type: object - allOf: - - $ref: '#/components/schemas/BatchAlarm' - - properties: - actionParameters: - $ref: '#/components/schemas/AlarmUpdate' - action: - enum: - - update - query: - $ref: '#/components/schemas/BulkQueryIds' - required: - - entity - - action - - query - - actionParameters - BulkQueryIds: - title: Bulk Query Ids Filter - type: object - properties: - ids: - type: array - minItems: 1 - items: - $ref: '#/components/schemas/AlarmId' - required: - - ids - BulkQueryFilter: - title: Bulk Query Filter - type: object - description: 'Object specifying filters on the alarm to which the operation - will be applied. - - At least one of the filters must be set.' - properties: - type: - title: Alarm Type Filter - oneOf: - - $ref: '#/components/schemas/AlarmType' - - type: array - items: - $ref: '#/components/schemas/AlarmType' - status: - title: Alarm Status Filter - oneOf: - - $ref: '#/components/schemas/AlarmStatus' - - type: array - items: - $ref: '#/components/schemas/AlarmStatus' - severity: - title: Alarm Severity Filter - oneOf: - - $ref: '#/components/schemas/AlarmSeverity' - - type: array - items: - $ref: '#/components/schemas/AlarmSeverity' - source: - title: Alarm Source Filter - oneOf: - - type: string - - type: array - items: - type: string - dateFrom: - allOf: - - $ref: '#/components/schemas/UnixEpochMillis' - - title: Alarm timestamp filter (>=) - dateTo: - allOf: - - $ref: '#/components/schemas/UnixEpochMillis' - - title: Alarm timestamp filter (<=) - assignee: - $ref: '#/components/schemas/AlarmAssignee' - creationTimeFrom: - allOf: - - $ref: '#/components/schemas/UnixEpochMillis' - - title: Alarm creationTime filter (>=) - creationTimeTo: - allOf: - - $ref: '#/components/schemas/UnixEpochMillis' - - title: Alarm creationTime filter (<=) - lastUpdatedFrom: - allOf: - - $ref: '#/components/schemas/UnixEpochMillis' - - title: Alarm lastUpdateTime filter (>=) - lastUpdatedTo: - allOf: - - $ref: '#/components/schemas/UnixEpochMillis' - - title: Alarm lastUpdateTime filter (<=) - lastTriggeredFrom: - allOf: - - $ref: '#/components/schemas/UnixEpochMillis' - - title: Alarm lastTriggeredTime filter (>=) - lastTriggeredTo: - allOf: - - $ref: '#/components/schemas/UnixEpochMillis' - - title: Alarm lastTriggeredTime filter (<=) - ISO8601Timestamp: - title: ISO8601 timestamp - type: string - format: date-time - example: '2011-09-06T12:03:27.845Z' - ISO8601TimestampOrMillis: - title: timestamp - description: ISO8601 timestamp or unix epoch milliseconds. - oneOf: - - $ref: '#/components/schemas/UnixEpochMillis' - - $ref: '#/components/schemas/ISO8601Timestamp' - UnixEpochMillis: - type: integer - title: Unix Epoch Milliseconds - description: "Timestamp expressed as milliseconds since 00:00:00 UTC on 1 January\ - \ 1970, \nnot counting leap seconds." - example: 1663269720694 - AlarmSelfLink: - type: string - format: uri - title: Link to alarm - example: /alarms/v1/alarms/ea381b65-eb57-4dca-b510-44a9efba3cf3 - IdObject: - type: object - description: A JSON object with an id field indicating the resource. - properties: - id: - type: string - title: Resource Id - required: - - id - example: - id: '12345' - AlarmStatus: - title: Alarm Status - type: string - enum: - - ACTIVE - - ACKNOWLEDGED - - CLEARED - default: ACTIVE - AlarmSeverity: - title: Alarm Severity - type: string - enum: - - CRITICAL - - MAJOR - - MINOR - - WARNING - AlarmEntity: - type: object - title: Alarm Representation - properties: - id: - $ref: '#/components/schemas/AlarmId' - creationTime: - $ref: '#/components/schemas/ISO8601Timestamp' - lastUpdateTime: - $ref: '#/components/schemas/ISO8601Timestamp' - lastTriggeredTime: - $ref: '#/components/schemas/ISO8601Timestamp' - type: - $ref: '#/components/schemas/AlarmType' - text: - $ref: '#/components/schemas/AlarmText' - timestamp: - $ref: '#/components/schemas/ISO8601Timestamp' - source: - $ref: '#/components/schemas/IdObject' - severity: - $ref: '#/components/schemas/AlarmSeverity' - status: - $ref: '#/components/schemas/AlarmStatus' - count: - title: Event count - description: The number of times this alarm has been sent - type: integer - minimum: 1 - assignee: - $ref: '#/components/schemas/AlarmAssignee' - history: - title: History of modifications - type: array - minItems: 1 - items: - $ref: '#/components/schemas/AlarmAuditRecord' - self: - $ref: '#/components/schemas/AlarmSelfLink' - additionalProperties: - description: Additional properties that were present in the creation payload - type: object - example: - task: 1e294c8b-8a7d-4770-997e-2d57fc5ad6ea - myRef: 902d4191-d1ab-47ae-8405-c33bb237f1d5 - required: - - id - - creationTime - - lastUpdateTime - - lastTriggeredTime - - type - - text - - timestamp - - source - - severity - - status - - count - AlarmAuditRecord: - title: Audit Record - type: object - properties: - id: - type: string - example: ca0c5181-11dc-47dd-aeb3-a7a508ea1599" - type: - $ref: '#/components/schemas/AlarmEventType' - text: - type: string - description: Text describing the change - example: Alarm raised - timestamp: - allOf: - - $ref: '#/components/schemas/ISO8601Timestamp' - - description: timestamp when the change happened - required: - - id - - type - - text - - timestamp - AlarmsQueryResult: - type: object - title: Alarm Query Response - properties: - self: - type: string - format: uri - description: Link to alarm query - example: /alarms/v1/alarms?page=3 - alarms: - type: array - title: List of alarms - items: - $ref: '#/components/schemas/AlarmEntity' - total: - type: integer - description: Total number of alarms that fulfill the criteria - example: 248 - next: - type: string - format: uri - description: Link to the next page of results (if more results are available) - example: /alarms/v1/alarms?page=4 - prev: - type: string - format: uri - description: Link to the previous page of result (if previous page is available) - example: /alarms/v1/alarms?page=2 - required: - - self - - alarms - - total - AlarmTimelineInfo: - type: object - description: The alarm as it is after the event - properties: - id: - $ref: '#/components/schemas/AlarmId' - creationTime: - $ref: '#/components/schemas/ISO8601Timestamp' - timestamp: - $ref: '#/components/schemas/ISO8601Timestamp' - source: - $ref: '#/components/schemas/IdObject' - type: - $ref: '#/components/schemas/AlarmType' - text: - $ref: '#/components/schemas/AlarmText' - severity: - $ref: '#/components/schemas/AlarmSeverity' - status: - $ref: '#/components/schemas/AlarmStatus' - assignee: - $ref: '#/components/schemas/AlarmAssignee' - required: - - id - - creationTime - - timestamp - - source - - type - - text - - severity - - status - AlarmTimelineTimestamp: - description: Timestamp of the event - type: integer - title: Unix Epoch Milliseconds - example: 1663269720694 - AlarmsTimelineItem: - type: object - title: Alarm Timeline Item. - properties: - timestamp: - $ref: '#/components/schemas/AlarmTimelineTimestamp' - type: - $ref: '#/components/schemas/AlarmEventType' - alarm: - $ref: '#/components/schemas/AlarmTimelineInfo' - required: - - timestamp - - type - - alarm - AlarmEventType: - title: Alarm Event Type - type: string - oneOf: - - enum: - - io.waylay.alarm.AlarmRaised - description: A new alarm was created. - title: Alarm Creation Event Type - - enum: - - io.waylay.alarm.EventOccuredAgain - description: An alarm happened again. - title: Alarm Event Happened Again Event type - - enum: - - io.waylay.alarm.AlarmUpdated - description: An alarm was updated. - title: Alarm Update Event Type - AlarmEvent: - type: object - title: Alarm Event - properties: - eventtype: - $ref: '#/components/schemas/AlarmEventType' - eventtime: - $ref: '#/components/schemas/ISO8601Timestamp' - alarm: - $ref: '#/components/schemas/AlarmEventAlarm' - changes: - type: array - description: 'Describes the changes that where done - - - Will only be there if `eventtype` is `io.waylay.alarm.AlarmUpdated`' - items: - type: object - properties: - attribute: - type: string - example: severity - type: - type: string - description: Indication of what has changed - enum: - - io.waylay.alarm.change.severity - - io.waylay.alarm.change.status - - io.waylay.alarm.change.attribute - oldValue: - type: string - nullable: true - example: MAJOR - newValue: - type: string - nullable: true - example: CRITICAL - required: - - eventtype - - eventtime - - alarm - AlarmEventAlarm: - title: Alarm - description: Summary representation of an alarm. - type: object - properties: - id: - $ref: '#/components/schemas/AlarmId' - tenantId: - type: string - creationTime: - $ref: '#/components/schemas/ISO8601Timestamp' - type: - $ref: '#/components/schemas/AlarmType' - text: - $ref: '#/components/schemas/AlarmText' - timestamp: - $ref: '#/components/schemas/ISO8601Timestamp' - source: - $ref: '#/components/schemas/IdObject' - severity: - $ref: '#/components/schemas/AlarmSeverity' - status: - $ref: '#/components/schemas/AlarmStatus' - count: - type: integer - minimum: 1 - required: - - id - - tenantId - - creationTime - - type - - text - - timestamp - - source - - severity - - status - - count - CloudAlarmEventData: - type: object - properties: - id: - example: dd59d2d9-9657-4d36-b045-ef97315f2d20 - source: - example: /alarms/v1/alarms - subject: - type: string - example: 289dd1a3-35a7-44fa-8596-9aee3ad0b36f/2c49e3bf-547b-42bc-a5e9-9193155ec03d - type: - enum: - - io.waylay.alarms.v1.AlarmRaised - - io.waylay.alarms.v1.EventOccurredAgain - - io.waylay.alarms.v1.AlarmUpdated - data: - $ref: '#/components/schemas/AlarmEvent' - time: - $ref: '#/components/schemas/ISO8601Timestamp' - CloudAlarmEvent: - allOf: - - $ref: ./cloudevents.schema.yaml#/definitions/cloudevent_json - - $ref: '#/components/schemas/CloudAlarmEventData' - - required: - - subject - - time - example: &id002 - time: '2011-09-06T12:03:27.845Z' - type: io.waylay.alarms.v1.AlarmUpdated - subject: 289dd1a3-35a7-44fa-8596-9aee3ad0b36f/2c49e3bf-547b-42bc-a5e9-9193155ec03d - BatchId: - title: Batch Operation id - type: string - example: afcea5a1-81df-44f6-bd34-e0b602a2cf3d - BatchOperation: - title: Batch Operation - type: object - properties: - id: - $ref: '#/components/schemas/BatchId' - user: - type: string - description: User id of the user who started the operation - example: user/22f6dfdf-a50c-4eab-953e-8d2e56891dbe - operation: - type: object - description: Summary of the batch operation - properties: - entity: - $ref: '#/components/schemas/BatchAlarmEntity' - action: - type: string - enum: - - delete - - update - description: - type: string - description: Description of the operation - example: deleting 3 alarms - required: - - entity - - action - - description - queueTime: - $ref: '#/components/schemas/ISO8601Timestamp' - required: - - id - - user - - operation - - queueTime - SuccessOperationResult: - type: object - description: "Object containing the successful operation results. \nThe keys\ - \ will be alarm ids." - additionalProperties: - type: object - description: The keys will be alarm ids. - properties: - statusCode: - type: integer - description: The statusCode of the operation - required: - - statusCode - FailureOperationResult: - type: object - description: "Object containing the unsuccessful operation results. \nThe keys\ - \ will be alarm ids." - additionalProperties: - type: object - description: The keys will be alarm ids. - properties: - statusCode: - type: integer - description: The statusCode of the operation - error: - type: string - description: Error description of what went wrong. - required: - - statusCode - - error - OperationResultObject: - description: Finished Batch Operation results - type: object - properties: - finishedTime: - $ref: '#/components/schemas/ISO8601Timestamp' - results: - type: object - properties: - success: - $ref: '#/components/schemas/SuccessOperationResult' - failure: - $ref: '#/components/schemas/FailureOperationResult' - required: - - success - - failure - required: - - finishedTime - - results - BatchOperationResult: - title: Result of a finished Batch Operation - allOf: - - $ref: '#/components/schemas/BatchOperation' - - $ref: '#/components/schemas/OperationResultObject' - example: - id: afcea5a1-81df-44f6-bd34-e0b602a2cf3d - user: user/22f6dfdf-a50c-4eab-953e-8d2e56891dbe - operation: - entity: alarm - action: delete - description: deleting 3 alarms - queueTime: '2020-04-27T09:54:44.051Z' - finishedTime: '2020-04-27T09:54:44.129Z' - results: - success: - df036bf8-4b32-4bd8-8ee7-42800ab26bf5: - statusCode: 204 - failure: - 586ac2f2-fbec-426a-b696-d63d6cb153ac: - statusCode: 404, - error: alarm with id '586ac2f2-fbec-426a-b696-d63d6cb153ac' not found - e64de65c-e3ef-482d-9eb7-32ca17d1e147: - statusCode: 404, - error: alarm with id 'e64de65c-e3ef-482d-9eb7-32ca17d1e147' not found - parameters: - AlarmId: - name: alarmId - in: path - description: Unique Alarm Identifier - required: true - schema: - $ref: '#/components/schemas/AlarmId' - BatchId: - name: batchId - in: path - description: Unique Batch Operation identifier - required: true - schema: - $ref: '#/components/schemas/BatchId' - requestBodies: - AlarmsSpecification: - description: Alarm Operations - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/CreateAlarm' - BatchAlarmsSpecification: - description: Batch Alarm Operation - required: true - content: - application/json: - schema: - title: a batch alarms specification - type: object - oneOf: - - $ref: '#/components/schemas/BatchUpdateAlarm' - - $ref: '#/components/schemas/BatchDeleteAlarm' - responses: - DefaultSuccessResponse: - description: Successful Response - content: - application/json: - schema: - type: object - ErrorResponse: - description: Error Response - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - ErrorResponseWithDetails: - description: Error Response - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponseWithDetails' - VersionResponse: - description: Successful Response - content: - application/json: - schema: - $ref: '#/components/schemas/VersionResponse' - SuccessCreationResponse: - description: Successful Response - content: - application/json: - schema: - $ref: '#/components/schemas/AlarmEntity' - AlarmNotFoundResponse: - description: Alarm Not Found - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - example: - statusCode: 404 - error: alarm with id '2c49e3bf-547b-42bc-a5e9-9193155ec03d' not found - GetEventStreamResponse: - description: Alarm Events Stream - content: - application/x-ndjson: - schema: - title: NdJsonResponseStream - oneOf: - - $ref: '#/components/schemas/AlarmEvent' - - $ref: '#/components/schemas/CloudAlarmEvent' - example: *id002 - text/event-stream: - schema: - title: SSEventStream - oneOf: - - $ref: '#/components/schemas/AlarmEvent' - - $ref: '#/components/schemas/CloudAlarmEvent' - BatchStartResponse: - description: Batch Operation Started - content: - application/json: - schema: - title: Batch operation enqueued - type: object - properties: - statusCode: - type: integer - example: 202 - uri: - type: string - description: URI where the batch operation status can be followed - format: uri - example: /alarms/v1/batch/afcea5a1-81df-44f6-bd34-e0b602a2cf3d - entity: - type: object - properties: - id: - $ref: '#/components/schemas/BatchId' - queueTime: - $ref: '#/components/schemas/ISO8601Timestamp' - operation: - title: Queued operation summary - type: object - properties: - entity: - $ref: '#/components/schemas/BatchAlarmEntity' - action: - type: string - enum: - - update - - delete - required: - - entity - - action - required: - - id - - queueTime - - operation - required: - - statusCode - - uri - - entity - headers: - Location: - description: URI where the batch operation status can be followed - example: /alarms/v1/batch/afcea5a1-81df-44f6-bd34-e0b602a2cf3d - schema: - type: string - format: uri - GetBatchOperationResponse: - description: Get Batch Operation - content: - application/json: - schema: - title: BatchOperationResults - anyOf: - - $ref: '#/components/schemas/BatchOperationResult' - - $ref: '#/components/schemas/BatchOperation' - BatchNotFoundResponse: - description: Batch Operation Not Found - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - example: - statusCode: 404 - error: Operation with id 'afcea5a1-81df-44f6-bd34-e0b602a2cf3d' not found - securitySchemes: - waylayApiKeySecret: - type: http - description: Waylay apiKey/apiSecret basic authentication. All endpoints support - also Waylay JWT Bearer authentication. - scheme: basic -servers: -- url: https://api.waylay.io - description: Waylay enterprise gateway diff --git a/test/_run/openapi/alarms.openapi.yaml.json b/test/_run/openapi/alarms.openapi.yaml.json deleted file mode 100644 index d85fe62..0000000 --- a/test/_run/openapi/alarms.openapi.yaml.json +++ /dev/null @@ -1,1862 +0,0 @@ -{ - "openapi": "3.0.3", - "info": { - "title": "Waylay Alarms", - "version": "1.11.0", - "description": "" - }, - "externalDocs": { - "url": "https://docs.waylay.io/#/api/alarms/", - "description": "Waylay Documentation" - }, - "tags": [ - { - "name": "Alarms" - }, - { - "name": "Alarm Events" - }, - { - "name": "Alarms Batch Operations" - }, - { - "name": "Version" - } - ], - "paths": { - "/alarms/v1/alarms": { - "post": { - "operationId": "create", - "summary": "Create Alarm", - "description": "Create an alarm.\n\nIf an `ACTIVE` or `ACKNOWLEDGED` alarm with the same `source.id` and `type` exists, \nno new alarm is created. \n\nInstead, the existing alarm is updated by incrementing the `count` property \nand a new audit record of type `io.waylay.alarm.EventOccuredAgain` is added to the history. \n\nOnly the latest 1000 `io.waylay.alarm.EventOccuredAgain` audit records are kept in the history.", - "tags": [ - "Alarms" - ], - "externalDocs": { - "description": "Waylay Docs", - "url": "https://docs.waylay.io/#/api/alarms/?id=create-an-alarm" - }, - "requestBody": { - "$ref": "#/components/requestBodies/AlarmsSpecification" - }, - "responses": { - "200": { - "$ref": "#/components/responses/SuccessCreationResponse" - }, - "400": { - "$ref": "#/components/responses/ErrorResponseWithDetails" - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ] - }, - "get": { - "operationId": "list", - "summary": "Query Multiple Alarms", - "description": "Query multiple alarms using a query language.\nThe response contains the total number of alarms that fulfill the criteria.\n\nBy default, returns the first 50 alarms.", - "tags": [ - "Alarms" - ], - "externalDocs": { - "description": "Waylay Docs", - "url": "https://docs.waylay.io/#/api/alarms/?id=query-multiple-alarms" - }, - "parameters": [ - { - "name": "type", - "in": "query", - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/AlarmType" - } - }, - "explode": true, - "description": "Filter on one or more alarm types." - }, - { - "name": "status", - "in": "query", - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/AlarmStatus" - } - }, - "description": "Filter on one or more alarm statuses.", - "explode": true - }, - { - "name": "severity", - "in": "query", - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/AlarmSeverity" - } - }, - "description": "Filter on one or more alarm severities.", - "explode": true - }, - { - "name": "source", - "in": "query", - "schema": { - "type": "array", - "items": { - "type": "string" - } - }, - "explode": true, - "description": "Filter on one or more source ids.\n\nAt least one source id is mandatory in combination with `Accept: application/vnd.waylay.alarms.timeseries+json`" - }, - { - "name": "dateFrom", - "in": "query", - "schema": { - "$ref": "#/components/schemas/UnixEpochMillis" - }, - "description": "Filter on alarm timestamp (equal or above)." - }, - { - "name": "dateTo", - "in": "query", - "schema": { - "$ref": "#/components/schemas/UnixEpochMillis" - }, - "description": "Filter on alarm timestamp (equal or below)." - }, - { - "name": "from", - "in": "query", - "schema": { - "$ref": "#/components/schemas/UnixEpochMillis" - }, - "description": "Only applicable in combination with `Accept: application/vnd.waylay.alarms.timeseries+json`\n\nLimits the timestamp of the Alarm Audit Records to be >= `from`" - }, - { - "name": "to", - "in": "query", - "schema": { - "$ref": "#/components/schemas/UnixEpochMillis" - }, - "description": "Only applicable in combination with `Accept: application/vnd.waylay.alarms.timeseries+json`\n\nLimits the timestamp of the Alarm Audit Records to be <= `to`" - }, - { - "name": "creationTimeFrom", - "in": "query", - "schema": { - "$ref": "#/components/schemas/UnixEpochMillis" - }, - "description": "Filter on alarm creationTime (equal or above)." - }, - { - "name": "creationTimeTo", - "in": "query", - "schema": { - "$ref": "#/components/schemas/UnixEpochMillis" - }, - "description": "Filter on alarm creationTime (equal or below)." - }, - { - "name": "lastUpdatedFrom", - "in": "query", - "schema": { - "$ref": "#/components/schemas/UnixEpochMillis" - }, - "description": "Filter on alarm lastUpdateTime (equal or above)." - }, - { - "name": "lastUpdatedTo", - "in": "query", - "schema": { - "$ref": "#/components/schemas/UnixEpochMillis" - }, - "description": "Filter on alarm lastUpdateTime (equal or below)." - }, - { - "name": "lastTriggeredFrom", - "in": "query", - "schema": { - "$ref": "#/components/schemas/UnixEpochMillis" - }, - "description": "Filter on alarm lastTriggeredTime (equal or above)." - }, - { - "name": "lastTriggeredTo", - "in": "query", - "schema": { - "$ref": "#/components/schemas/UnixEpochMillis" - }, - "description": "Filter on alarm lastTriggeredTime (equal or below)." - }, - { - "name": "sort", - "in": "query", - "schema": { - "type": "string", - "enum": [ - "timestamp", - "lastUpdateTime", - "lastTriggeredTime" - ], - "default": "timestamp" - }, - "description": "(Pagination) field used to sort the alarms\n\nIgnored in combination with `Accept: application/vnd.waylay.alarms.timeseries+json`" - }, - { - "name": "order", - "in": "query", - "schema": { - "type": "string", - "enum": [ - "asc", - "desc" - ], - "default": "desc" - }, - "description": "(Pagination) sort order\n\nIgnored in combination with `Accept: application/vnd.waylay.alarms.timeseries+json`" - }, - { - "name": "page", - "in": "query", - "schema": { - "type": "integer", - "default": 1 - }, - "description": "(Pagination) page Number \n\nIgnored in combination with `Accept: application/vnd.waylay.alarms.timeseries+json`" - }, - { - "name": "size", - "in": "query", - "schema": { - "type": "integer", - "default": 50 - }, - "description": "(Pagination) size of a page\n\nIgnored in combination with `Accept: application/vnd.waylay.alarms.timeseries+json`" - }, - { - "name": "additionalQueryParams", - "in": "query", - "style": "form", - "explode": true, - "schema": { - "type": "object", - "additionalProperties": { - "anyOf": [ - { - "type": "number" - }, - { - "type": "string" - }, - { - "type": "boolean" - } - ] - } - }, - "description": "To query the alarms based on the value of an additional property of the alarm, \nyou can add the key of the additional property as query parameter \nwith value the value you expect the alarm to have.", - "example": { - "task": 3425 - } - } - ], - "responses": { - "200": { - "description": "Successful Response", - "headers": { - "X-Count": { - "description": "Total number of alarms that fulfill the criteria", - "schema": { - "type": "integer" - } - } - }, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AlarmsQueryResult" - } - }, - "application/vnd.waylay.alarms.timeseries+json": { - "schema": { - "title": "Query alarms as a timeline", - "externalDocs": { - "description": "Query alarms as a timeline", - "url": "https://docs.waylay.io/#/api/alarms/?id=query-alarms-as-a-timeline" - }, - "type": "array", - "items": { - "$ref": "#/components/schemas/AlarmsTimelineItem" - } - } - } - } - }, - "400": { - "$ref": "#/components/responses/ErrorResponse" - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ] - } - }, - "/alarms/v1/alarms/{alarmId}": { - "get": { - "operationId": "get_alarm", - "summary": "Get Alarm", - "description": "Get an alarm.", - "tags": [ - "Alarms" - ], - "externalDocs": { - "description": "Waylay Docs", - "url": "https://docs.waylay.io/#/api/alarms/?id=get-an-alarm" - }, - "parameters": [ - { - "$ref": "#/components/parameters/AlarmId" - } - ], - "responses": { - "200": { - "description": "Alarm Fetched", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AlarmEntity" - } - } - } - }, - "404": { - "$ref": "#/components/responses/AlarmNotFoundResponse" - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ] - }, - "put": { - "operationId": "update", - "summary": "Update Alarm", - "description": "Update an alarm.", - "tags": [ - "Alarms" - ], - "externalDocs": { - "description": "Waylay Docs", - "url": "https://docs.waylay.io/#/api/alarms/?id=update-an-alarm" - }, - "parameters": [ - { - "$ref": "#/components/parameters/AlarmId" - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AlarmUpdate" - } - } - } - }, - "responses": { - "200": { - "description": "Alarm Updated", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AlarmEntity" - } - } - } - }, - "400": { - "$ref": "#/components/responses/ErrorResponseWithDetails" - }, - "404": { - "$ref": "#/components/responses/AlarmNotFoundResponse" - }, - "412": { - "description": "Precondition Failed", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - }, - "example": { - "statusCode": 412, - "error": "Alarm is in final state" - } - } - } - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ] - }, - "delete": { - "operationId": "delete", - "summary": "Delete Alarm", - "description": "Delete an Alarm.", - "tags": [ - "Alarms" - ], - "externalDocs": { - "description": "Waylay Docs", - "url": "https://docs.waylay.io/#/api/alarms/?id=deletion-of-an-alarm" - }, - "parameters": [ - { - "$ref": "#/components/parameters/AlarmId" - } - ], - "responses": { - "204": { - "description": "Alarm Deleted" - }, - "404": { - "$ref": "#/components/responses/AlarmNotFoundResponse" - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ] - } - }, - "/alarms/v1/events": { - "get": { - "operationId": "get_eventstream", - "summary": "Alarm Events", - "description": "Opens a data stream for all Alarm Events for this tenant.", - "tags": [ - "Alarm Events" - ], - "externalDocs": { - "description": "Waylay Docs", - "url": "https://docs.waylay.io/#/api/alarms/?id=alarm-events" - }, - "parameters": [ - { - "name": "eventFormat", - "in": "query", - "schema": { - "type": "string", - "enum": [ - "application/cloudevents+json" - ] - }, - "description": "The format of events in the stream. \n\nIf specified this must be `application/cloudevents+json` (make sure to correctly URL encode the `+` as `%2B`)" - } - ], - "responses": { - "200": { - "$ref": "#/components/responses/GetEventStreamResponse" - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ] - } - }, - "/alarms/v1/batch": { - "post": { - "operationId": "start", - "summary": "Start Alarms Batch Operation", - "description": "Start Alarms Batch Operation.", - "tags": [ - "Alarms Batch Operations" - ], - "externalDocs": { - "description": "Waylay Docs", - "url": "https://docs.waylay.io/#/api/alarms/?id=batch-alarm-operations" - }, - "requestBody": { - "$ref": "#/components/requestBodies/BatchAlarmsSpecification" - }, - "responses": { - "202": { - "$ref": "#/components/responses/BatchStartResponse" - }, - "400": { - "$ref": "#/components/responses/ErrorResponseWithDetails" - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ] - } - }, - "/alarms/v1/batch/{batchId}": { - "get": { - "operationId": "get_batchoperation", - "summary": "Get Alarms Batch Operation Status", - "description": "Get the results of the Alarms Batch Operation.", - "externalDocs": { - "description": "Waylay Docs", - "url": "https://docs.waylay.io/#/api/alarms/?id=batch-alarm-operations" - }, - "tags": [ - "Alarms Batch Operations" - ], - "parameters": [ - { - "$ref": "#/components/parameters/BatchId" - } - ], - "responses": { - "200": { - "$ref": "#/components/responses/GetBatchOperationResponse" - }, - "404": { - "$ref": "#/components/responses/BatchNotFoundResponse" - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ] - } - }, - "/alarms/v1": { - "get": { - "tags": [ - "Version" - ], - "operationId": "get_version", - "summary": "Version", - "description": "Get the status and version of the service.", - "responses": { - "200": { - "$ref": "#/components/responses/VersionResponse" - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ] - } - } - }, - "components": { - "schemas": { - "AlarmId": { - "title": "Alarm identifier", - "description": "Unique alarm identifier.", - "type": "string", - "example": "2c49e3bf-547b-42bc-a5e9-9193155ec03d" - }, - "VersionResponse": { - "type": "object", - "properties": { - "version": { - "type": "string", - "example": "2.7.0" - }, - "name": { - "type": "string", - "example": "alarm-service" - } - }, - "required": [ - "name", - "version" - ] - }, - "ErrorResponse": { - "type": "object", - "properties": { - "statusCode": { - "type": "integer", - "title": "The error code", - "example": 400 - }, - "error": { - "type": "string", - "title": "The error message", - "example": "error in body" - } - }, - "required": [ - "statusCode", - "error" - ] - }, - "ErrorResponseWithDetails": { - "allOf": [ - { - "$ref": "#/components/schemas/ErrorResponse" - }, - { - "type": "object", - "properties": { - "details": { - "type": "array", - "minItems": 1, - "items": { - "type": "string", - "description": "specific error message", - "example": "/severity <- Could not parse severity, valid values are: CRITICAL, MAJOR, MINOR, WARNING" - } - } - } - } - ] - }, - "AlarmType": { - "type": "string", - "description": "Type of the alarm.", - "example": "io.waylay.alarm.test" - }, - "AlarmText": { - "type": "string", - "description": "Description of the alarm.", - "example": "Some alarm documentation" - }, - "AlarmAssignee": { - "type": "string", - "description": "String field to indicate an assignee for the alarm.", - "example": "operator13" - }, - "CreateAlarm": { - "title": "create an alarm", - "type": "object", - "description": "To create an alarm, you need to provide the following mandatory inputs.", - "properties": { - "type": { - "$ref": "#/components/schemas/AlarmType" - }, - "text": { - "$ref": "#/components/schemas/AlarmText" - }, - "severity": { - "$ref": "#/components/schemas/AlarmSeverity" - }, - "source": { - "$ref": "#/components/schemas/IdObject" - }, - "status": { - "$ref": "#/components/schemas/AlarmStatus" - }, - "timestamp": { - "$ref": "#/components/schemas/ISO8601TimestampOrMillis" - }, - "assignee": { - "$ref": "#/components/schemas/AlarmAssignee" - } - }, - "additionalProperties": { - "title": "Additional properties", - "description": "Any additional properties provided upon creation will be stored in the `additionalProperties` field\nof the created alarm." - }, - "required": [ - "type", - "text", - "severity", - "source" - ], - "example": { - "type": "io.waylay.alarm.test", - "text": "Valve test failed", - "severity": "CRITICAL", - "source": { - "id": "733c06ed-7919-416a-9d19-8996821be70d" - }, - "task": "1e294c8b-8a7d-4770-997e-2d57fc5ad6ea", - "myRef": "902d4191-d1ab-47ae-8405-c33bb237f1d5" - } - }, - "AlarmUpdate": { - "title": "Alarm update", - "type": "object", - "description": "At least one field must be specified.", - "properties": { - "severity": { - "$ref": "#/components/schemas/AlarmSeverity" - }, - "status": { - "$ref": "#/components/schemas/AlarmStatus" - }, - "assignee": { - "allOf": [ - { - "$ref": "#/components/schemas/AlarmAssignee" - }, - { - "nullable": true - } - ] - } - } - }, - "BatchAlarmEntity": { - "type": "string", - "enum": [ - "alarm" - ] - }, - "BatchAlarm": { - "type": "object", - "properties": { - "entity": { - "$ref": "#/components/schemas/BatchAlarmEntity" - }, - "action": { - "type": "string" - }, - "query": { - "type": "object" - } - } - }, - "BatchDeleteAlarm": { - "title": "Delete alarms by query or Id's", - "type": "object", - "allOf": [ - { - "$ref": "#/components/schemas/BatchAlarm" - }, - { - "properties": { - "action": { - "enum": [ - "delete" - ] - }, - "query": { - "oneOf": [ - { - "$ref": "#/components/schemas/BulkQueryIds" - }, - { - "$ref": "#/components/schemas/BulkQueryFilter" - } - ] - } - } - } - ], - "required": [ - "entity", - "action", - "query" - ] - }, - "BatchUpdateAlarm": { - "title": "Update alarm", - "type": "object", - "allOf": [ - { - "$ref": "#/components/schemas/BatchAlarm" - }, - { - "properties": { - "actionParameters": { - "$ref": "#/components/schemas/AlarmUpdate" - }, - "action": { - "enum": [ - "update" - ] - }, - "query": { - "$ref": "#/components/schemas/BulkQueryIds" - } - } - } - ], - "required": [ - "entity", - "action", - "query", - "actionParameters" - ] - }, - "BulkQueryIds": { - "title": "Bulk Query Ids Filter", - "type": "object", - "properties": { - "ids": { - "type": "array", - "minItems": 1, - "items": { - "$ref": "#/components/schemas/AlarmId" - } - } - }, - "required": [ - "ids" - ] - }, - "BulkQueryFilter": { - "title": "Bulk Query Filter", - "type": "object", - "description": "Object specifying filters on the alarm to which the operation will be applied.\nAt least one of the filters must be set.", - "properties": { - "type": { - "title": "Alarm Type Filter", - "oneOf": [ - { - "$ref": "#/components/schemas/AlarmType" - }, - { - "type": "array", - "items": { - "$ref": "#/components/schemas/AlarmType" - } - } - ] - }, - "status": { - "title": "Alarm Status Filter", - "oneOf": [ - { - "$ref": "#/components/schemas/AlarmStatus" - }, - { - "type": "array", - "items": { - "$ref": "#/components/schemas/AlarmStatus" - } - } - ] - }, - "severity": { - "title": "Alarm Severity Filter", - "oneOf": [ - { - "$ref": "#/components/schemas/AlarmSeverity" - }, - { - "type": "array", - "items": { - "$ref": "#/components/schemas/AlarmSeverity" - } - } - ] - }, - "source": { - "title": "Alarm Source Filter", - "oneOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "type": "string" - } - } - ] - }, - "dateFrom": { - "allOf": [ - { - "$ref": "#/components/schemas/UnixEpochMillis" - }, - { - "title": "Alarm timestamp filter (>=)" - } - ] - }, - "dateTo": { - "allOf": [ - { - "$ref": "#/components/schemas/UnixEpochMillis" - }, - { - "title": "Alarm timestamp filter (<=)" - } - ] - }, - "assignee": { - "$ref": "#/components/schemas/AlarmAssignee" - }, - "creationTimeFrom": { - "allOf": [ - { - "$ref": "#/components/schemas/UnixEpochMillis" - }, - { - "title": "Alarm creationTime filter (>=)" - } - ] - }, - "creationTimeTo": { - "allOf": [ - { - "$ref": "#/components/schemas/UnixEpochMillis" - }, - { - "title": "Alarm creationTime filter (<=)" - } - ] - }, - "lastUpdatedFrom": { - "allOf": [ - { - "$ref": "#/components/schemas/UnixEpochMillis" - }, - { - "title": "Alarm lastUpdateTime filter (>=)" - } - ] - }, - "lastUpdatedTo": { - "allOf": [ - { - "$ref": "#/components/schemas/UnixEpochMillis" - }, - { - "title": "Alarm lastUpdateTime filter (<=)" - } - ] - }, - "lastTriggeredFrom": { - "allOf": [ - { - "$ref": "#/components/schemas/UnixEpochMillis" - }, - { - "title": "Alarm lastTriggeredTime filter (>=)" - } - ] - }, - "lastTriggeredTo": { - "allOf": [ - { - "$ref": "#/components/schemas/UnixEpochMillis" - }, - { - "title": "Alarm lastTriggeredTime filter (<=)" - } - ] - } - } - }, - "ISO8601Timestamp": { - "title": "ISO8601 timestamp", - "type": "string", - "format": "date-time", - "example": "2011-09-06T12:03:27.845Z" - }, - "ISO8601TimestampOrMillis": { - "title": "timestamp", - "description": "ISO8601 timestamp or unix epoch milliseconds.", - "oneOf": [ - { - "$ref": "#/components/schemas/UnixEpochMillis" - }, - { - "$ref": "#/components/schemas/ISO8601Timestamp" - } - ] - }, - "UnixEpochMillis": { - "type": "integer", - "title": "Unix Epoch Milliseconds", - "description": "Timestamp expressed as milliseconds since 00:00:00 UTC on 1 January 1970, \nnot counting leap seconds.", - "example": 1663269720694 - }, - "AlarmSelfLink": { - "type": "string", - "format": "uri", - "title": "Link to alarm", - "example": "/alarms/v1/alarms/ea381b65-eb57-4dca-b510-44a9efba3cf3" - }, - "IdObject": { - "type": "object", - "description": "A JSON object with an id field indicating the resource.", - "properties": { - "id": { - "type": "string", - "title": "Resource Id" - } - }, - "required": [ - "id" - ], - "example": { - "id": "12345" - } - }, - "AlarmStatus": { - "title": "Alarm Status", - "type": "string", - "enum": [ - "ACTIVE", - "ACKNOWLEDGED", - "CLEARED" - ], - "default": "ACTIVE" - }, - "AlarmSeverity": { - "title": "Alarm Severity", - "type": "string", - "enum": [ - "CRITICAL", - "MAJOR", - "MINOR", - "WARNING" - ] - }, - "AlarmEntity": { - "type": "object", - "title": "Alarm Representation", - "properties": { - "id": { - "$ref": "#/components/schemas/AlarmId" - }, - "creationTime": { - "$ref": "#/components/schemas/ISO8601Timestamp" - }, - "lastUpdateTime": { - "$ref": "#/components/schemas/ISO8601Timestamp" - }, - "lastTriggeredTime": { - "$ref": "#/components/schemas/ISO8601Timestamp" - }, - "type": { - "$ref": "#/components/schemas/AlarmType" - }, - "text": { - "$ref": "#/components/schemas/AlarmText" - }, - "timestamp": { - "$ref": "#/components/schemas/ISO8601Timestamp" - }, - "source": { - "$ref": "#/components/schemas/IdObject" - }, - "severity": { - "$ref": "#/components/schemas/AlarmSeverity" - }, - "status": { - "$ref": "#/components/schemas/AlarmStatus" - }, - "count": { - "title": "Event count", - "description": "The number of times this alarm has been sent", - "type": "integer", - "minimum": 1 - }, - "assignee": { - "$ref": "#/components/schemas/AlarmAssignee" - }, - "history": { - "title": "History of modifications", - "type": "array", - "minItems": 1, - "items": { - "$ref": "#/components/schemas/AlarmAuditRecord" - } - }, - "self": { - "$ref": "#/components/schemas/AlarmSelfLink" - }, - "additionalProperties": { - "description": "Additional properties that were present in the creation payload", - "type": "object", - "example": { - "task": "1e294c8b-8a7d-4770-997e-2d57fc5ad6ea", - "myRef": "902d4191-d1ab-47ae-8405-c33bb237f1d5" - } - } - }, - "required": [ - "id", - "creationTime", - "lastUpdateTime", - "lastTriggeredTime", - "type", - "text", - "timestamp", - "source", - "severity", - "status", - "count" - ] - }, - "AlarmAuditRecord": { - "title": "Audit Record", - "type": "object", - "properties": { - "id": { - "type": "string", - "example": "ca0c5181-11dc-47dd-aeb3-a7a508ea1599\"" - }, - "type": { - "$ref": "#/components/schemas/AlarmEventType" - }, - "text": { - "type": "string", - "description": "Text describing the change", - "example": "Alarm raised" - }, - "timestamp": { - "allOf": [ - { - "$ref": "#/components/schemas/ISO8601Timestamp" - }, - { - "description": "timestamp when the change happened" - } - ] - } - }, - "required": [ - "id", - "type", - "text", - "timestamp" - ] - }, - "AlarmsQueryResult": { - "type": "object", - "title": "Alarm Query Response", - "properties": { - "self": { - "type": "string", - "format": "uri", - "description": "Link to alarm query", - "example": "/alarms/v1/alarms?page=3" - }, - "alarms": { - "type": "array", - "title": "List of alarms", - "items": { - "$ref": "#/components/schemas/AlarmEntity" - } - }, - "total": { - "type": "integer", - "description": "Total number of alarms that fulfill the criteria", - "example": 248 - }, - "next": { - "type": "string", - "format": "uri", - "description": "Link to the next page of results (if more results are available)", - "example": "/alarms/v1/alarms?page=4" - }, - "prev": { - "type": "string", - "format": "uri", - "description": "Link to the previous page of result (if previous page is available)", - "example": "/alarms/v1/alarms?page=2" - } - }, - "required": [ - "self", - "alarms", - "total" - ] - }, - "AlarmTimelineInfo": { - "type": "object", - "description": "The alarm as it is after the event", - "properties": { - "id": { - "$ref": "#/components/schemas/AlarmId" - }, - "creationTime": { - "$ref": "#/components/schemas/ISO8601Timestamp" - }, - "timestamp": { - "$ref": "#/components/schemas/ISO8601Timestamp" - }, - "source": { - "$ref": "#/components/schemas/IdObject" - }, - "type": { - "$ref": "#/components/schemas/AlarmType" - }, - "text": { - "$ref": "#/components/schemas/AlarmText" - }, - "severity": { - "$ref": "#/components/schemas/AlarmSeverity" - }, - "status": { - "$ref": "#/components/schemas/AlarmStatus" - }, - "assignee": { - "$ref": "#/components/schemas/AlarmAssignee" - } - }, - "required": [ - "id", - "creationTime", - "timestamp", - "source", - "type", - "text", - "severity", - "status" - ] - }, - "AlarmTimelineTimestamp": { - "description": "Timestamp of the event", - "type": "integer", - "title": "Unix Epoch Milliseconds", - "example": 1663269720694 - }, - "AlarmsTimelineItem": { - "type": "object", - "title": "Alarm Timeline Item.", - "properties": { - "timestamp": { - "$ref": "#/components/schemas/AlarmTimelineTimestamp" - }, - "type": { - "$ref": "#/components/schemas/AlarmEventType" - }, - "alarm": { - "$ref": "#/components/schemas/AlarmTimelineInfo" - } - }, - "required": [ - "timestamp", - "type", - "alarm" - ] - }, - "AlarmEventType": { - "title": "Alarm Event Type", - "type": "string", - "oneOf": [ - { - "enum": [ - "io.waylay.alarm.AlarmRaised" - ], - "description": "A new alarm was created.", - "title": "Alarm Creation Event Type" - }, - { - "enum": [ - "io.waylay.alarm.EventOccuredAgain" - ], - "description": "An alarm happened again.", - "title": "Alarm Event Happened Again Event type" - }, - { - "enum": [ - "io.waylay.alarm.AlarmUpdated" - ], - "description": "An alarm was updated.", - "title": "Alarm Update Event Type" - } - ] - }, - "AlarmEvent": { - "type": "object", - "title": "Alarm Event", - "properties": { - "eventtype": { - "$ref": "#/components/schemas/AlarmEventType" - }, - "eventtime": { - "$ref": "#/components/schemas/ISO8601Timestamp" - }, - "alarm": { - "$ref": "#/components/schemas/AlarmEventAlarm" - }, - "changes": { - "type": "array", - "description": "Describes the changes that where done\n\nWill only be there if `eventtype` is `io.waylay.alarm.AlarmUpdated`", - "items": { - "type": "object", - "properties": { - "attribute": { - "type": "string", - "example": "severity" - }, - "type": { - "type": "string", - "description": "Indication of what has changed", - "enum": [ - "io.waylay.alarm.change.severity", - "io.waylay.alarm.change.status", - "io.waylay.alarm.change.attribute" - ] - }, - "oldValue": { - "type": "string", - "nullable": true, - "example": "MAJOR" - }, - "newValue": { - "type": "string", - "nullable": true, - "example": "CRITICAL" - } - } - } - } - }, - "required": [ - "eventtype", - "eventtime", - "alarm" - ] - }, - "AlarmEventAlarm": { - "title": "Alarm", - "description": "Summary representation of an alarm.", - "type": "object", - "properties": { - "id": { - "$ref": "#/components/schemas/AlarmId" - }, - "tenantId": { - "type": "string" - }, - "creationTime": { - "$ref": "#/components/schemas/ISO8601Timestamp" - }, - "type": { - "$ref": "#/components/schemas/AlarmType" - }, - "text": { - "$ref": "#/components/schemas/AlarmText" - }, - "timestamp": { - "$ref": "#/components/schemas/ISO8601Timestamp" - }, - "source": { - "$ref": "#/components/schemas/IdObject" - }, - "severity": { - "$ref": "#/components/schemas/AlarmSeverity" - }, - "status": { - "$ref": "#/components/schemas/AlarmStatus" - }, - "count": { - "type": "integer", - "minimum": 1 - } - }, - "required": [ - "id", - "tenantId", - "creationTime", - "type", - "text", - "timestamp", - "source", - "severity", - "status", - "count" - ] - }, - "CloudAlarmEventData": { - "type": "object", - "properties": { - "id": { - "example": "dd59d2d9-9657-4d36-b045-ef97315f2d20" - }, - "source": { - "example": "/alarms/v1/alarms" - }, - "subject": { - "type": "string", - "example": "289dd1a3-35a7-44fa-8596-9aee3ad0b36f/2c49e3bf-547b-42bc-a5e9-9193155ec03d" - }, - "type": { - "enum": [ - "io.waylay.alarms.v1.AlarmRaised", - "io.waylay.alarms.v1.EventOccurredAgain", - "io.waylay.alarms.v1.AlarmUpdated" - ] - }, - "data": { - "$ref": "#/components/schemas/AlarmEvent" - }, - "time": { - "$ref": "#/components/schemas/ISO8601Timestamp" - } - } - }, - "CloudAlarmEvent": { - "allOf": [ - { - "$ref": "./cloudevents.schema.yaml#/definitions/cloudevent_json" - }, - { - "$ref": "#/components/schemas/CloudAlarmEventData" - }, - { - "required": [ - "subject", - "time" - ] - } - ], - "example": { - "time": "2011-09-06T12:03:27.845Z", - "type": "io.waylay.alarms.v1.AlarmUpdated", - "subject": "289dd1a3-35a7-44fa-8596-9aee3ad0b36f/2c49e3bf-547b-42bc-a5e9-9193155ec03d" - } - }, - "BatchId": { - "title": "Batch Operation id", - "type": "string", - "example": "afcea5a1-81df-44f6-bd34-e0b602a2cf3d" - }, - "BatchOperation": { - "title": "Batch Operation", - "type": "object", - "properties": { - "id": { - "$ref": "#/components/schemas/BatchId" - }, - "user": { - "type": "string", - "description": "User id of the user who started the operation", - "example": "user/22f6dfdf-a50c-4eab-953e-8d2e56891dbe" - }, - "operation": { - "type": "object", - "description": "Summary of the batch operation", - "properties": { - "entity": { - "$ref": "#/components/schemas/BatchAlarmEntity" - }, - "action": { - "type": "string", - "enum": [ - "delete", - "update" - ] - }, - "description": { - "type": "string", - "description": "Description of the operation", - "example": "deleting 3 alarms" - } - }, - "required": [ - "entity", - "action", - "description" - ] - }, - "queueTime": { - "$ref": "#/components/schemas/ISO8601Timestamp" - } - }, - "required": [ - "id", - "user", - "operation", - "queueTime" - ] - }, - "SuccessOperationResult": { - "type": "object", - "description": "Object containing the successful operation results. \nThe keys will be alarm ids.", - "additionalProperties": { - "type": "object", - "description": "The keys will be alarm ids.", - "properties": { - "statusCode": { - "type": "integer", - "description": "The statusCode of the operation" - } - }, - "required": [ - "statusCode" - ] - } - }, - "FailureOperationResult": { - "type": "object", - "description": "Object containing the unsuccessful operation results. \nThe keys will be alarm ids.", - "additionalProperties": { - "type": "object", - "description": "The keys will be alarm ids.", - "properties": { - "statusCode": { - "type": "integer", - "description": "The statusCode of the operation" - }, - "error": { - "type": "string", - "description": "Error description of what went wrong." - } - }, - "required": [ - "statusCode", - "error" - ] - } - }, - "OperationResultObject": { - "description": "Finished Batch Operation results", - "type": "object", - "properties": { - "finishedTime": { - "$ref": "#/components/schemas/ISO8601Timestamp" - }, - "results": { - "type": "object", - "properties": { - "success": { - "$ref": "#/components/schemas/SuccessOperationResult" - }, - "failure": { - "$ref": "#/components/schemas/FailureOperationResult" - } - }, - "required": [ - "success", - "failure" - ] - } - }, - "required": [ - "finishedTime", - "results" - ] - }, - "BatchOperationResult": { - "title": "Result of a finished Batch Operation", - "allOf": [ - { - "$ref": "#/components/schemas/BatchOperation" - }, - { - "$ref": "#/components/schemas/OperationResultObject" - } - ], - "example": { - "id": "afcea5a1-81df-44f6-bd34-e0b602a2cf3d", - "user": "user/22f6dfdf-a50c-4eab-953e-8d2e56891dbe", - "operation": { - "entity": "alarm", - "action": "delete", - "description": "deleting 3 alarms" - }, - "queueTime": "2020-04-27T09:54:44.051Z", - "finishedTime": "2020-04-27T09:54:44.129Z", - "results": { - "success": { - "df036bf8-4b32-4bd8-8ee7-42800ab26bf5": { - "statusCode": 204 - } - }, - "failure": { - "586ac2f2-fbec-426a-b696-d63d6cb153ac": { - "statusCode": "404,", - "error": "alarm with id '586ac2f2-fbec-426a-b696-d63d6cb153ac' not found" - }, - "e64de65c-e3ef-482d-9eb7-32ca17d1e147": { - "statusCode": "404,", - "error": "alarm with id 'e64de65c-e3ef-482d-9eb7-32ca17d1e147' not found" - } - } - } - } - } - }, - "parameters": { - "AlarmId": { - "name": "alarmId", - "in": "path", - "description": "Unique Alarm Identifier", - "required": true, - "schema": { - "$ref": "#/components/schemas/AlarmId" - } - }, - "BatchId": { - "name": "batchId", - "in": "path", - "description": "Unique Batch Operation identifier", - "required": true, - "schema": { - "$ref": "#/components/schemas/BatchId" - } - } - }, - "requestBodies": { - "AlarmsSpecification": { - "description": "Alarm Operations", - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateAlarm" - } - } - } - }, - "BatchAlarmsSpecification": { - "description": "Batch Alarm Operation", - "required": true, - "content": { - "application/json": { - "schema": { - "title": "a batch alarms specification", - "type": "object", - "oneOf": [ - { - "$ref": "#/components/schemas/BatchUpdateAlarm" - }, - { - "$ref": "#/components/schemas/BatchDeleteAlarm" - } - ] - } - } - } - } - }, - "responses": { - "DefaultSuccessResponse": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "type": "object" - } - } - } - }, - "ErrorResponse": { - "description": "Error Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "ErrorResponseWithDetails": { - "description": "Error Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponseWithDetails" - } - } - } - }, - "VersionResponse": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/VersionResponse" - } - } - } - }, - "SuccessCreationResponse": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AlarmEntity" - } - } - } - }, - "AlarmNotFoundResponse": { - "description": "Alarm Not Found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - }, - "example": { - "statusCode": 404, - "error": "alarm with id '2c49e3bf-547b-42bc-a5e9-9193155ec03d' not found" - } - } - } - }, - "GetEventStreamResponse": { - "description": "Alarm Events Stream", - "content": { - "application/x-ndjson": { - "schema": { - "title": "NdJsonResponseStream", - "oneOf": [ - { - "$ref": "#/components/schemas/AlarmEvent" - }, - { - "$ref": "#/components/schemas/CloudAlarmEvent" - } - ], - "example": { - "time": "2011-09-06T12:03:27.845Z", - "type": "io.waylay.alarms.v1.AlarmUpdated", - "subject": "289dd1a3-35a7-44fa-8596-9aee3ad0b36f/2c49e3bf-547b-42bc-a5e9-9193155ec03d" - } - } - }, - "text/event-stream": { - "schema": { - "title": "SSEventStream", - "oneOf": [ - { - "$ref": "#/components/schemas/AlarmEvent" - }, - { - "$ref": "#/components/schemas/CloudAlarmEvent" - } - ] - } - } - } - }, - "BatchStartResponse": { - "description": "Batch Operation Started", - "content": { - "application/json": { - "schema": { - "title": "Batch operation enqueued", - "type": "object", - "properties": { - "statusCode": { - "type": "integer", - "example": 202 - }, - "uri": { - "type": "string", - "description": "URI where the batch operation status can be followed", - "format": "uri", - "example": "/alarms/v1/batch/afcea5a1-81df-44f6-bd34-e0b602a2cf3d" - }, - "entity": { - "type": "object", - "properties": { - "id": { - "$ref": "#/components/schemas/BatchId" - }, - "queueTime": { - "$ref": "#/components/schemas/ISO8601Timestamp" - }, - "operation": { - "title": "Queued operation summary", - "type": "object", - "properties": { - "entity": { - "$ref": "#/components/schemas/BatchAlarmEntity" - }, - "action": { - "type": "string", - "enum": [ - "update", - "delete" - ] - } - }, - "required": [ - "entity", - "action" - ] - } - }, - "required": [ - "id", - "queueTime", - "operation" - ] - } - }, - "required": [ - "statusCode", - "uri", - "entity" - ] - } - } - }, - "headers": { - "Location": { - "description": "URI where the batch operation status can be followed", - "example": "/alarms/v1/batch/afcea5a1-81df-44f6-bd34-e0b602a2cf3d", - "schema": { - "type": "string", - "format": "uri" - } - } - } - }, - "GetBatchOperationResponse": { - "description": "Get Batch Operation", - "content": { - "application/json": { - "schema": { - "title": "BatchOperationResults", - "anyOf": [ - { - "$ref": "#/components/schemas/BatchOperationResult" - }, - { - "$ref": "#/components/schemas/BatchOperation" - } - ] - } - } - } - }, - "BatchNotFoundResponse": { - "description": "Batch Operation Not Found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - }, - "example": { - "statusCode": 404, - "error": "Operation with id 'afcea5a1-81df-44f6-bd34-e0b602a2cf3d' not found" - } - } - } - } - }, - "securitySchemes": { - "waylayApiKeySecret": { - "type": "http", - "description": "Waylay apiKey/apiSecret basic authentication. All endpoints support also Waylay JWT Bearer authentication.", - "scheme": "basic" - } - } - }, - "servers": [ - { - "url": "https://api.waylay.io", - "description": "Waylay enterprise gateway" - } - ] -} - diff --git a/test/_run/openapi/alarms.transformed.openapi.yaml b/test/_run/openapi/alarms.transformed.openapi.yaml deleted file mode 100644 index 7690a08..0000000 --- a/test/_run/openapi/alarms.transformed.openapi.yaml +++ /dev/null @@ -1,1343 +0,0 @@ -openapi: 3.0.3 -info: - title: Waylay Alarms - version: 1.11.0 - description: '' -externalDocs: - url: https://docs.waylay.io/#/api/alarms/ - description: Waylay Documentation -tags: - - name: Alarms - - name: Alarm Events - - name: Alarms Batch Operations - - name: Version -paths: - /alarms/v1/alarms: - post: - operationId: create - summary: Create Alarm - description: >- - Create an alarm. - - - If an `ACTIVE` or `ACKNOWLEDGED` alarm with the same `source.id` and - `type` exists, - - no new alarm is created. - - - Instead, the existing alarm is updated by incrementing the `count` - property - - and a new audit record of type `io.waylay.alarm.EventOccuredAgain` is - added to the history. - - - Only the latest 1000 `io.waylay.alarm.EventOccuredAgain` audit records - are kept in the history. - tags: - - Alarms - externalDocs: - description: Waylay Docs - url: https://docs.waylay.io/#/api/alarms/?id=create-an-alarm - requestBody: - $ref: '#/components/requestBodies/AlarmsSpecification' - responses: - '200': - $ref: '#/components/responses/SuccessCreationResponse' - '400': - $ref: '#/components/responses/ErrorResponseWithDetails' - security: - - waylayApiKeySecret: [] - x-py-method: create - x-consumes-multipart: false - x-consumes-urlencoded: false - x-consumes-json: false - x-consumes-other: false - get: - operationId: list - summary: Query Multiple Alarms - description: >- - Query multiple alarms using a query language. - - The response contains the total number of alarms that fulfill the - criteria. - - - By default, returns the first 50 alarms. - tags: - - Alarms - externalDocs: - description: Waylay Docs - url: https://docs.waylay.io/#/api/alarms/?id=query-multiple-alarms - parameters: - - name: type - in: query - schema: - type: array - items: - $ref: '#/components/schemas/AlarmType' - explode: true - description: Filter on one or more alarm types. - x-showExample: false - - name: status - in: query - schema: - type: array - items: - $ref: '#/components/schemas/AlarmStatus' - description: Filter on one or more alarm statuses. - explode: true - x-showExample: false - - name: severity - in: query - schema: - type: array - items: - $ref: '#/components/schemas/AlarmSeverity' - description: Filter on one or more alarm severities. - explode: true - x-showExample: false - - name: source - in: query - schema: - type: array - items: - type: string - explode: true - description: >- - Filter on one or more source ids. - - - At least one source id is mandatory in combination with `Accept: - application/vnd.waylay.alarms.timeseries+json` - x-showExample: false - - name: dateFrom - in: query - schema: - $ref: '#/components/schemas/UnixEpochMillis' - description: Filter on alarm timestamp (equal or above). - x-example: 1663269720694 - x-showExample: true - - name: dateTo - in: query - schema: - $ref: '#/components/schemas/UnixEpochMillis' - description: Filter on alarm timestamp (equal or below). - x-example: 1663269720694 - x-showExample: true - - name: from - in: query - schema: - $ref: '#/components/schemas/UnixEpochMillis' - description: >- - Only applicable in combination with `Accept: - application/vnd.waylay.alarms.timeseries+json` - - - Limits the timestamp of the Alarm Audit Records to be >= `from` - x-example: 1663269720694 - x-showExample: true - - name: to - in: query - schema: - $ref: '#/components/schemas/UnixEpochMillis' - description: >- - Only applicable in combination with `Accept: - application/vnd.waylay.alarms.timeseries+json` - - - Limits the timestamp of the Alarm Audit Records to be <= `to` - x-example: 1663269720694 - x-showExample: true - - name: creationTimeFrom - in: query - schema: - $ref: '#/components/schemas/UnixEpochMillis' - description: Filter on alarm creationTime (equal or above). - x-example: 1663269720694 - x-showExample: true - - name: creationTimeTo - in: query - schema: - $ref: '#/components/schemas/UnixEpochMillis' - description: Filter on alarm creationTime (equal or below). - x-example: 1663269720694 - x-showExample: true - - name: lastUpdatedFrom - in: query - schema: - $ref: '#/components/schemas/UnixEpochMillis' - description: Filter on alarm lastUpdateTime (equal or above). - x-example: 1663269720694 - x-showExample: true - - name: lastUpdatedTo - in: query - schema: - $ref: '#/components/schemas/UnixEpochMillis' - description: Filter on alarm lastUpdateTime (equal or below). - x-example: 1663269720694 - x-showExample: true - - name: lastTriggeredFrom - in: query - schema: - $ref: '#/components/schemas/UnixEpochMillis' - description: Filter on alarm lastTriggeredTime (equal or above). - x-example: 1663269720694 - x-showExample: true - - name: lastTriggeredTo - in: query - schema: - $ref: '#/components/schemas/UnixEpochMillis' - description: Filter on alarm lastTriggeredTime (equal or below). - x-example: 1663269720694 - x-showExample: true - - name: sort - in: query - schema: - type: string - enum: - - timestamp - - lastUpdateTime - - lastTriggeredTime - default: timestamp - description: >- - (Pagination) field used to sort the alarms - - - Ignored in combination with `Accept: - application/vnd.waylay.alarms.timeseries+json` - x-showExample: true - - name: order - in: query - schema: - type: string - enum: - - asc - - desc - default: desc - description: >- - (Pagination) sort order - - - Ignored in combination with `Accept: - application/vnd.waylay.alarms.timeseries+json` - x-showExample: true - - name: page - in: query - schema: - type: integer - default: 1 - description: >- - (Pagination) page Number - - - Ignored in combination with `Accept: - application/vnd.waylay.alarms.timeseries+json` - x-showExample: true - - name: size - in: query - schema: - type: integer - default: 50 - description: >- - (Pagination) size of a page - - - Ignored in combination with `Accept: - application/vnd.waylay.alarms.timeseries+json` - x-showExample: true - - name: additionalQueryParams - in: query - style: form - explode: true - schema: - type: object - additionalProperties: - anyOf: - - type: number - - type: string - - type: boolean - description: >- - To query the alarms based on the value of an additional property of - the alarm, - - you can add the key of the additional property as query parameter - - with value the value you expect the alarm to have. - example: &ref_0 - task: 3425 - x-example: *ref_0 - x-showExample: true - responses: - '200': - description: Successful Response - headers: - X-Count: - description: Total number of alarms that fulfill the criteria - schema: - type: integer - content: - application/json: - schema: - $ref: '#/components/schemas/AlarmsQueryResult' - application/vnd.waylay.alarms.timeseries+json: - schema: - title: Query alarms as a timeline - externalDocs: - description: Query alarms as a timeline - url: >- - https://docs.waylay.io/#/api/alarms/?id=query-alarms-as-a-timeline - type: array - items: - $ref: '#/components/schemas/AlarmsTimelineItem' - '400': - $ref: '#/components/responses/ErrorResponse' - security: - - waylayApiKeySecret: [] - x-py-method: list - x-consumes-multipart: false - x-consumes-urlencoded: false - x-consumes-json: false - x-consumes-other: false - /alarms/v1/alarms/{alarmId}: - get: - operationId: get_alarm - summary: Get Alarm - description: Get an alarm. - tags: - - Alarms - externalDocs: - description: Waylay Docs - url: https://docs.waylay.io/#/api/alarms/?id=get-an-alarm - parameters: - - $ref: '#/components/parameters/AlarmId' - x-showExample: false - responses: - '200': - description: Alarm Fetched - content: - application/json: - schema: - $ref: '#/components/schemas/AlarmEntity' - '404': - $ref: '#/components/responses/AlarmNotFoundResponse' - security: - - waylayApiKeySecret: [] - x-py-method: get - x-consumes-multipart: false - x-consumes-urlencoded: false - x-consumes-json: false - x-consumes-other: false - put: - operationId: update - summary: Update Alarm - description: Update an alarm. - tags: - - Alarms - externalDocs: - description: Waylay Docs - url: https://docs.waylay.io/#/api/alarms/?id=update-an-alarm - parameters: - - $ref: '#/components/parameters/AlarmId' - x-showExample: false - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/AlarmUpdate' - responses: - '200': - description: Alarm Updated - content: - application/json: - schema: - $ref: '#/components/schemas/AlarmEntity' - '400': - $ref: '#/components/responses/ErrorResponseWithDetails' - '404': - $ref: '#/components/responses/AlarmNotFoundResponse' - '412': - description: Precondition Failed - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - example: - statusCode: 412 - error: Alarm is in final state - security: - - waylayApiKeySecret: [] - x-py-method: update - x-consumes-multipart: false - x-consumes-urlencoded: false - x-consumes-json: true - x-consumes-other: false - delete: - operationId: delete - summary: Delete Alarm - description: Delete an Alarm. - tags: - - Alarms - externalDocs: - description: Waylay Docs - url: https://docs.waylay.io/#/api/alarms/?id=deletion-of-an-alarm - parameters: - - $ref: '#/components/parameters/AlarmId' - x-showExample: false - responses: - '204': - description: Alarm Deleted - '404': - $ref: '#/components/responses/AlarmNotFoundResponse' - security: - - waylayApiKeySecret: [] - x-py-method: delete - x-consumes-multipart: false - x-consumes-urlencoded: false - x-consumes-json: false - x-consumes-other: false - /alarms/v1/events: - get: - operationId: get_eventstream - summary: Alarm Events - description: Opens a data stream for all Alarm Events for this tenant. - tags: - - Alarm Events - externalDocs: - description: Waylay Docs - url: https://docs.waylay.io/#/api/alarms/?id=alarm-events - parameters: - - name: eventFormat - in: query - schema: - type: string - enum: - - application/cloudevents+json - description: >- - The format of events in the stream. - - - If specified this must be `application/cloudevents+json` (make sure - to correctly URL encode the `+` as `%2B`) - x-showExample: true - responses: - '200': - $ref: '#/components/responses/GetEventStreamResponse' - security: - - waylayApiKeySecret: [] - x-py-method: get - x-consumes-multipart: false - x-consumes-urlencoded: false - x-consumes-json: false - x-consumes-other: false - /alarms/v1/batch: - post: - operationId: start - summary: Start Alarms Batch Operation - description: Start Alarms Batch Operation. - tags: - - Alarms Batch Operations - externalDocs: - description: Waylay Docs - url: https://docs.waylay.io/#/api/alarms/?id=batch-alarm-operations - requestBody: - $ref: '#/components/requestBodies/BatchAlarmsSpecification' - responses: - '202': - $ref: '#/components/responses/BatchStartResponse' - '400': - $ref: '#/components/responses/ErrorResponseWithDetails' - security: - - waylayApiKeySecret: [] - x-py-method: start - x-consumes-multipart: false - x-consumes-urlencoded: false - x-consumes-json: false - x-consumes-other: false - /alarms/v1/batch/{batchId}: - get: - operationId: get_batchoperation - summary: Get Alarms Batch Operation Status - description: Get the results of the Alarms Batch Operation. - externalDocs: - description: Waylay Docs - url: https://docs.waylay.io/#/api/alarms/?id=batch-alarm-operations - tags: - - Alarms Batch Operations - parameters: - - $ref: '#/components/parameters/BatchId' - x-showExample: false - responses: - '200': - $ref: '#/components/responses/GetBatchOperationResponse' - '404': - $ref: '#/components/responses/BatchNotFoundResponse' - security: - - waylayApiKeySecret: [] - x-py-method: get - x-consumes-multipart: false - x-consumes-urlencoded: false - x-consumes-json: false - x-consumes-other: false - /alarms/v1: - get: - tags: - - Version - operationId: get_version - summary: Version - description: Get the status and version of the service. - responses: - '200': - $ref: '#/components/responses/VersionResponse' - security: - - waylayApiKeySecret: [] - x-py-method: get - x-consumes-multipart: false - x-consumes-urlencoded: false - x-consumes-json: false - x-consumes-other: false -components: - schemas: - AlarmId: - description: Unique alarm identifier. - type: string - example: 2c49e3bf-547b-42bc-a5e9-9193155ec03d - VersionResponse: - type: object - properties: - version: - type: string - example: 2.7.0 - name: - type: string - example: alarm-service - required: - - name - - version - ErrorResponse: - type: object - properties: - statusCode: - type: integer - title: The error code - example: 400 - error: - type: string - title: The error message - example: error in body - required: - - statusCode - - error - ErrorResponseWithDetails: - allOf: - - $ref: '#/components/schemas/ErrorResponse' - - type: object - properties: - details: - type: array - minItems: 1 - items: - type: string - description: specific error message - example: >- - /severity <- Could not parse severity, valid values are: - CRITICAL, MAJOR, MINOR, WARNING - AlarmType: - type: string - description: Type of the alarm. - example: io.waylay.alarm.test - AlarmText: - type: string - description: Description of the alarm. - example: Some alarm documentation - AlarmAssignee: - type: string - description: String field to indicate an assignee for the alarm. - example: operator13 - CreateAlarm: - type: object - description: To create an alarm, you need to provide the following mandatory inputs. - properties: - type: - $ref: '#/components/schemas/AlarmType' - text: - $ref: '#/components/schemas/AlarmText' - severity: - $ref: '#/components/schemas/AlarmSeverity' - source: - $ref: '#/components/schemas/IdObject' - status: - $ref: '#/components/schemas/AlarmStatus' - timestamp: - $ref: '#/components/schemas/SO8601TimestampOrMillis' - assignee: - $ref: '#/components/schemas/AlarmAssignee' - additionalProperties: - title: Additional properties - description: >- - Any additional properties provided upon creation will be stored in the - `additionalProperties` field - - of the created alarm. - required: - - type - - text - - severity - - source - example: - type: io.waylay.alarm.test - text: Valve test failed - severity: CRITICAL - source: - id: 733c06ed-7919-416a-9d19-8996821be70d - task: 1e294c8b-8a7d-4770-997e-2d57fc5ad6ea - myRef: 902d4191-d1ab-47ae-8405-c33bb237f1d5 - AlarmUpdate: - type: object - description: At least one field must be specified. - properties: - severity: - $ref: '#/components/schemas/AlarmSeverity' - status: - $ref: '#/components/schemas/AlarmStatus' - assignee: - allOf: - - $ref: '#/components/schemas/AlarmAssignee' - - nullable: true - BatchAlarmEntity: - type: string - enum: - - alarm - BatchAlarm: - type: object - properties: - entity: - $ref: '#/components/schemas/BatchAlarmEntity' - action: - type: string - query: - type: object - BatchDeleteAlarm: - type: object - allOf: - - $ref: '#/components/schemas/BatchAlarm' - - properties: - action: - enum: - - delete - query: - oneOf: - - $ref: '#/components/schemas/BulkQueryIds' - - $ref: '#/components/schemas/BulkQueryFilter' - required: - - entity - - action - - query - BatchUpdateAlarm: - type: object - allOf: - - $ref: '#/components/schemas/BatchAlarm' - - properties: - actionParameters: - $ref: '#/components/schemas/AlarmUpdate' - action: - enum: - - update - query: - $ref: '#/components/schemas/BulkQueryIds' - required: - - entity - - action - - query - - actionParameters - BulkQueryIds: - type: object - properties: - ids: - type: array - minItems: 1 - items: - $ref: '#/components/schemas/AlarmId' - required: - - ids - BulkQueryFilter: - type: object - description: >- - Object specifying filters on the alarm to which the operation will be - applied. - - At least one of the filters must be set. - properties: - type: - title: Alarm Type Filter - oneOf: - - $ref: '#/components/schemas/AlarmType' - - type: array - items: - $ref: '#/components/schemas/AlarmType' - status: - title: Alarm Status Filter - oneOf: - - $ref: '#/components/schemas/AlarmStatus' - - type: array - items: - $ref: '#/components/schemas/AlarmStatus' - severity: - title: Alarm Severity Filter - oneOf: - - $ref: '#/components/schemas/AlarmSeverity' - - type: array - items: - $ref: '#/components/schemas/AlarmSeverity' - source: - title: Alarm Source Filter - oneOf: - - type: string - - type: array - items: - type: string - dateFrom: - allOf: - - $ref: '#/components/schemas/UnixEpochMillis' - - title: Alarm timestamp filter (>=) - dateTo: - allOf: - - $ref: '#/components/schemas/UnixEpochMillis' - - title: Alarm timestamp filter (<=) - assignee: - $ref: '#/components/schemas/AlarmAssignee' - creationTimeFrom: - allOf: - - $ref: '#/components/schemas/UnixEpochMillis' - - title: Alarm creationTime filter (>=) - creationTimeTo: - allOf: - - $ref: '#/components/schemas/UnixEpochMillis' - - title: Alarm creationTime filter (<=) - lastUpdatedFrom: - allOf: - - $ref: '#/components/schemas/UnixEpochMillis' - - title: Alarm lastUpdateTime filter (>=) - lastUpdatedTo: - allOf: - - $ref: '#/components/schemas/UnixEpochMillis' - - title: Alarm lastUpdateTime filter (<=) - lastTriggeredFrom: - allOf: - - $ref: '#/components/schemas/UnixEpochMillis' - - title: Alarm lastTriggeredTime filter (>=) - lastTriggeredTo: - allOf: - - $ref: '#/components/schemas/UnixEpochMillis' - - title: Alarm lastTriggeredTime filter (<=) - SO8601Timestamp: - type: string - format: date-time - example: '2011-09-06T12:03:27.845Z' - SO8601TimestampOrMillis: - description: ISO8601 timestamp or unix epoch milliseconds. - oneOf: - - $ref: '#/components/schemas/UnixEpochMillis' - - $ref: '#/components/schemas/SO8601Timestamp' - UnixEpochMillis: - type: integer - description: >- - Timestamp expressed as milliseconds since 00:00:00 UTC on 1 January - 1970, - - not counting leap seconds. - example: 1663269720694 - AlarmSelfLink: - type: string - format: uri - example: /alarms/v1/alarms/ea381b65-eb57-4dca-b510-44a9efba3cf3 - IdObject: - type: object - description: A JSON object with an id field indicating the resource. - properties: - id: - type: string - title: Resource Id - required: - - id - example: - id: '12345' - AlarmStatus: - type: string - enum: - - ACTIVE - - ACKNOWLEDGED - - CLEARED - default: ACTIVE - AlarmSeverity: - type: string - enum: - - CRITICAL - - MAJOR - - MINOR - - WARNING - AlarmEntity: - type: object - properties: - id: - $ref: '#/components/schemas/AlarmId' - creationTime: - $ref: '#/components/schemas/SO8601Timestamp' - lastUpdateTime: - $ref: '#/components/schemas/SO8601Timestamp' - lastTriggeredTime: - $ref: '#/components/schemas/SO8601Timestamp' - type: - $ref: '#/components/schemas/AlarmType' - text: - $ref: '#/components/schemas/AlarmText' - timestamp: - $ref: '#/components/schemas/SO8601Timestamp' - source: - $ref: '#/components/schemas/IdObject' - severity: - $ref: '#/components/schemas/AlarmSeverity' - status: - $ref: '#/components/schemas/AlarmStatus' - count: - title: Event count - description: The number of times this alarm has been sent - type: integer - minimum: 1 - assignee: - $ref: '#/components/schemas/AlarmAssignee' - history: - title: History of modifications - type: array - minItems: 1 - items: - $ref: '#/components/schemas/AlarmAuditRecord' - self: - $ref: '#/components/schemas/AlarmSelfLink' - additionalProperties: - description: Additional properties that were present in the creation payload - type: object - example: - task: 1e294c8b-8a7d-4770-997e-2d57fc5ad6ea - myRef: 902d4191-d1ab-47ae-8405-c33bb237f1d5 - required: - - id - - creationTime - - lastUpdateTime - - lastTriggeredTime - - type - - text - - timestamp - - source - - severity - - status - - count - AlarmAuditRecord: - type: object - properties: - id: - type: string - example: ca0c5181-11dc-47dd-aeb3-a7a508ea1599" - type: - $ref: '#/components/schemas/AlarmEventType' - text: - type: string - description: Text describing the change - example: Alarm raised - timestamp: - allOf: - - $ref: '#/components/schemas/SO8601Timestamp' - - description: timestamp when the change happened - required: - - id - - type - - text - - timestamp - AlarmsQueryResult: - type: object - properties: - self: - type: string - format: uri - description: Link to alarm query - example: /alarms/v1/alarms?page=3 - alarms: - type: array - title: List of alarms - items: - $ref: '#/components/schemas/AlarmEntity' - total: - type: integer - description: Total number of alarms that fulfill the criteria - example: 248 - next: - type: string - format: uri - description: Link to the next page of results (if more results are available) - example: /alarms/v1/alarms?page=4 - prev: - type: string - format: uri - description: Link to the previous page of result (if previous page is available) - example: /alarms/v1/alarms?page=2 - required: - - self - - alarms - - total - AlarmTimelineInfo: - type: object - description: The alarm as it is after the event - properties: - id: - $ref: '#/components/schemas/AlarmId' - creationTime: - $ref: '#/components/schemas/SO8601Timestamp' - timestamp: - $ref: '#/components/schemas/SO8601Timestamp' - source: - $ref: '#/components/schemas/IdObject' - type: - $ref: '#/components/schemas/AlarmType' - text: - $ref: '#/components/schemas/AlarmText' - severity: - $ref: '#/components/schemas/AlarmSeverity' - status: - $ref: '#/components/schemas/AlarmStatus' - assignee: - $ref: '#/components/schemas/AlarmAssignee' - required: - - id - - creationTime - - timestamp - - source - - type - - text - - severity - - status - AlarmTimelineTimestamp: - description: Timestamp of the event - type: integer - example: 1663269720694 - AlarmsTimelineItem: - type: object - properties: - timestamp: - $ref: '#/components/schemas/AlarmTimelineTimestamp' - type: - $ref: '#/components/schemas/AlarmEventType' - alarm: - $ref: '#/components/schemas/AlarmTimelineInfo' - required: - - timestamp - - type - - alarm - AlarmEventType: - type: string - oneOf: - - enum: - - io.waylay.alarm.AlarmRaised - description: A new alarm was created. - - enum: - - io.waylay.alarm.EventOccuredAgain - description: An alarm happened again. - - enum: - - io.waylay.alarm.AlarmUpdated - description: An alarm was updated. - AlarmEvent: - type: object - properties: - eventtype: - $ref: '#/components/schemas/AlarmEventType' - eventtime: - $ref: '#/components/schemas/SO8601Timestamp' - alarm: - $ref: '#/components/schemas/AlarmEventAlarm' - changes: - type: array - description: |- - Describes the changes that where done - - Will only be there if `eventtype` is `io.waylay.alarm.AlarmUpdated` - items: - type: object - properties: - attribute: - type: string - example: severity - type: - type: string - description: Indication of what has changed - enum: - - io.waylay.alarm.change.severity - - io.waylay.alarm.change.status - - io.waylay.alarm.change.attribute - oldValue: - type: string - nullable: true - example: MAJOR - newValue: - type: string - nullable: true - example: CRITICAL - required: - - eventtype - - eventtime - - alarm - AlarmEventAlarm: - description: Summary representation of an alarm. - type: object - properties: - id: - $ref: '#/components/schemas/AlarmId' - tenantId: - type: string - creationTime: - $ref: '#/components/schemas/SO8601Timestamp' - type: - $ref: '#/components/schemas/AlarmType' - text: - $ref: '#/components/schemas/AlarmText' - timestamp: - $ref: '#/components/schemas/SO8601Timestamp' - source: - $ref: '#/components/schemas/IdObject' - severity: - $ref: '#/components/schemas/AlarmSeverity' - status: - $ref: '#/components/schemas/AlarmStatus' - count: - type: integer - minimum: 1 - required: - - id - - tenantId - - creationTime - - type - - text - - timestamp - - source - - severity - - status - - count - CloudAlarmEventData: - type: object - properties: - id: - example: dd59d2d9-9657-4d36-b045-ef97315f2d20 - source: - example: /alarms/v1/alarms - subject: - type: string - example: >- - 289dd1a3-35a7-44fa-8596-9aee3ad0b36f/2c49e3bf-547b-42bc-a5e9-9193155ec03d - type: - enum: - - io.waylay.alarms.v1.AlarmRaised - - io.waylay.alarms.v1.EventOccurredAgain - - io.waylay.alarms.v1.AlarmUpdated - data: - $ref: '#/components/schemas/AlarmEvent' - time: - $ref: '#/components/schemas/SO8601Timestamp' - CloudAlarmEvent: - allOf: - - $ref: ./cloudevents.schema.yaml#/definitions/cloudevent_json - - $ref: '#/components/schemas/CloudAlarmEventData' - - required: - - subject - - time - example: - time: '2011-09-06T12:03:27.845Z' - type: io.waylay.alarms.v1.AlarmUpdated - subject: >- - 289dd1a3-35a7-44fa-8596-9aee3ad0b36f/2c49e3bf-547b-42bc-a5e9-9193155ec03d - BatchId: - type: string - example: afcea5a1-81df-44f6-bd34-e0b602a2cf3d - BatchOperation: - type: object - properties: - id: - $ref: '#/components/schemas/BatchId' - user: - type: string - description: User id of the user who started the operation - example: user/22f6dfdf-a50c-4eab-953e-8d2e56891dbe - operation: - type: object - description: Summary of the batch operation - properties: - entity: - $ref: '#/components/schemas/BatchAlarmEntity' - action: - type: string - enum: - - delete - - update - description: - type: string - description: Description of the operation - example: deleting 3 alarms - required: - - entity - - action - - description - queueTime: - $ref: '#/components/schemas/SO8601Timestamp' - required: - - id - - user - - operation - - queueTime - SuccessOperationResult: - type: object - description: |- - Object containing the successful operation results. - The keys will be alarm ids. - additionalProperties: - type: object - description: The keys will be alarm ids. - properties: - statusCode: - type: integer - description: The statusCode of the operation - required: - - statusCode - FailureOperationResult: - type: object - description: |- - Object containing the unsuccessful operation results. - The keys will be alarm ids. - additionalProperties: - type: object - description: The keys will be alarm ids. - properties: - statusCode: - type: integer - description: The statusCode of the operation - error: - type: string - description: Error description of what went wrong. - required: - - statusCode - - error - OperationResultObject: - description: Finished Batch Operation results - type: object - properties: - finishedTime: - $ref: '#/components/schemas/SO8601Timestamp' - results: - type: object - properties: - success: - $ref: '#/components/schemas/SuccessOperationResult' - failure: - $ref: '#/components/schemas/FailureOperationResult' - required: - - success - - failure - required: - - finishedTime - - results - BatchOperationResult: - allOf: - - $ref: '#/components/schemas/BatchOperation' - - $ref: '#/components/schemas/OperationResultObject' - example: - id: afcea5a1-81df-44f6-bd34-e0b602a2cf3d - user: user/22f6dfdf-a50c-4eab-953e-8d2e56891dbe - operation: - entity: alarm - action: delete - description: deleting 3 alarms - queueTime: '2020-04-27T09:54:44.051Z' - finishedTime: '2020-04-27T09:54:44.129Z' - results: - success: - df036bf8-4b32-4bd8-8ee7-42800ab26bf5: - statusCode: 204 - failure: - 586ac2f2-fbec-426a-b696-d63d6cb153ac: - statusCode: 404, - error: alarm with id '586ac2f2-fbec-426a-b696-d63d6cb153ac' not found - e64de65c-e3ef-482d-9eb7-32ca17d1e147: - statusCode: 404, - error: alarm with id 'e64de65c-e3ef-482d-9eb7-32ca17d1e147' not found - parameters: - AlarmId: - name: alarmId - in: path - description: Unique Alarm Identifier - required: true - schema: - $ref: '#/components/schemas/AlarmId' - BatchId: - name: batchId - in: path - description: Unique Batch Operation identifier - required: true - schema: - $ref: '#/components/schemas/BatchId' - requestBodies: - AlarmsSpecification: - description: Alarm Operations - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/CreateAlarm' - BatchAlarmsSpecification: - description: Batch Alarm Operation - required: true - content: - application/json: - schema: - title: a batch alarms specification - type: object - oneOf: - - $ref: '#/components/schemas/BatchUpdateAlarm' - - $ref: '#/components/schemas/BatchDeleteAlarm' - responses: - DefaultSuccessResponse: - description: Successful Response - content: - application/json: - schema: - type: object - ErrorResponse: - description: Error Response - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - ErrorResponseWithDetails: - description: Error Response - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponseWithDetails' - VersionResponse: - description: Successful Response - content: - application/json: - schema: - $ref: '#/components/schemas/VersionResponse' - SuccessCreationResponse: - description: Successful Response - content: - application/json: - schema: - $ref: '#/components/schemas/AlarmEntity' - AlarmNotFoundResponse: - description: Alarm Not Found - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - example: - statusCode: 404 - error: alarm with id '2c49e3bf-547b-42bc-a5e9-9193155ec03d' not found - GetEventStreamResponse: - description: Alarm Events Stream - content: - application/x-ndjson: - schema: - title: NdJsonResponseStream - oneOf: - - $ref: '#/components/schemas/AlarmEvent' - - $ref: '#/components/schemas/CloudAlarmEvent' - example: - time: '2011-09-06T12:03:27.845Z' - type: io.waylay.alarms.v1.AlarmUpdated - subject: >- - 289dd1a3-35a7-44fa-8596-9aee3ad0b36f/2c49e3bf-547b-42bc-a5e9-9193155ec03d - text/event-stream: - schema: - title: SSEventStream - oneOf: - - $ref: '#/components/schemas/AlarmEvent' - - $ref: '#/components/schemas/CloudAlarmEvent' - BatchStartResponse: - description: Batch Operation Started - content: - application/json: - schema: - title: Batch operation enqueued - type: object - properties: - statusCode: - type: integer - example: 202 - uri: - type: string - description: URI where the batch operation status can be followed - format: uri - example: /alarms/v1/batch/afcea5a1-81df-44f6-bd34-e0b602a2cf3d - entity: - type: object - properties: - id: - $ref: '#/components/schemas/BatchId' - queueTime: - $ref: '#/components/schemas/SO8601Timestamp' - operation: - title: Queued operation summary - type: object - properties: - entity: - $ref: '#/components/schemas/BatchAlarmEntity' - action: - type: string - enum: - - update - - delete - required: - - entity - - action - required: - - id - - queueTime - - operation - required: - - statusCode - - uri - - entity - headers: - Location: - description: URI where the batch operation status can be followed - example: /alarms/v1/batch/afcea5a1-81df-44f6-bd34-e0b602a2cf3d - schema: - type: string - format: uri - GetBatchOperationResponse: - description: Get Batch Operation - content: - application/json: - schema: - title: BatchOperationResults - anyOf: - - $ref: '#/components/schemas/BatchOperationResult' - - $ref: '#/components/schemas/BatchOperation' - BatchNotFoundResponse: - description: Batch Operation Not Found - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - example: - statusCode: 404 - error: Operation with id 'afcea5a1-81df-44f6-bd34-e0b602a2cf3d' not found - securitySchemes: - waylayApiKeySecret: - type: http - description: >- - Waylay apiKey/apiSecret basic authentication. All endpoints support also - Waylay JWT Bearer authentication. - scheme: basic -servers: - - url: https://api.waylay.io - description: Waylay enterprise gateway diff --git a/test/_run/openapi/alarms.transformed.openapi.yaml.json b/test/_run/openapi/alarms.transformed.openapi.yaml.json deleted file mode 100644 index abf37db..0000000 --- a/test/_run/openapi/alarms.transformed.openapi.yaml.json +++ /dev/null @@ -1,1917 +0,0 @@ -{ - "openapi": "3.0.3", - "info": { - "title": "Waylay Alarms", - "version": "1.11.0", - "description": "" - }, - "externalDocs": { - "url": "https://docs.waylay.io/#/api/alarms/", - "description": "Waylay Documentation" - }, - "tags": [ - { - "name": "Alarms" - }, - { - "name": "Alarm Events" - }, - { - "name": "Alarms Batch Operations" - }, - { - "name": "Version" - } - ], - "paths": { - "/alarms/v1/alarms": { - "post": { - "operationId": "create", - "summary": "Create Alarm", - "description": "Create an alarm.\n\nIf an `ACTIVE` or `ACKNOWLEDGED` alarm with the same `source.id` and `type` exists, \nno new alarm is created. \n\nInstead, the existing alarm is updated by incrementing the `count` property \nand a new audit record of type `io.waylay.alarm.EventOccuredAgain` is added to the history. \n\nOnly the latest 1000 `io.waylay.alarm.EventOccuredAgain` audit records are kept in the history.", - "tags": [ - "Alarms" - ], - "externalDocs": { - "description": "Waylay Docs", - "url": "https://docs.waylay.io/#/api/alarms/?id=create-an-alarm" - }, - "requestBody": { - "$ref": "#/components/requestBodies/AlarmsSpecification" - }, - "responses": { - "200": { - "$ref": "#/components/responses/SuccessCreationResponse" - }, - "400": { - "$ref": "#/components/responses/ErrorResponseWithDetails" - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ], - "x-py-method": "create", - "x-consumes-multipart": false, - "x-consumes-urlencoded": false, - "x-consumes-json": false, - "x-consumes-other": false - }, - "get": { - "operationId": "list", - "summary": "Query Multiple Alarms", - "description": "Query multiple alarms using a query language.\nThe response contains the total number of alarms that fulfill the criteria.\n\nBy default, returns the first 50 alarms.", - "tags": [ - "Alarms" - ], - "externalDocs": { - "description": "Waylay Docs", - "url": "https://docs.waylay.io/#/api/alarms/?id=query-multiple-alarms" - }, - "parameters": [ - { - "name": "type", - "in": "query", - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/AlarmType" - } - }, - "explode": true, - "description": "Filter on one or more alarm types.", - "x-showExample": false - }, - { - "name": "status", - "in": "query", - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/AlarmStatus" - } - }, - "description": "Filter on one or more alarm statuses.", - "explode": true, - "x-showExample": false - }, - { - "name": "severity", - "in": "query", - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/AlarmSeverity" - } - }, - "description": "Filter on one or more alarm severities.", - "explode": true, - "x-showExample": false - }, - { - "name": "source", - "in": "query", - "schema": { - "type": "array", - "items": { - "type": "string" - } - }, - "explode": true, - "description": "Filter on one or more source ids.\n\nAt least one source id is mandatory in combination with `Accept: application/vnd.waylay.alarms.timeseries+json`", - "x-showExample": false - }, - { - "name": "dateFrom", - "in": "query", - "schema": { - "$ref": "#/components/schemas/UnixEpochMillis" - }, - "description": "Filter on alarm timestamp (equal or above).", - "x-example": 1663269720694, - "x-showExample": true - }, - { - "name": "dateTo", - "in": "query", - "schema": { - "$ref": "#/components/schemas/UnixEpochMillis" - }, - "description": "Filter on alarm timestamp (equal or below).", - "x-example": 1663269720694, - "x-showExample": true - }, - { - "name": "from", - "in": "query", - "schema": { - "$ref": "#/components/schemas/UnixEpochMillis" - }, - "description": "Only applicable in combination with `Accept: application/vnd.waylay.alarms.timeseries+json`\n\nLimits the timestamp of the Alarm Audit Records to be >= `from`", - "x-example": 1663269720694, - "x-showExample": true - }, - { - "name": "to", - "in": "query", - "schema": { - "$ref": "#/components/schemas/UnixEpochMillis" - }, - "description": "Only applicable in combination with `Accept: application/vnd.waylay.alarms.timeseries+json`\n\nLimits the timestamp of the Alarm Audit Records to be <= `to`", - "x-example": 1663269720694, - "x-showExample": true - }, - { - "name": "creationTimeFrom", - "in": "query", - "schema": { - "$ref": "#/components/schemas/UnixEpochMillis" - }, - "description": "Filter on alarm creationTime (equal or above).", - "x-example": 1663269720694, - "x-showExample": true - }, - { - "name": "creationTimeTo", - "in": "query", - "schema": { - "$ref": "#/components/schemas/UnixEpochMillis" - }, - "description": "Filter on alarm creationTime (equal or below).", - "x-example": 1663269720694, - "x-showExample": true - }, - { - "name": "lastUpdatedFrom", - "in": "query", - "schema": { - "$ref": "#/components/schemas/UnixEpochMillis" - }, - "description": "Filter on alarm lastUpdateTime (equal or above).", - "x-example": 1663269720694, - "x-showExample": true - }, - { - "name": "lastUpdatedTo", - "in": "query", - "schema": { - "$ref": "#/components/schemas/UnixEpochMillis" - }, - "description": "Filter on alarm lastUpdateTime (equal or below).", - "x-example": 1663269720694, - "x-showExample": true - }, - { - "name": "lastTriggeredFrom", - "in": "query", - "schema": { - "$ref": "#/components/schemas/UnixEpochMillis" - }, - "description": "Filter on alarm lastTriggeredTime (equal or above).", - "x-example": 1663269720694, - "x-showExample": true - }, - { - "name": "lastTriggeredTo", - "in": "query", - "schema": { - "$ref": "#/components/schemas/UnixEpochMillis" - }, - "description": "Filter on alarm lastTriggeredTime (equal or below).", - "x-example": 1663269720694, - "x-showExample": true - }, - { - "name": "sort", - "in": "query", - "schema": { - "type": "string", - "enum": [ - "timestamp", - "lastUpdateTime", - "lastTriggeredTime" - ], - "default": "timestamp" - }, - "description": "(Pagination) field used to sort the alarms\n\nIgnored in combination with `Accept: application/vnd.waylay.alarms.timeseries+json`", - "x-showExample": true - }, - { - "name": "order", - "in": "query", - "schema": { - "type": "string", - "enum": [ - "asc", - "desc" - ], - "default": "desc" - }, - "description": "(Pagination) sort order\n\nIgnored in combination with `Accept: application/vnd.waylay.alarms.timeseries+json`", - "x-showExample": true - }, - { - "name": "page", - "in": "query", - "schema": { - "type": "integer", - "default": 1 - }, - "description": "(Pagination) page Number \n\nIgnored in combination with `Accept: application/vnd.waylay.alarms.timeseries+json`", - "x-showExample": true - }, - { - "name": "size", - "in": "query", - "schema": { - "type": "integer", - "default": 50 - }, - "description": "(Pagination) size of a page\n\nIgnored in combination with `Accept: application/vnd.waylay.alarms.timeseries+json`", - "x-showExample": true - }, - { - "name": "additionalQueryParams", - "in": "query", - "style": "form", - "explode": true, - "schema": { - "type": "object", - "additionalProperties": { - "anyOf": [ - { - "type": "number" - }, - { - "type": "string" - }, - { - "type": "boolean" - } - ] - } - }, - "description": "To query the alarms based on the value of an additional property of the alarm, \nyou can add the key of the additional property as query parameter \nwith value the value you expect the alarm to have.", - "example": { - "task": 3425 - }, - "x-example": { - "task": 3425 - }, - "x-showExample": true - } - ], - "responses": { - "200": { - "description": "Successful Response", - "headers": { - "X-Count": { - "description": "Total number of alarms that fulfill the criteria", - "schema": { - "type": "integer" - } - } - }, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AlarmsQueryResult" - } - }, - "application/vnd.waylay.alarms.timeseries+json": { - "schema": { - "title": "Query alarms as a timeline", - "externalDocs": { - "description": "Query alarms as a timeline", - "url": "https://docs.waylay.io/#/api/alarms/?id=query-alarms-as-a-timeline" - }, - "type": "array", - "items": { - "$ref": "#/components/schemas/AlarmsTimelineItem" - } - } - } - } - }, - "400": { - "$ref": "#/components/responses/ErrorResponse" - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ], - "x-py-method": "list", - "x-consumes-multipart": false, - "x-consumes-urlencoded": false, - "x-consumes-json": false, - "x-consumes-other": false - } - }, - "/alarms/v1/alarms/{alarmId}": { - "get": { - "operationId": "get_alarm", - "summary": "Get Alarm", - "description": "Get an alarm.", - "tags": [ - "Alarms" - ], - "externalDocs": { - "description": "Waylay Docs", - "url": "https://docs.waylay.io/#/api/alarms/?id=get-an-alarm" - }, - "parameters": [ - { - "$ref": "#/components/parameters/AlarmId", - "x-showExample": false - } - ], - "responses": { - "200": { - "description": "Alarm Fetched", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AlarmEntity" - } - } - } - }, - "404": { - "$ref": "#/components/responses/AlarmNotFoundResponse" - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ], - "x-py-method": "get", - "x-consumes-multipart": false, - "x-consumes-urlencoded": false, - "x-consumes-json": false, - "x-consumes-other": false - }, - "put": { - "operationId": "update", - "summary": "Update Alarm", - "description": "Update an alarm.", - "tags": [ - "Alarms" - ], - "externalDocs": { - "description": "Waylay Docs", - "url": "https://docs.waylay.io/#/api/alarms/?id=update-an-alarm" - }, - "parameters": [ - { - "$ref": "#/components/parameters/AlarmId", - "x-showExample": false - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AlarmUpdate" - } - } - } - }, - "responses": { - "200": { - "description": "Alarm Updated", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AlarmEntity" - } - } - } - }, - "400": { - "$ref": "#/components/responses/ErrorResponseWithDetails" - }, - "404": { - "$ref": "#/components/responses/AlarmNotFoundResponse" - }, - "412": { - "description": "Precondition Failed", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - }, - "example": { - "statusCode": 412, - "error": "Alarm is in final state" - } - } - } - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ], - "x-py-method": "update", - "x-consumes-multipart": false, - "x-consumes-urlencoded": false, - "x-consumes-json": true, - "x-consumes-other": false - }, - "delete": { - "operationId": "delete", - "summary": "Delete Alarm", - "description": "Delete an Alarm.", - "tags": [ - "Alarms" - ], - "externalDocs": { - "description": "Waylay Docs", - "url": "https://docs.waylay.io/#/api/alarms/?id=deletion-of-an-alarm" - }, - "parameters": [ - { - "$ref": "#/components/parameters/AlarmId", - "x-showExample": false - } - ], - "responses": { - "204": { - "description": "Alarm Deleted" - }, - "404": { - "$ref": "#/components/responses/AlarmNotFoundResponse" - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ], - "x-py-method": "delete", - "x-consumes-multipart": false, - "x-consumes-urlencoded": false, - "x-consumes-json": false, - "x-consumes-other": false - } - }, - "/alarms/v1/events": { - "get": { - "operationId": "get_eventstream", - "summary": "Alarm Events", - "description": "Opens a data stream for all Alarm Events for this tenant.", - "tags": [ - "Alarm Events" - ], - "externalDocs": { - "description": "Waylay Docs", - "url": "https://docs.waylay.io/#/api/alarms/?id=alarm-events" - }, - "parameters": [ - { - "name": "eventFormat", - "in": "query", - "schema": { - "type": "string", - "enum": [ - "application/cloudevents+json" - ] - }, - "description": "The format of events in the stream. \n\nIf specified this must be `application/cloudevents+json` (make sure to correctly URL encode the `+` as `%2B`)", - "x-showExample": true - } - ], - "responses": { - "200": { - "$ref": "#/components/responses/GetEventStreamResponse" - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ], - "x-py-method": "get", - "x-consumes-multipart": false, - "x-consumes-urlencoded": false, - "x-consumes-json": false, - "x-consumes-other": false - } - }, - "/alarms/v1/batch": { - "post": { - "operationId": "start", - "summary": "Start Alarms Batch Operation", - "description": "Start Alarms Batch Operation.", - "tags": [ - "Alarms Batch Operations" - ], - "externalDocs": { - "description": "Waylay Docs", - "url": "https://docs.waylay.io/#/api/alarms/?id=batch-alarm-operations" - }, - "requestBody": { - "$ref": "#/components/requestBodies/BatchAlarmsSpecification" - }, - "responses": { - "202": { - "$ref": "#/components/responses/BatchStartResponse" - }, - "400": { - "$ref": "#/components/responses/ErrorResponseWithDetails" - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ], - "x-py-method": "start", - "x-consumes-multipart": false, - "x-consumes-urlencoded": false, - "x-consumes-json": false, - "x-consumes-other": false - } - }, - "/alarms/v1/batch/{batchId}": { - "get": { - "operationId": "get_batchoperation", - "summary": "Get Alarms Batch Operation Status", - "description": "Get the results of the Alarms Batch Operation.", - "externalDocs": { - "description": "Waylay Docs", - "url": "https://docs.waylay.io/#/api/alarms/?id=batch-alarm-operations" - }, - "tags": [ - "Alarms Batch Operations" - ], - "parameters": [ - { - "$ref": "#/components/parameters/BatchId", - "x-showExample": false - } - ], - "responses": { - "200": { - "$ref": "#/components/responses/GetBatchOperationResponse" - }, - "404": { - "$ref": "#/components/responses/BatchNotFoundResponse" - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ], - "x-py-method": "get", - "x-consumes-multipart": false, - "x-consumes-urlencoded": false, - "x-consumes-json": false, - "x-consumes-other": false - } - }, - "/alarms/v1": { - "get": { - "tags": [ - "Version" - ], - "operationId": "get_version", - "summary": "Version", - "description": "Get the status and version of the service.", - "responses": { - "200": { - "$ref": "#/components/responses/VersionResponse" - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ], - "x-py-method": "get", - "x-consumes-multipart": false, - "x-consumes-urlencoded": false, - "x-consumes-json": false, - "x-consumes-other": false - } - } - }, - "components": { - "schemas": { - "AlarmId": { - "description": "Unique alarm identifier.", - "type": "string", - "example": "2c49e3bf-547b-42bc-a5e9-9193155ec03d" - }, - "VersionResponse": { - "type": "object", - "properties": { - "version": { - "type": "string", - "example": "2.7.0" - }, - "name": { - "type": "string", - "example": "alarm-service" - } - }, - "required": [ - "name", - "version" - ] - }, - "ErrorResponse": { - "type": "object", - "properties": { - "statusCode": { - "type": "integer", - "title": "The error code", - "example": 400 - }, - "error": { - "type": "string", - "title": "The error message", - "example": "error in body" - } - }, - "required": [ - "statusCode", - "error" - ] - }, - "ErrorResponseWithDetails": { - "allOf": [ - { - "$ref": "#/components/schemas/ErrorResponse" - }, - { - "type": "object", - "properties": { - "details": { - "type": "array", - "minItems": 1, - "items": { - "type": "string", - "description": "specific error message", - "example": "/severity <- Could not parse severity, valid values are: CRITICAL, MAJOR, MINOR, WARNING" - } - } - } - } - ] - }, - "AlarmType": { - "type": "string", - "description": "Type of the alarm.", - "example": "io.waylay.alarm.test" - }, - "AlarmText": { - "type": "string", - "description": "Description of the alarm.", - "example": "Some alarm documentation" - }, - "AlarmAssignee": { - "type": "string", - "description": "String field to indicate an assignee for the alarm.", - "example": "operator13" - }, - "CreateAlarm": { - "type": "object", - "description": "To create an alarm, you need to provide the following mandatory inputs.", - "properties": { - "type": { - "$ref": "#/components/schemas/AlarmType" - }, - "text": { - "$ref": "#/components/schemas/AlarmText" - }, - "severity": { - "$ref": "#/components/schemas/AlarmSeverity" - }, - "source": { - "$ref": "#/components/schemas/IdObject" - }, - "status": { - "$ref": "#/components/schemas/AlarmStatus" - }, - "timestamp": { - "$ref": "#/components/schemas/SO8601TimestampOrMillis" - }, - "assignee": { - "$ref": "#/components/schemas/AlarmAssignee" - } - }, - "additionalProperties": { - "title": "Additional properties", - "description": "Any additional properties provided upon creation will be stored in the `additionalProperties` field\nof the created alarm." - }, - "required": [ - "type", - "text", - "severity", - "source" - ], - "example": { - "type": "io.waylay.alarm.test", - "text": "Valve test failed", - "severity": "CRITICAL", - "source": { - "id": "733c06ed-7919-416a-9d19-8996821be70d" - }, - "task": "1e294c8b-8a7d-4770-997e-2d57fc5ad6ea", - "myRef": "902d4191-d1ab-47ae-8405-c33bb237f1d5" - } - }, - "AlarmUpdate": { - "type": "object", - "description": "At least one field must be specified.", - "properties": { - "severity": { - "$ref": "#/components/schemas/AlarmSeverity" - }, - "status": { - "$ref": "#/components/schemas/AlarmStatus" - }, - "assignee": { - "allOf": [ - { - "$ref": "#/components/schemas/AlarmAssignee" - }, - { - "nullable": true - } - ] - } - } - }, - "BatchAlarmEntity": { - "type": "string", - "enum": [ - "alarm" - ] - }, - "BatchAlarm": { - "type": "object", - "properties": { - "entity": { - "$ref": "#/components/schemas/BatchAlarmEntity" - }, - "action": { - "type": "string" - }, - "query": { - "type": "object" - } - } - }, - "BatchDeleteAlarm": { - "type": "object", - "allOf": [ - { - "$ref": "#/components/schemas/BatchAlarm" - }, - { - "properties": { - "action": { - "enum": [ - "delete" - ] - }, - "query": { - "oneOf": [ - { - "$ref": "#/components/schemas/BulkQueryIds" - }, - { - "$ref": "#/components/schemas/BulkQueryFilter" - } - ] - } - } - } - ], - "required": [ - "entity", - "action", - "query" - ] - }, - "BatchUpdateAlarm": { - "type": "object", - "allOf": [ - { - "$ref": "#/components/schemas/BatchAlarm" - }, - { - "properties": { - "actionParameters": { - "$ref": "#/components/schemas/AlarmUpdate" - }, - "action": { - "enum": [ - "update" - ] - }, - "query": { - "$ref": "#/components/schemas/BulkQueryIds" - } - } - } - ], - "required": [ - "entity", - "action", - "query", - "actionParameters" - ] - }, - "BulkQueryIds": { - "type": "object", - "properties": { - "ids": { - "type": "array", - "minItems": 1, - "items": { - "$ref": "#/components/schemas/AlarmId" - } - } - }, - "required": [ - "ids" - ] - }, - "BulkQueryFilter": { - "type": "object", - "description": "Object specifying filters on the alarm to which the operation will be applied.\nAt least one of the filters must be set.", - "properties": { - "type": { - "title": "Alarm Type Filter", - "oneOf": [ - { - "$ref": "#/components/schemas/AlarmType" - }, - { - "type": "array", - "items": { - "$ref": "#/components/schemas/AlarmType" - } - } - ] - }, - "status": { - "title": "Alarm Status Filter", - "oneOf": [ - { - "$ref": "#/components/schemas/AlarmStatus" - }, - { - "type": "array", - "items": { - "$ref": "#/components/schemas/AlarmStatus" - } - } - ] - }, - "severity": { - "title": "Alarm Severity Filter", - "oneOf": [ - { - "$ref": "#/components/schemas/AlarmSeverity" - }, - { - "type": "array", - "items": { - "$ref": "#/components/schemas/AlarmSeverity" - } - } - ] - }, - "source": { - "title": "Alarm Source Filter", - "oneOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "type": "string" - } - } - ] - }, - "dateFrom": { - "allOf": [ - { - "$ref": "#/components/schemas/UnixEpochMillis" - }, - { - "title": "Alarm timestamp filter (>=)" - } - ] - }, - "dateTo": { - "allOf": [ - { - "$ref": "#/components/schemas/UnixEpochMillis" - }, - { - "title": "Alarm timestamp filter (<=)" - } - ] - }, - "assignee": { - "$ref": "#/components/schemas/AlarmAssignee" - }, - "creationTimeFrom": { - "allOf": [ - { - "$ref": "#/components/schemas/UnixEpochMillis" - }, - { - "title": "Alarm creationTime filter (>=)" - } - ] - }, - "creationTimeTo": { - "allOf": [ - { - "$ref": "#/components/schemas/UnixEpochMillis" - }, - { - "title": "Alarm creationTime filter (<=)" - } - ] - }, - "lastUpdatedFrom": { - "allOf": [ - { - "$ref": "#/components/schemas/UnixEpochMillis" - }, - { - "title": "Alarm lastUpdateTime filter (>=)" - } - ] - }, - "lastUpdatedTo": { - "allOf": [ - { - "$ref": "#/components/schemas/UnixEpochMillis" - }, - { - "title": "Alarm lastUpdateTime filter (<=)" - } - ] - }, - "lastTriggeredFrom": { - "allOf": [ - { - "$ref": "#/components/schemas/UnixEpochMillis" - }, - { - "title": "Alarm lastTriggeredTime filter (>=)" - } - ] - }, - "lastTriggeredTo": { - "allOf": [ - { - "$ref": "#/components/schemas/UnixEpochMillis" - }, - { - "title": "Alarm lastTriggeredTime filter (<=)" - } - ] - } - } - }, - "SO8601Timestamp": { - "type": "string", - "format": "date-time", - "example": "2011-09-06T12:03:27.845Z" - }, - "SO8601TimestampOrMillis": { - "description": "ISO8601 timestamp or unix epoch milliseconds.", - "oneOf": [ - { - "$ref": "#/components/schemas/UnixEpochMillis" - }, - { - "$ref": "#/components/schemas/SO8601Timestamp" - } - ] - }, - "UnixEpochMillis": { - "type": "integer", - "description": "Timestamp expressed as milliseconds since 00:00:00 UTC on 1 January 1970, \nnot counting leap seconds.", - "example": 1663269720694 - }, - "AlarmSelfLink": { - "type": "string", - "format": "uri", - "example": "/alarms/v1/alarms/ea381b65-eb57-4dca-b510-44a9efba3cf3" - }, - "IdObject": { - "type": "object", - "description": "A JSON object with an id field indicating the resource.", - "properties": { - "id": { - "type": "string", - "title": "Resource Id" - } - }, - "required": [ - "id" - ], - "example": { - "id": "12345" - } - }, - "AlarmStatus": { - "type": "string", - "enum": [ - "ACTIVE", - "ACKNOWLEDGED", - "CLEARED" - ], - "default": "ACTIVE" - }, - "AlarmSeverity": { - "type": "string", - "enum": [ - "CRITICAL", - "MAJOR", - "MINOR", - "WARNING" - ] - }, - "AlarmEntity": { - "type": "object", - "properties": { - "id": { - "$ref": "#/components/schemas/AlarmId" - }, - "creationTime": { - "$ref": "#/components/schemas/SO8601Timestamp" - }, - "lastUpdateTime": { - "$ref": "#/components/schemas/SO8601Timestamp" - }, - "lastTriggeredTime": { - "$ref": "#/components/schemas/SO8601Timestamp" - }, - "type": { - "$ref": "#/components/schemas/AlarmType" - }, - "text": { - "$ref": "#/components/schemas/AlarmText" - }, - "timestamp": { - "$ref": "#/components/schemas/SO8601Timestamp" - }, - "source": { - "$ref": "#/components/schemas/IdObject" - }, - "severity": { - "$ref": "#/components/schemas/AlarmSeverity" - }, - "status": { - "$ref": "#/components/schemas/AlarmStatus" - }, - "count": { - "title": "Event count", - "description": "The number of times this alarm has been sent", - "type": "integer", - "minimum": 1 - }, - "assignee": { - "$ref": "#/components/schemas/AlarmAssignee" - }, - "history": { - "title": "History of modifications", - "type": "array", - "minItems": 1, - "items": { - "$ref": "#/components/schemas/AlarmAuditRecord" - } - }, - "self": { - "$ref": "#/components/schemas/AlarmSelfLink" - }, - "additionalProperties": { - "description": "Additional properties that were present in the creation payload", - "type": "object", - "example": { - "task": "1e294c8b-8a7d-4770-997e-2d57fc5ad6ea", - "myRef": "902d4191-d1ab-47ae-8405-c33bb237f1d5" - } - } - }, - "required": [ - "id", - "creationTime", - "lastUpdateTime", - "lastTriggeredTime", - "type", - "text", - "timestamp", - "source", - "severity", - "status", - "count" - ] - }, - "AlarmAuditRecord": { - "type": "object", - "properties": { - "id": { - "type": "string", - "example": "ca0c5181-11dc-47dd-aeb3-a7a508ea1599\"" - }, - "type": { - "$ref": "#/components/schemas/AlarmEventType" - }, - "text": { - "type": "string", - "description": "Text describing the change", - "example": "Alarm raised" - }, - "timestamp": { - "allOf": [ - { - "$ref": "#/components/schemas/SO8601Timestamp" - }, - { - "description": "timestamp when the change happened" - } - ] - } - }, - "required": [ - "id", - "type", - "text", - "timestamp" - ] - }, - "AlarmsQueryResult": { - "type": "object", - "properties": { - "self": { - "type": "string", - "format": "uri", - "description": "Link to alarm query", - "example": "/alarms/v1/alarms?page=3" - }, - "alarms": { - "type": "array", - "title": "List of alarms", - "items": { - "$ref": "#/components/schemas/AlarmEntity" - } - }, - "total": { - "type": "integer", - "description": "Total number of alarms that fulfill the criteria", - "example": 248 - }, - "next": { - "type": "string", - "format": "uri", - "description": "Link to the next page of results (if more results are available)", - "example": "/alarms/v1/alarms?page=4" - }, - "prev": { - "type": "string", - "format": "uri", - "description": "Link to the previous page of result (if previous page is available)", - "example": "/alarms/v1/alarms?page=2" - } - }, - "required": [ - "self", - "alarms", - "total" - ] - }, - "AlarmTimelineInfo": { - "type": "object", - "description": "The alarm as it is after the event", - "properties": { - "id": { - "$ref": "#/components/schemas/AlarmId" - }, - "creationTime": { - "$ref": "#/components/schemas/SO8601Timestamp" - }, - "timestamp": { - "$ref": "#/components/schemas/SO8601Timestamp" - }, - "source": { - "$ref": "#/components/schemas/IdObject" - }, - "type": { - "$ref": "#/components/schemas/AlarmType" - }, - "text": { - "$ref": "#/components/schemas/AlarmText" - }, - "severity": { - "$ref": "#/components/schemas/AlarmSeverity" - }, - "status": { - "$ref": "#/components/schemas/AlarmStatus" - }, - "assignee": { - "$ref": "#/components/schemas/AlarmAssignee" - } - }, - "required": [ - "id", - "creationTime", - "timestamp", - "source", - "type", - "text", - "severity", - "status" - ] - }, - "AlarmTimelineTimestamp": { - "description": "Timestamp of the event", - "type": "integer", - "example": 1663269720694 - }, - "AlarmsTimelineItem": { - "type": "object", - "properties": { - "timestamp": { - "$ref": "#/components/schemas/AlarmTimelineTimestamp" - }, - "type": { - "$ref": "#/components/schemas/AlarmEventType" - }, - "alarm": { - "$ref": "#/components/schemas/AlarmTimelineInfo" - } - }, - "required": [ - "timestamp", - "type", - "alarm" - ] - }, - "AlarmEventType": { - "type": "string", - "oneOf": [ - { - "enum": [ - "io.waylay.alarm.AlarmRaised" - ], - "description": "A new alarm was created." - }, - { - "enum": [ - "io.waylay.alarm.EventOccuredAgain" - ], - "description": "An alarm happened again." - }, - { - "enum": [ - "io.waylay.alarm.AlarmUpdated" - ], - "description": "An alarm was updated." - } - ] - }, - "AlarmEvent": { - "type": "object", - "properties": { - "eventtype": { - "$ref": "#/components/schemas/AlarmEventType" - }, - "eventtime": { - "$ref": "#/components/schemas/SO8601Timestamp" - }, - "alarm": { - "$ref": "#/components/schemas/AlarmEventAlarm" - }, - "changes": { - "type": "array", - "description": "Describes the changes that where done\n\nWill only be there if `eventtype` is `io.waylay.alarm.AlarmUpdated`", - "items": { - "type": "object", - "properties": { - "attribute": { - "type": "string", - "example": "severity" - }, - "type": { - "type": "string", - "description": "Indication of what has changed", - "enum": [ - "io.waylay.alarm.change.severity", - "io.waylay.alarm.change.status", - "io.waylay.alarm.change.attribute" - ] - }, - "oldValue": { - "type": "string", - "nullable": true, - "example": "MAJOR" - }, - "newValue": { - "type": "string", - "nullable": true, - "example": "CRITICAL" - } - } - } - } - }, - "required": [ - "eventtype", - "eventtime", - "alarm" - ] - }, - "AlarmEventAlarm": { - "description": "Summary representation of an alarm.", - "type": "object", - "properties": { - "id": { - "$ref": "#/components/schemas/AlarmId" - }, - "tenantId": { - "type": "string" - }, - "creationTime": { - "$ref": "#/components/schemas/SO8601Timestamp" - }, - "type": { - "$ref": "#/components/schemas/AlarmType" - }, - "text": { - "$ref": "#/components/schemas/AlarmText" - }, - "timestamp": { - "$ref": "#/components/schemas/SO8601Timestamp" - }, - "source": { - "$ref": "#/components/schemas/IdObject" - }, - "severity": { - "$ref": "#/components/schemas/AlarmSeverity" - }, - "status": { - "$ref": "#/components/schemas/AlarmStatus" - }, - "count": { - "type": "integer", - "minimum": 1 - } - }, - "required": [ - "id", - "tenantId", - "creationTime", - "type", - "text", - "timestamp", - "source", - "severity", - "status", - "count" - ] - }, - "CloudAlarmEventData": { - "type": "object", - "properties": { - "id": { - "example": "dd59d2d9-9657-4d36-b045-ef97315f2d20" - }, - "source": { - "example": "/alarms/v1/alarms" - }, - "subject": { - "type": "string", - "example": "289dd1a3-35a7-44fa-8596-9aee3ad0b36f/2c49e3bf-547b-42bc-a5e9-9193155ec03d" - }, - "type": { - "enum": [ - "io.waylay.alarms.v1.AlarmRaised", - "io.waylay.alarms.v1.EventOccurredAgain", - "io.waylay.alarms.v1.AlarmUpdated" - ] - }, - "data": { - "$ref": "#/components/schemas/AlarmEvent" - }, - "time": { - "$ref": "#/components/schemas/SO8601Timestamp" - } - } - }, - "CloudAlarmEvent": { - "allOf": [ - { - "$ref": "./cloudevents.schema.yaml#/definitions/cloudevent_json" - }, - { - "$ref": "#/components/schemas/CloudAlarmEventData" - }, - { - "required": [ - "subject", - "time" - ] - } - ], - "example": { - "time": "2011-09-06T12:03:27.845Z", - "type": "io.waylay.alarms.v1.AlarmUpdated", - "subject": "289dd1a3-35a7-44fa-8596-9aee3ad0b36f/2c49e3bf-547b-42bc-a5e9-9193155ec03d" - } - }, - "BatchId": { - "type": "string", - "example": "afcea5a1-81df-44f6-bd34-e0b602a2cf3d" - }, - "BatchOperation": { - "type": "object", - "properties": { - "id": { - "$ref": "#/components/schemas/BatchId" - }, - "user": { - "type": "string", - "description": "User id of the user who started the operation", - "example": "user/22f6dfdf-a50c-4eab-953e-8d2e56891dbe" - }, - "operation": { - "type": "object", - "description": "Summary of the batch operation", - "properties": { - "entity": { - "$ref": "#/components/schemas/BatchAlarmEntity" - }, - "action": { - "type": "string", - "enum": [ - "delete", - "update" - ] - }, - "description": { - "type": "string", - "description": "Description of the operation", - "example": "deleting 3 alarms" - } - }, - "required": [ - "entity", - "action", - "description" - ] - }, - "queueTime": { - "$ref": "#/components/schemas/SO8601Timestamp" - } - }, - "required": [ - "id", - "user", - "operation", - "queueTime" - ] - }, - "SuccessOperationResult": { - "type": "object", - "description": "Object containing the successful operation results. \nThe keys will be alarm ids.", - "additionalProperties": { - "type": "object", - "description": "The keys will be alarm ids.", - "properties": { - "statusCode": { - "type": "integer", - "description": "The statusCode of the operation" - } - }, - "required": [ - "statusCode" - ] - } - }, - "FailureOperationResult": { - "type": "object", - "description": "Object containing the unsuccessful operation results. \nThe keys will be alarm ids.", - "additionalProperties": { - "type": "object", - "description": "The keys will be alarm ids.", - "properties": { - "statusCode": { - "type": "integer", - "description": "The statusCode of the operation" - }, - "error": { - "type": "string", - "description": "Error description of what went wrong." - } - }, - "required": [ - "statusCode", - "error" - ] - } - }, - "OperationResultObject": { - "description": "Finished Batch Operation results", - "type": "object", - "properties": { - "finishedTime": { - "$ref": "#/components/schemas/SO8601Timestamp" - }, - "results": { - "type": "object", - "properties": { - "success": { - "$ref": "#/components/schemas/SuccessOperationResult" - }, - "failure": { - "$ref": "#/components/schemas/FailureOperationResult" - } - }, - "required": [ - "success", - "failure" - ] - } - }, - "required": [ - "finishedTime", - "results" - ] - }, - "BatchOperationResult": { - "allOf": [ - { - "$ref": "#/components/schemas/BatchOperation" - }, - { - "$ref": "#/components/schemas/OperationResultObject" - } - ], - "example": { - "id": "afcea5a1-81df-44f6-bd34-e0b602a2cf3d", - "user": "user/22f6dfdf-a50c-4eab-953e-8d2e56891dbe", - "operation": { - "entity": "alarm", - "action": "delete", - "description": "deleting 3 alarms" - }, - "queueTime": "2020-04-27T09:54:44.051Z", - "finishedTime": "2020-04-27T09:54:44.129Z", - "results": { - "success": { - "df036bf8-4b32-4bd8-8ee7-42800ab26bf5": { - "statusCode": 204 - } - }, - "failure": { - "586ac2f2-fbec-426a-b696-d63d6cb153ac": { - "statusCode": "404,", - "error": "alarm with id '586ac2f2-fbec-426a-b696-d63d6cb153ac' not found" - }, - "e64de65c-e3ef-482d-9eb7-32ca17d1e147": { - "statusCode": "404,", - "error": "alarm with id 'e64de65c-e3ef-482d-9eb7-32ca17d1e147' not found" - } - } - } - } - } - }, - "parameters": { - "AlarmId": { - "name": "alarmId", - "in": "path", - "description": "Unique Alarm Identifier", - "required": true, - "schema": { - "$ref": "#/components/schemas/AlarmId" - } - }, - "BatchId": { - "name": "batchId", - "in": "path", - "description": "Unique Batch Operation identifier", - "required": true, - "schema": { - "$ref": "#/components/schemas/BatchId" - } - } - }, - "requestBodies": { - "AlarmsSpecification": { - "description": "Alarm Operations", - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateAlarm" - } - } - } - }, - "BatchAlarmsSpecification": { - "description": "Batch Alarm Operation", - "required": true, - "content": { - "application/json": { - "schema": { - "title": "a batch alarms specification", - "type": "object", - "oneOf": [ - { - "$ref": "#/components/schemas/BatchUpdateAlarm" - }, - { - "$ref": "#/components/schemas/BatchDeleteAlarm" - } - ] - } - } - } - } - }, - "responses": { - "DefaultSuccessResponse": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "type": "object" - } - } - } - }, - "ErrorResponse": { - "description": "Error Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "ErrorResponseWithDetails": { - "description": "Error Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponseWithDetails" - } - } - } - }, - "VersionResponse": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/VersionResponse" - } - } - } - }, - "SuccessCreationResponse": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AlarmEntity" - } - } - } - }, - "AlarmNotFoundResponse": { - "description": "Alarm Not Found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - }, - "example": { - "statusCode": 404, - "error": "alarm with id '2c49e3bf-547b-42bc-a5e9-9193155ec03d' not found" - } - } - } - }, - "GetEventStreamResponse": { - "description": "Alarm Events Stream", - "content": { - "application/x-ndjson": { - "schema": { - "title": "NdJsonResponseStream", - "oneOf": [ - { - "$ref": "#/components/schemas/AlarmEvent" - }, - { - "$ref": "#/components/schemas/CloudAlarmEvent" - } - ], - "example": { - "time": "2011-09-06T12:03:27.845Z", - "type": "io.waylay.alarms.v1.AlarmUpdated", - "subject": "289dd1a3-35a7-44fa-8596-9aee3ad0b36f/2c49e3bf-547b-42bc-a5e9-9193155ec03d" - } - } - }, - "text/event-stream": { - "schema": { - "title": "SSEventStream", - "oneOf": [ - { - "$ref": "#/components/schemas/AlarmEvent" - }, - { - "$ref": "#/components/schemas/CloudAlarmEvent" - } - ] - } - } - } - }, - "BatchStartResponse": { - "description": "Batch Operation Started", - "content": { - "application/json": { - "schema": { - "title": "Batch operation enqueued", - "type": "object", - "properties": { - "statusCode": { - "type": "integer", - "example": 202 - }, - "uri": { - "type": "string", - "description": "URI where the batch operation status can be followed", - "format": "uri", - "example": "/alarms/v1/batch/afcea5a1-81df-44f6-bd34-e0b602a2cf3d" - }, - "entity": { - "type": "object", - "properties": { - "id": { - "$ref": "#/components/schemas/BatchId" - }, - "queueTime": { - "$ref": "#/components/schemas/SO8601Timestamp" - }, - "operation": { - "title": "Queued operation summary", - "type": "object", - "properties": { - "entity": { - "$ref": "#/components/schemas/BatchAlarmEntity" - }, - "action": { - "type": "string", - "enum": [ - "update", - "delete" - ] - } - }, - "required": [ - "entity", - "action" - ] - } - }, - "required": [ - "id", - "queueTime", - "operation" - ] - } - }, - "required": [ - "statusCode", - "uri", - "entity" - ] - } - } - }, - "headers": { - "Location": { - "description": "URI where the batch operation status can be followed", - "example": "/alarms/v1/batch/afcea5a1-81df-44f6-bd34-e0b602a2cf3d", - "schema": { - "type": "string", - "format": "uri" - } - } - } - }, - "GetBatchOperationResponse": { - "description": "Get Batch Operation", - "content": { - "application/json": { - "schema": { - "title": "BatchOperationResults", - "anyOf": [ - { - "$ref": "#/components/schemas/BatchOperationResult" - }, - { - "$ref": "#/components/schemas/BatchOperation" - } - ] - } - } - } - }, - "BatchNotFoundResponse": { - "description": "Batch Operation Not Found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - }, - "example": { - "statusCode": 404, - "error": "Operation with id 'afcea5a1-81df-44f6-bd34-e0b602a2cf3d' not found" - } - } - } - } - }, - "securitySchemes": { - "waylayApiKeySecret": { - "type": "http", - "description": "Waylay apiKey/apiSecret basic authentication. All endpoints support also Waylay JWT Bearer authentication.", - "scheme": "basic" - } - } - }, - "servers": [ - { - "url": "https://api.waylay.io", - "description": "Waylay enterprise gateway" - } - ] -} - diff --git a/test/_run/openapi/cloudevents.schema.yaml b/test/_run/openapi/cloudevents.schema.yaml deleted file mode 100644 index b801577..0000000 --- a/test/_run/openapi/cloudevents.schema.yaml +++ /dev/null @@ -1,110 +0,0 @@ -$schema: http://json-schema.org/draft-07/schema# -description: CloudEvents Specification JSON Schema -definitions: - iddef: - type: string - minLength: 1 - description: Identifies the event. - sourcedef: - type: string - format: uri-reference - minLength: 1 - description: Identifies the context in which an event happened. - examples: - - https://github.com/cloudevents - - mailto:cncf-wg-serverless@lists.cncf.io - - urn:uuid:6e8bc430-9c3a-11d9-9669-0800200c9a66 - - cloudevents/spec/pull/123 - - /sensors/tn-1234567/alerts - - 1-555-123-4567 - specversiondef: - type: string - minLength: 1 - description: The version of the CloudEvents specification which the event uses. - examples: - - '1.0' - typedef: - type: string - minLength: 1 - description: Describes the type of event related to the originating occurrence. - datacontenttypedef: - type: string - minLength: 1 - description: Content type of the data value. Must adhere to RFC 2046 format. - examples: - - application/json - - text/xml - - image/png - - multipart/form-data - dataschemadef: - type: string - format: uri - minLength: 1 - description: Identifies the schema that data adheres to. - subjectdef: - type: string - minLength: 1 - description: Describes the subject of the event in the context of the event producer - (identified by source). - timedef: - type: string - format: date-time - minLength: 1 - description: Timestamp of when the occurrence happened. Must adhere to RFC 3339. - examples: - - '2018-04-05T17:31:00Z' - data_base64def: - type: string - contentEncoding: base64 - description: Base64 encoded event payload. Must adhere to RFC4648. - json_data: - properties: - datacontenttype: - allOf: - - $ref: '#/definitions/datacontenttypedef' - - enum: - - application/json - data: - description: The event payload. - required: - - datacontenttype - - data - base64_data: - properties: - data_base64: - $ref: '#/definitions/data_base64def' - required: - - data_base64 - mandatory_properties: - properties: - id: - $ref: '#/definitions/iddef' - source: - $ref: '#/definitions/sourcedef' - specversion: - $ref: '#/definitions/specversiondef' - type: - $ref: '#/definitions/typedef' - required: - - id - - source - - specversion - - type - optional_properties: - properties: - subject: - $ref: '#/definitions/subjectdef' - time: - $ref: '#/definitions/timedef' - cloudevent_json: - title: Cloud Event - allOf: - - $ref: '#/definitions/mandatory_properties' - - $ref: '#/definitions/optional_properties' - - $ref: '#/definitions/json_data' - cloudevent_binary: - title: Cloud Event - allOf: - - $ref: '#/definitions/mandatory_properties' - - $ref: '#/definitions/optional_properties' - - $ref: '#/definitions/base64_data' diff --git a/test/_run/openapi/cloudevents.schema.yaml.json b/test/_run/openapi/cloudevents.schema.yaml.json deleted file mode 100644 index 6e3e5b5..0000000 --- a/test/_run/openapi/cloudevents.schema.yaml.json +++ /dev/null @@ -1,168 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "description": "CloudEvents Specification JSON Schema", - "definitions": { - "iddef": { - "type": "string", - "minLength": 1, - "description": "Identifies the event." - }, - "sourcedef": { - "type": "string", - "format": "uri-reference", - "minLength": 1, - "description": "Identifies the context in which an event happened.", - "examples": [ - "https://github.com/cloudevents", - "mailto:cncf-wg-serverless@lists.cncf.io", - "urn:uuid:6e8bc430-9c3a-11d9-9669-0800200c9a66", - "cloudevents/spec/pull/123", - "/sensors/tn-1234567/alerts", - "1-555-123-4567" - ] - }, - "specversiondef": { - "type": "string", - "minLength": 1, - "description": "The version of the CloudEvents specification which the event uses.", - "examples": [ - "1.0" - ] - }, - "typedef": { - "type": "string", - "minLength": 1, - "description": "Describes the type of event related to the originating occurrence." - }, - "datacontenttypedef": { - "type": "string", - "minLength": 1, - "description": "Content type of the data value. Must adhere to RFC 2046 format.", - "examples": [ - "application/json", - "text/xml", - "image/png", - "multipart/form-data" - ] - }, - "dataschemadef": { - "type": "string", - "format": "uri", - "minLength": 1, - "description": "Identifies the schema that data adheres to." - }, - "subjectdef": { - "type": "string", - "minLength": 1, - "description": "Describes the subject of the event in the context of the event producer (identified by source)." - }, - "timedef": { - "type": "string", - "format": "date-time", - "minLength": 1, - "description": "Timestamp of when the occurrence happened. Must adhere to RFC 3339.", - "examples": [ - "2018-04-05T17:31:00Z" - ] - }, - "data_base64def": { - "type": "string", - "contentEncoding": "base-64", - "description": "Base64 encoded event payload. Must adhere to RFC4648." - }, - "json_data": { - "properties": { - "datacontenttype": { - "allOf": [ - { - "$ref": "#/definitions/datacontenttypedef" - }, - { - "enum": [ - "application/json" - ] - } - ] - }, - "data": { - "description": "The event payload." - } - }, - "required": [ - "datacontenttype", - "data" - ] - }, - "base64_data": { - "properties": { - "data_base64": { - "$ref": "#/definitions/data_base64def" - } - }, - "required": [ - "data_base64" - ] - }, - "mandatory_properties": { - "properties": { - "id": { - "$ref": "#/definitions/iddef" - }, - "source": { - "$ref": "#/definitions/sourcedef" - }, - "specversion": { - "$ref": "#/definitions/specversiondef" - }, - "type": { - "$ref": "#/definitions/typedef" - } - }, - "required": [ - "id", - "source", - "specversion", - "type" - ] - }, - "optional_properties": { - "properties": { - "subject": { - "$ref": "#/definitions/subjectdef" - }, - "time": { - "$ref": "#/definitions/timedef" - } - } - }, - "cloudevent_json": { - "title": "Cloud Event", - "allOf": [ - { - "$ref": "#/definitions/mandatory_properties" - }, - { - "$ref": "#/definitions/optional_properties" - }, - { - "$ref": "#/definitions/json_data" - } - ] - }, - "cloudevent_binary": { - "title": "Cloud Event", - "allOf": [ - { - "$ref": "#/definitions/mandatory_properties" - }, - { - "$ref": "#/definitions/optional_properties" - }, - { - "$ref": "#/definitions/base64_data" - } - ] - } - } -} - diff --git a/test/api/version_api_test.py b/test/api/about_api_test.py similarity index 83% rename from test/api/version_api_test.py rename to test/api/about_api_test.py index 03a0c89..85d5e27 100644 --- a/test/api/version_api_test.py +++ b/test/api/about_api_test.py @@ -18,7 +18,7 @@ from typeguard import check_type from waylay.sdk import ApiClient, WaylayClient from waylay.sdk.api._models import Model -from waylay.services.alarms.api import VersionApi +from waylay.services.alarms.api import AboutApi from waylay.services.alarms.service import AlarmsService from ..types.version_response_stub import VersionResponseStub @@ -36,13 +36,13 @@ @pytest.fixture -def version_api(waylay_api_client: ApiClient) -> VersionApi: - return VersionApi(waylay_api_client) +def about_api(waylay_api_client: ApiClient) -> AboutApi: + return AboutApi(waylay_api_client) def test_registered(waylay_client: WaylayClient): - """Test that VersionApi api is registered in the sdk client.""" - assert isinstance(waylay_client.alarms.version, VersionApi) + """Test that AboutApi api is registered in the sdk client.""" + assert isinstance(waylay_client.alarms.about, AboutApi) def _get_set_mock_response(httpx_mock: HTTPXMock, gateway_url: str): @@ -60,12 +60,12 @@ def _get_set_mock_response(httpx_mock: HTTPXMock, gateway_url: str): @pytest.mark.skipif(not MODELS_AVAILABLE, reason="Types not installed.") async def test_get(service: AlarmsService, gateway_url: str, httpx_mock: HTTPXMock): """Test case for get - Version + Get Service Information """ # set path params kwargs = {} _get_set_mock_response(httpx_mock, gateway_url) - resp = await service.version.get(**kwargs) + resp = await service.about.get(**kwargs) check_type(resp, Union[VersionResponse,]) @@ -75,10 +75,10 @@ async def test_get_without_types( service: AlarmsService, gateway_url: str, httpx_mock: HTTPXMock ): """Test case for get with models not installed - Version + Get Service Information """ # set path params kwargs = {} _get_set_mock_response(httpx_mock, gateway_url) - resp = await service.version.get(**kwargs) + resp = await service.about.get(**kwargs) check_type(resp, Model) diff --git a/test/api/alarm_events_api_test.py b/test/api/alarm_events_api_test.py index c785447..c522496 100644 --- a/test/api/alarm_events_api_test.py +++ b/test/api/alarm_events_api_test.py @@ -11,7 +11,7 @@ import json import re from importlib.util import find_spec -from typing import Union +from typing import AsyncIterator, Union, get_args import pytest from pytest_httpx import HTTPXMock @@ -51,8 +51,9 @@ def _get_set_mock_response(httpx_mock: HTTPXMock, gateway_url: str): httpx_mock_kwargs = { "method": "GET", "url": re.compile(f"^{gateway_url}/alarms/v1/events(\\?.*)?"), - "content": json.dumps(mock_response, default=str), + "content": json.dumps(mock_response, default=str) + "\n", "status_code": 200, + "headers": {"content-type": "application/x-ndjson"}, } httpx_mock.add_response(**httpx_mock_kwargs) @@ -72,7 +73,10 @@ async def test_get(service: AlarmsService, gateway_url: str, httpx_mock: HTTPXMo } _get_set_mock_response(httpx_mock, gateway_url) resp = await service.alarm_events.get(**kwargs) - check_type(resp, Union[NdJsonResponseStream,]) + check_type(resp, Union[AsyncIterator[NdJsonResponseStream],]) + async for item in resp: + check_type(item, get_args(Union[AsyncIterator[NdJsonResponseStream],])[0]) + break # Test only the first value @pytest.mark.asyncio @@ -92,3 +96,6 @@ async def test_get_without_types( _get_set_mock_response(httpx_mock, gateway_url) resp = await service.alarm_events.get(**kwargs) check_type(resp, Model) + async for item in resp: + check_type(item, Model) + break # Test only the first value diff --git a/waylay-sdk-alarms-types/.openapi-generator/FILES b/waylay-sdk-alarms-types/.openapi-generator/FILES index 2f5632f..7b8a034 100644 --- a/waylay-sdk-alarms-types/.openapi-generator/FILES +++ b/waylay-sdk-alarms-types/.openapi-generator/FILES @@ -1,5 +1,4 @@ LICENSE.txt -README.md pyproject.toml src/waylay/services/alarms/models/__init__.py src/waylay/services/alarms/models/a_batch_alarms_specification.py @@ -63,8 +62,8 @@ src/waylay/services/alarms/models/ss_event_stream.py src/waylay/services/alarms/models/success_operation_result_value.py src/waylay/services/alarms/models/version_response.py src/waylay/services/alarms/queries/__init__.py +src/waylay/services/alarms/queries/about_api.py src/waylay/services/alarms/queries/alarm_events_api.py src/waylay/services/alarms/queries/alarms_api.py src/waylay/services/alarms/queries/alarms_batch_operations_api.py src/waylay/services/alarms/queries/py.typed -src/waylay/services/alarms/queries/version_api.py diff --git a/waylay-sdk-alarms-types/README.md b/waylay-sdk-alarms-types/README.md index 5f653b7..704e288 100644 --- a/waylay-sdk-alarms-types/README.md +++ b/waylay-sdk-alarms-types/README.md @@ -3,6 +3,7 @@ No description provided (generated by Openapi Generator https://github.com/opena This Python package is automatically generated based on the Waylay Alarms OpenAPI specification (API version: 1.11.0) +For more information, please visit [the openapi specification](https://docs.waylay.io/openapi/public/redocly/alarms.html). It is considered an extension of the waylay-sdk-alarms package, and it consists of the typed model classes for all path params, query params, body params and responses for each of the api methods in `waylay-sdk-alarms`. @@ -10,21 +11,20 @@ It is considered an extension of the waylay-sdk-alarms package, and it consists This package requires Python 3.9+. ## Installation -Typically this package is installed when installing the [waylay-sdk](https://github.com/waylayio/waylay-sdk-py) package to enable the service's functionality. +Typically this package is installed when installing the [waylay-sdk-core](https://pypi.org/project/waylay-sdk/) package to enable the service's functionality. When the service api methods are required, waylay-sdk-alarms is included in: -- ```pip install waylay-sdk[alarms]``` to install `waylay-sdk` along with only this service, or -- ```pip install waylay-sdk[services]``` to install `waylay-sdk` along with all services. +- ```pip install waylay-sdk-core[alarms]``` to install `waylay-sdk-core` along with only this service, or +- ```pip install waylay-sdk-core[services]``` to install `waylay-sdk-core` along with all services. When the typed models are required, both waylay-sdk-alarms and waylay-sdk-alarms-types are included in: -- ```pip install waylay-sdk[alarms,alarms-types]``` to install `waylay-sdk` along with only this service including the typed models, or -- ```pip install waylay-sdk[services,services-types]``` to install `waylay-sdk` along with all services along with the typed models. +- ```pip install waylay-sdk-core[alarms,alarms-types]``` to install `waylay-sdk-core` along with only this service including the typed models, or +- ```pip install waylay-sdk-core[services,services-types]``` to install `waylay-sdk-core` along with all services along with the typed models. ## Usage - ```python from pprint import pprint -# Import the waylay-client from the waylay-sdk package +# Import the waylay-client from the waylay-sdk-core package from waylay.sdk.client import WaylayClient from waylay.sdk.api.api_exceptions import ApiError @@ -32,21 +32,17 @@ from waylay.sdk.api.api_exceptions import ApiError waylay_client = WaylayClient.from_profile() # Note that the typed model classes for responses/parameters/... are only available when `waylay-sdk-alarms-types` is installed -from ..models.get_eventstream_event_format_parameter import GetEventstreamEventFormatParameter -from ..models.nd_json_response_stream import NdJsonResponseStream +from waylay.services.alarms.models.version_response import VersionResponse try: - # Alarm Events - # calls `GET /alarms/v1/events` - api_response = await waylay_client.alarms.alarm_events.get( - # query parameters: - query = { - 'eventFormat': 'application/cloudevents+json' - }, + # Get Service Information + # calls `GET /alarms/v1` + api_response = await waylay_client.alarms.about.get( ) - print("The response of alarms.alarm_events.get:\n") + print("The response of alarms.about.get:\n") pprint(api_response) except ApiError as e: - print("Exception when calling alarms.alarm_events.get: %s\n" % e) + print("Exception when calling alarms.about.get: %s\n" % e) ``` +For more information, please visit the [Waylay API documentation](https://docs.waylay.io/#/api/?id=software-development-kits). diff --git a/waylay-sdk-alarms-types/pyproject.toml b/waylay-sdk-alarms-types/pyproject.toml index 76a0345..950fa58 100644 --- a/waylay-sdk-alarms-types/pyproject.toml +++ b/waylay-sdk-alarms-types/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "waylay-sdk-alarms-types" -version = "1.11.0rc1" +version = "1.11.0" description = "Waylay Alarms Types " authors = [ { name = "Waylay", email = "info@waylay.io"} @@ -12,7 +12,8 @@ authors = [ keywords = ["Waylay Alarms" , "Types"] requires-python = ">= 3.9" dependencies = [ - "waylay-sdk ~= 0.0.4rc5", + "waylay-sdk-core ~= 0.2.0", + "waylay-sdk-alarms == 1.11.0", "pydantic ~= 2.6", "typing-extensions ~= 4.10", "eval-type-backport ~= 0.1.3; python_version < '3.10'", @@ -22,8 +23,9 @@ license={file = "LICENSE.txt"} [project.urls] Homepage = "https://www.waylay.io/" -Documentation = "https://docs.waylay.io/#/" +Documentation = "https://docs.waylay.io/#/api/?id=software-development-kits" Repository = "https://github.com/waylayio/waylay-sdk-alarms-py.git" +"Openapi Specification" = "https://docs.waylay.io/openapi/public/redocly/alarms.html" [project.optional-dependencies] dev = [ diff --git a/waylay-sdk-alarms-types/src/waylay/services/alarms/models/__init__.py b/waylay-sdk-alarms-types/src/waylay/services/alarms/models/__init__.py index 38cb1b3..15f9af2 100644 --- a/waylay-sdk-alarms-types/src/waylay/services/alarms/models/__init__.py +++ b/waylay-sdk-alarms-types/src/waylay/services/alarms/models/__init__.py @@ -12,7 +12,7 @@ Do not edit the class manually. """ -__version__ = "1.11.0rc1" +__version__ = "1.11.0" # import models into model package from .a_batch_alarms_specification import ABatchAlarmsSpecification diff --git a/waylay-sdk-alarms-types/src/waylay/services/alarms/queries/version_api.py b/waylay-sdk-alarms-types/src/waylay/services/alarms/queries/about_api.py similarity index 100% rename from waylay-sdk-alarms-types/src/waylay/services/alarms/queries/version_api.py rename to waylay-sdk-alarms-types/src/waylay/services/alarms/queries/about_api.py diff --git a/waylay-sdk-alarms/.openapi-generator/FILES b/waylay-sdk-alarms/.openapi-generator/FILES index bf23f94..72950df 100644 --- a/waylay-sdk-alarms/.openapi-generator/FILES +++ b/waylay-sdk-alarms/.openapi-generator/FILES @@ -1,12 +1,11 @@ LICENSE.txt -README.md pyproject.toml src/waylay/services/alarms/api/__init__.py +src/waylay/services/alarms/api/about_api.py src/waylay/services/alarms/api/alarm_events_api.py src/waylay/services/alarms/api/alarms_api.py src/waylay/services/alarms/api/alarms_batch_operations_api.py src/waylay/services/alarms/api/py.typed -src/waylay/services/alarms/api/version_api.py src/waylay/services/alarms/service/__init__.py src/waylay/services/alarms/service/py.typed src/waylay/services/alarms/service/service.py diff --git a/waylay-sdk-alarms/README.md b/waylay-sdk-alarms/README.md index 58a5c0a..9839fdb 100644 --- a/waylay-sdk-alarms/README.md +++ b/waylay-sdk-alarms/README.md @@ -3,29 +3,29 @@ No description provided (generated by Openapi Generator https://github.com/opena This Python package is automatically generated based on the Waylay Alarms OpenAPI specification (API version: 1.11.0) +For more information, please visit [the openapi specification](https://docs.waylay.io/openapi/public/redocly/alarms.html). -It consists of a plugin for the waylay-sdk package, and contains the Alarms api methods. +It consists of a plugin for the waylay-sdk-core package, and contains the Alarms api methods. Note that the typed model classes for all path params, query params, body params and responses for each of the api methods are contained in a separate package called waylay-sdk-alarms-types. ## Requirements. This package requires Python 3.9+. ## Installation -Typically this package is installed when installing the [waylay-sdk](https://github.com/waylayio/waylay-sdk-py) package to enable the service's functionality. +Typically this package is installed when installing the [waylay-sdk-core](https://pypi.org/project/waylay-sdk/) package to enable the service's functionality. When the service api methods are required, waylay-sdk-alarms is included in: -- ```pip install waylay-sdk[alarms]``` to install `waylay-sdk` along with only this service, or -- ```pip install waylay-sdk[services]``` to install `waylay-sdk` along with all services. +- ```pip install waylay-sdk-core[alarms]``` to install `waylay-sdk-core` along with only this service, or +- ```pip install waylay-sdk-core[services]``` to install `waylay-sdk-core` along with all services. When the typed models are required, both waylay-sdk-alarms and waylay-sdk-alarms-types are included in: -- ```pip install waylay-sdk[alarms,alarms-types]``` to install `waylay-sdk` along with only this service including the typed models, or -- ```pip install waylay-sdk[services,services-types]``` to install `waylay-sdk` along with all services along with the typed models. +- ```pip install waylay-sdk-core[alarms,alarms-types]``` to install `waylay-sdk-core` along with only this service including the typed models, or +- ```pip install waylay-sdk-core[services,services-types]``` to install `waylay-sdk-core` along with all services along with the typed models. ## Usage - ```python from pprint import pprint -# Import the waylay-client from the waylay-sdk package +# Import the waylay-client from the waylay-sdk-core package from waylay.sdk.client import WaylayClient from waylay.sdk.api.api_exceptions import ApiError @@ -33,21 +33,17 @@ from waylay.sdk.api.api_exceptions import ApiError waylay_client = WaylayClient.from_profile() # Note that the typed model classes for responses/parameters/... are only available when `waylay-sdk-alarms-types` is installed -from alarms.models.get_eventstream_event_format_parameter import GetEventstreamEventFormatParameter -from alarms.models.nd_json_response_stream import NdJsonResponseStream +from waylay.services.alarms.models.version_response import VersionResponse try: - # Alarm Events - # calls `GET /alarms/v1/events` - api_response = await waylay_client.alarms.alarm_events.get( - # query parameters: - query = { - 'eventFormat': 'application/cloudevents+json' - }, + # Get Service Information + # calls `GET /alarms/v1` + api_response = await waylay_client.alarms.about.get( ) - print("The response of alarms.alarm_events.get:\n") + print("The response of alarms.about.get:\n") pprint(api_response) except ApiError as e: - print("Exception when calling alarms.alarm_events.get: %s\n" % e) + print("Exception when calling alarms.about.get: %s\n" % e) ``` +For more information, please visit the [Waylay API documentation](https://docs.waylay.io/#/api/?id=software-development-kits). \ No newline at end of file diff --git a/waylay-sdk-alarms/pyproject.toml b/waylay-sdk-alarms/pyproject.toml index 358dacc..3b0cc5e 100644 --- a/waylay-sdk-alarms/pyproject.toml +++ b/waylay-sdk-alarms/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "waylay-sdk-alarms" -version = "1.11.0rc1" +version = "1.11.0" description = "Waylay Alarms" authors = [ { name = "Waylay", email = "info@waylay.io"} @@ -12,8 +12,7 @@ authors = [ keywords = ["Waylay Alarms"] requires-python = ">= 3.9" dependencies = [ - "waylay-sdk ~= 0.0.4rc5", - "waylay-sdk-alarms == 1.11.0rc1", + "waylay-sdk-core ~= 0.2.0", "pydantic ~= 2.6", "typing-extensions ~= 4.10", "eval-type-backport ~= 0.1.3; python_version < '3.10'", @@ -23,8 +22,9 @@ license={file = "LICENSE.txt"} [project.urls] Homepage = "https://www.waylay.io/" -Documentation = "https://docs.waylay.io/#/" +Documentation = "https://docs.waylay.io/#/api/?id=software-development-kits" Repository = "https://github.com/waylayio/waylay-sdk-alarms-py.git" +"Openapi Specification" = "https://docs.waylay.io/openapi/public/redocly/alarms.html" [project.optional-dependencies] dev = [ diff --git a/waylay-sdk-alarms/src/waylay/services/alarms/api/__init__.py b/waylay-sdk-alarms/src/waylay/services/alarms/api/__init__.py index d17b5ed..0e91959 100644 --- a/waylay-sdk-alarms/src/waylay/services/alarms/api/__init__.py +++ b/waylay-sdk-alarms/src/waylay/services/alarms/api/__init__.py @@ -1,14 +1,14 @@ """Waylay Alarms: apis.""" # import apis into api package +from .about_api import AboutApi from .alarm_events_api import AlarmEventsApi from .alarms_api import AlarmsApi from .alarms_batch_operations_api import AlarmsBatchOperationsApi -from .version_api import VersionApi __all__ = [ + "AboutApi", "AlarmEventsApi", "AlarmsApi", "AlarmsBatchOperationsApi", - "VersionApi", ] diff --git a/waylay-sdk-alarms/src/waylay/services/alarms/api/version_api.py b/waylay-sdk-alarms/src/waylay/services/alarms/api/about_api.py similarity index 95% rename from waylay-sdk-alarms/src/waylay/services/alarms/api/version_api.py rename to waylay-sdk-alarms/src/waylay/services/alarms/api/about_api.py index 3ccdc9e..c6b6bd4 100644 --- a/waylay-sdk-alarms/src/waylay/services/alarms/api/version_api.py +++ b/waylay-sdk-alarms/src/waylay/services/alarms/api/about_api.py @@ -33,12 +33,12 @@ if TYPE_CHECKING: from waylay.services.alarms.models import VersionResponse - from waylay.services.alarms.queries.version_api import GetQuery + from waylay.services.alarms.queries.about_api import GetQuery try: from waylay.services.alarms.models import VersionResponse - from waylay.services.alarms.queries.version_api import GetQuery + from waylay.services.alarms.queries.about_api import GetQuery MODELS_AVAILABLE = True except ImportError: @@ -52,8 +52,8 @@ T = TypeVar("T") -class VersionApi(WithApiClient): - """VersionApi service methods. +class AboutApi(WithApiClient): + """AboutApi service methods. NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech @@ -131,9 +131,9 @@ async def get( headers: HeaderTypes | None = None, **kwargs, ) -> VersionResponse | T | Response | Model: - """Version. + """Get Service Information. - Get the status and version of the service. + Get the name and version of the service. :param query: URL Query parameters. :type query: GetQuery | QueryParamTypes, optional :param raw_response: If true, return the http Response object instead of returning an api model object, or throwing an ApiError. diff --git a/waylay-sdk-alarms/src/waylay/services/alarms/api/alarm_events_api.py b/waylay-sdk-alarms/src/waylay/services/alarms/api/alarm_events_api.py index 587e1fc..a55042f 100644 --- a/waylay-sdk-alarms/src/waylay/services/alarms/api/alarm_events_api.py +++ b/waylay-sdk-alarms/src/waylay/services/alarms/api/alarm_events_api.py @@ -13,6 +13,7 @@ from typing import ( TYPE_CHECKING, Any, + AsyncIterator, Dict, Literal, TypeVar, @@ -29,6 +30,7 @@ Response, ) from waylay.sdk.api._models import Model +from waylay.sdk.api.constants import STREAM_TIMEOUTS from waylay.sdk.plugin import WithApiClient if TYPE_CHECKING: @@ -70,8 +72,10 @@ async def get( select_path: Literal[""] = "", response_type: Literal[None] = None, headers: HeaderTypes | None = None, + stream: bool = True, + timeout=STREAM_TIMEOUTS, **kwargs, - ) -> NdJsonResponseStream: ... + ) -> AsyncIterator[NdJsonResponseStream]: ... @overload async def get( @@ -82,8 +86,10 @@ async def get( select_path: Literal[""] = "", response_type: T, headers: HeaderTypes | None = None, + stream: bool = True, + timeout=STREAM_TIMEOUTS, **kwargs, - ) -> T: ... + ) -> AsyncIterator[T]: ... @overload async def get( @@ -94,6 +100,8 @@ async def get( select_path: Literal["_not_used_"] = "_not_used_", response_type: Literal[None] = None, # not used headers: HeaderTypes | None = None, + stream: bool = True, + timeout=STREAM_TIMEOUTS, **kwargs, ) -> Response: ... @@ -106,8 +114,10 @@ async def get( select_path: str, response_type: Literal[None] = None, headers: HeaderTypes | None = None, + stream: bool = True, + timeout=STREAM_TIMEOUTS, **kwargs, - ) -> Model: ... + ) -> AsyncIterator[Model]: ... @overload async def get( @@ -118,8 +128,10 @@ async def get( select_path: str, response_type: T, headers: HeaderTypes | None = None, + stream: bool = True, + timeout=STREAM_TIMEOUTS, **kwargs, - ) -> T: ... + ) -> AsyncIterator[T]: ... async def get( self, @@ -129,8 +141,15 @@ async def get( select_path: str = "", response_type: T | None = None, headers: HeaderTypes | None = None, + stream: bool = True, + timeout=STREAM_TIMEOUTS, **kwargs, - ) -> NdJsonResponseStream | T | Response | Model: + ) -> ( + AsyncIterator[NdJsonResponseStream] + | AsyncIterator[T] + | Response + | AsyncIterator[Model] + ): """Alarm Events. Opens a data stream for all Alarm Events for this tenant. @@ -192,6 +211,8 @@ async def get( params=query, **body_args, headers=headers, + stream=stream, + timeout=timeout, **kwargs, response_type=response_types_map, select_path=select_path, diff --git a/waylay-sdk-alarms/src/waylay/services/alarms/service/__init__.py b/waylay-sdk-alarms/src/waylay/services/alarms/service/__init__.py index f50514b..07492de 100644 --- a/waylay-sdk-alarms/src/waylay/services/alarms/service/__init__.py +++ b/waylay-sdk-alarms/src/waylay/services/alarms/service/__init__.py @@ -12,7 +12,7 @@ Do not edit the class manually. """ -__version__ = "1.11.0rc1" +__version__ = "1.11.0" from .service import AlarmsService diff --git a/waylay-sdk-alarms/src/waylay/services/alarms/service/service.py b/waylay-sdk-alarms/src/waylay/services/alarms/service/service.py index 726227e..e80f562 100644 --- a/waylay-sdk-alarms/src/waylay/services/alarms/service/service.py +++ b/waylay-sdk-alarms/src/waylay/services/alarms/service/service.py @@ -2,10 +2,10 @@ from waylay.sdk import ApiClient, WaylayService +from ..api.about_api import AboutApi from ..api.alarm_events_api import AlarmEventsApi from ..api.alarms_api import AlarmsApi from ..api.alarms_batch_operations_api import AlarmsBatchOperationsApi -from ..api.version_api import VersionApi class AlarmsService(WaylayService): @@ -14,16 +14,16 @@ class AlarmsService(WaylayService): name = "alarms" title = "Alarms Service" + about: AboutApi alarm_events: AlarmEventsApi alarms: AlarmsApi alarms_batch_operations: AlarmsBatchOperationsApi - version: VersionApi def __init__(self, api_client: ApiClient): """Create the alarms service.""" super().__init__(api_client) + self.about = AboutApi(api_client) self.alarm_events = AlarmEventsApi(api_client) self.alarms = AlarmsApi(api_client) self.alarms_batch_operations = AlarmsBatchOperationsApi(api_client) - self.version = VersionApi(api_client)