From 5a52f515885084dc179548cb109314a3e5c809cf Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Wed, 30 Oct 2024 18:59:54 +0000 Subject: [PATCH] Regenerate client from commit 755120dd of spec repo --- .apigentools-info | 8 +- .generator/schemas/v2/openapi.yaml | 138 +++++++++ .../domain-allowlist/GetDomainAllowlist.java | 24 ++ .../PatchDomainAllowlist.java | 39 +++ .../api/client/v2/api/DomainAllowlistApi.java | 286 ++++++++++++++++++ .../api/client/v2/model/DomainAllowlist.java | 216 +++++++++++++ .../v2/model/DomainAllowlistAttributes.java | 175 +++++++++++ .../v2/model/DomainAllowlistRequest.java | 145 +++++++++ .../v2/model/DomainAllowlistResponse.java | 136 +++++++++ .../v2/model/DomainAllowlistResponseData.java | 217 +++++++++++++ ...DomainAllowlistResponseDataAttributes.java | 176 +++++++++++ .../client/v2/model/DomainAllowlistType.java | 56 ++++ ...omain_Allowlist_returns_OK_response.freeze | 1 + ..._Domain_Allowlist_returns_OK_response.json | 28 ++ ...omain_Allowlist_returns_OK_response.freeze | 1 + ..._Domain_Allowlist_returns_OK_response.json | 32 ++ .../client/v2/api/domain_allowlist.feature | 32 ++ .../com/datadog/api/client/v2/api/undo.json | 12 + 18 files changed, 1718 insertions(+), 4 deletions(-) create mode 100644 examples/v2/domain-allowlist/GetDomainAllowlist.java create mode 100644 examples/v2/domain-allowlist/PatchDomainAllowlist.java create mode 100644 src/main/java/com/datadog/api/client/v2/api/DomainAllowlistApi.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/DomainAllowlist.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/DomainAllowlistAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/DomainAllowlistRequest.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/DomainAllowlistResponse.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/DomainAllowlistResponseData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/DomainAllowlistResponseDataAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/DomainAllowlistType.java create mode 100644 src/test/resources/cassettes/features/v2/Get_Domain_Allowlist_returns_OK_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Get_Domain_Allowlist_returns_OK_response.json create mode 100644 src/test/resources/cassettes/features/v2/Sets_Domain_Allowlist_returns_OK_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Sets_Domain_Allowlist_returns_OK_response.json create mode 100644 src/test/resources/com/datadog/api/client/v2/api/domain_allowlist.feature diff --git a/.apigentools-info b/.apigentools-info index e20a3e76417..91595476b0f 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2024-10-29 20:46:31.079470", - "spec_repo_commit": "c0b9551e" + "regenerated": "2024-10-30 18:58:12.249463", + "spec_repo_commit": "755120dd" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-10-29 20:46:31.098654", - "spec_repo_commit": "c0b9551e" + "regenerated": "2024-10-30 18:58:12.267886", + "spec_repo_commit": "755120dd" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index ab32a814306..38238fba6cc 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -7115,6 +7115,81 @@ components: description: The type of the resource. The value should always be device. type: string type: object + DomainAllowlist: + description: The email domain allowlist for an org. + properties: + attributes: + $ref: '#/components/schemas/DomainAllowlistAttributes' + id: + description: The unique identifier of the org. + nullable: true + type: string + type: + $ref: '#/components/schemas/DomainAllowlistType' + required: + - type + type: object + DomainAllowlistAttributes: + description: The details of the email domain allowlist. + properties: + domains: + description: The list of domains in the email domain allowlist. + items: + type: string + type: array + enabled: + description: Whether the email domain allowlist is enabled for the org. + type: boolean + type: object + DomainAllowlistRequest: + description: Request containing the desired email domain allowlist configuration. + properties: + data: + $ref: '#/components/schemas/DomainAllowlist' + required: + - data + type: object + DomainAllowlistResponse: + description: Response containing information about the email domain allowlist. + properties: + data: + $ref: '#/components/schemas/DomainAllowlistResponseData' + type: object + DomainAllowlistResponseData: + description: The email domain allowlist response for an org. + properties: + attributes: + $ref: '#/components/schemas/DomainAllowlistResponseDataAttributes' + id: + description: The unique identifier of the org. + nullable: true + type: string + type: + $ref: '#/components/schemas/DomainAllowlistType' + required: + - type + type: object + DomainAllowlistResponseDataAttributes: + description: The details of the email domain allowlist. + properties: + domains: + description: The list of domains in the email domain allowlist. + items: + type: string + type: array + enabled: + description: Whether the email domain allowlist is enabled for the org. + type: boolean + type: object + DomainAllowlistType: + default: domain_allowlist + description: Email domain allowlist allowlist type. + enum: + - domain_allowlist + example: domain_allowlist + type: string + x-enum-varnames: + - DOMAIN_ALLOWLIST DowntimeCreateRequest: description: Request for creating a downtime. properties: @@ -29433,6 +29508,61 @@ paths: tags: - Dashboard Lists x-codegen-request-body-name: body + /api/v2/domain_allowlist: + get: + description: Get the domain allowlist for an organization. + operationId: GetDomainAllowlist + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/DomainAllowlistResponse' + description: OK + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - org_management + summary: Get Domain Allowlist + tags: + - Domain Allowlist + x-permission: + operator: OR + permissions: + - org_management + patch: + description: Update the domain allowlist for an organization. + operationId: PatchDomainAllowlist + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/DomainAllowlistRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/DomainAllowlistResponse' + description: OK + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - org_management + summary: Sets Domain Allowlist + tags: + - Domain Allowlist + x-permission: + operator: OR + permissions: + - org_management /api/v2/dora/deployment: post: description: 'Use this API endpoint to provide data about deployments for DORA @@ -41786,6 +41916,14 @@ tags: organization.' name: Dashboard Lists +- description: 'Configure your Datadog Email Domain Allowlist directly through the + Datadog API. + + The Email Domain Allowlist controls the domains that certain datadog emails can + be sent to. + + For more information, see the [Domain Allowlist docs page](https://docs.datadoghq.com/account_management/org_settings/domain_allowlist)' + name: Domain Allowlist - description: '**Note**: Downtime V2 is currently in private beta. To request access, contact [Datadog support](https://docs.datadoghq.com/help/). diff --git a/examples/v2/domain-allowlist/GetDomainAllowlist.java b/examples/v2/domain-allowlist/GetDomainAllowlist.java new file mode 100644 index 00000000000..e9899038dd7 --- /dev/null +++ b/examples/v2/domain-allowlist/GetDomainAllowlist.java @@ -0,0 +1,24 @@ +// Get Domain Allowlist returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.DomainAllowlistApi; +import com.datadog.api.client.v2.model.DomainAllowlistResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + DomainAllowlistApi apiInstance = new DomainAllowlistApi(defaultClient); + + try { + DomainAllowlistResponse result = apiInstance.getDomainAllowlist(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DomainAllowlistApi#getDomainAllowlist"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/domain-allowlist/PatchDomainAllowlist.java b/examples/v2/domain-allowlist/PatchDomainAllowlist.java new file mode 100644 index 00000000000..f31cac580d2 --- /dev/null +++ b/examples/v2/domain-allowlist/PatchDomainAllowlist.java @@ -0,0 +1,39 @@ +// Sets Domain Allowlist returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.DomainAllowlistApi; +import com.datadog.api.client.v2.model.DomainAllowlist; +import com.datadog.api.client.v2.model.DomainAllowlistAttributes; +import com.datadog.api.client.v2.model.DomainAllowlistRequest; +import com.datadog.api.client.v2.model.DomainAllowlistResponse; +import com.datadog.api.client.v2.model.DomainAllowlistType; +import java.util.Collections; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + DomainAllowlistApi apiInstance = new DomainAllowlistApi(defaultClient); + + DomainAllowlistRequest body = + new DomainAllowlistRequest() + .data( + new DomainAllowlist() + .attributes( + new DomainAllowlistAttributes() + .domains(Collections.singletonList("@static-test-domain.test")) + .enabled(false)) + .type(DomainAllowlistType.DOMAIN_ALLOWLIST)); + + try { + DomainAllowlistResponse result = apiInstance.patchDomainAllowlist(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DomainAllowlistApi#patchDomainAllowlist"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/src/main/java/com/datadog/api/client/v2/api/DomainAllowlistApi.java b/src/main/java/com/datadog/api/client/v2/api/DomainAllowlistApi.java new file mode 100644 index 00000000000..669f6c02633 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/api/DomainAllowlistApi.java @@ -0,0 +1,286 @@ +package com.datadog.api.client.v2.api; + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.ApiResponse; +import com.datadog.api.client.Pair; +import com.datadog.api.client.v2.model.DomainAllowlistRequest; +import com.datadog.api.client.v2.model.DomainAllowlistResponse; +import jakarta.ws.rs.client.Invocation; +import jakarta.ws.rs.core.GenericType; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CompletableFuture; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class DomainAllowlistApi { + private ApiClient apiClient; + + public DomainAllowlistApi() { + this(ApiClient.getDefaultApiClient()); + } + + public DomainAllowlistApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Get the API client. + * + * @return API client + */ + public ApiClient getApiClient() { + return apiClient; + } + + /** + * Set the API client. + * + * @param apiClient an instance of API client + */ + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Get Domain Allowlist. + * + *

See {@link #getDomainAllowlistWithHttpInfo}. + * + * @return DomainAllowlistResponse + * @throws ApiException if fails to make API call + */ + public DomainAllowlistResponse getDomainAllowlist() throws ApiException { + return getDomainAllowlistWithHttpInfo().getData(); + } + + /** + * Get Domain Allowlist. + * + *

See {@link #getDomainAllowlistWithHttpInfoAsync}. + * + * @return CompletableFuture<DomainAllowlistResponse> + */ + public CompletableFuture getDomainAllowlistAsync() { + return getDomainAllowlistWithHttpInfoAsync() + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get the domain allowlist for an organization. + * + * @return ApiResponse<DomainAllowlistResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
429 Too many requests -
+ */ + public ApiResponse getDomainAllowlistWithHttpInfo() throws ApiException { + Object localVarPostBody = null; + // create path and map variables + String localVarPath = "/api/v2/domain_allowlist"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.DomainAllowlistApi.getDomainAllowlist", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get Domain Allowlist. + * + *

See {@link #getDomainAllowlistWithHttpInfo}. + * + * @return CompletableFuture<ApiResponse<DomainAllowlistResponse>> + */ + public CompletableFuture> + getDomainAllowlistWithHttpInfoAsync() { + Object localVarPostBody = null; + // create path and map variables + String localVarPath = "/api/v2/domain_allowlist"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.DomainAllowlistApi.getDomainAllowlist", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Sets Domain Allowlist. + * + *

See {@link #patchDomainAllowlistWithHttpInfo}. + * + * @param body (required) + * @return DomainAllowlistResponse + * @throws ApiException if fails to make API call + */ + public DomainAllowlistResponse patchDomainAllowlist(DomainAllowlistRequest body) + throws ApiException { + return patchDomainAllowlistWithHttpInfo(body).getData(); + } + + /** + * Sets Domain Allowlist. + * + *

See {@link #patchDomainAllowlistWithHttpInfoAsync}. + * + * @param body (required) + * @return CompletableFuture<DomainAllowlistResponse> + */ + public CompletableFuture patchDomainAllowlistAsync( + DomainAllowlistRequest body) { + return patchDomainAllowlistWithHttpInfoAsync(body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Update the domain allowlist for an organization. + * + * @param body (required) + * @return ApiResponse<DomainAllowlistResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
429 Too many requests -
+ */ + public ApiResponse patchDomainAllowlistWithHttpInfo( + DomainAllowlistRequest body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling patchDomainAllowlist"); + } + // create path and map variables + String localVarPath = "/api/v2/domain_allowlist"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.DomainAllowlistApi.patchDomainAllowlist", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "PATCH", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Sets Domain Allowlist. + * + *

See {@link #patchDomainAllowlistWithHttpInfo}. + * + * @param body (required) + * @return CompletableFuture<ApiResponse<DomainAllowlistResponse>> + */ + public CompletableFuture> + patchDomainAllowlistWithHttpInfoAsync(DomainAllowlistRequest body) { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'body' when calling patchDomainAllowlist")); + return result; + } + // create path and map variables + String localVarPath = "/api/v2/domain_allowlist"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.DomainAllowlistApi.patchDomainAllowlist", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "PATCH", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/DomainAllowlist.java b/src/main/java/com/datadog/api/client/v2/model/DomainAllowlist.java new file mode 100644 index 00000000000..a17cf28dd81 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/DomainAllowlist.java @@ -0,0 +1,216 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.openapitools.jackson.nullable.JsonNullable; + +/** The email domain allowlist for an org. */ +@JsonPropertyOrder({ + DomainAllowlist.JSON_PROPERTY_ATTRIBUTES, + DomainAllowlist.JSON_PROPERTY_ID, + DomainAllowlist.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class DomainAllowlist { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private DomainAllowlistAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private JsonNullable id = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_TYPE = "type"; + private DomainAllowlistType type = DomainAllowlistType.DOMAIN_ALLOWLIST; + + public DomainAllowlist() {} + + @JsonCreator + public DomainAllowlist( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) DomainAllowlistType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public DomainAllowlist attributes(DomainAllowlistAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * The details of the email domain allowlist. + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public DomainAllowlistAttributes getAttributes() { + return attributes; + } + + public void setAttributes(DomainAllowlistAttributes attributes) { + this.attributes = attributes; + } + + public DomainAllowlist id(String id) { + this.id = JsonNullable.of(id); + return this; + } + + /** + * The unique identifier of the org. + * + * @return id + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getId() { + return id.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getId_JsonNullable() { + return id; + } + + @JsonProperty(JSON_PROPERTY_ID) + public void setId_JsonNullable(JsonNullable id) { + this.id = id; + } + + public void setId(String id) { + this.id = JsonNullable.of(id); + } + + public DomainAllowlist type(DomainAllowlistType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Email domain allowlist allowlist type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public DomainAllowlistType getType() { + return type; + } + + public void setType(DomainAllowlistType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return DomainAllowlist + */ + @JsonAnySetter + public DomainAllowlist putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this DomainAllowlist object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DomainAllowlist domainAllowlist = (DomainAllowlist) o; + return Objects.equals(this.attributes, domainAllowlist.attributes) + && Objects.equals(this.id, domainAllowlist.id) + && Objects.equals(this.type, domainAllowlist.type) + && Objects.equals(this.additionalProperties, domainAllowlist.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DomainAllowlist {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/DomainAllowlistAttributes.java b/src/main/java/com/datadog/api/client/v2/model/DomainAllowlistAttributes.java new file mode 100644 index 00000000000..f339d0fc945 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/DomainAllowlistAttributes.java @@ -0,0 +1,175 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** The details of the email domain allowlist. */ +@JsonPropertyOrder({ + DomainAllowlistAttributes.JSON_PROPERTY_DOMAINS, + DomainAllowlistAttributes.JSON_PROPERTY_ENABLED +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class DomainAllowlistAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DOMAINS = "domains"; + private List domains = null; + + public static final String JSON_PROPERTY_ENABLED = "enabled"; + private Boolean enabled; + + public DomainAllowlistAttributes domains(List domains) { + this.domains = domains; + return this; + } + + public DomainAllowlistAttributes addDomainsItem(String domainsItem) { + if (this.domains == null) { + this.domains = new ArrayList<>(); + } + this.domains.add(domainsItem); + return this; + } + + /** + * The list of domains in the email domain allowlist. + * + * @return domains + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DOMAINS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getDomains() { + return domains; + } + + public void setDomains(List domains) { + this.domains = domains; + } + + public DomainAllowlistAttributes enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Whether the email domain allowlist is enabled for the org. + * + * @return enabled + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ENABLED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getEnabled() { + return enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return DomainAllowlistAttributes + */ + @JsonAnySetter + public DomainAllowlistAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this DomainAllowlistAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DomainAllowlistAttributes domainAllowlistAttributes = (DomainAllowlistAttributes) o; + return Objects.equals(this.domains, domainAllowlistAttributes.domains) + && Objects.equals(this.enabled, domainAllowlistAttributes.enabled) + && Objects.equals( + this.additionalProperties, domainAllowlistAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(domains, enabled, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DomainAllowlistAttributes {\n"); + sb.append(" domains: ").append(toIndentedString(domains)).append("\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/DomainAllowlistRequest.java b/src/main/java/com/datadog/api/client/v2/model/DomainAllowlistRequest.java new file mode 100644 index 00000000000..611f8ec1759 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/DomainAllowlistRequest.java @@ -0,0 +1,145 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Request containing the desired email domain allowlist configuration. */ +@JsonPropertyOrder({DomainAllowlistRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class DomainAllowlistRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private DomainAllowlist data; + + public DomainAllowlistRequest() {} + + @JsonCreator + public DomainAllowlistRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) DomainAllowlist data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public DomainAllowlistRequest data(DomainAllowlist data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * The email domain allowlist for an org. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public DomainAllowlist getData() { + return data; + } + + public void setData(DomainAllowlist data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return DomainAllowlistRequest + */ + @JsonAnySetter + public DomainAllowlistRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this DomainAllowlistRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DomainAllowlistRequest domainAllowlistRequest = (DomainAllowlistRequest) o; + return Objects.equals(this.data, domainAllowlistRequest.data) + && Objects.equals(this.additionalProperties, domainAllowlistRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DomainAllowlistRequest {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/DomainAllowlistResponse.java b/src/main/java/com/datadog/api/client/v2/model/DomainAllowlistResponse.java new file mode 100644 index 00000000000..205a6bccb7c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/DomainAllowlistResponse.java @@ -0,0 +1,136 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Response containing information about the email domain allowlist. */ +@JsonPropertyOrder({DomainAllowlistResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class DomainAllowlistResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private DomainAllowlistResponseData data; + + public DomainAllowlistResponse data(DomainAllowlistResponseData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * The email domain allowlist response for an org. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public DomainAllowlistResponseData getData() { + return data; + } + + public void setData(DomainAllowlistResponseData data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return DomainAllowlistResponse + */ + @JsonAnySetter + public DomainAllowlistResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this DomainAllowlistResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DomainAllowlistResponse domainAllowlistResponse = (DomainAllowlistResponse) o; + return Objects.equals(this.data, domainAllowlistResponse.data) + && Objects.equals(this.additionalProperties, domainAllowlistResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DomainAllowlistResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/DomainAllowlistResponseData.java b/src/main/java/com/datadog/api/client/v2/model/DomainAllowlistResponseData.java new file mode 100644 index 00000000000..b8c2a8541e6 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/DomainAllowlistResponseData.java @@ -0,0 +1,217 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.openapitools.jackson.nullable.JsonNullable; + +/** The email domain allowlist response for an org. */ +@JsonPropertyOrder({ + DomainAllowlistResponseData.JSON_PROPERTY_ATTRIBUTES, + DomainAllowlistResponseData.JSON_PROPERTY_ID, + DomainAllowlistResponseData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class DomainAllowlistResponseData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private DomainAllowlistResponseDataAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private JsonNullable id = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_TYPE = "type"; + private DomainAllowlistType type = DomainAllowlistType.DOMAIN_ALLOWLIST; + + public DomainAllowlistResponseData() {} + + @JsonCreator + public DomainAllowlistResponseData( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) DomainAllowlistType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public DomainAllowlistResponseData attributes(DomainAllowlistResponseDataAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * The details of the email domain allowlist. + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public DomainAllowlistResponseDataAttributes getAttributes() { + return attributes; + } + + public void setAttributes(DomainAllowlistResponseDataAttributes attributes) { + this.attributes = attributes; + } + + public DomainAllowlistResponseData id(String id) { + this.id = JsonNullable.of(id); + return this; + } + + /** + * The unique identifier of the org. + * + * @return id + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getId() { + return id.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getId_JsonNullable() { + return id; + } + + @JsonProperty(JSON_PROPERTY_ID) + public void setId_JsonNullable(JsonNullable id) { + this.id = id; + } + + public void setId(String id) { + this.id = JsonNullable.of(id); + } + + public DomainAllowlistResponseData type(DomainAllowlistType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Email domain allowlist allowlist type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public DomainAllowlistType getType() { + return type; + } + + public void setType(DomainAllowlistType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return DomainAllowlistResponseData + */ + @JsonAnySetter + public DomainAllowlistResponseData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this DomainAllowlistResponseData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DomainAllowlistResponseData domainAllowlistResponseData = (DomainAllowlistResponseData) o; + return Objects.equals(this.attributes, domainAllowlistResponseData.attributes) + && Objects.equals(this.id, domainAllowlistResponseData.id) + && Objects.equals(this.type, domainAllowlistResponseData.type) + && Objects.equals( + this.additionalProperties, domainAllowlistResponseData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DomainAllowlistResponseData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/DomainAllowlistResponseDataAttributes.java b/src/main/java/com/datadog/api/client/v2/model/DomainAllowlistResponseDataAttributes.java new file mode 100644 index 00000000000..d8f35d3bcea --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/DomainAllowlistResponseDataAttributes.java @@ -0,0 +1,176 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** The details of the email domain allowlist. */ +@JsonPropertyOrder({ + DomainAllowlistResponseDataAttributes.JSON_PROPERTY_DOMAINS, + DomainAllowlistResponseDataAttributes.JSON_PROPERTY_ENABLED +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class DomainAllowlistResponseDataAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DOMAINS = "domains"; + private List domains = null; + + public static final String JSON_PROPERTY_ENABLED = "enabled"; + private Boolean enabled; + + public DomainAllowlistResponseDataAttributes domains(List domains) { + this.domains = domains; + return this; + } + + public DomainAllowlistResponseDataAttributes addDomainsItem(String domainsItem) { + if (this.domains == null) { + this.domains = new ArrayList<>(); + } + this.domains.add(domainsItem); + return this; + } + + /** + * The list of domains in the email domain allowlist. + * + * @return domains + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DOMAINS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getDomains() { + return domains; + } + + public void setDomains(List domains) { + this.domains = domains; + } + + public DomainAllowlistResponseDataAttributes enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Whether the email domain allowlist is enabled for the org. + * + * @return enabled + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ENABLED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getEnabled() { + return enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return DomainAllowlistResponseDataAttributes + */ + @JsonAnySetter + public DomainAllowlistResponseDataAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this DomainAllowlistResponseDataAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DomainAllowlistResponseDataAttributes domainAllowlistResponseDataAttributes = + (DomainAllowlistResponseDataAttributes) o; + return Objects.equals(this.domains, domainAllowlistResponseDataAttributes.domains) + && Objects.equals(this.enabled, domainAllowlistResponseDataAttributes.enabled) + && Objects.equals( + this.additionalProperties, domainAllowlistResponseDataAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(domains, enabled, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DomainAllowlistResponseDataAttributes {\n"); + sb.append(" domains: ").append(toIndentedString(domains)).append("\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/DomainAllowlistType.java b/src/main/java/com/datadog/api/client/v2/model/DomainAllowlistType.java new file mode 100644 index 00000000000..bad6a42f1a8 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/DomainAllowlistType.java @@ -0,0 +1,56 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** Email domain allowlist allowlist type. */ +@JsonSerialize(using = DomainAllowlistType.DomainAllowlistTypeSerializer.class) +public class DomainAllowlistType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("domain_allowlist")); + + public static final DomainAllowlistType DOMAIN_ALLOWLIST = + new DomainAllowlistType("domain_allowlist"); + + DomainAllowlistType(String value) { + super(value, allowedValues); + } + + public static class DomainAllowlistTypeSerializer extends StdSerializer { + public DomainAllowlistTypeSerializer(Class t) { + super(t); + } + + public DomainAllowlistTypeSerializer() { + this(null); + } + + @Override + public void serialize( + DomainAllowlistType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static DomainAllowlistType fromValue(String value) { + return new DomainAllowlistType(value); + } +} diff --git a/src/test/resources/cassettes/features/v2/Get_Domain_Allowlist_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Get_Domain_Allowlist_returns_OK_response.freeze new file mode 100644 index 00000000000..2090a82fa0f --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_Domain_Allowlist_returns_OK_response.freeze @@ -0,0 +1 @@ +2024-10-23T18:16:16.668Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_Domain_Allowlist_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Get_Domain_Allowlist_returns_OK_response.json new file mode 100644 index 00000000000..bd4fe03937e --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_Domain_Allowlist_returns_OK_response.json @@ -0,0 +1,28 @@ +[ + { + "httpRequest": { + "headers": {}, + "method": "GET", + "path": "/api/v2/domain_allowlist", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"type\":\"domain_allowlist\",\"attributes\":{\"enabled\":false,\"domains\":[\"@static-test-domain.test\"]}}}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "ef25ca5c-7248-f1ce-0d70-0b9c841b7279" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Sets_Domain_Allowlist_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Sets_Domain_Allowlist_returns_OK_response.freeze new file mode 100644 index 00000000000..6315d630bc7 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Sets_Domain_Allowlist_returns_OK_response.freeze @@ -0,0 +1 @@ +2024-10-23T18:16:16.928Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Sets_Domain_Allowlist_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Sets_Domain_Allowlist_returns_OK_response.json new file mode 100644 index 00000000000..7008fad17db --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Sets_Domain_Allowlist_returns_OK_response.json @@ -0,0 +1,32 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"domains\":[\"@static-test-domain.test\"],\"enabled\":false},\"type\":\"domain_allowlist\"}}" + }, + "headers": {}, + "method": "PATCH", + "path": "/api/v2/domain_allowlist", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"type\":\"domain_allowlist\",\"attributes\":{\"enabled\":false,\"domains\":[\"@static-test-domain.test\"]}}}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "a389d9f3-b7a7-111e-6014-fd052f8b33d1" + } +] \ No newline at end of file diff --git a/src/test/resources/com/datadog/api/client/v2/api/domain_allowlist.feature b/src/test/resources/com/datadog/api/client/v2/api/domain_allowlist.feature new file mode 100644 index 00000000000..8fe10371d5c --- /dev/null +++ b/src/test/resources/com/datadog/api/client/v2/api/domain_allowlist.feature @@ -0,0 +1,32 @@ +@endpoint(domain-allowlist) @endpoint(domain-allowlist-v2) +Feature: Domain Allowlist + Configure your Datadog Email Domain Allowlist directly through the Datadog + API. The Email Domain Allowlist controls the domains that certain datadog + emails can be sent to. For more information, see the [Domain Allowlist + docs page](https://docs.datadoghq.com/account_management/org_settings/doma + in_allowlist) + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "DomainAllowlist" API + + @team:Datadog/team-aaa-dogmail + Scenario: Get Domain Allowlist returns "OK" response + Given new "GetDomainAllowlist" request + When the request is sent + Then the response status is 200 OK + And the response "data.type" is equal to "domain_allowlist" + And the response "data.attributes.domains" array contains value "@static-test-domain.test" + And the response "data.attributes.enabled" is equal to false + + @team:Datadog/team-aaa-dogmail + Scenario: Sets Domain Allowlist returns "OK" response + Given new "PatchDomainAllowlist" request + And body with value {"data": {"attributes": {"domains": ["@static-test-domain.test"], "enabled": false}, "type": "domain_allowlist"}} + When the request is sent + Then the response status is 200 OK + And the response "data.type" is equal to "domain_allowlist" + And the response "data.attributes.domains" has length 1 + And the response "data.attributes.domains" array contains value "@static-test-domain.test" + And the response "data.attributes.enabled" is equal to false diff --git a/src/test/resources/com/datadog/api/client/v2/api/undo.json b/src/test/resources/com/datadog/api/client/v2/api/undo.json index 68b64dfc24d..5516102f8ff 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/undo.json +++ b/src/test/resources/com/datadog/api/client/v2/api/undo.json @@ -547,6 +547,18 @@ "type": "safe" } }, + "GetDomainAllowlist": { + "tag": "Domain Allowlist", + "undo": { + "type": "safe" + } + }, + "PatchDomainAllowlist": { + "tag": "Domain Allowlist", + "undo": { + "type": "idempotent" + } + }, "CreateDORADeployment": { "tag": "DORA Metrics", "undo": {