Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16644,6 +16644,14 @@ components:
required:
- id
type: object
DeploymentGateRulesResponse:
description: Response for a deployment gate rules.
properties:
data:
items:
$ref: '#/components/schemas/DeploymentRuleResponseData'
type: array
type: object
DeploymentMetadata:
description: Metadata object containing the publication creation information.
properties:
Expand Down Expand Up @@ -64391,6 +64399,50 @@ paths:

If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).'
/api/v2/deployment_gates/{gate_id}/rules:
get:
description: Endpoint to get rules for a deployment gate.
operationId: GetDeploymentGateRules
parameters:
- description: The ID of the deployment gate.
in: path
name: gate_id
required: true
schema:
type: string
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/DeploymentGateRulesResponse'
description: OK
'400':
$ref: '#/components/responses/HTTPCDGatesBadRequestResponse'
'401':
$ref: '#/components/responses/UnauthorizedResponse'
'403':
$ref: '#/components/responses/ForbiddenResponse'
'429':
$ref: '#/components/responses/TooManyRequestsResponse'
'500':
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPCIAppErrors'
description: Internal Server Error
security:
- apiKeyAuth: []
appKeyAuth: []
summary: Get rules for a deployment gate
tags:
- Deployment Gates
x-permission:
operator: OR
permissions:
- deployment_gates_read
x-unstable: '**Note**: This endpoint is in preview and may be subject to change.

If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).'
post:
description: Endpoint to create a deployment rule. A gate for the rule must
already exist.
Expand Down
29 changes: 29 additions & 0 deletions examples/v2/deployment-gates/GetDeploymentGateRules.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Get rules for a deployment gate returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.DeploymentGatesApi;
import com.datadog.api.client.v2.model.DeploymentGateRulesResponse;

public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
defaultClient.setUnstableOperationEnabled("v2.getDeploymentGateRules", true);
DeploymentGatesApi apiInstance = new DeploymentGatesApi(defaultClient);

// there is a valid "deployment_gate" in the system
String DEPLOYMENT_GATE_DATA_ID = System.getenv("DEPLOYMENT_GATE_DATA_ID");

try {
DeploymentGateRulesResponse result =
apiInstance.getDeploymentGateRules(DEPLOYMENT_GATE_DATA_ID);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling DeploymentGatesApi#getDeploymentGateRules");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
1 change: 1 addition & 0 deletions src/main/java/com/datadog/api/client/ApiClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -738,6 +738,7 @@ public class ApiClient {
put("v2.deleteDeploymentGate", false);
put("v2.deleteDeploymentRule", false);
put("v2.getDeploymentGate", false);
put("v2.getDeploymentGateRules", false);
put("v2.getDeploymentRule", false);
put("v2.updateDeploymentGate", false);
put("v2.updateDeploymentRule", false);
Expand Down
158 changes: 158 additions & 0 deletions src/main/java/com/datadog/api/client/v2/api/DeploymentGatesApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.datadog.api.client.v2.model.CreateDeploymentGateParams;
import com.datadog.api.client.v2.model.CreateDeploymentRuleParams;
import com.datadog.api.client.v2.model.DeploymentGateResponse;
import com.datadog.api.client.v2.model.DeploymentGateRulesResponse;
import com.datadog.api.client.v2.model.DeploymentRuleResponse;
import com.datadog.api.client.v2.model.UpdateDeploymentGateParams;
import com.datadog.api.client.v2.model.UpdateDeploymentRuleParams;
Expand Down Expand Up @@ -857,6 +858,163 @@ public CompletableFuture<ApiResponse<DeploymentGateResponse>> getDeploymentGateW
new GenericType<DeploymentGateResponse>() {});
}

/**
* Get rules for a deployment gate.
*
* <p>See {@link #getDeploymentGateRulesWithHttpInfo}.
*
* @param gateId The ID of the deployment gate. (required)
* @return DeploymentGateRulesResponse
* @throws ApiException if fails to make API call
*/
public DeploymentGateRulesResponse getDeploymentGateRules(String gateId) throws ApiException {
return getDeploymentGateRulesWithHttpInfo(gateId).getData();
}

/**
* Get rules for a deployment gate.
*
* <p>See {@link #getDeploymentGateRulesWithHttpInfoAsync}.
*
* @param gateId The ID of the deployment gate. (required)
* @return CompletableFuture&lt;DeploymentGateRulesResponse&gt;
*/
public CompletableFuture<DeploymentGateRulesResponse> getDeploymentGateRulesAsync(String gateId) {
return getDeploymentGateRulesWithHttpInfoAsync(gateId)
.thenApply(
response -> {
return response.getData();
});
}

/**
* Endpoint to get rules for a deployment gate.
*
* @param gateId The ID of the deployment gate. (required)
* @return ApiResponse&lt;DeploymentGateRulesResponse&gt;
* @throws ApiException if fails to make API call
* @http.response.details
* <table border="1">
* <caption>Response details</caption>
* <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
* <tr><td> 200 </td><td> OK </td><td> - </td></tr>
* <tr><td> 400 </td><td> Bad request. </td><td> - </td></tr>
* <tr><td> 401 </td><td> Unauthorized </td><td> - </td></tr>
* <tr><td> 403 </td><td> Forbidden </td><td> - </td></tr>
* <tr><td> 429 </td><td> Too many requests </td><td> - </td></tr>
* <tr><td> 500 </td><td> Internal Server Error </td><td> - </td></tr>
* </table>
*/
public ApiResponse<DeploymentGateRulesResponse> getDeploymentGateRulesWithHttpInfo(String gateId)
throws ApiException {
// Check if unstable operation is enabled
String operationId = "getDeploymentGateRules";
if (apiClient.isUnstableOperationEnabled("v2." + operationId)) {
apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId));
} else {
throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId));
}
Object localVarPostBody = null;

// verify the required parameter 'gateId' is set
if (gateId == null) {
throw new ApiException(
400, "Missing the required parameter 'gateId' when calling getDeploymentGateRules");
}
// create path and map variables
String localVarPath =
"/api/v2/deployment_gates/{gate_id}/rules"
.replaceAll("\\{" + "gate_id" + "\\}", apiClient.escapeString(gateId.toString()));

Map<String, String> localVarHeaderParams = new HashMap<String, String>();

Invocation.Builder builder =
apiClient.createBuilder(
"v2.DeploymentGatesApi.getDeploymentGateRules",
localVarPath,
new ArrayList<Pair>(),
localVarHeaderParams,
new HashMap<String, String>(),
new String[] {"application/json"},
new String[] {"apiKeyAuth", "appKeyAuth"});
return apiClient.invokeAPI(
"GET",
builder,
localVarHeaderParams,
new String[] {},
localVarPostBody,
new HashMap<String, Object>(),
false,
new GenericType<DeploymentGateRulesResponse>() {});
}

/**
* Get rules for a deployment gate.
*
* <p>See {@link #getDeploymentGateRulesWithHttpInfo}.
*
* @param gateId The ID of the deployment gate. (required)
* @return CompletableFuture&lt;ApiResponse&lt;DeploymentGateRulesResponse&gt;&gt;
*/
public CompletableFuture<ApiResponse<DeploymentGateRulesResponse>>
getDeploymentGateRulesWithHttpInfoAsync(String gateId) {
// Check if unstable operation is enabled
String operationId = "getDeploymentGateRules";
if (apiClient.isUnstableOperationEnabled("v2." + operationId)) {
apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId));
} else {
CompletableFuture<ApiResponse<DeploymentGateRulesResponse>> result =
new CompletableFuture<>();
result.completeExceptionally(
new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)));
return result;
}
Object localVarPostBody = null;

// verify the required parameter 'gateId' is set
if (gateId == null) {
CompletableFuture<ApiResponse<DeploymentGateRulesResponse>> result =
new CompletableFuture<>();
result.completeExceptionally(
new ApiException(
400, "Missing the required parameter 'gateId' when calling getDeploymentGateRules"));
return result;
}
// create path and map variables
String localVarPath =
"/api/v2/deployment_gates/{gate_id}/rules"
.replaceAll("\\{" + "gate_id" + "\\}", apiClient.escapeString(gateId.toString()));

Map<String, String> localVarHeaderParams = new HashMap<String, String>();

Invocation.Builder builder;
try {
builder =
apiClient.createBuilder(
"v2.DeploymentGatesApi.getDeploymentGateRules",
localVarPath,
new ArrayList<Pair>(),
localVarHeaderParams,
new HashMap<String, String>(),
new String[] {"application/json"},
new String[] {"apiKeyAuth", "appKeyAuth"});
} catch (ApiException ex) {
CompletableFuture<ApiResponse<DeploymentGateRulesResponse>> result =
new CompletableFuture<>();
result.completeExceptionally(ex);
return result;
}
return apiClient.invokeAPIAsync(
"GET",
builder,
localVarHeaderParams,
new String[] {},
localVarPostBody,
new HashMap<String, Object>(),
false,
new GenericType<DeploymentGateRulesResponse>() {});
}

/**
* Get deployment rule.
*
Expand Down
Loading
Loading