-
Notifications
You must be signed in to change notification settings - Fork 52
Expand file tree
/
Copy pathCreateCostGCPUsageCostConfig.py
More file actions
33 lines (29 loc) · 1.45 KB
/
CreateCostGCPUsageCostConfig.py
File metadata and controls
33 lines (29 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
"""
Create Google Cloud Usage Cost config returns "OK" response
"""
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi
from datadog_api_client.v2.model.gcp_usage_cost_config_post_data import GCPUsageCostConfigPostData
from datadog_api_client.v2.model.gcp_usage_cost_config_post_request import GCPUsageCostConfigPostRequest
from datadog_api_client.v2.model.gcp_usage_cost_config_post_request_attributes import (
GCPUsageCostConfigPostRequestAttributes,
)
from datadog_api_client.v2.model.gcp_usage_cost_config_post_request_type import GCPUsageCostConfigPostRequestType
body = GCPUsageCostConfigPostRequest(
data=GCPUsageCostConfigPostData(
attributes=GCPUsageCostConfigPostRequestAttributes(
billing_account_id="123456_A123BC_12AB34",
bucket_name="dd-cost-bucket",
export_dataset_name="billing",
export_prefix="datadog_cloud_cost_usage_export",
export_project_name="dd-cloud-cost-report",
service_account="dd-ccm-gcp-integration@my-environment.iam.gserviceaccount.com",
),
type=GCPUsageCostConfigPostRequestType.GCP_USAGE_COST_CONFIG_POST_REQUEST,
),
)
configuration = Configuration()
with ApiClient(configuration) as api_client:
api_instance = CloudCostManagementApi(api_client)
response = api_instance.create_cost_gcp_usage_cost_config(body=body)
print(response)