Skip to content

Commit

Permalink
Merge branch 'master' into therve/poetry-update
Browse files Browse the repository at this point in the history
  • Loading branch information
therve authored Dec 15, 2023
2 parents a587daa + 52bc9e3 commit 3cf7c4b
Show file tree
Hide file tree
Showing 19 changed files with 228 additions and 32 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-12-14 19:38:24.188378",
"spec_repo_commit": "cdc82e06"
"regenerated": "2023-12-15 17:29:36.806700",
"spec_repo_commit": "0285f23a"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2023-12-14 19:38:24.201899",
"spec_repo_commit": "cdc82e06"
"regenerated": "2023-12-15 17:29:36.827320",
"spec_repo_commit": "0285f23a"
}
}
}
3 changes: 1 addition & 2 deletions .generator/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ def unique(request):
},
}


def relative_time(imports, calls, freezed_time, iso):
time_re = re.compile(r"now( *([+-]) *(\d+)([smhdMy]))?")

Expand Down Expand Up @@ -229,7 +228,6 @@ def store_calls(arg):

return store_calls


@pytest.fixture
def context(request, unique, freezed_time):
"""
Expand Down Expand Up @@ -266,6 +264,7 @@ def is_used(self, key):
"unique_hash": unique_hash,
"timestamp": relative_time(imports, replace_values, freezed_time, False),
"timeISO": relative_time(imports, replace_values, freezed_time, True),
"uuid": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
"_replace_values": replace_values,
"_imports": imports,
"_given": given,
Expand Down
8 changes: 4 additions & 4 deletions examples/v1/azure-integration/CreateAzureIntegration.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
body = AzureAccount(
app_service_plan_filters="key:value,filter:example",
automute=True,
client_id="testc7f6-1234-5678-9101-3fcbf464test",
client_id="9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
client_secret="testingx./Sw*g/Y33t..R1cH+hScMDt",
container_app_filters="key:value,filter:example",
cspm_enabled=True,
Expand All @@ -18,10 +18,10 @@
"*",
],
host_filters="key:value,filter:example",
new_client_id="new1c7f6-1234-5678-9101-3fcbf464test",
new_tenant_name="new1c44-1234-5678-9101-cc00736ftest",
new_client_id="9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
new_tenant_name="9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
resource_collection_enabled=True,
tenant_name="testc44-1234-5678-9101-cc00736ftest",
tenant_name="9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
)

configuration = Configuration()
Expand Down
8 changes: 4 additions & 4 deletions examples/v1/azure-integration/DeleteAzureIntegration.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
body = AzureAccount(
app_service_plan_filters="key:value,filter:example",
automute=True,
client_id="testc7f6-1234-5678-9101-3fcbf464test",
client_id="9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
client_secret="testingx./Sw*g/Y33t..R1cH+hScMDt",
container_app_filters="key:value,filter:example",
cspm_enabled=True,
Expand All @@ -18,10 +18,10 @@
"*",
],
host_filters="key:value,filter:example",
new_client_id="new1c7f6-1234-5678-9101-3fcbf464test",
new_tenant_name="new1c44-1234-5678-9101-cc00736ftest",
new_client_id="9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
new_tenant_name="9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
resource_collection_enabled=True,
tenant_name="testc44-1234-5678-9101-cc00736ftest",
tenant_name="9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
)

configuration = Configuration()
Expand Down
8 changes: 4 additions & 4 deletions examples/v1/azure-integration/UpdateAzureIntegration.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
body = AzureAccount(
app_service_plan_filters="key:value,filter:example",
automute=True,
client_id="testc7f6-1234-5678-9101-3fcbf464test",
client_id="9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
client_secret="testingx./Sw*g/Y33t..R1cH+hScMDt",
container_app_filters="key:value,filter:example",
cspm_enabled=True,
Expand All @@ -18,10 +18,10 @@
"*",
],
host_filters="key:value,filter:example",
new_client_id="new1c7f6-1234-5678-9101-3fcbf464test",
new_tenant_name="new1c44-1234-5678-9101-cc00736ftest",
new_client_id="9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
new_tenant_name="9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
resource_collection_enabled=True,
tenant_name="testc44-1234-5678-9101-cc00736ftest",
tenant_name="9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
)

configuration = Configuration()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
data=GCPSTSServiceAccountData(
attributes=GCPSTSServiceAccountAttributes(
is_cspm_enabled=True,
resource_collection_enabled=True,
client_email="[email protected]",
host_filters=[],
),
Expand Down
6 changes: 6 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,11 @@ def func(arg):
return func


def generate_uuid(freezed_time):
freezed_time_string = str(freezed_time.timestamp())
return freezed_time_string[:8] + "-0000-0000-0000-" + freezed_time_string[:10] + "00"


@pytest.fixture
def context(vcr, unique, freezed_time):
"""
Expand All @@ -209,6 +214,7 @@ def context(vcr, unique, freezed_time):
"unique_hash": unique_hash,
"timestamp": relative_time(freezed_time, False),
"timeISO": relative_time(freezed_time, True),
"uuid": generate_uuid(freezed_time),
}

yield ctx
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2023-12-08T15:34:43.210Z
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
interactions:
- request:
body: '{"app_service_plan_filters":"key:value,filter:example","automute":true,"client_id":"17020496-0000-0000-0000-170204968300","client_secret":"testingx./Sw*g/Y33t..R1cH+hScMDt","container_app_filters":"key:value,filter:example","cspm_enabled":true,"custom_metrics_enabled":true,"errors":["*"],"host_filters":"key:value,filter:example","new_client_id":"17020496-0000-0000-0000-170204968300","new_tenant_name":"17020496-0000-0000-0000-170204968300","resource_collection_enabled":true,"tenant_name":"17020496-0000-0000-0000-170204968300"}'
headers:
accept:
- application/json
content-type:
- application/json
method: POST
uri: https://api.datadoghq.com/api/v1/integration/azure
response:
body:
string: '{}
'
headers:
content-type:
- application/json
status:
code: 200
message: OK
- request:
body: '{"app_service_plan_filters":"key:value,filter:example","automute":true,"client_id":"17020496-0000-0000-0000-170204968300","client_secret":"testingx./Sw*g/Y33t..R1cH+hScMDt","container_app_filters":"key:value,filter:example","cspm_enabled":true,"custom_metrics_enabled":true,"errors":["*"],"host_filters":"key:value,filter:example","new_client_id":"17020496-0000-0000-0000-170204968300","new_tenant_name":"17020496-0000-0000-0000-170204968300","resource_collection_enabled":true,"tenant_name":"17020496-0000-0000-0000-170204968300"}'
headers:
accept:
- application/json
content-type:
- application/json
method: DELETE
uri: https://api.datadoghq.com/api/v1/integration/azure
response:
body:
string: '{}
'
headers:
content-type:
- application/json
status:
code: 200
message: OK
version: 1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2023-12-15T17:19:40.609Z
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
interactions:
- request:
body: '{"app_service_plan_filters":"key:value,filter:example","automute":true,"client_id":"17026607-0000-0000-0000-170266078000","client_secret":"testingx./Sw*g/Y33t..R1cH+hScMDt","container_app_filters":"key:value,filter:example","cspm_enabled":true,"custom_metrics_enabled":true,"errors":["*"],"host_filters":"key:value,filter:example","new_client_id":"17026607-0000-0000-0000-170266078000","new_tenant_name":"17026607-0000-0000-0000-170266078000","resource_collection_enabled":true,"tenant_name":"17026607-0000-0000-0000-170266078000"}'
headers:
accept:
- application/json
content-type:
- application/json
method: POST
uri: https://api.datadoghq.com/api/v1/integration/azure
response:
body:
string: '{}
'
headers:
content-type:
- application/json
status:
code: 200
message: OK
- request:
body: '{"app_service_plan_filters":"key:value,filter:example","automute":true,"client_id":"17026607-0000-0000-0000-170266078000","client_secret":"testingx./Sw*g/Y33t..R1cH+hScMDt","container_app_filters":"key:value,filter:example","cspm_enabled":true,"custom_metrics_enabled":true,"errors":["*"],"host_filters":"key:value,filter:example","new_client_id":"17026607-0000-0000-0000-170266078000","new_tenant_name":"17026607-0000-0000-0000-170266078000","resource_collection_enabled":true,"tenant_name":"17026607-0000-0000-0000-170266078000"}'
headers:
accept:
- application/json
content-type:
- application/json
method: DELETE
uri: https://api.datadoghq.com/api/v1/integration/azure
response:
body:
string: '{}
'
headers:
content-type:
- application/json
status:
code: 200
message: OK
- request:
body: '{"app_service_plan_filters":"key:value,filter:example","automute":true,"client_id":"17026607-0000-0000-0000-170266078000","client_secret":"testingx./Sw*g/Y33t..R1cH+hScMDt","container_app_filters":"key:value,filter:example","cspm_enabled":true,"custom_metrics_enabled":true,"errors":["*"],"host_filters":"key:value,filter:example","new_client_id":"17026607-0000-0000-0000-170266078000","new_tenant_name":"17026607-0000-0000-0000-170266078000","resource_collection_enabled":true,"tenant_name":"17026607-0000-0000-0000-170266078000"}'
headers:
accept:
- application/json
content-type:
- application/json
method: DELETE
uri: https://api.datadoghq.com/api/v1/integration/azure
response:
body:
string: '{}
'
headers:
content-type:
- application/json
status:
code: 200
message: OK
version: 1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2023-12-15T17:19:43.390Z
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
interactions:
- request:
body: '{"app_service_plan_filters":"key:value,filter:example","automute":true,"client_id":"17026607-0000-0000-0000-170266078300","client_secret":"testingx./Sw*g/Y33t..R1cH+hScMDt","container_app_filters":"key:value,filter:example","cspm_enabled":true,"custom_metrics_enabled":true,"errors":["*"],"host_filters":"key:value,filter:example","new_client_id":"17026607-0000-0000-0000-170266078300","new_tenant_name":"17026607-0000-0000-0000-170266078300","resource_collection_enabled":true,"tenant_name":"17026607-0000-0000-0000-170266078300"}'
headers:
accept:
- application/json
content-type:
- application/json
method: POST
uri: https://api.datadoghq.com/api/v1/integration/azure
response:
body:
string: '{}
'
headers:
content-type:
- application/json
status:
code: 200
message: OK
- request:
body: '{"app_service_plan_filters":"key:value,filter:example","automute":true,"client_id":"17026607-0000-0000-0000-170266078300","client_secret":"testingx./Sw*g/Y33t..R1cH+hScMDt","container_app_filters":"key:value,filter:example","cspm_enabled":true,"custom_metrics_enabled":true,"errors":["*"],"host_filters":"key:value,filter:example","new_client_id":"17026607-0000-0000-0000-170266078300","new_tenant_name":"17026607-0000-0000-0000-170266078300","resource_collection_enabled":true,"tenant_name":"17026607-0000-0000-0000-170266078300"}'
headers:
accept:
- application/json
content-type:
- application/json
method: PUT
uri: https://api.datadoghq.com/api/v1/integration/azure
response:
body:
string: '{}
'
headers:
content-type:
- application/json
status:
code: 200
message: OK
- request:
body: '{"app_service_plan_filters":"key:value,filter:example","automute":true,"client_id":"17026607-0000-0000-0000-170266078300","client_secret":"testingx./Sw*g/Y33t..R1cH+hScMDt","container_app_filters":"key:value,filter:example","cspm_enabled":true,"custom_metrics_enabled":true,"errors":["*"],"host_filters":"key:value,filter:example","new_client_id":"17026607-0000-0000-0000-170266078300","new_tenant_name":"17026607-0000-0000-0000-170266078300","resource_collection_enabled":true,"tenant_name":"17026607-0000-0000-0000-170266078300"}'
headers:
accept:
- application/json
content-type:
- application/json
method: DELETE
uri: https://api.datadoghq.com/api/v1/integration/azure
response:
body:
string: '{}
'
headers:
content-type:
- application/json
status:
code: 200
message: OK
version: 1
18 changes: 10 additions & 8 deletions tests/v1/features/azure_integration.feature
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ Feature: Azure Integration
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:DataDog/azure-integrations
@team:DataDog/azure-integrations
Scenario: Create an Azure integration returns "OK" response
Given new "CreateAzureIntegration" request
And body with value {"app_service_plan_filters": "key:value,filter:example", "automute": true, "client_id": "testc7f6-1234-5678-9101-3fcbf464test", "client_secret": "testingx./Sw*g/Y33t..R1cH+hScMDt", "container_app_filters": "key:value,filter:example", "cspm_enabled": true, "custom_metrics_enabled": true, "errors": ["*"], "host_filters": "key:value,filter:example", "new_client_id": "new1c7f6-1234-5678-9101-3fcbf464test", "new_tenant_name": "new1c44-1234-5678-9101-cc00736ftest", "resource_collection_enabled": true, "tenant_name": "testc44-1234-5678-9101-cc00736ftest"}
And body with value {"app_service_plan_filters": "key:value,filter:example", "automute": true, "client_id": "{{ uuid }}", "client_secret": "testingx./Sw*g/Y33t..R1cH+hScMDt", "container_app_filters": "key:value,filter:example", "cspm_enabled": true, "custom_metrics_enabled": true, "errors": ["*"], "host_filters": "key:value,filter:example", "new_client_id": "{{ uuid }}", "new_tenant_name": "{{ uuid }}", "resource_collection_enabled": true, "tenant_name": "{{ uuid }}"}
When the request is sent
Then the response status is 200 OK

Expand All @@ -30,10 +30,11 @@ Feature: Azure Integration
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:DataDog/azure-integrations
@team:DataDog/azure-integrations
Scenario: Delete an Azure integration returns "OK" response
Given new "DeleteAzureIntegration" request
And body with value {"app_service_plan_filters": "key:value,filter:example", "automute": true, "client_id": "testc7f6-1234-5678-9101-3fcbf464test", "client_secret": "testingx./Sw*g/Y33t..R1cH+hScMDt", "container_app_filters": "key:value,filter:example", "cspm_enabled": true, "custom_metrics_enabled": true, "errors": ["*"], "host_filters": "key:value,filter:example", "new_client_id": "new1c7f6-1234-5678-9101-3fcbf464test", "new_tenant_name": "new1c44-1234-5678-9101-cc00736ftest", "resource_collection_enabled": true, "tenant_name": "testc44-1234-5678-9101-cc00736ftest"}
Given there is a valid "azure_account" in the system
And new "DeleteAzureIntegration" request
And body with value {"app_service_plan_filters": "key:value,filter:example", "automute": true, "client_id": "{{ uuid }}", "client_secret": "testingx./Sw*g/Y33t..R1cH+hScMDt", "container_app_filters": "key:value,filter:example", "cspm_enabled": true, "custom_metrics_enabled": true, "errors": ["*"], "host_filters": "key:value,filter:example", "new_client_id": "{{ uuid }}", "new_tenant_name": "{{ uuid }}", "resource_collection_enabled": true, "tenant_name": "{{ uuid }}"}
When the request is sent
Then the response status is 200 OK

Expand Down Expand Up @@ -70,9 +71,10 @@ Feature: Azure Integration
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:DataDog/azure-integrations
@team:DataDog/azure-integrations
Scenario: Update an Azure integration returns "OK" response
Given new "UpdateAzureIntegration" request
And body with value {"app_service_plan_filters": "key:value,filter:example", "automute": true, "client_id": "testc7f6-1234-5678-9101-3fcbf464test", "client_secret": "testingx./Sw*g/Y33t..R1cH+hScMDt", "container_app_filters": "key:value,filter:example", "cspm_enabled": true, "custom_metrics_enabled": true, "errors": ["*"], "host_filters": "key:value,filter:example", "new_client_id": "new1c7f6-1234-5678-9101-3fcbf464test", "new_tenant_name": "new1c44-1234-5678-9101-cc00736ftest", "resource_collection_enabled": true, "tenant_name": "testc44-1234-5678-9101-cc00736ftest"}
Given there is a valid "azure_account" in the system
And new "UpdateAzureIntegration" request
And body with value {"app_service_plan_filters": "key:value,filter:example", "automute": true, "client_id": "{{ uuid }}", "client_secret": "testingx./Sw*g/Y33t..R1cH+hScMDt", "container_app_filters": "key:value,filter:example", "cspm_enabled": true, "custom_metrics_enabled": true, "errors": ["*"], "host_filters": "key:value,filter:example", "new_client_id": "{{ uuid }}", "new_tenant_name": "{{ uuid }}", "resource_collection_enabled": true, "tenant_name": "{{ uuid }}"}
When the request is sent
Then the response status is 200 OK
13 changes: 13 additions & 0 deletions tests/v1/features/given.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,19 @@
"tag": "AWS Integration",
"operationId": "CreateAWSAccount"
},
{
"parameters": [
{
"name": "body",
"origin": "request",
"value": "{\n \"app_service_plan_filters\": \"key:value,filter:example\",\n \"automute\": true,\n \"client_id\": \"{{ uuid }}\",\n \"client_secret\": \"testingx./Sw*g/Y33t..R1cH+hScMDt\",\n \"container_app_filters\": \"key:value,filter:example\",\n \"cspm_enabled\": true,\n \"custom_metrics_enabled\": true,\n \"errors\": [\"*\"],\n \"host_filters\": \"key:value,filter:example\",\n \"new_client_id\": \"{{ uuid }}\",\n \"new_tenant_name\": \"{{ uuid }}\",\n \"resource_collection_enabled\": true,\n \"tenant_name\": \"{{ uuid }}\"\n}"
}
],
"step": "there is a valid \"azure_account\" in the system",
"key": "aws_account",
"tag": "Azure Integration",
"operationId": "CreateAzureIntegration"
},
{
"parameters": [
{
Expand Down
8 changes: 7 additions & 1 deletion tests/v1/features/undo.json
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,13 @@
"tag": "Azure Integration",
"undo": {
"operationId": "DeleteAzureIntegration",
"parameters": [],
"parameters": [
{
"name": "body",
"origin": "request",
"template": "{\n \"app_service_plan_filters\": \"key:value,filter:example\",\n \"automute\": true,\n \"client_id\": \"{{client_id}}\",\n \"client_secret\": \"testingx./Sw*g/Y33t..R1cH+hScMDt\",\n \"container_app_filters\": \"key:value,filter:example\",\n \"cspm_enabled\": true,\n \"custom_metrics_enabled\": true,\n \"errors\": [\"*\"],\n \"host_filters\": \"key:value,filter:example\",\n \"new_client_id\": \"{{new_client_id}}\",\n \"new_tenant_name\": \"{{new_tenant_name}}\",\n \"resource_collection_enabled\": true,\n \"tenant_name\": \"{{tenant_name}}\"\n}"
}
],
"type": "unsafe"
}
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2023-12-13T21:29:09.202Z
2023-12-15T08:45:38.020Z
Loading

0 comments on commit 3cf7c4b

Please sign in to comment.