Skip to content

Commit afbfebc

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
[FA] Add fleet automation config update endpoint (#3201)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent dda24b8 commit afbfebc

22 files changed

+3339
-0
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 422 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Cancel a deployment returns "Deployment successfully canceled." response
2+
3+
import com.datadog.api.client.ApiClient;
4+
import com.datadog.api.client.ApiException;
5+
import com.datadog.api.client.v2.api.FleetAutomationApi;
6+
7+
public class Example {
8+
public static void main(String[] args) {
9+
ApiClient defaultClient = ApiClient.getDefaultApiClient();
10+
defaultClient.setUnstableOperationEnabled("v2.cancelFleetDeployment", true);
11+
FleetAutomationApi apiInstance = new FleetAutomationApi(defaultClient);
12+
13+
try {
14+
apiInstance.cancelFleetDeployment("abc-def-ghi");
15+
} catch (ApiException e) {
16+
System.err.println("Exception when calling FleetAutomationApi#cancelFleetDeployment");
17+
System.err.println("Status code: " + e.getCode());
18+
System.err.println("Reason: " + e.getResponseBody());
19+
System.err.println("Response headers: " + e.getResponseHeaders());
20+
e.printStackTrace();
21+
}
22+
}
23+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
// Create a deployment returns "CREATED" response
2+
3+
import com.datadog.api.client.ApiClient;
4+
import com.datadog.api.client.ApiException;
5+
import com.datadog.api.client.v2.api.FleetAutomationApi;
6+
import com.datadog.api.client.v2.model.FleetDeploymentConfigureAttributes;
7+
import com.datadog.api.client.v2.model.FleetDeploymentConfigureCreate;
8+
import com.datadog.api.client.v2.model.FleetDeploymentConfigureCreateRequest;
9+
import com.datadog.api.client.v2.model.FleetDeploymentFileOp;
10+
import com.datadog.api.client.v2.model.FleetDeploymentOperation;
11+
import com.datadog.api.client.v2.model.FleetDeploymentResourceType;
12+
import com.datadog.api.client.v2.model.FleetDeploymentResponse;
13+
import java.util.Collections;
14+
import java.util.Map;
15+
16+
public class Example {
17+
public static void main(String[] args) {
18+
ApiClient defaultClient = ApiClient.getDefaultApiClient();
19+
defaultClient.setUnstableOperationEnabled("v2.createFleetDeploymentConfigure", true);
20+
FleetAutomationApi apiInstance = new FleetAutomationApi(defaultClient);
21+
22+
FleetDeploymentConfigureCreateRequest body =
23+
new FleetDeploymentConfigureCreateRequest()
24+
.data(
25+
new FleetDeploymentConfigureCreate()
26+
.attributes(
27+
new FleetDeploymentConfigureAttributes()
28+
.configOperations(
29+
Collections.singletonList(
30+
new FleetDeploymentOperation()
31+
.fileOp(FleetDeploymentFileOp.MERGE_PATCH)
32+
.filePath("/datadog.yaml")
33+
.patch(
34+
Map.ofEntries(
35+
Map.entry("apm_config", "{'enabled': True}"),
36+
Map.entry("log_level", "debug"),
37+
Map.entry("logs_enabled", "True")))))
38+
.filterQuery("env:prod AND service:web"))
39+
.type(FleetDeploymentResourceType.DEPLOYMENT));
40+
41+
try {
42+
FleetDeploymentResponse result = apiInstance.createFleetDeploymentConfigure(body);
43+
System.out.println(result);
44+
} catch (ApiException e) {
45+
System.err.println(
46+
"Exception when calling FleetAutomationApi#createFleetDeploymentConfigure");
47+
System.err.println("Status code: " + e.getCode());
48+
System.err.println("Reason: " + e.getResponseBody());
49+
System.err.println("Response headers: " + e.getResponseHeaders());
50+
e.printStackTrace();
51+
}
52+
}
53+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Get a deployment by ID returns "OK" response
2+
3+
import com.datadog.api.client.ApiClient;
4+
import com.datadog.api.client.ApiException;
5+
import com.datadog.api.client.v2.api.FleetAutomationApi;
6+
import com.datadog.api.client.v2.model.FleetDeploymentResponse;
7+
8+
public class Example {
9+
public static void main(String[] args) {
10+
ApiClient defaultClient = ApiClient.getDefaultApiClient();
11+
defaultClient.setUnstableOperationEnabled("v2.getFleetDeployment", true);
12+
FleetAutomationApi apiInstance = new FleetAutomationApi(defaultClient);
13+
14+
// there is a valid "deployment" in the system
15+
String DEPLOYMENT_ID = System.getenv("DEPLOYMENT_ID");
16+
17+
try {
18+
FleetDeploymentResponse result = apiInstance.getFleetDeployment(DEPLOYMENT_ID);
19+
System.out.println(result);
20+
} catch (ApiException e) {
21+
System.err.println("Exception when calling FleetAutomationApi#getFleetDeployment");
22+
System.err.println("Status code: " + e.getCode());
23+
System.err.println("Reason: " + e.getResponseBody());
24+
System.err.println("Response headers: " + e.getResponseHeaders());
25+
e.printStackTrace();
26+
}
27+
}
28+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// List all deployments returns "OK" response
2+
3+
import com.datadog.api.client.ApiClient;
4+
import com.datadog.api.client.ApiException;
5+
import com.datadog.api.client.v2.api.FleetAutomationApi;
6+
import com.datadog.api.client.v2.model.FleetDeploymentsResponse;
7+
8+
public class Example {
9+
public static void main(String[] args) {
10+
ApiClient defaultClient = ApiClient.getDefaultApiClient();
11+
defaultClient.setUnstableOperationEnabled("v2.listFleetDeployments", true);
12+
FleetAutomationApi apiInstance = new FleetAutomationApi(defaultClient);
13+
14+
try {
15+
FleetDeploymentsResponse result = apiInstance.listFleetDeployments();
16+
System.out.println(result);
17+
} catch (ApiException e) {
18+
System.err.println("Exception when calling FleetAutomationApi#listFleetDeployments");
19+
System.err.println("Status code: " + e.getCode());
20+
System.err.println("Reason: " + e.getResponseBody());
21+
System.err.println("Response headers: " + e.getResponseHeaders());
22+
e.printStackTrace();
23+
}
24+
}
25+
}

src/main/java/com/datadog/api/client/ApiClient.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -687,6 +687,10 @@ public class ApiClient {
687687
protected final Map<String, Boolean> unstableOperations =
688688
new HashMap<String, Boolean>() {
689689
{
690+
put("v2.cancelFleetDeployment", false);
691+
put("v2.createFleetDeploymentConfigure", false);
692+
put("v2.getFleetDeployment", false);
693+
put("v2.listFleetDeployments", false);
690694
put("v2.createOpenAPI", false);
691695
put("v2.deleteOpenAPI", false);
692696
put("v2.getOpenAPI", false);

0 commit comments

Comments
 (0)