-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathCreateFleetDeploymentConfigure.java
More file actions
53 lines (49 loc) · 2.57 KB
/
CreateFleetDeploymentConfigure.java
File metadata and controls
53 lines (49 loc) · 2.57 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
53
// Create a deployment returns "CREATED" response
import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.FleetAutomationApi;
import com.datadog.api.client.v2.model.FleetDeploymentConfigureAttributes;
import com.datadog.api.client.v2.model.FleetDeploymentConfigureCreate;
import com.datadog.api.client.v2.model.FleetDeploymentConfigureCreateRequest;
import com.datadog.api.client.v2.model.FleetDeploymentFileOp;
import com.datadog.api.client.v2.model.FleetDeploymentOperation;
import com.datadog.api.client.v2.model.FleetDeploymentResourceType;
import com.datadog.api.client.v2.model.FleetDeploymentResponse;
import java.util.Collections;
import java.util.Map;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
defaultClient.setUnstableOperationEnabled("v2.createFleetDeploymentConfigure", true);
FleetAutomationApi apiInstance = new FleetAutomationApi(defaultClient);
FleetDeploymentConfigureCreateRequest body =
new FleetDeploymentConfigureCreateRequest()
.data(
new FleetDeploymentConfigureCreate()
.attributes(
new FleetDeploymentConfigureAttributes()
.configOperations(
Collections.singletonList(
new FleetDeploymentOperation()
.fileOp(FleetDeploymentFileOp.MERGE_PATCH)
.filePath("/datadog.yaml")
.patch(
Map.ofEntries(
Map.entry("apm_config", "{'enabled': True}"),
Map.entry("log_level", "debug"),
Map.entry("logs_enabled", "True")))))
.filterQuery("env:prod AND service:web"))
.type(FleetDeploymentResourceType.DEPLOYMENT));
try {
FleetDeploymentResponse result = apiInstance.createFleetDeploymentConfigure(body);
System.out.println(result);
} catch (ApiException e) {
System.err.println(
"Exception when calling FleetAutomationApi#createFleetDeploymentConfigure");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}