-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add account-tags to GCP Service Account Attributes (#1678)
Co-authored-by: ci.datadog-api-spec <[email protected]>
- Loading branch information
1 parent
385cde6
commit aaf30ac
Showing
9 changed files
with
107 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
examples/v2/gcp-integration/CreateGCPSTSAccount_109518525.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
""" | ||
Create a new entry for your service account with account_tags returns "OK" response | ||
""" | ||
|
||
from datadog_api_client import ApiClient, Configuration | ||
from datadog_api_client.v2.api.gcp_integration_api import GCPIntegrationApi | ||
from datadog_api_client.v2.model.gcp_service_account_type import GCPServiceAccountType | ||
from datadog_api_client.v2.model.gcpsts_service_account_attributes import GCPSTSServiceAccountAttributes | ||
from datadog_api_client.v2.model.gcpsts_service_account_create_request import GCPSTSServiceAccountCreateRequest | ||
from datadog_api_client.v2.model.gcpsts_service_account_data import GCPSTSServiceAccountData | ||
|
||
body = GCPSTSServiceAccountCreateRequest( | ||
data=GCPSTSServiceAccountData( | ||
attributes=GCPSTSServiceAccountAttributes( | ||
account_tags=[ | ||
"lorem", | ||
"ipsum", | ||
], | ||
client_email="[email protected]", | ||
host_filters=[], | ||
), | ||
type=GCPServiceAccountType.GCP_SERVICE_ACCOUNT, | ||
), | ||
) | ||
|
||
configuration = Configuration() | ||
with ApiClient(configuration) as api_client: | ||
api_instance = GCPIntegrationApi(api_client) | ||
response = api_instance.create_gcpsts_account(body=body) | ||
|
||
print(response) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...est_scenarios/test_create_a_new_entry_for_your_service_account_returns_ok_response.frozen
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
2023-06-16T14:05:25.134Z | ||
2023-09-29T12:39:55.710Z |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
..._create_a_new_entry_for_your_service_account_with_account_tags_returns_ok_response.frozen
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
2023-09-27T14:45:59.771Z |
38 changes: 38 additions & 0 deletions
38
...st_create_a_new_entry_for_your_service_account_with_account_tags_returns_ok_response.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
interactions: | ||
- request: | ||
body: '{"data":{"attributes":{"account_tags":["lorem","ipsum"],"client_email":"[email protected]","host_filters":[]},"type":"gcp_service_account"}}' | ||
headers: | ||
accept: | ||
- application/json | ||
content-type: | ||
- application/json | ||
method: POST | ||
uri: https://api.datadoghq.com/api/v2/integration/gcp/accounts | ||
response: | ||
body: | ||
string: '{"data":{"type":"gcp_service_account","attributes":{"host_filters":[],"client_email":"[email protected]","is_cspm_enabled":false,"automute":false,"account_tags":["lorem","ipsum"]},"id":"1cdedba8-a0a3-4036-82b0-ad8088dd0c02"}} | ||
' | ||
headers: | ||
content-type: | ||
- application/json | ||
status: | ||
code: 201 | ||
message: Created | ||
- request: | ||
body: null | ||
headers: | ||
accept: | ||
- '*/*' | ||
method: DELETE | ||
uri: https://api.datadoghq.com/api/v2/integration/gcp/accounts/1cdedba8-a0a3-4036-82b0-ad8088dd0c02 | ||
response: | ||
body: | ||
string: '' | ||
headers: | ||
content-type: | ||
- text/html; charset=utf-8 | ||
status: | ||
code: 204 | ||
message: No Content | ||
version: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,14 +34,14 @@ Feature: GCP Integration | |
@generated @skip @team:DataDog/gcp-integrations | ||
Scenario: Create a new entry for your service account returns "Bad Request" response | ||
Given new "CreateGCPSTSAccount" request | ||
And body with value {"data": {"attributes": {"client_email": "[email protected]", "host_filters": []}, "type": "gcp_service_account"}} | ||
And body with value {"data": {"attributes": {"account_tags": [], "client_email": "[email protected]", "host_filters": []}, "type": "gcp_service_account"}} | ||
When the request is sent | ||
Then the response status is 400 Bad Request | ||
|
||
@generated @skip @team:DataDog/gcp-integrations | ||
Scenario: Create a new entry for your service account returns "Conflict" response | ||
Given new "CreateGCPSTSAccount" request | ||
And body with value {"data": {"attributes": {"client_email": "[email protected]", "host_filters": []}, "type": "gcp_service_account"}} | ||
And body with value {"data": {"attributes": {"account_tags": [], "client_email": "[email protected]", "host_filters": []}, "type": "gcp_service_account"}} | ||
When the request is sent | ||
Then the response status is 409 Conflict | ||
|
||
|
@@ -54,6 +54,16 @@ Feature: GCP Integration | |
And the response "data.type" is equal to "gcp_service_account" | ||
And the response "data.attributes.client_email" is equal to "{{ unique_hash }}@test-project.iam.gserviceaccount.com" | ||
|
||
@team:DataDog/gcp-integrations | ||
Scenario: Create a new entry for your service account with account_tags returns "OK" response | ||
Given new "CreateGCPSTSAccount" request | ||
And body with value {"data": {"attributes": {"account_tags": ["lorem", "ipsum"], "client_email": "{{ unique_hash }}@test-project.iam.gserviceaccount.com", "host_filters": []}, "type": "gcp_service_account"}} | ||
When the request is sent | ||
Then the response status is 201 OK | ||
And the response "data.type" is equal to "gcp_service_account" | ||
And the response "data.attributes.client_email" is equal to "{{ unique_hash }}@test-project.iam.gserviceaccount.com" | ||
And the response "data.attributes.account_tags" is equal to ["lorem", "ipsum"] | ||
|
||
@generated @skip @team:DataDog/gcp-integrations | ||
Scenario: Delete an STS enabled GCP Account returns "Bad Request" response | ||
Given new "DeleteGCPSTSAccount" request | ||
|
@@ -93,15 +103,15 @@ Feature: GCP Integration | |
Scenario: Update STS Service Account returns "Bad Request" response | ||
Given new "UpdateGCPSTSAccount" request | ||
And request contains "account_id" parameter from "REPLACE.ME" | ||
And body with value {"data": {"attributes": {"client_email": "[email protected]", "host_filters": []}, "id": "d291291f-12c2-22g4-j290-123456678897", "type": "gcp_service_account"}} | ||
And body with value {"data": {"attributes": {"account_tags": [], "client_email": "[email protected]", "host_filters": []}, "id": "d291291f-12c2-22g4-j290-123456678897", "type": "gcp_service_account"}} | ||
When the request is sent | ||
Then the response status is 400 Bad Request | ||
|
||
@generated @skip @team:DataDog/gcp-integrations | ||
Scenario: Update STS Service Account returns "Not Found" response | ||
Given new "UpdateGCPSTSAccount" request | ||
And request contains "account_id" parameter from "REPLACE.ME" | ||
And body with value {"data": {"attributes": {"client_email": "[email protected]", "host_filters": []}, "id": "d291291f-12c2-22g4-j290-123456678897", "type": "gcp_service_account"}} | ||
And body with value {"data": {"attributes": {"account_tags": [], "client_email": "[email protected]", "host_filters": []}, "id": "d291291f-12c2-22g4-j290-123456678897", "type": "gcp_service_account"}} | ||
When the request is sent | ||
Then the response status is 404 Not Found | ||
|
||
|