diff --git a/.apigentools-info b/.apigentools-info index d59581ee0c..07d79c4c16 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2024-01-08 16:03:17.520602", - "spec_repo_commit": "8b5aed97" + "regenerated": "2024-01-08 19:23:25.412666", + "spec_repo_commit": "150ace98" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-01-08 16:03:17.535558", - "spec_repo_commit": "8b5aed97" + "regenerated": "2024-01-08 19:23:25.429398", + "spec_repo_commit": "150ace98" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 92f333119e..156c5365b9 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -3776,6 +3776,22 @@ components: description: The name of the Cloudflare account. example: test-name type: string + resources: + description: An allowlist of resources to restrict pulling metrics for. + example: + - web + - dns + items: + type: string + type: array + zones: + description: An allowlist of zones to restrict pulling metrics for. + example: + - zone_id_1 + - zone_id_2 + items: + type: string + type: array required: - api_key - name @@ -3808,6 +3824,22 @@ components: description: The name of the Cloudflare account. example: test-name type: string + resources: + description: An allowlist of resources to restrict pulling metrics for. + example: + - web + - dns + items: + type: string + type: array + zones: + description: An allowlist of zones to restrict pulling metrics for. + example: + - zone_id_1 + - zone_id_2 + items: + type: string + type: array required: - name type: object @@ -3856,6 +3888,22 @@ components: key is provided (and not a token), this field is also required. example: test-email@example.com type: string + resources: + description: An allowlist of resources to restrict pulling metrics for. + example: + - web + - dns + items: + type: string + type: array + zones: + description: An allowlist of zones to restrict pulling metrics for. + example: + - zone_id_1 + - zone_id_2 + items: + type: string + type: array required: - api_key type: object diff --git a/examples/v2/cloudflare-integration/CreateCloudflareAccount.py b/examples/v2/cloudflare-integration/CreateCloudflareAccount.py index adccd441fb..15ba6b3f79 100644 --- a/examples/v2/cloudflare-integration/CreateCloudflareAccount.py +++ b/examples/v2/cloudflare-integration/CreateCloudflareAccount.py @@ -15,7 +15,7 @@ data=CloudflareAccountCreateRequestData( attributes=CloudflareAccountCreateRequestAttributes( api_key="fakekey", - email="new@email", + email="dev@datadoghq.com", name="examplecloudflareintegration", ), type=CloudflareAccountType.CLOUDFLARE_ACCOUNTS, diff --git a/examples/v2/cloudflare-integration/UpdateCloudflareAccount.py b/examples/v2/cloudflare-integration/UpdateCloudflareAccount.py index 3c4fda4bca..950c1457c7 100644 --- a/examples/v2/cloudflare-integration/UpdateCloudflareAccount.py +++ b/examples/v2/cloudflare-integration/UpdateCloudflareAccount.py @@ -19,7 +19,10 @@ data=CloudflareAccountUpdateRequestData( attributes=CloudflareAccountUpdateRequestAttributes( api_key="fakekey", - email="new@email", + email="dev@datadoghq.com", + zones=[ + "zone-id-3", + ], ), type=CloudflareAccountType.CLOUDFLARE_ACCOUNTS, ), diff --git a/src/datadog_api_client/v2/model/cloudflare_account_create_request_attributes.py b/src/datadog_api_client/v2/model/cloudflare_account_create_request_attributes.py index 53ed85ba6b..8fb47691bd 100644 --- a/src/datadog_api_client/v2/model/cloudflare_account_create_request_attributes.py +++ b/src/datadog_api_client/v2/model/cloudflare_account_create_request_attributes.py @@ -3,7 +3,7 @@ # Copyright 2019-Present Datadog, Inc. from __future__ import annotations -from typing import Union +from typing import List, Union from datadog_api_client.model_utils import ( ModelNormal, @@ -20,15 +20,27 @@ def openapi_types(_): "api_key": (str,), "email": (str,), "name": (str,), + "resources": ([str],), + "zones": ([str],), } attribute_map = { "api_key": "api_key", "email": "email", "name": "name", + "resources": "resources", + "zones": "zones", } - def __init__(self_, api_key: str, name: str, email: Union[str, UnsetType] = unset, **kwargs): + def __init__( + self_, + api_key: str, + name: str, + email: Union[str, UnsetType] = unset, + resources: Union[List[str], UnsetType] = unset, + zones: Union[List[str], UnsetType] = unset, + **kwargs, + ): """ Attributes object for creating a Cloudflare account. @@ -40,9 +52,19 @@ def __init__(self_, api_key: str, name: str, email: Union[str, UnsetType] = unse :param name: The name of the Cloudflare account. :type name: str + + :param resources: An allowlist of resources to restrict pulling metrics for. + :type resources: [str], optional + + :param zones: An allowlist of zones to restrict pulling metrics for. + :type zones: [str], optional """ if email is not unset: kwargs["email"] = email + if resources is not unset: + kwargs["resources"] = resources + if zones is not unset: + kwargs["zones"] = zones super().__init__(kwargs) self_.api_key = api_key diff --git a/src/datadog_api_client/v2/model/cloudflare_account_response_attributes.py b/src/datadog_api_client/v2/model/cloudflare_account_response_attributes.py index 0daac66235..be85a8c5bf 100644 --- a/src/datadog_api_client/v2/model/cloudflare_account_response_attributes.py +++ b/src/datadog_api_client/v2/model/cloudflare_account_response_attributes.py @@ -3,7 +3,7 @@ # Copyright 2019-Present Datadog, Inc. from __future__ import annotations -from typing import Union +from typing import List, Union from datadog_api_client.model_utils import ( ModelNormal, @@ -19,14 +19,25 @@ def openapi_types(_): return { "email": (str,), "name": (str,), + "resources": ([str],), + "zones": ([str],), } attribute_map = { "email": "email", "name": "name", + "resources": "resources", + "zones": "zones", } - def __init__(self_, name: str, email: Union[str, UnsetType] = unset, **kwargs): + def __init__( + self_, + name: str, + email: Union[str, UnsetType] = unset, + resources: Union[List[str], UnsetType] = unset, + zones: Union[List[str], UnsetType] = unset, + **kwargs, + ): """ Attributes object of a Cloudflare account. @@ -35,9 +46,19 @@ def __init__(self_, name: str, email: Union[str, UnsetType] = unset, **kwargs): :param name: The name of the Cloudflare account. :type name: str + + :param resources: An allowlist of resources to restrict pulling metrics for. + :type resources: [str], optional + + :param zones: An allowlist of zones to restrict pulling metrics for. + :type zones: [str], optional """ if email is not unset: kwargs["email"] = email + if resources is not unset: + kwargs["resources"] = resources + if zones is not unset: + kwargs["zones"] = zones super().__init__(kwargs) self_.name = name diff --git a/src/datadog_api_client/v2/model/cloudflare_account_update_request_attributes.py b/src/datadog_api_client/v2/model/cloudflare_account_update_request_attributes.py index 2169a62404..9902151f30 100644 --- a/src/datadog_api_client/v2/model/cloudflare_account_update_request_attributes.py +++ b/src/datadog_api_client/v2/model/cloudflare_account_update_request_attributes.py @@ -3,7 +3,7 @@ # Copyright 2019-Present Datadog, Inc. from __future__ import annotations -from typing import Union +from typing import List, Union from datadog_api_client.model_utils import ( ModelNormal, @@ -19,14 +19,25 @@ def openapi_types(_): return { "api_key": (str,), "email": (str,), + "resources": ([str],), + "zones": ([str],), } attribute_map = { "api_key": "api_key", "email": "email", + "resources": "resources", + "zones": "zones", } - def __init__(self_, api_key: str, email: Union[str, UnsetType] = unset, **kwargs): + def __init__( + self_, + api_key: str, + email: Union[str, UnsetType] = unset, + resources: Union[List[str], UnsetType] = unset, + zones: Union[List[str], UnsetType] = unset, + **kwargs, + ): """ Attributes object for updating a Cloudflare account. @@ -35,9 +46,19 @@ def __init__(self_, api_key: str, email: Union[str, UnsetType] = unset, **kwargs :param email: The email associated with the Cloudflare account. If an API key is provided (and not a token), this field is also required. :type email: str, optional + + :param resources: An allowlist of resources to restrict pulling metrics for. + :type resources: [str], optional + + :param zones: An allowlist of zones to restrict pulling metrics for. + :type zones: [str], optional """ if email is not unset: kwargs["email"] = email + if resources is not unset: + kwargs["resources"] = resources + if zones is not unset: + kwargs["zones"] = zones super().__init__(kwargs) self_.api_key = api_key diff --git a/tests/v2/cassettes/test_scenarios/test_add_cloudflare_account_returns_bad_request_response_due_to_missing_email.frozen b/tests/v2/cassettes/test_scenarios/test_add_cloudflare_account_returns_bad_request_response_due_to_missing_email.frozen index 2ea546653e..d9508c1c1b 100644 --- a/tests/v2/cassettes/test_scenarios/test_add_cloudflare_account_returns_bad_request_response_due_to_missing_email.frozen +++ b/tests/v2/cassettes/test_scenarios/test_add_cloudflare_account_returns_bad_request_response_due_to_missing_email.frozen @@ -1 +1 @@ -2023-01-26T10:55:04.225Z \ No newline at end of file +2024-01-04T18:40:40.939Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_add_cloudflare_account_returns_bad_request_response_due_to_missing_email.yaml b/tests/v2/cassettes/test_scenarios/test_add_cloudflare_account_returns_bad_request_response_due_to_missing_email.yaml index 946aa33535..d52036cb98 100644 --- a/tests/v2/cassettes/test_scenarios/test_add_cloudflare_account_returns_bad_request_response_due_to_missing_email.yaml +++ b/tests/v2/cassettes/test_scenarios/test_add_cloudflare_account_returns_bad_request_response_due_to_missing_email.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{"data":{"attributes":{"api_key":"test-api-key","name":"testaddcloudflareaccountreturnsbadrequestresponseduetomissingemail1674730504"},"type":"cloudflare-accounts"}}' + body: '{"data":{"attributes":{"api_key":"fakekey","name":"testaddcloudflareaccountreturnsbadrequestresponseduetomissingemail1704393640"},"type":"cloudflare-accounts"}}' headers: accept: - application/json @@ -10,7 +10,7 @@ interactions: uri: https://api.datadoghq.com/api/v2/integrations/cloudflare/accounts response: body: - string: '{"errors":["{u''_schema'': [''Email address is required if providing + string: '{"errors":["{''_schema'': [''Email address is required if providing an api key and not an api token.'']}"]}' headers: content-type: diff --git a/tests/v2/cassettes/test_scenarios/test_add_cloudflare_account_returns_bad_request_response_using_invalid_auth_key.frozen b/tests/v2/cassettes/test_scenarios/test_add_cloudflare_account_returns_bad_request_response_using_invalid_auth_key.frozen index 86f90fee57..00c73cdafa 100644 --- a/tests/v2/cassettes/test_scenarios/test_add_cloudflare_account_returns_bad_request_response_using_invalid_auth_key.frozen +++ b/tests/v2/cassettes/test_scenarios/test_add_cloudflare_account_returns_bad_request_response_using_invalid_auth_key.frozen @@ -1 +1 @@ -2023-01-26T10:54:47.296Z \ No newline at end of file +2024-01-04T18:40:41.099Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_add_cloudflare_account_returns_bad_request_response_using_invalid_auth_key.yaml b/tests/v2/cassettes/test_scenarios/test_add_cloudflare_account_returns_bad_request_response_using_invalid_auth_key.yaml index 26f12119ec..70affce31f 100644 --- a/tests/v2/cassettes/test_scenarios/test_add_cloudflare_account_returns_bad_request_response_using_invalid_auth_key.yaml +++ b/tests/v2/cassettes/test_scenarios/test_add_cloudflare_account_returns_bad_request_response_using_invalid_auth_key.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{"data":{"attributes":{"api_key":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","name":"testaddcloudflareaccountreturnsbadrequestresponseusinginvalidauthkey1674730487"},"type":"cloudflare-accounts"}}' + body: '{"data":{"attributes":{"api_key":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","name":"testaddcloudflareaccountreturnsbadrequestresponseusinginvalidauthkey1704393641"},"type":"cloudflare-accounts"}}' headers: accept: - application/json @@ -11,7 +11,7 @@ interactions: response: body: string: '{"errors":["Invalid account. Your Cloudflare configuration is invalid. - Impossible to get zones for the account testaddcloudflareaccountreturnsbadrequestresponseusinginvalidauthkey1674730487: + Impossible to get zones for the account testaddcloudflareaccountreturnsbadrequestresponseusinginvalidauthkey1704393641: API key or email is unknown."]}' headers: content-type: diff --git a/tests/v2/cassettes/test_scenarios/test_add_cloudflare_account_returns_created_response.frozen b/tests/v2/cassettes/test_scenarios/test_add_cloudflare_account_returns_created_response.frozen index 08656ce57d..0e350ffed1 100644 --- a/tests/v2/cassettes/test_scenarios/test_add_cloudflare_account_returns_created_response.frozen +++ b/tests/v2/cassettes/test_scenarios/test_add_cloudflare_account_returns_created_response.frozen @@ -1 +1 @@ -2023-01-26T10:54:24.725Z \ No newline at end of file +2024-01-04T18:40:41.520Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_add_cloudflare_account_returns_created_response.yaml b/tests/v2/cassettes/test_scenarios/test_add_cloudflare_account_returns_created_response.yaml index 5ad5799066..47cbb7e2ca 100644 --- a/tests/v2/cassettes/test_scenarios/test_add_cloudflare_account_returns_created_response.yaml +++ b/tests/v2/cassettes/test_scenarios/test_add_cloudflare_account_returns_created_response.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{"data":{"attributes":{"api_key":"fakekey","email":"new@email","name":"testaddcloudflareaccountreturnscreatedresponse1674730464"},"type":"cloudflare-accounts"}}' + body: '{"data":{"attributes":{"api_key":"fakekey","email":"dev@datadoghq.com","name":"testaddcloudflareaccountreturnscreatedresponse1704393641"},"type":"cloudflare-accounts"}}' headers: accept: - application/json @@ -10,7 +10,7 @@ interactions: uri: https://api.datadoghq.com/api/v2/integrations/cloudflare/accounts response: body: - string: '{"data":{"attributes":{"email":"new@email","name":"testaddcloudflareaccountreturnscreatedresponse1674730464"},"type":"cloudflare-accounts","id":"328432a98957fd7bcba6f70daea72519"}} + string: '{"data":{"type":"cloudflare-accounts","attributes":{"email":"dev@datadoghq.com","name":"testaddcloudflareaccountreturnscreatedresponse1704393641","resources":[],"zones":[]},"id":"baa2079200095466b080d75adfdb32fa"}} ' headers: @@ -25,7 +25,7 @@ interactions: accept: - '*/*' method: DELETE - uri: https://api.datadoghq.com/api/v2/integrations/cloudflare/accounts/328432a98957fd7bcba6f70daea72519 + uri: https://api.datadoghq.com/api/v2/integrations/cloudflare/accounts/baa2079200095466b080d75adfdb32fa response: body: string: '' diff --git a/tests/v2/cassettes/test_scenarios/test_add_cloudflare_account_returns_created_response_with_optional_filters.frozen b/tests/v2/cassettes/test_scenarios/test_add_cloudflare_account_returns_created_response_with_optional_filters.frozen new file mode 100644 index 0000000000..8168df4418 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_add_cloudflare_account_returns_created_response_with_optional_filters.frozen @@ -0,0 +1 @@ +2024-01-03T19:17:37.850Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_add_cloudflare_account_returns_created_response_with_optional_filters.yaml b/tests/v2/cassettes/test_scenarios/test_add_cloudflare_account_returns_created_response_with_optional_filters.yaml new file mode 100644 index 0000000000..9a1cf3a77f --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_add_cloudflare_account_returns_created_response_with_optional_filters.yaml @@ -0,0 +1,22 @@ +interactions: +- request: + body: '{"data":{"attributes":{"api_key":"fakekey","email":"new@email","name":"testaddcloudflareaccountreturnscreatedresponsewithoptionalfilters1704309457","resources":["lb","dns"],"zones":["zone-id-1","zone-id-2"]},"type":"cloudflare-accounts"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/integrations/cloudflare/accounts + response: + body: + string: '{"errors":["Invalid account. Your Cloudflare configuration is invalid. + Impossible to get zones for the account testaddcloudflareaccountreturnscreatedresponsewithoptionalfilters1704309457: + API key or email is not in the correct format."]}' + headers: + content-type: + - application/json + status: + code: 400 + message: Bad Request +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_get_cloudflare_account_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_get_cloudflare_account_returns_ok_response.frozen index 5ddb9d7aa7..22b0b70c1b 100644 --- a/tests/v2/cassettes/test_scenarios/test_get_cloudflare_account_returns_ok_response.frozen +++ b/tests/v2/cassettes/test_scenarios/test_get_cloudflare_account_returns_ok_response.frozen @@ -1 +1 @@ -2023-01-27T09:00:21.006Z \ No newline at end of file +2024-01-04T18:40:42.323Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_get_cloudflare_account_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_get_cloudflare_account_returns_ok_response.yaml index c842b9607d..9e0e1ce4fb 100644 --- a/tests/v2/cassettes/test_scenarios/test_get_cloudflare_account_returns_ok_response.yaml +++ b/tests/v2/cassettes/test_scenarios/test_get_cloudflare_account_returns_ok_response.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{"data":{"attributes":{"api_key":"fakekey","email":"dev@datadog.com","name":"testgetcloudflareaccountreturnsokresponse1674810021"},"type":"cloudflare-accounts"}}' + body: '{"data":{"attributes":{"api_key":"fakekey","email":"dev@datadog.com","name":"testgetcloudflareaccountreturnsokresponse1704393642","resources":["web","dns"],"zones":["zone-id-1","zone-id-2"]},"type":"cloudflare-accounts"}}' headers: accept: - application/json @@ -10,7 +10,7 @@ interactions: uri: https://api.datadoghq.com/api/v2/integrations/cloudflare/accounts response: body: - string: '{"data":{"attributes":{"email":"dev@datadog.com","name":"testgetcloudflareaccountreturnsokresponse1674810021"},"type":"cloudflare-accounts","id":"ec582035efa21742f8f4ef4393ded49c"}} + string: '{"data":{"type":"cloudflare-accounts","attributes":{"name":"testgetcloudflareaccountreturnsokresponse1704393642","email":"dev@datadog.com","zones":["zone-id-1","zone-id-2"],"resources":["web","dns"]},"id":"88d65a60026254bfaf976a427606c061"}} ' headers: @@ -25,10 +25,10 @@ interactions: accept: - application/json method: GET - uri: https://api.datadoghq.com/api/v2/integrations/cloudflare/accounts/ec582035efa21742f8f4ef4393ded49c + uri: https://api.datadoghq.com/api/v2/integrations/cloudflare/accounts/88d65a60026254bfaf976a427606c061 response: body: - string: '{"data":{"attributes":{"email":"dev@datadog.com","name":"testgetcloudflareaccountreturnsokresponse1674810021"},"type":"cloudflare-accounts","id":"ec582035efa21742f8f4ef4393ded49c"}} + string: '{"data":{"type":"cloudflare-accounts","attributes":{"zones":["zone-id-1","zone-id-2"],"email":"dev@datadog.com","name":"testgetcloudflareaccountreturnsokresponse1704393642","resources":["web","dns"]},"id":"88d65a60026254bfaf976a427606c061"}} ' headers: @@ -43,7 +43,7 @@ interactions: accept: - '*/*' method: DELETE - uri: https://api.datadoghq.com/api/v2/integrations/cloudflare/accounts/ec582035efa21742f8f4ef4393ded49c + uri: https://api.datadoghq.com/api/v2/integrations/cloudflare/accounts/88d65a60026254bfaf976a427606c061 response: body: string: '' diff --git a/tests/v2/cassettes/test_scenarios/test_list_cloudflare_accounts_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_list_cloudflare_accounts_returns_ok_response.frozen index f1a4c9ed98..abacad3b17 100644 --- a/tests/v2/cassettes/test_scenarios/test_list_cloudflare_accounts_returns_ok_response.frozen +++ b/tests/v2/cassettes/test_scenarios/test_list_cloudflare_accounts_returns_ok_response.frozen @@ -1 +1 @@ -2023-01-27T09:00:01.876Z \ No newline at end of file +2024-01-04T18:40:43.242Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_list_cloudflare_accounts_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_list_cloudflare_accounts_returns_ok_response.yaml index 1801079b02..8a772955b4 100644 --- a/tests/v2/cassettes/test_scenarios/test_list_cloudflare_accounts_returns_ok_response.yaml +++ b/tests/v2/cassettes/test_scenarios/test_list_cloudflare_accounts_returns_ok_response.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{"data":{"attributes":{"api_key":"fakekey","email":"dev@datadog.com","name":"testlistcloudflareaccountsreturnsokresponse1674810001"},"type":"cloudflare-accounts"}}' + body: '{"data":{"attributes":{"api_key":"fakekey","email":"dev@datadog.com","name":"testlistcloudflareaccountsreturnsokresponse1704393643","resources":["web","dns"],"zones":["zone-id-1","zone-id-2"]},"type":"cloudflare-accounts"}}' headers: accept: - application/json @@ -10,7 +10,7 @@ interactions: uri: https://api.datadoghq.com/api/v2/integrations/cloudflare/accounts response: body: - string: '{"data":{"attributes":{"email":"dev@datadog.com","name":"testlistcloudflareaccountsreturnsokresponse1674810001"},"type":"cloudflare-accounts","id":"1458cfdd2c5679bdc8693a9c5a32bf45"}} + string: '{"data":{"type":"cloudflare-accounts","id":"032c2a7bec2890a18b9ff810ffbaf789","attributes":{"resources":["web","dns"],"name":"testlistcloudflareaccountsreturnsokresponse1704393643","email":"dev@datadog.com","zones":["zone-id-1","zone-id-2"]}}} ' headers: @@ -28,7 +28,7 @@ interactions: uri: https://api.datadoghq.com/api/v2/integrations/cloudflare/accounts response: body: - string: '{"data":[{"attributes":{"email":"dev@datadog.com","name":"testlistcloudflareaccountsreturnsokresponse1674810001"},"type":"cloudflare-accounts","id":"1458cfdd2c5679bdc8693a9c5a32bf45"}]} + string: '{"data":[{"type":"cloudflare-accounts","attributes":{"resources":["dns","worker"],"email":"dev@datadoghq.com","zones":["57d151866f1b1d5e4e0057aed6b9f4cb"],"name":"testing"},"id":"ae2b1fca515949e5d54fb22b8ed95575"},{"type":"cloudflare-accounts","attributes":{"resources":["web","dns"],"email":"dev@datadog.com","zones":["zone-id-1","zone-id-2"],"name":"testlistcloudflareaccountsreturnsokresponse1704393643"},"id":"032c2a7bec2890a18b9ff810ffbaf789"},{"type":"cloudflare-accounts","attributes":{"resources":[],"email":"","zones":[],"name":"testing_2"},"id":"8222b3d5b803354416362560a64a1725"},{"type":"cloudflare-accounts","attributes":{"resources":[],"email":"","zones":[],"name":"cloudflare-test"},"id":"fe0a70a58b246c3836c665e956f56bab"}]} ' headers: @@ -43,7 +43,7 @@ interactions: accept: - '*/*' method: DELETE - uri: https://api.datadoghq.com/api/v2/integrations/cloudflare/accounts/1458cfdd2c5679bdc8693a9c5a32bf45 + uri: https://api.datadoghq.com/api/v2/integrations/cloudflare/accounts/032c2a7bec2890a18b9ff810ffbaf789 response: body: string: '' diff --git a/tests/v2/cassettes/test_scenarios/test_update_cloudflare_account_returns_bad_request_response_due_to_invalid_api_key.frozen b/tests/v2/cassettes/test_scenarios/test_update_cloudflare_account_returns_bad_request_response_due_to_invalid_api_key.frozen index 0928cd1f86..36232fe686 100644 --- a/tests/v2/cassettes/test_scenarios/test_update_cloudflare_account_returns_bad_request_response_due_to_invalid_api_key.frozen +++ b/tests/v2/cassettes/test_scenarios/test_update_cloudflare_account_returns_bad_request_response_due_to_invalid_api_key.frozen @@ -1 +1 @@ -2023-01-27T08:59:31.378Z \ No newline at end of file +2024-01-04T18:40:44.099Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_update_cloudflare_account_returns_bad_request_response_due_to_invalid_api_key.yaml b/tests/v2/cassettes/test_scenarios/test_update_cloudflare_account_returns_bad_request_response_due_to_invalid_api_key.yaml index a2666b793f..aa5cc24779 100644 --- a/tests/v2/cassettes/test_scenarios/test_update_cloudflare_account_returns_bad_request_response_due_to_invalid_api_key.yaml +++ b/tests/v2/cassettes/test_scenarios/test_update_cloudflare_account_returns_bad_request_response_due_to_invalid_api_key.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{"data":{"attributes":{"api_key":"fakekey","email":"dev@datadog.com","name":"testupdatecloudflareaccountreturnsbadrequestresponseduetoinvalidapikey1674809971"},"type":"cloudflare-accounts"}}' + body: '{"data":{"attributes":{"api_key":"fakekey","email":"dev@datadog.com","name":"testupdatecloudflareaccountreturnsbadrequestresponseduetoinvalidapikey1704393644","resources":["web","dns"],"zones":["zone-id-1","zone-id-2"]},"type":"cloudflare-accounts"}}' headers: accept: - application/json @@ -10,7 +10,7 @@ interactions: uri: https://api.datadoghq.com/api/v2/integrations/cloudflare/accounts response: body: - string: '{"data":{"attributes":{"email":"dev@datadog.com","name":"testupdatecloudflareaccountreturnsbadrequestresponseduetoinvalidapikey1674809971"},"type":"cloudflare-accounts","id":"56a7295bd711e0aea34906a3bea8a2b3"}} + string: '{"data":{"type":"cloudflare-accounts","attributes":{"email":"dev@datadog.com","name":"testupdatecloudflareaccountreturnsbadrequestresponseduetoinvalidapikey1704393644","resources":["web","dns"],"zones":["zone-id-1","zone-id-2"]},"id":"25336f9851edaf58647eec09ce3b636f"}} ' headers: @@ -27,11 +27,11 @@ interactions: content-type: - application/json method: PATCH - uri: https://api.datadoghq.com/api/v2/integrations/cloudflare/accounts/56a7295bd711e0aea34906a3bea8a2b3 + uri: https://api.datadoghq.com/api/v2/integrations/cloudflare/accounts/25336f9851edaf58647eec09ce3b636f response: body: string: '{"errors":["Invalid account. Your Cloudflare configuration is invalid. - Impossible to get zones for the account testupdatecloudflareaccountreturnsbadrequestresponseduetoinvalidapikey1674809971: + Impossible to get zones for the account testupdatecloudflareaccountreturnsbadrequestresponseduetoinvalidapikey1704393644: API key or email is unknown."]}' headers: content-type: @@ -45,7 +45,7 @@ interactions: accept: - '*/*' method: DELETE - uri: https://api.datadoghq.com/api/v2/integrations/cloudflare/accounts/56a7295bd711e0aea34906a3bea8a2b3 + uri: https://api.datadoghq.com/api/v2/integrations/cloudflare/accounts/25336f9851edaf58647eec09ce3b636f response: body: string: '' diff --git a/tests/v2/cassettes/test_scenarios/test_update_cloudflare_account_returns_bad_request_response_due_to_missing_required_email.frozen b/tests/v2/cassettes/test_scenarios/test_update_cloudflare_account_returns_bad_request_response_due_to_missing_required_email.frozen index 541cd4979f..42e9357efa 100644 --- a/tests/v2/cassettes/test_scenarios/test_update_cloudflare_account_returns_bad_request_response_due_to_missing_required_email.frozen +++ b/tests/v2/cassettes/test_scenarios/test_update_cloudflare_account_returns_bad_request_response_due_to_missing_required_email.frozen @@ -1 +1 @@ -2023-01-27T08:59:14.675Z \ No newline at end of file +2024-01-04T18:40:46.262Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_update_cloudflare_account_returns_bad_request_response_due_to_missing_required_email.yaml b/tests/v2/cassettes/test_scenarios/test_update_cloudflare_account_returns_bad_request_response_due_to_missing_required_email.yaml index 70bfb9c8d9..5878771b40 100644 --- a/tests/v2/cassettes/test_scenarios/test_update_cloudflare_account_returns_bad_request_response_due_to_missing_required_email.yaml +++ b/tests/v2/cassettes/test_scenarios/test_update_cloudflare_account_returns_bad_request_response_due_to_missing_required_email.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{"data":{"attributes":{"api_key":"fakekey","email":"dev@datadog.com","name":"testupdatecloudflareaccountreturnsbadrequestresponseduetomissingrequiredemail1674809954"},"type":"cloudflare-accounts"}}' + body: '{"data":{"attributes":{"api_key":"fakekey","email":"dev@datadog.com","name":"testupdatecloudflareaccountreturnsbadrequestresponseduetomissingrequiredemail1704393646","resources":["web","dns"],"zones":["zone-id-1","zone-id-2"]},"type":"cloudflare-accounts"}}' headers: accept: - application/json @@ -10,7 +10,7 @@ interactions: uri: https://api.datadoghq.com/api/v2/integrations/cloudflare/accounts response: body: - string: '{"data":{"attributes":{"email":"dev@datadog.com","name":"testupdatecloudflareaccountreturnsbadrequestresponseduetomissingrequiredemail1674809954"},"type":"cloudflare-accounts","id":"c588ce074fe908f56db516f007afd3fd"}} + string: '{"data":{"type":"cloudflare-accounts","attributes":{"zones":["zone-id-1","zone-id-2"],"resources":["web","dns"],"name":"testupdatecloudflareaccountreturnsbadrequestresponseduetomissingrequiredemail1704393646","email":"dev@datadog.com"},"id":"f1d4f10fbad4add4962f2bc1fcb18c36"}} ' headers: @@ -20,17 +20,17 @@ interactions: code: 201 message: Created - request: - body: '{"data":{"attributes":{"api_key":"abcdefghijklmnopqrstuvwxyz"},"type":"cloudflare-accounts"}}' + body: '{"data":{"attributes":{"api_key":"fakekey"},"type":"cloudflare-accounts"}}' headers: accept: - application/json content-type: - application/json method: PATCH - uri: https://api.datadoghq.com/api/v2/integrations/cloudflare/accounts/c588ce074fe908f56db516f007afd3fd + uri: https://api.datadoghq.com/api/v2/integrations/cloudflare/accounts/f1d4f10fbad4add4962f2bc1fcb18c36 response: body: - string: '{"errors":["{u''_schema'': [''Email address is required if providing + string: '{"errors":["{''_schema'': [''Email address is required if providing an api key and not an api token.'']}"]}' headers: content-type: @@ -44,7 +44,7 @@ interactions: accept: - '*/*' method: DELETE - uri: https://api.datadoghq.com/api/v2/integrations/cloudflare/accounts/c588ce074fe908f56db516f007afd3fd + uri: https://api.datadoghq.com/api/v2/integrations/cloudflare/accounts/f1d4f10fbad4add4962f2bc1fcb18c36 response: body: string: '' diff --git a/tests/v2/cassettes/test_scenarios/test_update_cloudflare_account_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_update_cloudflare_account_returns_ok_response.frozen index 5c0c1ba853..ec278af7a5 100644 --- a/tests/v2/cassettes/test_scenarios/test_update_cloudflare_account_returns_ok_response.frozen +++ b/tests/v2/cassettes/test_scenarios/test_update_cloudflare_account_returns_ok_response.frozen @@ -1 +1 @@ -2023-01-27T08:58:49.822Z \ No newline at end of file +2024-01-04T18:40:47.476Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_update_cloudflare_account_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_update_cloudflare_account_returns_ok_response.yaml index 27c8f84ff5..e532c38a40 100644 --- a/tests/v2/cassettes/test_scenarios/test_update_cloudflare_account_returns_ok_response.yaml +++ b/tests/v2/cassettes/test_scenarios/test_update_cloudflare_account_returns_ok_response.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{"data":{"attributes":{"api_key":"fakekey","email":"dev@datadog.com","name":"testupdatecloudflareaccountreturnsokresponse1674809929"},"type":"cloudflare-accounts"}}' + body: '{"data":{"attributes":{"api_key":"fakekey","email":"dev@datadog.com","name":"testupdatecloudflareaccountreturnsokresponse1704393647","resources":["web","dns"],"zones":["zone-id-1","zone-id-2"]},"type":"cloudflare-accounts"}}' headers: accept: - application/json @@ -10,7 +10,7 @@ interactions: uri: https://api.datadoghq.com/api/v2/integrations/cloudflare/accounts response: body: - string: '{"data":{"attributes":{"email":"dev@datadog.com","name":"testupdatecloudflareaccountreturnsokresponse1674809929"},"type":"cloudflare-accounts","id":"4d22579092049210a1db06b632485219"}} + string: '{"data":{"type":"cloudflare-accounts","attributes":{"zones":["zone-id-1","zone-id-2"],"resources":["web","dns"],"name":"testupdatecloudflareaccountreturnsokresponse1704393647","email":"dev@datadog.com"},"id":"6956534375b31b062c809696f3c34ee8"}} ' headers: @@ -20,17 +20,17 @@ interactions: code: 201 message: Created - request: - body: '{"data":{"attributes":{"api_key":"fakekey","email":"new@email"},"type":"cloudflare-accounts"}}' + body: '{"data":{"attributes":{"api_key":"fakekey","email":"dev@datadoghq.com","zones":["zone-id-3"]},"type":"cloudflare-accounts"}}' headers: accept: - application/json content-type: - application/json method: PATCH - uri: https://api.datadoghq.com/api/v2/integrations/cloudflare/accounts/4d22579092049210a1db06b632485219 + uri: https://api.datadoghq.com/api/v2/integrations/cloudflare/accounts/6956534375b31b062c809696f3c34ee8 response: body: - string: '{"data":{"attributes":{"email":"new@email","name":"testupdatecloudflareaccountreturnsokresponse1674809929"},"type":"cloudflare-accounts","id":"4d22579092049210a1db06b632485219"}} + string: '{"data":{"type":"cloudflare-accounts","attributes":{"resources":[],"email":"dev@datadoghq.com","zones":["zone-id-3"],"name":"testupdatecloudflareaccountreturnsokresponse1704393647"},"id":"6956534375b31b062c809696f3c34ee8"}} ' headers: @@ -45,7 +45,7 @@ interactions: accept: - '*/*' method: DELETE - uri: https://api.datadoghq.com/api/v2/integrations/cloudflare/accounts/4d22579092049210a1db06b632485219 + uri: https://api.datadoghq.com/api/v2/integrations/cloudflare/accounts/6956534375b31b062c809696f3c34ee8 response: body: string: '' diff --git a/tests/v2/features/cloudflare_integration.feature b/tests/v2/features/cloudflare_integration.feature index a7bb9da3ec..c4105440f9 100644 --- a/tests/v2/features/cloudflare_integration.feature +++ b/tests/v2/features/cloudflare_integration.feature @@ -11,14 +11,14 @@ Feature: Cloudflare Integration @generated @skip @team:Datadog/web-integrations Scenario: Add Cloudflare account returns "Bad Request" response Given new "CreateCloudflareAccount" request - And body with value {"data": {"attributes": {"api_key": "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3", "email": "test-email@example.com", "name": "test-name"}, "type": "cloudflare-accounts"}} + And body with value {"data": {"attributes": {"api_key": "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3", "email": "test-email@example.com", "name": "test-name", "resources": ["web", "dns"], "zones": ["zone_id_1", "zone_id_2"]}, "type": "cloudflare-accounts"}} When the request is sent Then the response status is 400 Bad Request @replay-only @team:Datadog/web-integrations Scenario: Add Cloudflare account returns "Bad Request" response due to missing email Given new "CreateCloudflareAccount" request - And body with value {"data": {"attributes": {"api_key": "test-api-key", "name": "{{ unique_lower_alnum }}"}, "type": "cloudflare-accounts"}} + And body with value {"data": {"attributes": {"api_key": "fakekey", "name": "{{ unique_lower_alnum }}"}, "type": "cloudflare-accounts"}} When the request is sent Then the response status is 400 Bad Request @@ -32,17 +32,17 @@ Feature: Cloudflare Integration @replay-only @team:Datadog/web-integrations Scenario: Add Cloudflare account returns "CREATED" response Given new "CreateCloudflareAccount" request - And body with value {"data": {"attributes": {"api_key": "fakekey", "email": "new@email", "name": "{{ unique_lower_alnum }}"}, "type": "cloudflare-accounts"}} + And body with value {"data": {"attributes": {"api_key": "fakekey", "email": "dev@datadoghq.com", "name": "{{ unique_lower_alnum }}"}, "type": "cloudflare-accounts"}} When the request is sent Then the response status is 201 CREATED And the response "data.type" is equal to "cloudflare-accounts" - And the response "data.attributes.email" is equal to "new@email" + And the response "data.attributes.email" is equal to "dev@datadoghq.com" And the response "data.attributes.name" is equal to "{{ unique_lower_alnum }}" @generated @skip @team:Datadog/web-integrations Scenario: Add Cloudflare account returns "Not Found" response Given new "CreateCloudflareAccount" request - And body with value {"data": {"attributes": {"api_key": "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3", "email": "test-email@example.com", "name": "test-name"}, "type": "cloudflare-accounts"}} + And body with value {"data": {"attributes": {"api_key": "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3", "email": "test-email@example.com", "name": "test-name", "resources": ["web", "dns"], "zones": ["zone_id_1", "zone_id_2"]}, "type": "cloudflare-accounts"}} When the request is sent Then the response status is 404 Not Found @@ -116,7 +116,7 @@ Feature: Cloudflare Integration Scenario: Update Cloudflare account returns "Bad Request" response Given new "UpdateCloudflareAccount" request And request contains "account_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"api_key": "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3", "email": "test-email@example.com"}, "type": "cloudflare-accounts"}} + And body with value {"data": {"attributes": {"api_key": "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3", "email": "test-email@example.com", "resources": ["web", "dns"], "zones": ["zone_id_1", "zone_id_2"]}, "type": "cloudflare-accounts"}} When the request is sent Then the response status is 400 Bad Request @@ -134,7 +134,7 @@ Feature: Cloudflare Integration Given there is a valid "cloudflare_account" in the system And new "UpdateCloudflareAccount" request And request contains "account_id" parameter from "cloudflare_account.data.id" - And body with value {"data": {"attributes": {"api_key": "abcdefghijklmnopqrstuvwxyz"}, "type": "cloudflare-accounts"}} + And body with value {"data": {"attributes": {"api_key": "fakekey"}, "type": "cloudflare-accounts"}} When the request is sent Then the response status is 400 Bad Request @@ -142,7 +142,7 @@ Feature: Cloudflare Integration Scenario: Update Cloudflare account returns "Not Found" response Given new "UpdateCloudflareAccount" request And request contains "account_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"api_key": "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3", "email": "test-email@example.com"}, "type": "cloudflare-accounts"}} + And body with value {"data": {"attributes": {"api_key": "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3", "email": "test-email@example.com", "resources": ["web", "dns"], "zones": ["zone_id_1", "zone_id_2"]}, "type": "cloudflare-accounts"}} When the request is sent Then the response status is 404 Not Found @@ -151,8 +151,8 @@ Feature: Cloudflare Integration Given there is a valid "cloudflare_account" in the system And new "UpdateCloudflareAccount" request And request contains "account_id" parameter from "cloudflare_account.data.id" - And body with value {"data": {"attributes": {"api_key": "fakekey", "email": "new@email"}, "type": "cloudflare-accounts"}} + And body with value {"data": {"attributes": {"api_key": "fakekey", "email": "dev@datadoghq.com", "zones": ["zone-id-3"]}, "type": "cloudflare-accounts"}} When the request is sent Then the response status is 200 OK And the response "data.attributes.name" is equal to "{{cloudflare_account.data.attributes.name }}" - And the response "data.attributes.email" is equal to "new@email" + And the response "data.attributes.zones" array contains value "zone-id-3" diff --git a/tests/v2/features/given.json b/tests/v2/features/given.json index 87cad5da34..19f0c37eec 100644 --- a/tests/v2/features/given.json +++ b/tests/v2/features/given.json @@ -191,7 +191,7 @@ "parameters": [ { "name": "body", - "value": "{\n \"data\": {\n \"type\": \"cloudflare-accounts\",\n \"attributes\": {\n \"api_key\": \"fakekey\",\n \"name\": \"{{ unique_lower_alnum }}\",\n \"email\": \"dev@datadog.com\"\n }\n }\n}" + "value": "{\n \"data\": {\n \"type\": \"cloudflare-accounts\",\n \"attributes\": {\n \"api_key\": \"fakekey\",\n \"name\": \"{{ unique_lower_alnum }}\",\n \"email\": \"dev@datadog.com\",\n \"zones\": [\"zone-id-1\", \"zone-id-2\"],\n \"resources\": [\"web\", \"dns\"]\n }\n }\n}" } ], "step": "there is a valid \"cloudflare_account\" in the system",