diff --git a/.apigentools-info b/.apigentools-info index dd2525e365..48d962f0e3 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.2", - "regenerated": "2022-05-24 10:04:34.328775", - "spec_repo_commit": "068bc4e7" + "regenerated": "2022-05-24 12:02:31.048411", + "spec_repo_commit": "99dab0c3" }, "v2": { "apigentools_version": "1.6.2", - "regenerated": "2022-05-24 10:04:34.340976", - "spec_repo_commit": "068bc4e7" + "regenerated": "2022-05-24 12:02:31.062217", + "spec_repo_commit": "99dab0c3" } } } \ No newline at end of file diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index f250be829e..ce5de12920 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -10453,6 +10453,7 @@ components: - packetsReceived - networkHop - receivedMessage + - grpcHealthcheckStatus - connection example: statusCode type: string @@ -10472,6 +10473,7 @@ components: - PACKETS_RECEIVED - NETWORK_HOP - RECEIVED_MESSAGE + - GRPC_HEALTHCHECK_STATUS - CONNECTION SyntheticsBasicAuth: description: Object to handle basic authentication when performing the test. @@ -11976,7 +11978,7 @@ components: SyntheticsTestDetailsSubType: description: 'The subtype of the Synthetic API test, `http`, `ssl`, `tcp`, - `dns`, `icmp`, `udp`, `websocket` or `multi`.' + `dns`, `icmp`, `udp`, `websocket`, `grpc` or `multi`.' enum: - http - ssl @@ -11986,6 +11988,7 @@ components: - icmp - udp - websocket + - grpc example: http type: string x-enum-varnames: @@ -11997,6 +12000,7 @@ components: - ICMP - UDP - WEBSOCKET + - GRPC SyntheticsTestDetailsType: description: Type of the Synthetic test, either `api` or `browser`. enum: @@ -12023,6 +12027,12 @@ components: type: string description: Headers to include when performing the test. type: object + SyntheticsTestMetadata: + additionalProperties: + description: A single Metadatum. + type: string + description: Metadata to include when performing the gRPC test. + type: object SyntheticsTestMonitorStatus: description: 'The status of your Synthetic monitor. @@ -12200,6 +12210,8 @@ components: message: description: Message to send for UDP or WebSocket tests. type: string + metadata: + $ref: '#/components/schemas/SyntheticsTestMetadata' method: $ref: '#/components/schemas/HTTPMethod' noSavingResponseBody: @@ -12228,6 +12240,9 @@ components: the same IP address and TCP port number.' type: string + service: + description: gRPC service on which you want to perform the healthcheck. + type: string shouldTrackHops: description: Turns on a traceroute probe to discover all gateways along the path to the host destination. @@ -21570,19 +21585,19 @@ paths: Example: `"check".over(tags).last(count).by(group).count_by_status()` - - `check` name of the check, for example `datadog.agent.up` + - **`check`** name of the check, for example `datadog.agent.up` - - `tags` one or more quoted tags (comma-separated), or "*". for example: `.over("env:prod", - "role:db")`; `over` cannot be blank. + - **`tags`** one or more quoted tags (comma-separated), or "*". for example: + `.over("env:prod", "role:db")`; **`over`** cannot be blank. - - `count` must be at greater than or equal to your max threshold (defined + - **`count`** must be at greater than or equal to your max threshold (defined in the `options`). It is limited to 100. For example, if you''ve specified to notify on 1 critical, 3 ok, and 2 warn statuses, `count` should be at least 3. - - `group` must be specified for check monitors. Per-check grouping is already - explicitly known for some service checks. + - **`group`** must be specified for check monitors. Per-check grouping is + already explicitly known for some service checks. For example, Postgres integration monitors are tagged by `db`, `host`, and `port`, and Network monitors by `host`, `instance`, and `url`. See [Service @@ -21597,28 +21612,28 @@ paths: "string query"'').rollup("count").last("1h")"` - - `event`, the event query string: + - **`event`**, the event query string: - - `string_query` free text query to match against event title and text. + - **`string_query`** free text query to match against event title and text. - - `sources` event sources (comma-separated). + - **`sources`** event sources (comma-separated). - - `status` event statuses (comma-separated). Valid options: error, warn, and - info. + - **`status`** event statuses (comma-separated). Valid options: error, warn, + and info. - - `priority` event priorities (comma-separated). Valid options: low, normal, + - **`priority`** event priorities (comma-separated). Valid options: low, normal, all. - - `host` event reporting host (comma-separated). + - **`host`** event reporting host (comma-separated). - - `tags` event tags (comma-separated). + - **`tags`** event tags (comma-separated). - - `excluded_tags` excluded event tags (comma-separated). + - **`excluded_tags`** excluded event tags (comma-separated). - - `rollup` the stats roll-up method. `count` is the only supported method + - **`rollup`** the stats roll-up method. `count` is the only supported method now. - - `last` the timeframe to roll up the counts. Examples: 45m, 4h. Supported + - **`last`** the timeframe to roll up the counts. Examples: 45m, 4h. Supported timeframes: m, h and d. This value should not exceed 48 hours. @@ -21633,18 +21648,19 @@ paths: operator #` - - `query` The search query - following the [Log search syntax](https://docs.datadoghq.com/logs/search_syntax/). + - **`query`** The search query - following the [Log search syntax](https://docs.datadoghq.com/logs/search_syntax/). - - `rollup_method` The stats roll-up method - supports `count`, `avg` and `cardinality`. + - **`rollup_method`** The stats roll-up method - supports `count`, `avg` and + `cardinality`. - - `measure` For `avg` and cardinality `rollup_method` - specify the measure + - **`measure`** For `avg` and cardinality `rollup_method` - specify the measure or the facet name you want to use. - - `time_window` #m (between 1 and 2880), #h (between 1 and 48). + - **`time_window`** #m (between 1 and 2880), #h (between 1 and 48). - - `operator` `<`, `<=`, `>`, `>=`, `==`, or `!=`. + - **`operator`** `<`, `<=`, `>`, `>=`, `==`, or `!=`. - - `#` an integer or decimal number used to set the threshold. + - **`#`** an integer or decimal number used to set the threshold. **Process Alert Query** @@ -21654,19 +21670,19 @@ paths: #` - - `search` free text search string for querying processes. + - **`search`** free text search string for querying processes. Matching processes match results on the [Live Processes](https://docs.datadoghq.com/infrastructure/process/?tab=linuxwindows) page. - - `tags` one or more tags (comma-separated) + - **`tags`** one or more tags (comma-separated) - - `timeframe` the timeframe to roll up the counts. Examples: 10m, 4h. Supported - timeframes: s, m, h and d + - **`timeframe`** the timeframe to roll up the counts. Examples: 10m, 4h. + Supported timeframes: s, m, h and d - - `operator` <, <=, >, >=, ==, or != + - **`operator`** <, <=, >, >=, ==, or != - - `#` an integer or decimal number used to set the threshold + - **`#`** an integer or decimal number used to set the threshold **Logs Alert Query** @@ -21676,21 +21692,22 @@ paths: operator #` - - `query` The search query - following the [Log search syntax](https://docs.datadoghq.com/logs/search_syntax/). + - **`query`** The search query - following the [Log search syntax](https://docs.datadoghq.com/logs/search_syntax/). - - `index_name` For multi-index organizations, the log index in which the request - is performed. + - **`index_name`** For multi-index organizations, the log index in which the + request is performed. - - `rollup_method` The stats roll-up method - supports `count`, `avg` and `cardinality`. + - **`rollup_method`** The stats roll-up method - supports `count`, `avg` and + `cardinality`. - - `measure` For `avg` and cardinality `rollup_method` - specify the measure + - **`measure`** For `avg` and cardinality `rollup_method` - specify the measure or the facet name you want to use. - - `time_window` #m (between 1 and 2880), #h (between 1 and 48). + - **`time_window`** #m (between 1 and 2880), #h (between 1 and 48). - - `operator` `<`, `<=`, `>`, `>=`, `==`, or `!=`. + - **`operator`** `<`, `<=`, `>`, `>=`, `==`, or `!=`. - - `#` an integer or decimal number used to set the threshold. + - **`#`** an integer or decimal number used to set the threshold. **Composite Query** @@ -21700,16 +21717,16 @@ paths: monitors - * `name` [*required*, *default* = **dynamic, based on query**]: The name of - the alert. + * **`name`** [*required*, *default* = **dynamic, based on query**]: The name + of the alert. - * `message` [*required*, *default* = **dynamic, based on query**]: A message + * **`message`** [*required*, *default* = **dynamic, based on query**]: A message to include with notifications for this monitor. Email notifications can be sent to specific users by using the same ''@username'' notation as events. - * `tags` [*optional*, *default* = **empty list**]: A list of tags to associate + * **`tags`** [*optional*, *default* = **empty list**]: A list of tags to associate with your monitor. When getting all monitor details via the API, use the `monitor_tags` argument @@ -21725,13 +21742,13 @@ paths: Example: `error_budget("slo_id").over("time_window") operator #` - - `slo_id`: The alphanumeric SLO ID of the SLO you are configuring the alert - for. + - **`slo_id`**: The alphanumeric SLO ID of the SLO you are configuring the + alert for. - - `time_window`: The time window of the SLO target you wish to alert on. Valid - options: `7d`, `30d`, `90d`. + - **`time_window`**: The time window of the SLO target you wish to alert on. + Valid options: `7d`, `30d`, `90d`. - - `operator`: `>=` or `>` + - **`operator`**: `>=` or `>` **Audit Alert Query** @@ -21741,18 +21758,19 @@ paths: operator #` - - `query` The search query - following the [Log search syntax](https://docs.datadoghq.com/logs/search_syntax/). + - **`query`** The search query - following the [Log search syntax](https://docs.datadoghq.com/logs/search_syntax/). - - `rollup_method` The stats roll-up method - supports `count`, `avg` and `cardinality`. + - **`rollup_method`** The stats roll-up method - supports `count`, `avg` and + `cardinality`. - - `measure` For `avg` and cardinality `rollup_method` - specify the measure + - **`measure`** For `avg` and cardinality `rollup_method` - specify the measure or the facet name you want to use. - - `time_window` #m (between 1 and 2880), #h (between 1 and 48). + - **`time_window`** #m (between 1 and 2880), #h (between 1 and 48). - - `operator` `<`, `<=`, `>`, `>=`, `==`, or `!=`. + - **`operator`** `<`, `<=`, `>`, `>=`, `==`, or `!=`. - - `#` an integer or decimal number used to set the threshold. + - **`#`** an integer or decimal number used to set the threshold. **NOTE** Only available on US1-FED and in closed beta on US1, EU, US3, and @@ -21766,19 +21784,19 @@ paths: operator #` - - `query` The search query - following the [Log search syntax](https://docs.datadoghq.com/logs/search_syntax/). + - **`query`** The search query - following the [Log search syntax](https://docs.datadoghq.com/logs/search_syntax/). - - `rollup_method` The stats roll-up method - supports `count`, `avg`, and - `cardinality`. + - **`rollup_method`** The stats roll-up method - supports `count`, `avg`, + and `cardinality`. - - `measure` For `avg` and cardinality `rollup_method` - specify the measure + - **`measure`** For `avg` and cardinality `rollup_method` - specify the measure or the facet name you want to use. - - `time_window` #m (between 1 and 2880), #h (between 1 and 48). + - **`time_window`** #m (between 1 and 2880), #h (between 1 and 48). - - `operator` `<`, `<=`, `>`, `>=`, `==`, or `!=`. + - **`operator`** `<`, `<=`, `>`, `>=`, `==`, or `!=`. - - `#` an integer or decimal number used to set the threshold. + - **`#`** an integer or decimal number used to set the threshold. **NOTE** CI Pipeline monitors are in alpha on US1, EU, US3 and US5. @@ -21791,19 +21809,19 @@ paths: operator #` - - `query` The search query - following the [Log search syntax](https://docs.datadoghq.com/logs/search_syntax/). + - **`query`** The search query - following the [Log search syntax](https://docs.datadoghq.com/logs/search_syntax/). - - `rollup_method` The stats roll-up method - supports `count`, `avg`, and - `cardinality`. + - **`rollup_method`** The stats roll-up method - supports `count`, `avg`, + and `cardinality`. - - `measure` For `avg` and cardinality `rollup_method` - specify the measure + - **`measure`** For `avg` and cardinality `rollup_method` - specify the measure or the facet name you want to use. - - `time_window` #m (between 1 and 2880), #h (between 1 and 48). + - **`time_window`** #m (between 1 and 2880), #h (between 1 and 48). - - `operator` `<`, `<=`, `>`, `>=`, `==`, or `!=`. + - **`operator`** `<`, `<=`, `>`, `>=`, `==`, or `!=`. - - `#` an integer or decimal number used to set the threshold. + - **`#`** an integer or decimal number used to set the threshold. **NOTE** CI Test monitors are available only in closed beta on US1, EU, US3 @@ -21820,19 +21838,19 @@ paths: measure]).last(time_window) operator #` - - `query` The search query - following the [Log search syntax](https://docs.datadoghq.com/logs/search_syntax/). + - **`query`** The search query - following the [Log search syntax](https://docs.datadoghq.com/logs/search_syntax/). - - `rollup_method` The stats roll-up method - supports `count`, `avg`, and - `cardinality`. + - **`rollup_method`** The stats roll-up method - supports `count`, `avg`, + and `cardinality`. - - `measure` For `avg` and cardinality `rollup_method` - specify the measure + - **`measure`** For `avg` and cardinality `rollup_method` - specify the measure or the facet name you want to use. - - `time_window` #m (between 1 and 2880), #h (between 1 and 48). + - **`time_window`** #m (between 1 and 2880), #h (between 1 and 48). - - `operator` `<`, `<=`, `>`, `>=`, `==`, or `!=`. + - **`operator`** `<`, `<=`, `>`, `>=`, `==`, or `!=`. - - `#` an integer or decimal number used to set the threshold.' + - **`#`** an integer or decimal number used to set the threshold.' operationId: CreateMonitor requestBody: content: diff --git a/docs/datadog_api_client.v1.model.rst b/docs/datadog_api_client.v1.model.rst index 5caedf1590..0f107a64a0 100644 --- a/docs/datadog_api_client.v1.model.rst +++ b/docs/datadog_api_client.v1.model.rst @@ -4185,6 +4185,14 @@ synthetics\_test\_headers :undoc-members: :show-inheritance: +synthetics\_test\_metadata +-------------------------- + +.. automodule:: datadog_api_client.v1.model.synthetics_test_metadata + :members: + :undoc-members: + :show-inheritance: + synthetics\_test\_monitor\_status --------------------------------- diff --git a/examples/v1/synthetics/CreateSyntheticsAPITest_1402674167.py b/examples/v1/synthetics/CreateSyntheticsAPITest_1402674167.py new file mode 100644 index 0000000000..e32feb3dc8 --- /dev/null +++ b/examples/v1/synthetics/CreateSyntheticsAPITest_1402674167.py @@ -0,0 +1,64 @@ +""" +Create an API GRPC test returns "OK - Returns the created test details." response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v1.api.synthetics_api import SyntheticsApi +from datadog_api_client.v1.model.http_method import HTTPMethod +from datadog_api_client.v1.model.synthetics_api_test import SyntheticsAPITest +from datadog_api_client.v1.model.synthetics_api_test_config import SyntheticsAPITestConfig +from datadog_api_client.v1.model.synthetics_api_test_type import SyntheticsAPITestType +from datadog_api_client.v1.model.synthetics_assertion_operator import SyntheticsAssertionOperator +from datadog_api_client.v1.model.synthetics_assertion_target import SyntheticsAssertionTarget +from datadog_api_client.v1.model.synthetics_assertion_type import SyntheticsAssertionType +from datadog_api_client.v1.model.synthetics_test_details_sub_type import SyntheticsTestDetailsSubType +from datadog_api_client.v1.model.synthetics_test_metadata import SyntheticsTestMetadata +from datadog_api_client.v1.model.synthetics_test_options import SyntheticsTestOptions +from datadog_api_client.v1.model.synthetics_test_options_monitor_options import SyntheticsTestOptionsMonitorOptions +from datadog_api_client.v1.model.synthetics_test_request import SyntheticsTestRequest + +body = SyntheticsAPITest( + config=SyntheticsAPITestConfig( + assertions=[ + SyntheticsAssertionTarget( + operator=SyntheticsAssertionOperator("is"), + target=1, + type=SyntheticsAssertionType("grpcHealthcheckStatus"), + ), + ], + request=SyntheticsTestRequest( + host="localhost", + port=50051, + service="Hello", + method=HTTPMethod("GET"), + message="", + metadata=SyntheticsTestMetadata(), + ), + ), + locations=[ + "aws:us-east-2", + ], + message="BDD test payload: synthetics_api_grpc_test_payload.json", + name="Example-Create_an_API_GRPC_test_returns_OK_Returns_the_created_test_details_response", + options=SyntheticsTestOptions( + min_failure_duration=0, + min_location_failed=1, + monitor_options=SyntheticsTestOptionsMonitorOptions( + renotify_interval=0, + ), + monitor_name="Example-Create_an_API_GRPC_test_returns_OK_Returns_the_created_test_details_response", + tick_every=60, + ), + subtype=SyntheticsTestDetailsSubType("grpc"), + tags=[ + "testing:api", + ], + type=SyntheticsAPITestType("api"), +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = SyntheticsApi(api_client) + response = api_instance.create_synthetics_api_test(body=body) + + print(response) diff --git a/src/datadog_api_client/v1/api/monitors_api.py b/src/datadog_api_client/v1/api/monitors_api.py index bcf4176a31..d339a160b9 100644 --- a/src/datadog_api_client/v1/api/monitors_api.py +++ b/src/datadog_api_client/v1/api/monitors_api.py @@ -443,27 +443,27 @@ def create_monitor(self, body, **kwargs): Example: `"check".over(tags).last(count).by(group).count_by_status()` - - `check` name of the check, for example `datadog.agent.up` - - `tags` one or more quoted tags (comma-separated), or "*". for example: `.over("env:prod", "role:db")`; `over` cannot be blank. - - `count` must be at greater than or equal to your max threshold (defined in the `options`). It is limited to 100. + - **`check`** name of the check, for example `datadog.agent.up` + - **`tags`** one or more quoted tags (comma-separated), or "*". for example: `.over("env:prod", "role:db")`; **`over`** cannot be blank. + - **`count`** must be at greater than or equal to your max threshold (defined in the `options`). It is limited to 100. For example, if you've specified to notify on 1 critical, 3 ok, and 2 warn statuses, `count` should be at least 3. - - `group` must be specified for check monitors. Per-check grouping is already explicitly known for some service checks. + - **`group`** must be specified for check monitors. Per-check grouping is already explicitly known for some service checks. For example, Postgres integration monitors are tagged by `db`, `host`, and `port`, and Network monitors by `host`, `instance`, and `url`. See [Service Checks](https://docs.datadoghq.com/api/latest/service-checks/) documentation for more information. **Event Alert Query** Example: `events('sources:nagios status:error,warning priority:normal tags: "string query"').rollup("count").last("1h")"` - - `event`, the event query string: - - `string_query` free text query to match against event title and text. - - `sources` event sources (comma-separated). - - `status` event statuses (comma-separated). Valid options: error, warn, and info. - - `priority` event priorities (comma-separated). Valid options: low, normal, all. - - `host` event reporting host (comma-separated). - - `tags` event tags (comma-separated). - - `excluded_tags` excluded event tags (comma-separated). - - `rollup` the stats roll-up method. `count` is the only supported method now. - - `last` the timeframe to roll up the counts. Examples: 45m, 4h. Supported timeframes: m, h and d. This value should not exceed 48 hours. + - **`event`**, the event query string: + - **`string_query`** free text query to match against event title and text. + - **`sources`** event sources (comma-separated). + - **`status`** event statuses (comma-separated). Valid options: error, warn, and info. + - **`priority`** event priorities (comma-separated). Valid options: low, normal, all. + - **`host`** event reporting host (comma-separated). + - **`tags`** event tags (comma-separated). + - **`excluded_tags`** excluded event tags (comma-separated). + - **`rollup`** the stats roll-up method. `count` is the only supported method now. + - **`last`** the timeframe to roll up the counts. Examples: 45m, 4h. Supported timeframes: m, h and d. This value should not exceed 48 hours. **NOTE** The Event Alert Query is being deprecated and replaced by the Event V2 Alert Query. For more information, see the [Event Migration guide](https://docs.datadoghq.com/events/guides/migrating_to_new_events_features/). @@ -471,44 +471,44 @@ def create_monitor(self, body, **kwargs): Example: `events(query).rollup(rollup_method[, measure]).last(time_window) operator #` - - `query` The search query - following the [Log search syntax](https://docs.datadoghq.com/logs/search_syntax/). - - `rollup_method` The stats roll-up method - supports `count`, `avg` and `cardinality`. - - `measure` For `avg` and cardinality `rollup_method` - specify the measure or the facet name you want to use. - - `time_window` #m (between 1 and 2880), #h (between 1 and 48). - - `operator` `<`, `<=`, `>`, `>=`, `==`, or `!=`. - - `#` an integer or decimal number used to set the threshold. + - **`query`** The search query - following the [Log search syntax](https://docs.datadoghq.com/logs/search_syntax/). + - **`rollup_method`** The stats roll-up method - supports `count`, `avg` and `cardinality`. + - **`measure`** For `avg` and cardinality `rollup_method` - specify the measure or the facet name you want to use. + - **`time_window`** #m (between 1 and 2880), #h (between 1 and 48). + - **`operator`** `<`, `<=`, `>`, `>=`, `==`, or `!=`. + - **`#`** an integer or decimal number used to set the threshold. **Process Alert Query** Example: `processes(search).over(tags).rollup('count').last(timeframe) operator #` - - `search` free text search string for querying processes. + - **`search`** free text search string for querying processes. Matching processes match results on the [Live Processes](https://docs.datadoghq.com/infrastructure/process/?tab=linuxwindows) page. - - `tags` one or more tags (comma-separated) - - `timeframe` the timeframe to roll up the counts. Examples: 10m, 4h. Supported timeframes: s, m, h and d - - `operator` <, <=, >, >=, ==, or != - - `#` an integer or decimal number used to set the threshold + - **`tags`** one or more tags (comma-separated) + - **`timeframe`** the timeframe to roll up the counts. Examples: 10m, 4h. Supported timeframes: s, m, h and d + - **`operator`** <, <=, >, >=, ==, or != + - **`#`** an integer or decimal number used to set the threshold **Logs Alert Query** Example: `logs(query).index(index_name).rollup(rollup_method[, measure]).last(time_window) operator #` - - `query` The search query - following the [Log search syntax](https://docs.datadoghq.com/logs/search_syntax/). - - `index_name` For multi-index organizations, the log index in which the request is performed. - - `rollup_method` The stats roll-up method - supports `count`, `avg` and `cardinality`. - - `measure` For `avg` and cardinality `rollup_method` - specify the measure or the facet name you want to use. - - `time_window` #m (between 1 and 2880), #h (between 1 and 48). - - `operator` `<`, `<=`, `>`, `>=`, `==`, or `!=`. - - `#` an integer or decimal number used to set the threshold. + - **`query`** The search query - following the [Log search syntax](https://docs.datadoghq.com/logs/search_syntax/). + - **`index_name`** For multi-index organizations, the log index in which the request is performed. + - **`rollup_method`** The stats roll-up method - supports `count`, `avg` and `cardinality`. + - **`measure`** For `avg` and cardinality `rollup_method` - specify the measure or the facet name you want to use. + - **`time_window`** #m (between 1 and 2880), #h (between 1 and 48). + - **`operator`** `<`, `<=`, `>`, `>=`, `==`, or `!=`. + - **`#`** an integer or decimal number used to set the threshold. **Composite Query** Example: `12345 && 67890`, where `12345` and `67890` are the IDs of non-composite monitors - * `name` [*required*, *default* = **dynamic, based on query**]: The name of the alert. - * `message` [*required*, *default* = **dynamic, based on query**]: A message to include with notifications for this monitor. + * **`name`** [*required*, *default* = **dynamic, based on query**]: The name of the alert. + * **`message`** [*required*, *default* = **dynamic, based on query**]: A message to include with notifications for this monitor. Email notifications can be sent to specific users by using the same '@username' notation as events. - * `tags` [*optional*, *default* = **empty list**]: A list of tags to associate with your monitor. + * **`tags`** [*optional*, *default* = **empty list**]: A list of tags to associate with your monitor. When getting all monitor details via the API, use the `monitor_tags` argument to filter results by these tags. It is only available via the API and isn't visible or editable in the Datadog UI. @@ -516,20 +516,20 @@ def create_monitor(self, body, **kwargs): Example: `error_budget("slo_id").over("time_window") operator #` - - `slo_id`: The alphanumeric SLO ID of the SLO you are configuring the alert for. - - `time_window`: The time window of the SLO target you wish to alert on. Valid options: `7d`, `30d`, `90d`. - - `operator`: `>=` or `>` + - **`slo_id`**: The alphanumeric SLO ID of the SLO you are configuring the alert for. + - **`time_window`**: The time window of the SLO target you wish to alert on. Valid options: `7d`, `30d`, `90d`. + - **`operator`**: `>=` or `>` **Audit Alert Query** Example: `audits(query).rollup(rollup_method[, measure]).last(time_window) operator #` - - `query` The search query - following the [Log search syntax](https://docs.datadoghq.com/logs/search_syntax/). - - `rollup_method` The stats roll-up method - supports `count`, `avg` and `cardinality`. - - `measure` For `avg` and cardinality `rollup_method` - specify the measure or the facet name you want to use. - - `time_window` #m (between 1 and 2880), #h (between 1 and 48). - - `operator` `<`, `<=`, `>`, `>=`, `==`, or `!=`. - - `#` an integer or decimal number used to set the threshold. + - **`query`** The search query - following the [Log search syntax](https://docs.datadoghq.com/logs/search_syntax/). + - **`rollup_method`** The stats roll-up method - supports `count`, `avg` and `cardinality`. + - **`measure`** For `avg` and cardinality `rollup_method` - specify the measure or the facet name you want to use. + - **`time_window`** #m (between 1 and 2880), #h (between 1 and 48). + - **`operator`** `<`, `<=`, `>`, `>=`, `==`, or `!=`. + - **`#`** an integer or decimal number used to set the threshold. **NOTE** Only available on US1-FED and in closed beta on US1, EU, US3, and US5. @@ -537,12 +537,12 @@ def create_monitor(self, body, **kwargs): Example: `ci-pipelines(query).rollup(rollup_method[, measure]).last(time_window) operator #` - - `query` The search query - following the [Log search syntax](https://docs.datadoghq.com/logs/search_syntax/). - - `rollup_method` The stats roll-up method - supports `count`, `avg`, and `cardinality`. - - `measure` For `avg` and cardinality `rollup_method` - specify the measure or the facet name you want to use. - - `time_window` #m (between 1 and 2880), #h (between 1 and 48). - - `operator` `<`, `<=`, `>`, `>=`, `==`, or `!=`. - - `#` an integer or decimal number used to set the threshold. + - **`query`** The search query - following the [Log search syntax](https://docs.datadoghq.com/logs/search_syntax/). + - **`rollup_method`** The stats roll-up method - supports `count`, `avg`, and `cardinality`. + - **`measure`** For `avg` and cardinality `rollup_method` - specify the measure or the facet name you want to use. + - **`time_window`** #m (between 1 and 2880), #h (between 1 and 48). + - **`operator`** `<`, `<=`, `>`, `>=`, `==`, or `!=`. + - **`#`** an integer or decimal number used to set the threshold. **NOTE** CI Pipeline monitors are in alpha on US1, EU, US3 and US5. @@ -550,12 +550,12 @@ def create_monitor(self, body, **kwargs): Example: `ci-tests(query).rollup(rollup_method[, measure]).last(time_window) operator #` - - `query` The search query - following the [Log search syntax](https://docs.datadoghq.com/logs/search_syntax/). - - `rollup_method` The stats roll-up method - supports `count`, `avg`, and `cardinality`. - - `measure` For `avg` and cardinality `rollup_method` - specify the measure or the facet name you want to use. - - `time_window` #m (between 1 and 2880), #h (between 1 and 48). - - `operator` `<`, `<=`, `>`, `>=`, `==`, or `!=`. - - `#` an integer or decimal number used to set the threshold. + - **`query`** The search query - following the [Log search syntax](https://docs.datadoghq.com/logs/search_syntax/). + - **`rollup_method`** The stats roll-up method - supports `count`, `avg`, and `cardinality`. + - **`measure`** For `avg` and cardinality `rollup_method` - specify the measure or the facet name you want to use. + - **`time_window`** #m (between 1 and 2880), #h (between 1 and 48). + - **`operator`** `<`, `<=`, `>`, `>=`, `==`, or `!=`. + - **`#`** an integer or decimal number used to set the threshold. **NOTE** CI Test monitors are available only in closed beta on US1, EU, US3 and US5. @@ -564,12 +564,12 @@ def create_monitor(self, body, **kwargs): Example(RUM): `error-tracking-rum(query).rollup(rollup_method[, measure]).last(time_window) operator #` Example(APM Traces): `error-tracking-traces(query).rollup(rollup_method[, measure]).last(time_window) operator #` - - `query` The search query - following the [Log search syntax](https://docs.datadoghq.com/logs/search_syntax/). - - `rollup_method` The stats roll-up method - supports `count`, `avg`, and `cardinality`. - - `measure` For `avg` and cardinality `rollup_method` - specify the measure or the facet name you want to use. - - `time_window` #m (between 1 and 2880), #h (between 1 and 48). - - `operator` `<`, `<=`, `>`, `>=`, `==`, or `!=`. - - `#` an integer or decimal number used to set the threshold. + - **`query`** The search query - following the [Log search syntax](https://docs.datadoghq.com/logs/search_syntax/). + - **`rollup_method`** The stats roll-up method - supports `count`, `avg`, and `cardinality`. + - **`measure`** For `avg` and cardinality `rollup_method` - specify the measure or the facet name you want to use. + - **`time_window`** #m (between 1 and 2880), #h (between 1 and 48). + - **`operator`** `<`, `<=`, `>`, `>=`, `==`, or `!=`. + - **`#`** an integer or decimal number used to set the threshold. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True. diff --git a/src/datadog_api_client/v1/model/synthetics_api_test.py b/src/datadog_api_client/v1/model/synthetics_api_test.py index 15d49857c9..7e737085cd 100644 --- a/src/datadog_api_client/v1/model/synthetics_api_test.py +++ b/src/datadog_api_client/v1/model/synthetics_api_test.py @@ -89,7 +89,7 @@ def __init__(self, config, locations, name, options, type, *args, **kwargs): :type status: SyntheticsTestPauseStatus, optional :param subtype: The subtype of the Synthetic API test, `http`, `ssl`, `tcp`, - `dns`, `icmp`, `udp`, `websocket` or `multi`. + `dns`, `icmp`, `udp`, `websocket`, `grpc` or `multi`. :type subtype: SyntheticsTestDetailsSubType, optional :param tags: Array of tags attached to the test. diff --git a/src/datadog_api_client/v1/model/synthetics_assertion_type.py b/src/datadog_api_client/v1/model/synthetics_assertion_type.py index f6a9e37636..df87b049fb 100644 --- a/src/datadog_api_client/v1/model/synthetics_assertion_type.py +++ b/src/datadog_api_client/v1/model/synthetics_assertion_type.py @@ -29,6 +29,7 @@ class SyntheticsAssertionType(ModelSimple): "PACKETS_RECEIVED": "packetsReceived", "NETWORK_HOP": "networkHop", "RECEIVED_MESSAGE": "receivedMessage", + "GRPC_HEALTHCHECK_STATUS": "grpcHealthcheckStatus", "CONNECTION": "connection", }, } @@ -45,7 +46,7 @@ def __init__(self, *args, **kwargs): Note that value can be passed either in args or in kwargs, but not in both. - :param value: Must be one of ["body", "header", "statusCode", "certificate", "responseTime", "property", "recordEvery", "recordSome", "tlsVersion", "minTlsVersion", "latency", "packetLossPercentage", "packetsReceived", "networkHop", "receivedMessage", "connection"]. + :param value: Must be one of ["body", "header", "statusCode", "certificate", "responseTime", "property", "recordEvery", "recordSome", "tlsVersion", "minTlsVersion", "latency", "packetLossPercentage", "packetsReceived", "networkHop", "receivedMessage", "grpcHealthcheckStatus", "connection"]. :type value: str """ super().__init__(kwargs) diff --git a/src/datadog_api_client/v1/model/synthetics_test_details.py b/src/datadog_api_client/v1/model/synthetics_test_details.py index 05bf4c2a07..cdebd00ae4 100644 --- a/src/datadog_api_client/v1/model/synthetics_test_details.py +++ b/src/datadog_api_client/v1/model/synthetics_test_details.py @@ -104,7 +104,7 @@ def __init__(self, *args, **kwargs): :type steps: [SyntheticsStep], optional :param subtype: The subtype of the Synthetic API test, `http`, `ssl`, `tcp`, - `dns`, `icmp`, `udp`, `websocket` or `multi`. + `dns`, `icmp`, `udp`, `websocket`, `grpc` or `multi`. :type subtype: SyntheticsTestDetailsSubType, optional :param tags: Array of tags attached to the test. diff --git a/src/datadog_api_client/v1/model/synthetics_test_details_sub_type.py b/src/datadog_api_client/v1/model/synthetics_test_details_sub_type.py index d2e7ab9448..651bebffb5 100644 --- a/src/datadog_api_client/v1/model/synthetics_test_details_sub_type.py +++ b/src/datadog_api_client/v1/model/synthetics_test_details_sub_type.py @@ -22,6 +22,7 @@ class SyntheticsTestDetailsSubType(ModelSimple): "ICMP": "icmp", "UDP": "udp", "WEBSOCKET": "websocket", + "GRPC": "grpc", }, } @@ -34,11 +35,11 @@ def openapi_types(_): def __init__(self, *args, **kwargs): """ The subtype of the Synthetic API test, `http`, `ssl`, `tcp`, - `dns`, `icmp`, `udp`, `websocket` or `multi`. + `dns`, `icmp`, `udp`, `websocket`, `grpc` or `multi`. Note that value can be passed either in args or in kwargs, but not in both. - :param value: Must be one of ["http", "ssl", "tcp", "dns", "multi", "icmp", "udp", "websocket"]. + :param value: Must be one of ["http", "ssl", "tcp", "dns", "multi", "icmp", "udp", "websocket", "grpc"]. :type value: str """ super().__init__(kwargs) diff --git a/src/datadog_api_client/v1/model/synthetics_test_metadata.py b/src/datadog_api_client/v1/model/synthetics_test_metadata.py new file mode 100644 index 0000000000..c34fc63b05 --- /dev/null +++ b/src/datadog_api_client/v1/model/synthetics_test_metadata.py @@ -0,0 +1,33 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. + + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +class SyntheticsTestMetadata(ModelNormal): + @cached_property + def additional_properties_type(_): + return (str,) + + def __init__(self, *args, **kwargs): + """ + Metadata to include when performing the gRPC test. + """ + super().__init__(kwargs) + + self._check_pos_args(args) + + @classmethod + def _from_openapi_data(cls, *args, **kwargs): + """Helper creating a new instance from a response.""" + + self = super(SyntheticsTestMetadata, cls)._from_openapi_data(kwargs) + + self._check_pos_args(args) + + return self diff --git a/src/datadog_api_client/v1/model/synthetics_test_request.py b/src/datadog_api_client/v1/model/synthetics_test_request.py index 16b7ab0280..f0b3ad4202 100644 --- a/src/datadog_api_client/v1/model/synthetics_test_request.py +++ b/src/datadog_api_client/v1/model/synthetics_test_request.py @@ -13,12 +13,14 @@ def lazy_import(): from datadog_api_client.v1.model.synthetics_basic_auth import SyntheticsBasicAuth from datadog_api_client.v1.model.synthetics_test_request_certificate import SyntheticsTestRequestCertificate from datadog_api_client.v1.model.synthetics_test_headers import SyntheticsTestHeaders + from datadog_api_client.v1.model.synthetics_test_metadata import SyntheticsTestMetadata from datadog_api_client.v1.model.http_method import HTTPMethod from datadog_api_client.v1.model.synthetics_test_request_proxy import SyntheticsTestRequestProxy globals()["SyntheticsBasicAuth"] = SyntheticsBasicAuth globals()["SyntheticsTestRequestCertificate"] = SyntheticsTestRequestCertificate globals()["SyntheticsTestHeaders"] = SyntheticsTestHeaders + globals()["SyntheticsTestMetadata"] = SyntheticsTestMetadata globals()["HTTPMethod"] = HTTPMethod globals()["SyntheticsTestRequestProxy"] = SyntheticsTestRequestProxy @@ -49,6 +51,7 @@ def openapi_types(_): "headers": (SyntheticsTestHeaders,), "host": (str,), "message": (str,), + "metadata": (SyntheticsTestMetadata,), "method": (HTTPMethod,), "no_saving_response_body": (bool,), "number_of_packets": (int,), @@ -56,6 +59,7 @@ def openapi_types(_): "proxy": (SyntheticsTestRequestProxy,), "query": (dict,), "servername": (str,), + "service": (str,), "should_track_hops": (bool,), "timeout": (float,), "url": (str,), @@ -72,6 +76,7 @@ def openapi_types(_): "headers": "headers", "host": "host", "message": "message", + "metadata": "metadata", "method": "method", "no_saving_response_body": "noSavingResponseBody", "number_of_packets": "numberOfPackets", @@ -79,6 +84,7 @@ def openapi_types(_): "proxy": "proxy", "query": "query", "servername": "servername", + "service": "service", "should_track_hops": "shouldTrackHops", "timeout": "timeout", "url": "url", @@ -118,6 +124,9 @@ def __init__(self, *args, **kwargs): :param message: Message to send for UDP or WebSocket tests. :type message: str, optional + :param metadata: Metadata to include when performing the gRPC test. + :type metadata: SyntheticsTestMetadata, optional + :param method: The HTTP method. :type method: HTTPMethod, optional @@ -141,6 +150,9 @@ def __init__(self, *args, **kwargs): the same IP address and TCP port number. :type servername: str, optional + :param service: gRPC service on which you want to perform the healthcheck. + :type service: str, optional + :param should_track_hops: Turns on a traceroute probe to discover all gateways along the path to the host destination. :type should_track_hops: bool, optional diff --git a/src/datadog_api_client/v1/models/__init__.py b/src/datadog_api_client/v1/models/__init__.py index aa7e4de2e8..086dc09a09 100644 --- a/src/datadog_api_client/v1/models/__init__.py +++ b/src/datadog_api_client/v1/models/__init__.py @@ -593,6 +593,7 @@ from datadog_api_client.v1.model.synthetics_test_details_type import SyntheticsTestDetailsType from datadog_api_client.v1.model.synthetics_test_execution_rule import SyntheticsTestExecutionRule from datadog_api_client.v1.model.synthetics_test_headers import SyntheticsTestHeaders +from datadog_api_client.v1.model.synthetics_test_metadata import SyntheticsTestMetadata from datadog_api_client.v1.model.synthetics_test_monitor_status import SyntheticsTestMonitorStatus from datadog_api_client.v1.model.synthetics_test_options import SyntheticsTestOptions from datadog_api_client.v1.model.synthetics_test_options_monitor_options import SyntheticsTestOptionsMonitorOptions diff --git a/tests/v1/cassettes/test_scenarios/test_create_an_api_grpc_test_returns_ok_returns_the_created_test_details_response.frozen b/tests/v1/cassettes/test_scenarios/test_create_an_api_grpc_test_returns_ok_returns_the_created_test_details_response.frozen new file mode 100644 index 0000000000..bada38fe38 --- /dev/null +++ b/tests/v1/cassettes/test_scenarios/test_create_an_api_grpc_test_returns_ok_returns_the_created_test_details_response.frozen @@ -0,0 +1 @@ +2022-05-24T11:58:25.551Z \ No newline at end of file diff --git a/tests/v1/cassettes/test_scenarios/test_create_an_api_grpc_test_returns_ok_returns_the_created_test_details_response.yaml b/tests/v1/cassettes/test_scenarios/test_create_an_api_grpc_test_returns_ok_returns_the_created_test_details_response.yaml new file mode 100644 index 0000000000..fd725f1713 --- /dev/null +++ b/tests/v1/cassettes/test_scenarios/test_create_an_api_grpc_test_returns_ok_returns_the_created_test_details_response.yaml @@ -0,0 +1,40 @@ +interactions: +- request: + body: '{"config":{"assertions":[{"operator":"is","target":1,"type":"grpcHealthcheckStatus"}],"request":{"host":"localhost","message":"","metadata":{},"method":"GET","port":50051,"service":"Hello"}},"locations":["aws:us-east-2"],"message":"BDD + test payload: synthetics_api_grpc_test_payload.json","name":"Test-Create_an_API_GRPC_test_returns_OK_Returns_the_created_test_details_response-1653393505","options":{"min_failure_duration":0,"min_location_failed":1,"monitor_name":"Test-Create_an_API_GRPC_test_returns_OK_Returns_the_created_test_details_response-1653393505","monitor_options":{"renotify_interval":0},"tick_every":60},"subtype":"grpc","tags":["testing:api"],"type":"api"}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v1/synthetics/tests/api + response: + body: + string: '{"status":"live","public_id":"b42-9bj-kdp","tags":["testing:api"],"org_id":321813,"locations":["aws:us-east-2"],"message":"BDD + test payload: synthetics_api_grpc_test_payload.json","deleted_at":null,"name":"Test-Create_an_API_GRPC_test_returns_OK_Returns_the_created_test_details_response-1653393505","monitor_id":72307136,"type":"api","created_at":"2022-05-24T11:58:26.204508+00:00","modified_at":"2022-05-24T11:58:26.204508+00:00","subtype":"grpc","config":{"request":{"service":"Hello","port":50051,"host":"localhost","message":"","method":"GET","metadata":{}},"assertions":[{"operator":"is","type":"grpcHealthcheckStatus","target":1}]},"options":{"monitor_options":{"include_tags":true,"notify_no_data":false,"notify_audit":false,"new_host_delay":300,"renotify_interval":0},"tick_every":60,"monitor_name":"Test-Create_an_API_GRPC_test_returns_OK_Returns_the_created_test_details_response-1653393505","min_failure_duration":0,"min_location_failed":1}}' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +- request: + body: '{"public_ids":["b42-9bj-kdp"]}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v1/synthetics/tests/delete + response: + body: + string: '{"deleted_tests":[{"deleted_at":"2022-05-24T11:58:31.800773+00:00","public_id":"b42-9bj-kdp"}]}' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +version: 1 diff --git a/tests/v1/features/synthetics.feature b/tests/v1/features/synthetics.feature index 9159abe3d6..1afbc2a1e2 100644 --- a/tests/v1/features/synthetics.feature +++ b/tests/v1/features/synthetics.feature @@ -99,6 +99,14 @@ Feature: Synthetics When the request is sent Then the response status is 402 Quota reached for private locations + @team:DataDog/synthetics-app + Scenario: Create an API GRPC test returns "OK - Returns the created test details." response + Given new "CreateSyntheticsAPITest" request + And body from file "synthetics_api_grpc_test_payload.json" + When the request is sent + Then the response status is 200 OK - Returns the created test details. + And the response "name" is equal to "{{ unique }}" + @team:DataDog/synthetics-app Scenario: Create an API HTTP test returns "OK - Returns the created test details." response Given new "CreateSyntheticsAPITest" request diff --git a/tests/v1/features/synthetics_api_grpc_test_payload.json b/tests/v1/features/synthetics_api_grpc_test_payload.json new file mode 100644 index 0000000000..ccce96603b --- /dev/null +++ b/tests/v1/features/synthetics_api_grpc_test_payload.json @@ -0,0 +1,34 @@ +{ + "config": { + "assertions": [ + { + "operator": "is", + "target": 1, + "type": "grpcHealthcheckStatus" + } + ], + "request": { + "host": "localhost", + "port": 50051, + "service": "Hello", + "method": "GET", + "message": "", + "metadata": {} + } + }, + "locations": ["aws:us-east-2"], + "message": "BDD test payload: synthetics_api_grpc_test_payload.json", + "name": "{{ unique }}", + "options": { + "min_failure_duration": 0, + "min_location_failed": 1, + "monitor_options": { + "renotify_interval": 0 + }, + "monitor_name": "{{ unique }}", + "tick_every": 60 + }, + "subtype": "grpc", + "tags": ["testing:api"], + "type": "api" +} \ No newline at end of file