-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathCreateCostAzureUCConfigs.java
More file actions
52 lines (48 loc) · 2.59 KB
/
Copy pathCreateCostAzureUCConfigs.java
File metadata and controls
52 lines (48 loc) · 2.59 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Create Cloud Cost Management Azure configs returns "OK" response
import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.CloudCostManagementApi;
import com.datadog.api.client.v2.model.AzureUCConfigPairsResponse;
import com.datadog.api.client.v2.model.AzureUCConfigPostData;
import com.datadog.api.client.v2.model.AzureUCConfigPostRequest;
import com.datadog.api.client.v2.model.AzureUCConfigPostRequestAttributes;
import com.datadog.api.client.v2.model.AzureUCConfigPostRequestType;
import com.datadog.api.client.v2.model.BillConfig;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient);
AzureUCConfigPostRequest body =
new AzureUCConfigPostRequest()
.data(
new AzureUCConfigPostData()
.attributes(
new AzureUCConfigPostRequestAttributes()
.accountId("1234abcd-1234-abcd-1234-1234abcd1234")
.actualBillConfig(
new BillConfig()
.exportName("dd-actual-export")
.exportPath("dd-export-path")
.storageAccount("dd-storage-account")
.storageContainer("dd-storage-container"))
.amortizedBillConfig(
new BillConfig()
.exportName("dd-actual-export")
.exportPath("dd-export-path")
.storageAccount("dd-storage-account")
.storageContainer("dd-storage-container"))
.clientId("1234abcd-1234-abcd-1234-1234abcd1234")
.scope("subscriptions/1234abcd-1234-abcd-1234-1234abcd1234"))
.type(AzureUCConfigPostRequestType.AZURE_UC_CONFIG_POST_REQUEST));
try {
AzureUCConfigPairsResponse result = apiInstance.createCostAzureUCConfigs(body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling CloudCostManagementApi#createCostAzureUCConfigs");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}