Skip to content

Commit

Permalink
Regenerate client from commit 760c6307 of spec repo
Browse files Browse the repository at this point in the history
  • Loading branch information
ci.datadog-api-spec committed Nov 20, 2023
1 parent 3656eca commit d642d2c
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 16 deletions.
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2023-11-17 20:28:38.988410",
"spec_repo_commit": "7fb616ae"
"regenerated": "2023-11-20 12:32:41.059604",
"spec_repo_commit": "760c6307"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2023-11-17 20:28:39.002128",
"spec_repo_commit": "7fb616ae"
"regenerated": "2023-11-20 12:32:41.258105",
"spec_repo_commit": "760c6307"
}
}
}
2 changes: 1 addition & 1 deletion examples/v1/aws-integration/CreateAWSAccount.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from datadog_api_client.v1.model.aws_account import AWSAccount

body = AWSAccount(
account_id="123456789012",
account_id="163662907100",
account_specific_namespace_rules=dict(
auto_scaling=False,
),
Expand Down
14 changes: 8 additions & 6 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,13 +486,13 @@ def build_param(p):
result = operation_method(**kwargs)

if "body" in kwargs:
request_body = kwargs.get("body","")
request_body = kwargs.get("body", "")
else:
request_body = ""

# register undo method
def undo_operation():
return undo(api, version, operation_name, result, request_body,client=client)
return undo(api, version, operation_name, result, request_body, client=client)

if tracer:
undo_operation = tracer.wrap(name="undo", resource=operation["step"])(undo_operation)
Expand All @@ -516,6 +516,7 @@ def undo_operation():
for settings in json.load(fp):
given(settings["step"])(build_given(version, settings))


def extract_parameters(kwargs, data, parameter):
if "source" in parameter:
kwargs[parameter["name"]] = glom(data, parameter["source"])
Expand All @@ -526,6 +527,7 @@ def extract_parameters(kwargs, data, parameter):
ctx[var] = glom(data, var)
kwargs[parameter["name"]] = json.loads(Template(parameter["template"]).render(**ctx))


@pytest.fixture
def undo(package_name, undo_operations, client):
"""Clean after operation."""
Expand Down Expand Up @@ -553,12 +555,12 @@ def cleanup(api, version, operation_id, response, request, client=client):
operation_name = snake_case(operation["operationId"])
method = getattr(api, operation_name)
kwargs = {}
parameters= operation.get("parameters", [])
parameters = operation.get("parameters", [])
for parameter in parameters:
if "origin" not in parameter or parameter["origin"] == "response":
extract_parameters(kwargs,response,parameter)
extract_parameters(kwargs, response, parameter)
elif parameter["origin"] == "request":
extract_parameters(kwargs,request,parameter)
extract_parameters(kwargs, request, parameter)
if operation_name in client.configuration.unstable_operations:
client.configuration.unstable_operations[operation_name] = True

Expand Down Expand Up @@ -598,7 +600,7 @@ def execute_request(undo, context, client, api_version, request):
operation_id = api_request["request"].__name__
response = api_request["response"][0]
if "kwargs" in api_request and "body" in api_request["kwargs"]:
request_body = api_request.get("kwargs",{}).get("body","")
request_body = api_request.get("kwargs", {}).get("body", "")
else:
request_body = ""

Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2023-10-30T20:37:07.199Z
2023-11-13T14:17:01.291Z
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
interactions:
- request:
body: '{"account_id":"123456789012","account_specific_namespace_rules":{"auto_scaling":false},"cspm_resource_collection_enabled":true,"excluded_regions":["us-east-1","us-west-2"],"filter_tags":["$KEY:$VALUE"],"host_tags":["$KEY:$VALUE"],"metrics_collection_enabled":false,"resource_collection_enabled":true,"role_name":"DatadogAWSIntegrationRole"}'
body: '{"account_id":"169988502100","account_specific_namespace_rules":{"auto_scaling":false},"cspm_resource_collection_enabled":true,"excluded_regions":["us-east-1","us-west-2"],"filter_tags":["$KEY:$VALUE"],"host_tags":["$KEY:$VALUE"],"metrics_collection_enabled":false,"resource_collection_enabled":true,"role_name":"DatadogAWSIntegrationRole"}'
headers:
accept:
- application/json
Expand All @@ -10,7 +10,7 @@ interactions:
uri: https://api.datadoghq.com/api/v1/integration/aws
response:
body:
string: '{"external_id":"240b016c46fe4ceb95ac0232da138c88"}
string: '{"external_id":"9668e281c0ef4cc8be01710ef7a0ae4c"}
'
headers:
Expand All @@ -20,7 +20,7 @@ interactions:
code: 200
message: OK
- request:
body: '{"account_id":"123456789012","role_name":"DatadogAWSIntegrationRole"}'
body: '{"account_id":"169988502100","role_name":"DatadogAWSIntegrationRole"}'
headers:
accept:
- application/json
Expand Down
2 changes: 1 addition & 1 deletion tests/v1/features/aws_integration.feature
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Feature: AWS Integration
@team:DataDog/cloud-integrations
Scenario: Create an AWS integration returns "OK" response
Given new "CreateAWSAccount" request
And body with value {"account_id": "123456789012", "account_specific_namespace_rules": {"auto_scaling": false}, "cspm_resource_collection_enabled": true, "excluded_regions": ["us-east-1", "us-west-2"], "filter_tags": ["$KEY:$VALUE"], "host_tags": ["$KEY:$VALUE"], "metrics_collection_enabled": false, "resource_collection_enabled": true, "role_name": "DatadogAWSIntegrationRole"}
And body with value {"account_id": "{{ timestamp("now") }}00", "account_specific_namespace_rules": {"auto_scaling": false}, "cspm_resource_collection_enabled": true, "excluded_regions": ["us-east-1", "us-west-2"], "filter_tags": ["$KEY:$VALUE"], "host_tags": ["$KEY:$VALUE"], "metrics_collection_enabled": false, "resource_collection_enabled": true, "role_name": "DatadogAWSIntegrationRole"}
When the request is sent
Then the response status is 200 OK

Expand Down

0 comments on commit d642d2c

Please sign in to comment.