Skip to content

Commit e63972a

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Document new resource_collection and is_security_command_center_enabled fields in GCP APIs (#1804)
Co-authored-by: ci.datadog-api-spec <[email protected]> Co-authored-by: api-clients-generation-pipeline[bot] <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com>
1 parent 12e5833 commit e63972a

File tree

24 files changed

+450
-28
lines changed

24 files changed

+450
-28
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.6",
7-
"regenerated": "2023-12-14 10:49:25.707098",
8-
"spec_repo_commit": "43a99a56"
7+
"regenerated": "2023-12-14 17:13:00.567226",
8+
"spec_repo_commit": "fd0b0fcb"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2023-12-14 10:49:25.793558",
13-
"spec_repo_commit": "43a99a56"
12+
"regenerated": "2023-12-14 17:13:00.585680",
13+
"spec_repo_commit": "fd0b0fcb"
1414
}
1515
}
1616
}

.generator/schemas/v1/openapi.yaml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3212,8 +3212,16 @@ components:
32123212
type: string
32133213
is_cspm_enabled:
32143214
default: false
3215-
description: When enabled, Datadog performs configuration checks across
3216-
your Google Cloud environment by continuously scanning every resource.
3215+
description: 'When enabled, Datadog will activate the Cloud Security Monitoring
3216+
product for this service account. Note: This requires resource_collection_enabled
3217+
to be set to true.'
3218+
example: true
3219+
type: boolean
3220+
is_security_command_center_enabled:
3221+
default: false
3222+
description: 'When enabled, Datadog will attempt to collect Security Command
3223+
Center Findings. Note: This requires additional permissions on the service
3224+
account.'
32173225
example: true
32183226
type: boolean
32193227
private_key:
@@ -3229,6 +3237,11 @@ components:
32293237
key.
32303238
example: datadog-apitest
32313239
type: string
3240+
resource_collection_enabled:
3241+
default: false
3242+
description: When enabled, Datadog scans for all resources in your GCP environment.
3243+
example: true
3244+
type: boolean
32323245
token_uri:
32333246
description: Should be `https://accounts.google.com/o/oauth2/token`.
32343247
example: https://accounts.google.com/o/oauth2/token

.generator/schemas/v2/openapi.yaml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6393,8 +6393,20 @@ components:
63936393
type: string
63946394
type: array
63956395
is_cspm_enabled:
6396-
description: When enabled, Datadog performs configuration checks across
6397-
your Google Cloud environment by continuously scanning every resource.
6396+
description: 'When enabled, Datadog will activate the Cloud Security Monitoring
6397+
product for this service account. Note: This requires resource_collection_enabled
6398+
to be set to true.'
6399+
type: boolean
6400+
is_security_command_center_enabled:
6401+
default: false
6402+
description: 'When enabled, Datadog will attempt to collect Security Command
6403+
Center Findings. Note: This requires additional permissions on the service
6404+
account.'
6405+
example: true
6406+
type: boolean
6407+
resource_collection_enabled:
6408+
default: false
6409+
description: When enabled, Datadog scans for all resources in your GCP environment.
63986410
type: boolean
63996411
type: object
64006412
GCPSTSServiceAccountCreateRequest:

examples/v1/gcp-integration/CreateGCPIntegration.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@
1717
],
1818
host_filters="key:value,filter:example",
1919
is_cspm_enabled=True,
20+
is_security_command_center_enabled=True,
2021
private_key="private_key",
2122
private_key_id="123456789abcdefghi123456789abcdefghijklm",
2223
project_id="datadog-apitest",
24+
resource_collection_enabled=True,
2325
token_uri="https://accounts.google.com/o/oauth2/token",
2426
type="service_account",
2527
)

examples/v1/gcp-integration/DeleteGCPIntegration.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@
1717
],
1818
host_filters="key:value,filter:example",
1919
is_cspm_enabled=True,
20+
is_security_command_center_enabled=True,
2021
private_key="private_key",
2122
private_key_id="123456789abcdefghi123456789abcdefghijklm",
2223
project_id="datadog-apitest",
24+
resource_collection_enabled=True,
2325
token_uri="https://accounts.google.com/o/oauth2/token",
2426
type="service_account",
2527
)

examples/v1/gcp-integration/UpdateGCPIntegration.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@
1717
],
1818
host_filters="key:value,filter:example",
1919
is_cspm_enabled=True,
20+
is_security_command_center_enabled=True,
2021
private_key="private_key",
2122
private_key_id="123456789abcdefghi123456789abcdefghijklm",
2223
project_id="datadog-apitest",
24+
resource_collection_enabled=True,
2325
token_uri="https://accounts.google.com/o/oauth2/token",
2426
type="service_account",
2527
)
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
"""
2+
Create a new entry for your service account with resource collection enabled returns "OK" response
3+
"""
4+
5+
from datadog_api_client import ApiClient, Configuration
6+
from datadog_api_client.v2.api.gcp_integration_api import GCPIntegrationApi
7+
from datadog_api_client.v2.model.gcp_service_account_type import GCPServiceAccountType
8+
from datadog_api_client.v2.model.gcpsts_service_account_attributes import GCPSTSServiceAccountAttributes
9+
from datadog_api_client.v2.model.gcpsts_service_account_create_request import GCPSTSServiceAccountCreateRequest
10+
from datadog_api_client.v2.model.gcpsts_service_account_data import GCPSTSServiceAccountData
11+
12+
body = GCPSTSServiceAccountCreateRequest(
13+
data=GCPSTSServiceAccountData(
14+
attributes=GCPSTSServiceAccountAttributes(
15+
resource_collection_enabled=True,
16+
client_email="[email protected]",
17+
host_filters=[],
18+
),
19+
type=GCPServiceAccountType.GCP_SERVICE_ACCOUNT,
20+
),
21+
)
22+
23+
configuration = Configuration()
24+
with ApiClient(configuration) as api_client:
25+
api_instance = GCPIntegrationApi(api_client)
26+
response = api_instance.create_gcpsts_account(body=body)
27+
28+
print(response)
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
"""
2+
Create a new entry for your service account with security command center enabled returns "OK" response
3+
"""
4+
5+
from datadog_api_client import ApiClient, Configuration
6+
from datadog_api_client.v2.api.gcp_integration_api import GCPIntegrationApi
7+
from datadog_api_client.v2.model.gcp_service_account_type import GCPServiceAccountType
8+
from datadog_api_client.v2.model.gcpsts_service_account_attributes import GCPSTSServiceAccountAttributes
9+
from datadog_api_client.v2.model.gcpsts_service_account_create_request import GCPSTSServiceAccountCreateRequest
10+
from datadog_api_client.v2.model.gcpsts_service_account_data import GCPSTSServiceAccountData
11+
12+
body = GCPSTSServiceAccountCreateRequest(
13+
data=GCPSTSServiceAccountData(
14+
attributes=GCPSTSServiceAccountAttributes(
15+
is_security_command_center_enabled=True,
16+
client_email="[email protected]",
17+
host_filters=[],
18+
),
19+
type=GCPServiceAccountType.GCP_SERVICE_ACCOUNT,
20+
),
21+
)
22+
23+
configuration = Configuration()
24+
with ApiClient(configuration) as api_client:
25+
api_instance = GCPIntegrationApi(api_client)
26+
response = api_instance.create_gcpsts_account(body=body)
27+
28+
print(response)
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
"""
2+
Create a new entry for your service account with cspm enabled returns "OK" response
3+
"""
4+
5+
from datadog_api_client import ApiClient, Configuration
6+
from datadog_api_client.v2.api.gcp_integration_api import GCPIntegrationApi
7+
from datadog_api_client.v2.model.gcp_service_account_type import GCPServiceAccountType
8+
from datadog_api_client.v2.model.gcpsts_service_account_attributes import GCPSTSServiceAccountAttributes
9+
from datadog_api_client.v2.model.gcpsts_service_account_create_request import GCPSTSServiceAccountCreateRequest
10+
from datadog_api_client.v2.model.gcpsts_service_account_data import GCPSTSServiceAccountData
11+
12+
body = GCPSTSServiceAccountCreateRequest(
13+
data=GCPSTSServiceAccountData(
14+
attributes=GCPSTSServiceAccountAttributes(
15+
is_cspm_enabled=True,
16+
client_email="[email protected]",
17+
host_filters=[],
18+
),
19+
type=GCPServiceAccountType.GCP_SERVICE_ACCOUNT,
20+
),
21+
)
22+
23+
configuration = Configuration()
24+
with ApiClient(configuration) as api_client:
25+
api_instance = GCPIntegrationApi(api_client)
26+
response = api_instance.create_gcpsts_account(body=body)
27+
28+
print(response)
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
"""
2+
Update STS Service Account returns "OK" response with enable resource collection turned on
3+
"""
4+
5+
from os import environ
6+
from datadog_api_client import ApiClient, Configuration
7+
from datadog_api_client.v2.api.gcp_integration_api import GCPIntegrationApi
8+
from datadog_api_client.v2.model.gcp_service_account_type import GCPServiceAccountType
9+
from datadog_api_client.v2.model.gcpsts_service_account_attributes import GCPSTSServiceAccountAttributes
10+
from datadog_api_client.v2.model.gcpsts_service_account_update_request import GCPSTSServiceAccountUpdateRequest
11+
from datadog_api_client.v2.model.gcpsts_service_account_update_request_data import GCPSTSServiceAccountUpdateRequestData
12+
13+
# there is a valid "gcp_sts_account" in the system
14+
GCP_STS_ACCOUNT_DATA_ID = environ["GCP_STS_ACCOUNT_DATA_ID"]
15+
16+
body = GCPSTSServiceAccountUpdateRequest(
17+
data=GCPSTSServiceAccountUpdateRequestData(
18+
attributes=GCPSTSServiceAccountAttributes(
19+
client_email="[email protected]",
20+
resource_collection_enabled=True,
21+
),
22+
id=GCP_STS_ACCOUNT_DATA_ID,
23+
type=GCPServiceAccountType.GCP_SERVICE_ACCOUNT,
24+
),
25+
)
26+
27+
configuration = Configuration()
28+
with ApiClient(configuration) as api_client:
29+
api_instance = GCPIntegrationApi(api_client)
30+
response = api_instance.update_gcpsts_account(account_id=GCP_STS_ACCOUNT_DATA_ID, body=body)
31+
32+
print(response)

0 commit comments

Comments
 (0)