diff --git a/.apigentools-info b/.apigentools-info index e7c65f75b0d..2162c2d461a 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2025-01-03 18:07:39.659122", - "spec_repo_commit": "08abd462" + "regenerated": "2025-01-03 19:50:43.803520", + "spec_repo_commit": "a9ad82b7" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2025-01-03 18:07:39.674600", - "spec_repo_commit": "08abd462" + "regenerated": "2025-01-03 19:50:43.820690", + "spec_repo_commit": "a9ad82b7" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 5ffff4300a1..94ef9bc36a1 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -206,6 +206,13 @@ components: required: true schema: type: string + ConnectionId: + description: The ID of the action connection + in: path + name: connection_id + required: true + schema: + type: string CustomDestinationId: description: The ID of the custom destination. in: path @@ -1209,6 +1216,64 @@ components: required: - data type: object + AWSAssumeRole: + description: The definition of `AWSAssumeRole` object. + properties: + account_id: + description: AWS account the connection is created for + example: '111222333444' + pattern: ^\d{12}$ + type: string + external_id: + description: External ID used to scope which connection can be used to assume + the role + example: 33a1011635c44b38a064cf14e82e1d8f + readOnly: true + type: string + principal_id: + description: AWS account that will assume the role + example: '123456789012' + readOnly: true + type: string + role: + description: Role to assume + example: my-role + type: string + type: + $ref: '#/components/schemas/AWSAssumeRoleType' + required: + - type + - account_id + - role + type: object + AWSAssumeRoleType: + description: The definition of `AWSAssumeRoleType` object. + enum: + - AWSAssumeRole + example: AWSAssumeRole + type: string + x-enum-varnames: + - AWSASSUMEROLE + AWSAssumeRoleUpdate: + description: The definition of `AWSAssumeRoleUpdate` object. + properties: + account_id: + description: AWS account the connection is created for + example: '111222333444' + pattern: ^\d{12}$ + type: string + generate_new_external_id: + description: The `AWSAssumeRoleUpdate` `generate_new_external_id`. + type: boolean + role: + description: Role to assume + example: my-role + type: string + type: + $ref: '#/components/schemas/AWSAssumeRoleType' + required: + - type + type: object AWSAuthConfig: description: AWS Authentication config. oneOf: @@ -1247,6 +1312,43 @@ components: required: - role_name type: object + AWSCredentials: + description: The definition of `AWSCredentials` object. + oneOf: + - $ref: '#/components/schemas/AWSAssumeRole' + AWSCredentialsUpdate: + description: The definition of `AWSCredentialsUpdate` object. + oneOf: + - $ref: '#/components/schemas/AWSAssumeRoleUpdate' + AWSIntegration: + description: The definition of `AWSIntegration` object. + properties: + credentials: + $ref: '#/components/schemas/AWSCredentials' + type: + $ref: '#/components/schemas/AWSIntegrationType' + required: + - type + - credentials + type: object + AWSIntegrationType: + description: The definition of `AWSIntegrationType` object. + enum: + - AWS + example: AWS + type: string + x-enum-varnames: + - AWS + AWSIntegrationUpdate: + description: The definition of `AWSIntegrationUpdate` object. + properties: + credentials: + $ref: '#/components/schemas/AWSCredentialsUpdate' + type: + $ref: '#/components/schemas/AWSIntegrationType' + required: + - type + type: object AWSLambdaForwarderConfig: description: 'Log Autosubscription configuration for Datadog Forwarder Lambda functions. Automatically set up triggers for existing @@ -1560,6 +1662,73 @@ components: xray_services: $ref: '#/components/schemas/XRayServicesList' type: object + ActionConnectionAttributes: + description: The definition of `ActionConnectionAttributes` object. + properties: + integration: + $ref: '#/components/schemas/ActionConnectionIntegration' + name: + description: Name of the connection + example: My AWS Connection + type: string + required: + - name + - integration + type: object + ActionConnectionAttributesUpdate: + description: The definition of `ActionConnectionAttributesUpdate` object. + properties: + integration: + $ref: '#/components/schemas/ActionConnectionIntegrationUpdate' + name: + description: Name of the connection + example: My AWS Connection + type: string + type: object + ActionConnectionData: + description: Data related to the connection. + properties: + attributes: + $ref: '#/components/schemas/ActionConnectionAttributes' + id: + description: The connection identifier + readOnly: true + type: string + type: + $ref: '#/components/schemas/ActionConnectionDataType' + required: + - type + - attributes + type: object + ActionConnectionDataType: + description: The definition of `ActionConnectionDataType` object. + enum: + - action_connection + example: action_connection + type: string + x-enum-varnames: + - ACTION_CONNECTION + ActionConnectionDataUpdate: + description: Data related to the connection update. + properties: + attributes: + $ref: '#/components/schemas/ActionConnectionAttributesUpdate' + type: + $ref: '#/components/schemas/ActionConnectionDataType' + required: + - type + - attributes + type: object + ActionConnectionIntegration: + description: The definition of `ActionConnectionIntegration` object. + oneOf: + - $ref: '#/components/schemas/AWSIntegration' + - $ref: '#/components/schemas/HTTPIntegration' + ActionConnectionIntegrationUpdate: + description: The definition of `ActionConnectionIntegrationUpdate` object. + oneOf: + - $ref: '#/components/schemas/AWSIntegrationUpdate' + - $ref: '#/components/schemas/HTTPIntegrationUpdate' ActiveBillingDimensionsAttributes: description: List of active billing dimensions. properties: @@ -6995,6 +7164,20 @@ components: type: string x-enum-varnames: - COST_BY_ORG + CreateActionConnectionRequest: + description: Request used to create an action connection. + properties: + data: + $ref: '#/components/schemas/ActionConnectionData' + required: + - data + type: object + CreateActionConnectionResponse: + description: The response for a created connection + properties: + data: + $ref: '#/components/schemas/ActionConnectionData' + type: object CreateAppRequest: description: The definition of `CreateAppRequest` object. example: @@ -12202,6 +12385,12 @@ components: type: string x-enum-varnames: - GCP_SERVICE_ACCOUNT + GetActionConnectionResponse: + description: The response for found connection + properties: + data: + $ref: '#/components/schemas/ActionConnectionData' + type: object GetAppResponse: description: The definition of `GetAppResponse` object. properties: @@ -12496,6 +12685,18 @@ components: example: env:production type: string type: array + HTTPBody: + description: The definition of `HTTPBody` object. + properties: + content: + description: Serialized body content + example: '{"some-json": "with-value"}' + type: string + content_type: + description: Content type of the body + example: application/json + type: string + type: object HTTPCIAppError: description: List of errors. properties: @@ -12521,6 +12722,88 @@ components: $ref: '#/components/schemas/HTTPCIAppError' type: array type: object + HTTPCredentials: + description: The definition of `HTTPCredentials` object. + oneOf: + - $ref: '#/components/schemas/HTTPTokenAuth' + HTTPCredentialsUpdate: + description: The definition of `HTTPCredentialsUpdate` object. + oneOf: + - $ref: '#/components/schemas/HTTPTokenAuthUpdate' + HTTPHeader: + description: The definition of `HTTPHeader` object. + properties: + name: + description: The `HTTPHeader` `name`. + example: MyHttpHeader + pattern: ^[A-Za-z][A-Za-z\\d\\-\\_]*$ + type: string + value: + description: The `HTTPHeader` `value`. + example: Some header value + type: string + required: + - name + - value + type: object + HTTPHeaderUpdate: + description: The definition of `HTTPHeaderUpdate` object. + properties: + deleted: + description: Should the header be deleted. + type: boolean + name: + description: The `HTTPHeaderUpdate` `name`. + example: MyHttpHeader + pattern: ^[A-Za-z][A-Za-z\\d\\-\\_]*$ + type: string + value: + description: The `HTTPHeaderUpdate` `value`. + example: Updated Header Value + type: string + required: + - name + type: object + HTTPIntegration: + description: The definition of `HTTPIntegration` object. + properties: + base_url: + description: Base HTTP url for the integration + example: http://datadoghq.com + pattern: url + type: string + credentials: + $ref: '#/components/schemas/HTTPCredentials' + type: + $ref: '#/components/schemas/HTTPIntegrationType' + required: + - type + - base_url + - credentials + type: object + HTTPIntegrationType: + description: The definition of `HTTPIntegrationType` object. + enum: + - HTTP + example: HTTP + type: string + x-enum-varnames: + - HTTP + HTTPIntegrationUpdate: + description: The definition of `HTTPIntegrationUpdate` object. + properties: + base_url: + description: Base HTTP url for the integration + example: http://datadoghq.com + pattern: url + type: string + credentials: + $ref: '#/components/schemas/HTTPCredentialsUpdate' + type: + $ref: '#/components/schemas/HTTPIntegrationType' + required: + - type + type: object HTTPLog: description: Structured log message. items: @@ -12597,6 +12880,105 @@ components: required: - message type: object + HTTPToken: + description: The definition of `HTTPToken` object. + properties: + name: + description: The `HTTPToken` `name`. + example: MyToken + pattern: ^[A-Za-z][A-Za-z\\d]*$ + type: string + type: + $ref: '#/components/schemas/TokenType' + value: + description: The `HTTPToken` `value`. + example: Some Token Value + type: string + required: + - name + - value + - type + type: object + HTTPTokenAuth: + description: The definition of `HTTPTokenAuth` object. + properties: + body: + $ref: '#/components/schemas/HTTPBody' + headers: + description: The `HTTPTokenAuth` `headers`. + items: + $ref: '#/components/schemas/HTTPHeader' + type: array + tokens: + description: The `HTTPTokenAuth` `tokens`. + items: + $ref: '#/components/schemas/HTTPToken' + type: array + type: + $ref: '#/components/schemas/HTTPTokenAuthType' + url_parameters: + description: The `HTTPTokenAuth` `url_parameters`. + items: + $ref: '#/components/schemas/UrlParam' + type: array + required: + - type + type: object + HTTPTokenAuthType: + description: The definition of `HTTPTokenAuthType` object. + enum: + - HTTPTokenAuth + example: HTTPTokenAuth + type: string + x-enum-varnames: + - HTTPTOKENAUTH + HTTPTokenAuthUpdate: + description: The definition of `HTTPTokenAuthUpdate` object. + properties: + body: + $ref: '#/components/schemas/HTTPBody' + headers: + description: The `HTTPTokenAuthUpdate` `headers`. + items: + $ref: '#/components/schemas/HTTPHeaderUpdate' + type: array + tokens: + description: The `HTTPTokenAuthUpdate` `tokens`. + items: + $ref: '#/components/schemas/HTTPTokenUpdate' + type: array + type: + $ref: '#/components/schemas/HTTPTokenAuthType' + url_parameters: + description: The `HTTPTokenAuthUpdate` `url_parameters`. + items: + $ref: '#/components/schemas/UrlParamUpdate' + type: array + required: + - type + type: object + HTTPTokenUpdate: + description: The definition of `HTTPTokenUpdate` object. + properties: + deleted: + description: Should the header be deleted. + type: boolean + name: + description: The `HTTPToken` `name`. + example: MyToken + pattern: ^[A-Za-z][A-Za-z\\d]*$ + type: string + type: + $ref: '#/components/schemas/TokenType' + value: + description: The `HTTPToken` `value`. + example: Some Token Value + type: string + required: + - name + - type + - value + type: object HistoricalJobDataType: description: Type of payload. enum: @@ -28683,6 +29065,19 @@ components: items: $ref: '#/components/schemas/TimeseriesResponseValues' type: array + TokenName: + description: Name for tokens. + example: MyTokenName + pattern: ^[A-Za-z][A-Za-z\\d]*$ + type: string + TokenType: + description: The definition of `TokenType` object. + enum: + - SECRET + example: SECRET + type: string + x-enum-varnames: + - SECRET Unit: description: Object containing the metric unit family, scale factor, name, and short name. @@ -28711,6 +29106,20 @@ components: example: min type: string type: object + UpdateActionConnectionRequest: + description: Request used to update an action connection. + properties: + data: + $ref: '#/components/schemas/ActionConnectionDataUpdate' + required: + - data + type: object + UpdateActionConnectionResponse: + description: The response for an updated connection. + properties: + data: + $ref: '#/components/schemas/ActionConnectionData' + type: object UpdateAppRequest: description: The definition of `UpdateAppRequest` object. example: @@ -28981,6 +29390,36 @@ components: description: Upsert entity response included item. oneOf: - $ref: '#/components/schemas/EntityResponseIncludedSchema' + UrlParam: + description: The definition of `UrlParam` object. + properties: + name: + $ref: '#/components/schemas/TokenName' + example: MyUrlParameter + value: + description: The `UrlParam` `value`. + example: Some Url Parameter value + type: string + required: + - name + - value + type: object + UrlParamUpdate: + description: The definition of `UrlParamUpdate` object. + properties: + deleted: + description: Should the header be deleted. + type: boolean + name: + $ref: '#/components/schemas/TokenName' + example: MyUrlParameter + value: + description: The `UrlParamUpdate` `value`. + example: Some Url Parameter value + type: string + required: + - name + type: object UsageApplicationSecurityMonitoringResponse: description: Application Security Monitoring usage response. properties: @@ -30222,6 +30661,107 @@ info: version: '1.0' openapi: 3.0.0 paths: + /api/v2/actions/connections: + post: + description: Create a new Action Connection + operationId: CreateActionConnection + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateActionConnectionRequest' + required: true + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/CreateActionConnectionResponse' + description: Successfully created Action Connection + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Create a new Action Connection + tags: + - Action Connection + /api/v2/actions/connections/{connection_id}: + delete: + description: Delete an existing Action Connection + operationId: DeleteActionConnection + parameters: + - $ref: '#/components/parameters/ConnectionId' + responses: + '204': + description: The resource was deleted successfully. + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Delete an existing Action Connection + tags: + - Action Connection + x-permission: + operator: OR + permissions: + - connection_write + get: + description: Get an existing Action Connection + operationId: GetActionConnection + parameters: + - $ref: '#/components/parameters/ConnectionId' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/GetActionConnectionResponse' + description: Successfully get Action Connection + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Get an existing Action Connection + tags: + - Action Connection + patch: + description: Update an existing Action Connection + operationId: UpdateActionConnection + parameters: + - $ref: '#/components/parameters/ConnectionId' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateActionConnectionRequest' + description: Update an existing Action Connection request body + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateActionConnectionResponse' + description: Successfully updated Action Connection + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Update an existing Action Connection + tags: + - Action Connection /api/v2/api_keys: get: description: List all API keys available for your account. @@ -48120,6 +48660,17 @@ tags: externalDocs: url: https://docs.datadoghq.com/integrations/amazon_web_services/#log-collection name: AWS Logs Integration +- description: "Action connections extend your installed integrations and allow you + to take action in your third-party systems\n(e.g. AWS, Gitlab, and Statuspage) + with Datadog\u2019s Workflow Automation and App Builder products.\n\nDatadog\u2019s + Integrations automatically provide authentication for Slack, Microsoft Teams, + PagerDuty, Opsgenie,\nJIRA, GitHub, and Statuspage. You do not need additional + connections in order to access these tools within\nWorkflow Automation and App + Builder.\n\nWe offer granular access control for editing and resolving connections." + externalDocs: + description: Find out more at + url: https://docs.datadoghq.com/service_management/workflows/connections/ + name: Action Connection - description: Deploy and disable apps in App Builder. name: App Deployment - description: Create, read, update, and delete apps in App Builder. diff --git a/examples/v2/action-connection/CreateActionConnection.java b/examples/v2/action-connection/CreateActionConnection.java new file mode 100644 index 00000000000..ba3ebb320f5 --- /dev/null +++ b/examples/v2/action-connection/CreateActionConnection.java @@ -0,0 +1,53 @@ +// Create a new Action Connection returns "Successfully created Action Connection" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.ActionConnectionApi; +import com.datadog.api.client.v2.model.AWSAssumeRole; +import com.datadog.api.client.v2.model.AWSAssumeRoleType; +import com.datadog.api.client.v2.model.AWSCredentials; +import com.datadog.api.client.v2.model.AWSIntegration; +import com.datadog.api.client.v2.model.AWSIntegrationType; +import com.datadog.api.client.v2.model.ActionConnectionAttributes; +import com.datadog.api.client.v2.model.ActionConnectionData; +import com.datadog.api.client.v2.model.ActionConnectionDataType; +import com.datadog.api.client.v2.model.ActionConnectionIntegration; +import com.datadog.api.client.v2.model.CreateActionConnectionRequest; +import com.datadog.api.client.v2.model.CreateActionConnectionResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + ActionConnectionApi apiInstance = new ActionConnectionApi(defaultClient); + + CreateActionConnectionRequest body = + new CreateActionConnectionRequest() + .data( + new ActionConnectionData() + .type(ActionConnectionDataType.ACTION_CONNECTION) + .attributes( + new ActionConnectionAttributes() + .name("Cassette Connection DELETE_ME") + .integration( + new ActionConnectionIntegration( + new AWSIntegration() + .type(AWSIntegrationType.AWS) + .credentials( + new AWSCredentials( + new AWSAssumeRole() + .type(AWSAssumeRoleType.AWSASSUMEROLE) + .role("MyRoleUpdated") + .accountId("123456789123"))))))); + + try { + CreateActionConnectionResponse result = apiInstance.createActionConnection(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ActionConnectionApi#createActionConnection"); + 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/action-connection/DeleteActionConnection.java b/examples/v2/action-connection/DeleteActionConnection.java new file mode 100644 index 00000000000..82c29b140fe --- /dev/null +++ b/examples/v2/action-connection/DeleteActionConnection.java @@ -0,0 +1,22 @@ +// Delete an existing Action Connection returns "The resource was deleted successfully." response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.ActionConnectionApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + ActionConnectionApi apiInstance = new ActionConnectionApi(defaultClient); + + try { + apiInstance.deleteActionConnection("connection_id"); + } catch (ApiException e) { + System.err.println("Exception when calling ActionConnectionApi#deleteActionConnection"); + 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/action-connection/DeleteActionConnection_2142905164.java b/examples/v2/action-connection/DeleteActionConnection_2142905164.java new file mode 100644 index 00000000000..36251908ae8 --- /dev/null +++ b/examples/v2/action-connection/DeleteActionConnection_2142905164.java @@ -0,0 +1,25 @@ +// Delete an existing Action Connection returns "Successfully deleted Action Connection" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.ActionConnectionApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + ActionConnectionApi apiInstance = new ActionConnectionApi(defaultClient); + + // there is a valid "action_connection" in the system + String ACTION_CONNECTION_DATA_ID = System.getenv("ACTION_CONNECTION_DATA_ID"); + + try { + apiInstance.deleteActionConnection(ACTION_CONNECTION_DATA_ID); + } catch (ApiException e) { + System.err.println("Exception when calling ActionConnectionApi#deleteActionConnection"); + 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/action-connection/GetActionConnection.java b/examples/v2/action-connection/GetActionConnection.java new file mode 100644 index 00000000000..8435f61c17e --- /dev/null +++ b/examples/v2/action-connection/GetActionConnection.java @@ -0,0 +1,25 @@ +// Get an existing Action Connection returns "Successfully get Action Connection" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.ActionConnectionApi; +import com.datadog.api.client.v2.model.GetActionConnectionResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + ActionConnectionApi apiInstance = new ActionConnectionApi(defaultClient); + + try { + GetActionConnectionResponse result = + apiInstance.getActionConnection("cb460d51-3c88-4e87-adac-d47131d0423d"); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ActionConnectionApi#getActionConnection"); + 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/action-connection/UpdateActionConnection.java b/examples/v2/action-connection/UpdateActionConnection.java new file mode 100644 index 00000000000..7e76b9c6a09 --- /dev/null +++ b/examples/v2/action-connection/UpdateActionConnection.java @@ -0,0 +1,54 @@ +// Update an existing Action Connection returns "Successfully updated Action Connection" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.ActionConnectionApi; +import com.datadog.api.client.v2.model.AWSAssumeRoleType; +import com.datadog.api.client.v2.model.AWSAssumeRoleUpdate; +import com.datadog.api.client.v2.model.AWSCredentialsUpdate; +import com.datadog.api.client.v2.model.AWSIntegrationType; +import com.datadog.api.client.v2.model.AWSIntegrationUpdate; +import com.datadog.api.client.v2.model.ActionConnectionAttributesUpdate; +import com.datadog.api.client.v2.model.ActionConnectionDataType; +import com.datadog.api.client.v2.model.ActionConnectionDataUpdate; +import com.datadog.api.client.v2.model.ActionConnectionIntegrationUpdate; +import com.datadog.api.client.v2.model.UpdateActionConnectionRequest; +import com.datadog.api.client.v2.model.UpdateActionConnectionResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + ActionConnectionApi apiInstance = new ActionConnectionApi(defaultClient); + + UpdateActionConnectionRequest body = + new UpdateActionConnectionRequest() + .data( + new ActionConnectionDataUpdate() + .type(ActionConnectionDataType.ACTION_CONNECTION) + .attributes( + new ActionConnectionAttributesUpdate() + .name("Cassette Connection") + .integration( + new ActionConnectionIntegrationUpdate( + new AWSIntegrationUpdate() + .type(AWSIntegrationType.AWS) + .credentials( + new AWSCredentialsUpdate( + new AWSAssumeRoleUpdate() + .type(AWSAssumeRoleType.AWSASSUMEROLE) + .role("MyRoleUpdated") + .accountId("123456789123"))))))); + + try { + UpdateActionConnectionResponse result = + apiInstance.updateActionConnection("cb460d51-3c88-4e87-adac-d47131d0423d", body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ActionConnectionApi#updateActionConnection"); + 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/ActionConnectionApi.java b/src/main/java/com/datadog/api/client/v2/api/ActionConnectionApi.java new file mode 100644 index 00000000000..5e967c3a9f9 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/api/ActionConnectionApi.java @@ -0,0 +1,627 @@ +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.CreateActionConnectionRequest; +import com.datadog.api.client.v2.model.CreateActionConnectionResponse; +import com.datadog.api.client.v2.model.GetActionConnectionResponse; +import com.datadog.api.client.v2.model.UpdateActionConnectionRequest; +import com.datadog.api.client.v2.model.UpdateActionConnectionResponse; +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 ActionConnectionApi { + private ApiClient apiClient; + + public ActionConnectionApi() { + this(ApiClient.getDefaultApiClient()); + } + + public ActionConnectionApi(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; + } + + /** + * Create a new Action Connection. + * + *

See {@link #createActionConnectionWithHttpInfo}. + * + * @param body (required) + * @return CreateActionConnectionResponse + * @throws ApiException if fails to make API call + */ + public CreateActionConnectionResponse createActionConnection(CreateActionConnectionRequest body) + throws ApiException { + return createActionConnectionWithHttpInfo(body).getData(); + } + + /** + * Create a new Action Connection. + * + *

See {@link #createActionConnectionWithHttpInfoAsync}. + * + * @param body (required) + * @return CompletableFuture<CreateActionConnectionResponse> + */ + public CompletableFuture createActionConnectionAsync( + CreateActionConnectionRequest body) { + return createActionConnectionWithHttpInfoAsync(body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Create a new Action Connection + * + * @param body (required) + * @return ApiResponse<CreateActionConnectionResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
201 Successfully created Action Connection -
400 Bad Request -
403 Forbidden -
429 Too many requests -
+ */ + public ApiResponse createActionConnectionWithHttpInfo( + CreateActionConnectionRequest 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 createActionConnection"); + } + // create path and map variables + String localVarPath = "/api/v2/actions/connections"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.ActionConnectionApi.createActionConnection", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Create a new Action Connection. + * + *

See {@link #createActionConnectionWithHttpInfo}. + * + * @param body (required) + * @return CompletableFuture<ApiResponse<CreateActionConnectionResponse>> + */ + public CompletableFuture> + createActionConnectionWithHttpInfoAsync(CreateActionConnectionRequest 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 createActionConnection")); + return result; + } + // create path and map variables + String localVarPath = "/api/v2/actions/connections"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.ActionConnectionApi.createActionConnection", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Delete an existing Action Connection. + * + *

See {@link #deleteActionConnectionWithHttpInfo}. + * + * @param connectionId The ID of the action connection (required) + * @throws ApiException if fails to make API call + */ + public void deleteActionConnection(String connectionId) throws ApiException { + deleteActionConnectionWithHttpInfo(connectionId); + } + + /** + * Delete an existing Action Connection. + * + *

See {@link #deleteActionConnectionWithHttpInfoAsync}. + * + * @param connectionId The ID of the action connection (required) + * @return CompletableFuture + */ + public CompletableFuture deleteActionConnectionAsync(String connectionId) { + return deleteActionConnectionWithHttpInfoAsync(connectionId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Delete an existing Action Connection + * + * @param connectionId The ID of the action connection (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
204 The resource was deleted successfully. -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse deleteActionConnectionWithHttpInfo(String connectionId) + throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'connectionId' is set + if (connectionId == null) { + throw new ApiException( + 400, "Missing the required parameter 'connectionId' when calling deleteActionConnection"); + } + // create path and map variables + String localVarPath = + "/api/v2/actions/connections/{connection_id}" + .replaceAll( + "\\{" + "connection_id" + "\\}", apiClient.escapeString(connectionId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.ActionConnectionApi.deleteActionConnection", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "DELETE", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Delete an existing Action Connection. + * + *

See {@link #deleteActionConnectionWithHttpInfo}. + * + * @param connectionId The ID of the action connection (required) + * @return CompletableFuture<ApiResponse<Void>> + */ + public CompletableFuture> deleteActionConnectionWithHttpInfoAsync( + String connectionId) { + Object localVarPostBody = null; + + // verify the required parameter 'connectionId' is set + if (connectionId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'connectionId' when calling deleteActionConnection")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/actions/connections/{connection_id}" + .replaceAll( + "\\{" + "connection_id" + "\\}", apiClient.escapeString(connectionId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.ActionConnectionApi.deleteActionConnection", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "DELETE", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Get an existing Action Connection. + * + *

See {@link #getActionConnectionWithHttpInfo}. + * + * @param connectionId The ID of the action connection (required) + * @return GetActionConnectionResponse + * @throws ApiException if fails to make API call + */ + public GetActionConnectionResponse getActionConnection(String connectionId) throws ApiException { + return getActionConnectionWithHttpInfo(connectionId).getData(); + } + + /** + * Get an existing Action Connection. + * + *

See {@link #getActionConnectionWithHttpInfoAsync}. + * + * @param connectionId The ID of the action connection (required) + * @return CompletableFuture<GetActionConnectionResponse> + */ + public CompletableFuture getActionConnectionAsync( + String connectionId) { + return getActionConnectionWithHttpInfoAsync(connectionId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get an existing Action Connection + * + * @param connectionId The ID of the action connection (required) + * @return ApiResponse<GetActionConnectionResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 Successfully get Action Connection -
400 Bad Request -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse getActionConnectionWithHttpInfo( + String connectionId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'connectionId' is set + if (connectionId == null) { + throw new ApiException( + 400, "Missing the required parameter 'connectionId' when calling getActionConnection"); + } + // create path and map variables + String localVarPath = + "/api/v2/actions/connections/{connection_id}" + .replaceAll( + "\\{" + "connection_id" + "\\}", apiClient.escapeString(connectionId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.ActionConnectionApi.getActionConnection", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get an existing Action Connection. + * + *

See {@link #getActionConnectionWithHttpInfo}. + * + * @param connectionId The ID of the action connection (required) + * @return CompletableFuture<ApiResponse<GetActionConnectionResponse>> + */ + public CompletableFuture> + getActionConnectionWithHttpInfoAsync(String connectionId) { + Object localVarPostBody = null; + + // verify the required parameter 'connectionId' is set + if (connectionId == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'connectionId' when calling getActionConnection")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/actions/connections/{connection_id}" + .replaceAll( + "\\{" + "connection_id" + "\\}", apiClient.escapeString(connectionId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.ActionConnectionApi.getActionConnection", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"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() {}); + } + + /** + * Update an existing Action Connection. + * + *

See {@link #updateActionConnectionWithHttpInfo}. + * + * @param connectionId The ID of the action connection (required) + * @param body Update an existing Action Connection request body (required) + * @return UpdateActionConnectionResponse + * @throws ApiException if fails to make API call + */ + public UpdateActionConnectionResponse updateActionConnection( + String connectionId, UpdateActionConnectionRequest body) throws ApiException { + return updateActionConnectionWithHttpInfo(connectionId, body).getData(); + } + + /** + * Update an existing Action Connection. + * + *

See {@link #updateActionConnectionWithHttpInfoAsync}. + * + * @param connectionId The ID of the action connection (required) + * @param body Update an existing Action Connection request body (required) + * @return CompletableFuture<UpdateActionConnectionResponse> + */ + public CompletableFuture updateActionConnectionAsync( + String connectionId, UpdateActionConnectionRequest body) { + return updateActionConnectionWithHttpInfoAsync(connectionId, body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Update an existing Action Connection + * + * @param connectionId The ID of the action connection (required) + * @param body Update an existing Action Connection request body (required) + * @return ApiResponse<UpdateActionConnectionResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 Successfully updated Action Connection -
400 Bad Request -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse updateActionConnectionWithHttpInfo( + String connectionId, UpdateActionConnectionRequest body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'connectionId' is set + if (connectionId == null) { + throw new ApiException( + 400, "Missing the required parameter 'connectionId' when calling updateActionConnection"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling updateActionConnection"); + } + // create path and map variables + String localVarPath = + "/api/v2/actions/connections/{connection_id}" + .replaceAll( + "\\{" + "connection_id" + "\\}", apiClient.escapeString(connectionId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.ActionConnectionApi.updateActionConnection", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "PATCH", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Update an existing Action Connection. + * + *

See {@link #updateActionConnectionWithHttpInfo}. + * + * @param connectionId The ID of the action connection (required) + * @param body Update an existing Action Connection request body (required) + * @return CompletableFuture<ApiResponse<UpdateActionConnectionResponse>> + */ + public CompletableFuture> + updateActionConnectionWithHttpInfoAsync( + String connectionId, UpdateActionConnectionRequest body) { + Object localVarPostBody = body; + + // verify the required parameter 'connectionId' is set + if (connectionId == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'connectionId' when calling updateActionConnection")); + return result; + } + + // 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 updateActionConnection")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/actions/connections/{connection_id}" + .replaceAll( + "\\{" + "connection_id" + "\\}", apiClient.escapeString(connectionId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.ActionConnectionApi.updateActionConnection", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"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/AWSAssumeRole.java b/src/main/java/com/datadog/api/client/v2/model/AWSAssumeRole.java new file mode 100644 index 00000000000..0affa49aef1 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AWSAssumeRole.java @@ -0,0 +1,242 @@ +/* + * 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; + +/** The definition of AWSAssumeRole object. */ +@JsonPropertyOrder({ + AWSAssumeRole.JSON_PROPERTY_ACCOUNT_ID, + AWSAssumeRole.JSON_PROPERTY_EXTERNAL_ID, + AWSAssumeRole.JSON_PROPERTY_PRINCIPAL_ID, + AWSAssumeRole.JSON_PROPERTY_ROLE, + AWSAssumeRole.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AWSAssumeRole { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ACCOUNT_ID = "account_id"; + private String accountId; + + public static final String JSON_PROPERTY_EXTERNAL_ID = "external_id"; + private String externalId; + + public static final String JSON_PROPERTY_PRINCIPAL_ID = "principal_id"; + private String principalId; + + public static final String JSON_PROPERTY_ROLE = "role"; + private String role; + + public static final String JSON_PROPERTY_TYPE = "type"; + private AWSAssumeRoleType type; + + public AWSAssumeRole() {} + + @JsonCreator + public AWSAssumeRole( + @JsonProperty(required = true, value = JSON_PROPERTY_ACCOUNT_ID) String accountId, + @JsonProperty(required = true, value = JSON_PROPERTY_ROLE) String role, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) AWSAssumeRoleType type) { + this.accountId = accountId; + this.role = role; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public AWSAssumeRole accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * AWS account the connection is created for + * + * @return accountId + */ + @JsonProperty(JSON_PROPERTY_ACCOUNT_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getAccountId() { + return accountId; + } + + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + /** + * External ID used to scope which connection can be used to assume the role + * + * @return externalId + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_EXTERNAL_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getExternalId() { + return externalId; + } + + /** + * AWS account that will assume the role + * + * @return principalId + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PRINCIPAL_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getPrincipalId() { + return principalId; + } + + public AWSAssumeRole role(String role) { + this.role = role; + return this; + } + + /** + * Role to assume + * + * @return role + */ + @JsonProperty(JSON_PROPERTY_ROLE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getRole() { + return role; + } + + public void setRole(String role) { + this.role = role; + } + + public AWSAssumeRole type(AWSAssumeRoleType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of AWSAssumeRoleType object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AWSAssumeRoleType getType() { + return type; + } + + public void setType(AWSAssumeRoleType 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 AWSAssumeRole + */ + @JsonAnySetter + public AWSAssumeRole 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 AWSAssumeRole object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AWSAssumeRole awsAssumeRole = (AWSAssumeRole) o; + return Objects.equals(this.accountId, awsAssumeRole.accountId) + && Objects.equals(this.externalId, awsAssumeRole.externalId) + && Objects.equals(this.principalId, awsAssumeRole.principalId) + && Objects.equals(this.role, awsAssumeRole.role) + && Objects.equals(this.type, awsAssumeRole.type) + && Objects.equals(this.additionalProperties, awsAssumeRole.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(accountId, externalId, principalId, role, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AWSAssumeRole {\n"); + sb.append(" accountId: ").append(toIndentedString(accountId)).append("\n"); + sb.append(" externalId: ").append(toIndentedString(externalId)).append("\n"); + sb.append(" principalId: ").append(toIndentedString(principalId)).append("\n"); + sb.append(" role: ").append(toIndentedString(role)).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/AWSAssumeRoleType.java b/src/main/java/com/datadog/api/client/v2/model/AWSAssumeRoleType.java new file mode 100644 index 00000000000..c961b062ece --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AWSAssumeRoleType.java @@ -0,0 +1,54 @@ +/* + * 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; + +/** The definition of AWSAssumeRoleType object. */ +@JsonSerialize(using = AWSAssumeRoleType.AWSAssumeRoleTypeSerializer.class) +public class AWSAssumeRoleType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("AWSAssumeRole")); + + public static final AWSAssumeRoleType AWSASSUMEROLE = new AWSAssumeRoleType("AWSAssumeRole"); + + AWSAssumeRoleType(String value) { + super(value, allowedValues); + } + + public static class AWSAssumeRoleTypeSerializer extends StdSerializer { + public AWSAssumeRoleTypeSerializer(Class t) { + super(t); + } + + public AWSAssumeRoleTypeSerializer() { + this(null); + } + + @Override + public void serialize(AWSAssumeRoleType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static AWSAssumeRoleType fromValue(String value) { + return new AWSAssumeRoleType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AWSAssumeRoleUpdate.java b/src/main/java/com/datadog/api/client/v2/model/AWSAssumeRoleUpdate.java new file mode 100644 index 00000000000..0ac0c1b46c1 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AWSAssumeRoleUpdate.java @@ -0,0 +1,233 @@ +/* + * 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; + +/** The definition of AWSAssumeRoleUpdate object. */ +@JsonPropertyOrder({ + AWSAssumeRoleUpdate.JSON_PROPERTY_ACCOUNT_ID, + AWSAssumeRoleUpdate.JSON_PROPERTY_GENERATE_NEW_EXTERNAL_ID, + AWSAssumeRoleUpdate.JSON_PROPERTY_ROLE, + AWSAssumeRoleUpdate.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AWSAssumeRoleUpdate { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ACCOUNT_ID = "account_id"; + private String accountId; + + public static final String JSON_PROPERTY_GENERATE_NEW_EXTERNAL_ID = "generate_new_external_id"; + private Boolean generateNewExternalId; + + public static final String JSON_PROPERTY_ROLE = "role"; + private String role; + + public static final String JSON_PROPERTY_TYPE = "type"; + private AWSAssumeRoleType type; + + public AWSAssumeRoleUpdate() {} + + @JsonCreator + public AWSAssumeRoleUpdate( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) AWSAssumeRoleType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public AWSAssumeRoleUpdate accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * AWS account the connection is created for + * + * @return accountId + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ACCOUNT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getAccountId() { + return accountId; + } + + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + public AWSAssumeRoleUpdate generateNewExternalId(Boolean generateNewExternalId) { + this.generateNewExternalId = generateNewExternalId; + return this; + } + + /** + * The AWSAssumeRoleUpdate generate_new_external_id. + * + * @return generateNewExternalId + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_GENERATE_NEW_EXTERNAL_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getGenerateNewExternalId() { + return generateNewExternalId; + } + + public void setGenerateNewExternalId(Boolean generateNewExternalId) { + this.generateNewExternalId = generateNewExternalId; + } + + public AWSAssumeRoleUpdate role(String role) { + this.role = role; + return this; + } + + /** + * Role to assume + * + * @return role + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ROLE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getRole() { + return role; + } + + public void setRole(String role) { + this.role = role; + } + + public AWSAssumeRoleUpdate type(AWSAssumeRoleType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of AWSAssumeRoleType object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AWSAssumeRoleType getType() { + return type; + } + + public void setType(AWSAssumeRoleType 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 AWSAssumeRoleUpdate + */ + @JsonAnySetter + public AWSAssumeRoleUpdate 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 AWSAssumeRoleUpdate object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AWSAssumeRoleUpdate awsAssumeRoleUpdate = (AWSAssumeRoleUpdate) o; + return Objects.equals(this.accountId, awsAssumeRoleUpdate.accountId) + && Objects.equals(this.generateNewExternalId, awsAssumeRoleUpdate.generateNewExternalId) + && Objects.equals(this.role, awsAssumeRoleUpdate.role) + && Objects.equals(this.type, awsAssumeRoleUpdate.type) + && Objects.equals(this.additionalProperties, awsAssumeRoleUpdate.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(accountId, generateNewExternalId, role, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AWSAssumeRoleUpdate {\n"); + sb.append(" accountId: ").append(toIndentedString(accountId)).append("\n"); + sb.append(" generateNewExternalId: ") + .append(toIndentedString(generateNewExternalId)) + .append("\n"); + sb.append(" role: ").append(toIndentedString(role)).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/AWSCredentials.java b/src/main/java/com/datadog/api/client/v2/model/AWSCredentials.java new file mode 100644 index 00000000000..46bee42e01f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AWSCredentials.java @@ -0,0 +1,208 @@ +/* + * 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.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize(using = AWSCredentials.AWSCredentialsDeserializer.class) +@JsonSerialize(using = AWSCredentials.AWSCredentialsSerializer.class) +public class AWSCredentials extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(AWSCredentials.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class AWSCredentialsSerializer extends StdSerializer { + public AWSCredentialsSerializer(Class t) { + super(t); + } + + public AWSCredentialsSerializer() { + this(null); + } + + @Override + public void serialize(AWSCredentials value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class AWSCredentialsDeserializer extends StdDeserializer { + public AWSCredentialsDeserializer() { + this(AWSCredentials.class); + } + + public AWSCredentialsDeserializer(Class vc) { + super(vc); + } + + @Override + public AWSCredentials deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize AWSAssumeRole + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (AWSAssumeRole.class.equals(Integer.class) + || AWSAssumeRole.class.equals(Long.class) + || AWSAssumeRole.class.equals(Float.class) + || AWSAssumeRole.class.equals(Double.class) + || AWSAssumeRole.class.equals(Boolean.class) + || AWSAssumeRole.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((AWSAssumeRole.class.equals(Integer.class) + || AWSAssumeRole.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((AWSAssumeRole.class.equals(Float.class) + || AWSAssumeRole.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (AWSAssumeRole.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (AWSAssumeRole.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(AWSAssumeRole.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((AWSAssumeRole) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'AWSAssumeRole'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'AWSAssumeRole'", e); + } + + AWSCredentials ret = new AWSCredentials(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public AWSCredentials getNullValue(DeserializationContext ctxt) throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "AWSCredentials cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public AWSCredentials() { + super("oneOf", Boolean.FALSE); + } + + public AWSCredentials(AWSAssumeRole o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("AWSAssumeRole", new GenericType() {}); + JSON.registerDescendants(AWSCredentials.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return AWSCredentials.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: AWSAssumeRole + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(AWSAssumeRole.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException("Invalid instance type. Must be AWSAssumeRole"); + } + + /** + * Get the actual instance, which can be the following: AWSAssumeRole + * + * @return The actual instance (AWSAssumeRole) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `AWSAssumeRole`. If the actual instance is not `AWSAssumeRole`, the + * ClassCastException will be thrown. + * + * @return The actual instance of `AWSAssumeRole` + * @throws ClassCastException if the instance is not `AWSAssumeRole` + */ + public AWSAssumeRole getAWSAssumeRole() throws ClassCastException { + return (AWSAssumeRole) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AWSCredentialsUpdate.java b/src/main/java/com/datadog/api/client/v2/model/AWSCredentialsUpdate.java new file mode 100644 index 00000000000..6724b31def5 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AWSCredentialsUpdate.java @@ -0,0 +1,211 @@ +/* + * 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.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize(using = AWSCredentialsUpdate.AWSCredentialsUpdateDeserializer.class) +@JsonSerialize(using = AWSCredentialsUpdate.AWSCredentialsUpdateSerializer.class) +public class AWSCredentialsUpdate extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(AWSCredentialsUpdate.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class AWSCredentialsUpdateSerializer extends StdSerializer { + public AWSCredentialsUpdateSerializer(Class t) { + super(t); + } + + public AWSCredentialsUpdateSerializer() { + this(null); + } + + @Override + public void serialize( + AWSCredentialsUpdate value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class AWSCredentialsUpdateDeserializer + extends StdDeserializer { + public AWSCredentialsUpdateDeserializer() { + this(AWSCredentialsUpdate.class); + } + + public AWSCredentialsUpdateDeserializer(Class vc) { + super(vc); + } + + @Override + public AWSCredentialsUpdate deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize AWSAssumeRoleUpdate + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (AWSAssumeRoleUpdate.class.equals(Integer.class) + || AWSAssumeRoleUpdate.class.equals(Long.class) + || AWSAssumeRoleUpdate.class.equals(Float.class) + || AWSAssumeRoleUpdate.class.equals(Double.class) + || AWSAssumeRoleUpdate.class.equals(Boolean.class) + || AWSAssumeRoleUpdate.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((AWSAssumeRoleUpdate.class.equals(Integer.class) + || AWSAssumeRoleUpdate.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((AWSAssumeRoleUpdate.class.equals(Float.class) + || AWSAssumeRoleUpdate.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (AWSAssumeRoleUpdate.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (AWSAssumeRoleUpdate.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(AWSAssumeRoleUpdate.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((AWSAssumeRoleUpdate) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'AWSAssumeRoleUpdate'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'AWSAssumeRoleUpdate'", e); + } + + AWSCredentialsUpdate ret = new AWSCredentialsUpdate(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public AWSCredentialsUpdate getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "AWSCredentialsUpdate cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public AWSCredentialsUpdate() { + super("oneOf", Boolean.FALSE); + } + + public AWSCredentialsUpdate(AWSAssumeRoleUpdate o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("AWSAssumeRoleUpdate", new GenericType() {}); + JSON.registerDescendants(AWSCredentialsUpdate.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return AWSCredentialsUpdate.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: AWSAssumeRoleUpdate + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(AWSAssumeRoleUpdate.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException("Invalid instance type. Must be AWSAssumeRoleUpdate"); + } + + /** + * Get the actual instance, which can be the following: AWSAssumeRoleUpdate + * + * @return The actual instance (AWSAssumeRoleUpdate) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `AWSAssumeRoleUpdate`. If the actual instance is not + * `AWSAssumeRoleUpdate`, the ClassCastException will be thrown. + * + * @return The actual instance of `AWSAssumeRoleUpdate` + * @throws ClassCastException if the instance is not `AWSAssumeRoleUpdate` + */ + public AWSAssumeRoleUpdate getAWSAssumeRoleUpdate() throws ClassCastException { + return (AWSAssumeRoleUpdate) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AWSIntegration.java b/src/main/java/com/datadog/api/client/v2/model/AWSIntegration.java new file mode 100644 index 00000000000..6125f6b2d3c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AWSIntegration.java @@ -0,0 +1,177 @@ +/* + * 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; + +/** The definition of AWSIntegration object. */ +@JsonPropertyOrder({AWSIntegration.JSON_PROPERTY_CREDENTIALS, AWSIntegration.JSON_PROPERTY_TYPE}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AWSIntegration { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREDENTIALS = "credentials"; + private AWSCredentials credentials; + + public static final String JSON_PROPERTY_TYPE = "type"; + private AWSIntegrationType type; + + public AWSIntegration() {} + + @JsonCreator + public AWSIntegration( + @JsonProperty(required = true, value = JSON_PROPERTY_CREDENTIALS) AWSCredentials credentials, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) AWSIntegrationType type) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public AWSIntegration credentials(AWSCredentials credentials) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + return this; + } + + /** + * The definition of AWSCredentials object. + * + * @return credentials + */ + @JsonProperty(JSON_PROPERTY_CREDENTIALS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AWSCredentials getCredentials() { + return credentials; + } + + public void setCredentials(AWSCredentials credentials) { + this.credentials = credentials; + } + + public AWSIntegration type(AWSIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of AWSIntegrationType object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AWSIntegrationType getType() { + return type; + } + + public void setType(AWSIntegrationType 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 AWSIntegration + */ + @JsonAnySetter + public AWSIntegration 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 AWSIntegration object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AWSIntegration awsIntegration = (AWSIntegration) o; + return Objects.equals(this.credentials, awsIntegration.credentials) + && Objects.equals(this.type, awsIntegration.type) + && Objects.equals(this.additionalProperties, awsIntegration.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(credentials, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AWSIntegration {\n"); + sb.append(" credentials: ").append(toIndentedString(credentials)).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/AWSIntegrationType.java b/src/main/java/com/datadog/api/client/v2/model/AWSIntegrationType.java new file mode 100644 index 00000000000..b2e84dcc681 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AWSIntegrationType.java @@ -0,0 +1,53 @@ +/* + * 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; + +/** The definition of AWSIntegrationType object. */ +@JsonSerialize(using = AWSIntegrationType.AWSIntegrationTypeSerializer.class) +public class AWSIntegrationType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("AWS")); + + public static final AWSIntegrationType AWS = new AWSIntegrationType("AWS"); + + AWSIntegrationType(String value) { + super(value, allowedValues); + } + + public static class AWSIntegrationTypeSerializer extends StdSerializer { + public AWSIntegrationTypeSerializer(Class t) { + super(t); + } + + public AWSIntegrationTypeSerializer() { + this(null); + } + + @Override + public void serialize(AWSIntegrationType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static AWSIntegrationType fromValue(String value) { + return new AWSIntegrationType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AWSIntegrationUpdate.java b/src/main/java/com/datadog/api/client/v2/model/AWSIntegrationUpdate.java new file mode 100644 index 00000000000..2a9cdbdcf7e --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AWSIntegrationUpdate.java @@ -0,0 +1,178 @@ +/* + * 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; + +/** The definition of AWSIntegrationUpdate object. */ +@JsonPropertyOrder({ + AWSIntegrationUpdate.JSON_PROPERTY_CREDENTIALS, + AWSIntegrationUpdate.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AWSIntegrationUpdate { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREDENTIALS = "credentials"; + private AWSCredentialsUpdate credentials; + + public static final String JSON_PROPERTY_TYPE = "type"; + private AWSIntegrationType type; + + public AWSIntegrationUpdate() {} + + @JsonCreator + public AWSIntegrationUpdate( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) AWSIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public AWSIntegrationUpdate credentials(AWSCredentialsUpdate credentials) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + return this; + } + + /** + * The definition of AWSCredentialsUpdate object. + * + * @return credentials + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CREDENTIALS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public AWSCredentialsUpdate getCredentials() { + return credentials; + } + + public void setCredentials(AWSCredentialsUpdate credentials) { + this.credentials = credentials; + } + + public AWSIntegrationUpdate type(AWSIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of AWSIntegrationType object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AWSIntegrationType getType() { + return type; + } + + public void setType(AWSIntegrationType 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 AWSIntegrationUpdate + */ + @JsonAnySetter + public AWSIntegrationUpdate 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 AWSIntegrationUpdate object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AWSIntegrationUpdate awsIntegrationUpdate = (AWSIntegrationUpdate) o; + return Objects.equals(this.credentials, awsIntegrationUpdate.credentials) + && Objects.equals(this.type, awsIntegrationUpdate.type) + && Objects.equals(this.additionalProperties, awsIntegrationUpdate.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(credentials, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AWSIntegrationUpdate {\n"); + sb.append(" credentials: ").append(toIndentedString(credentials)).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/ActionConnectionAttributes.java b/src/main/java/com/datadog/api/client/v2/model/ActionConnectionAttributes.java new file mode 100644 index 00000000000..fb899554c13 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ActionConnectionAttributes.java @@ -0,0 +1,177 @@ +/* + * 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; + +/** The definition of ActionConnectionAttributes object. */ +@JsonPropertyOrder({ + ActionConnectionAttributes.JSON_PROPERTY_INTEGRATION, + ActionConnectionAttributes.JSON_PROPERTY_NAME +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ActionConnectionAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_INTEGRATION = "integration"; + private ActionConnectionIntegration integration; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public ActionConnectionAttributes() {} + + @JsonCreator + public ActionConnectionAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_INTEGRATION) + ActionConnectionIntegration integration, + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name) { + this.integration = integration; + this.unparsed |= integration.unparsed; + this.name = name; + } + + public ActionConnectionAttributes integration(ActionConnectionIntegration integration) { + this.integration = integration; + this.unparsed |= integration.unparsed; + return this; + } + + /** + * The definition of ActionConnectionIntegration object. + * + * @return integration + */ + @JsonProperty(JSON_PROPERTY_INTEGRATION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ActionConnectionIntegration getIntegration() { + return integration; + } + + public void setIntegration(ActionConnectionIntegration integration) { + this.integration = integration; + } + + public ActionConnectionAttributes name(String name) { + this.name = name; + return this; + } + + /** + * Name of the connection + * + * @return name + */ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + /** + * 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 ActionConnectionAttributes + */ + @JsonAnySetter + public ActionConnectionAttributes 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 ActionConnectionAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ActionConnectionAttributes actionConnectionAttributes = (ActionConnectionAttributes) o; + return Objects.equals(this.integration, actionConnectionAttributes.integration) + && Objects.equals(this.name, actionConnectionAttributes.name) + && Objects.equals( + this.additionalProperties, actionConnectionAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(integration, name, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ActionConnectionAttributes {\n"); + sb.append(" integration: ").append(toIndentedString(integration)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).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/ActionConnectionAttributesUpdate.java b/src/main/java/com/datadog/api/client/v2/model/ActionConnectionAttributesUpdate.java new file mode 100644 index 00000000000..6d8c3e5187a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ActionConnectionAttributesUpdate.java @@ -0,0 +1,168 @@ +/* + * 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; + +/** The definition of ActionConnectionAttributesUpdate object. */ +@JsonPropertyOrder({ + ActionConnectionAttributesUpdate.JSON_PROPERTY_INTEGRATION, + ActionConnectionAttributesUpdate.JSON_PROPERTY_NAME +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ActionConnectionAttributesUpdate { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_INTEGRATION = "integration"; + private ActionConnectionIntegrationUpdate integration; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public ActionConnectionAttributesUpdate integration( + ActionConnectionIntegrationUpdate integration) { + this.integration = integration; + this.unparsed |= integration.unparsed; + return this; + } + + /** + * The definition of ActionConnectionIntegrationUpdate object. + * + * @return integration + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_INTEGRATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public ActionConnectionIntegrationUpdate getIntegration() { + return integration; + } + + public void setIntegration(ActionConnectionIntegrationUpdate integration) { + this.integration = integration; + } + + public ActionConnectionAttributesUpdate name(String name) { + this.name = name; + return this; + } + + /** + * Name of the connection + * + * @return name + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + /** + * 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 ActionConnectionAttributesUpdate + */ + @JsonAnySetter + public ActionConnectionAttributesUpdate 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 ActionConnectionAttributesUpdate object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ActionConnectionAttributesUpdate actionConnectionAttributesUpdate = + (ActionConnectionAttributesUpdate) o; + return Objects.equals(this.integration, actionConnectionAttributesUpdate.integration) + && Objects.equals(this.name, actionConnectionAttributesUpdate.name) + && Objects.equals( + this.additionalProperties, actionConnectionAttributesUpdate.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(integration, name, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ActionConnectionAttributesUpdate {\n"); + sb.append(" integration: ").append(toIndentedString(integration)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).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/ActionConnectionData.java b/src/main/java/com/datadog/api/client/v2/model/ActionConnectionData.java new file mode 100644 index 00000000000..d4cc0664b0e --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ActionConnectionData.java @@ -0,0 +1,199 @@ +/* + * 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; + +/** Data related to the connection. */ +@JsonPropertyOrder({ + ActionConnectionData.JSON_PROPERTY_ATTRIBUTES, + ActionConnectionData.JSON_PROPERTY_ID, + ActionConnectionData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ActionConnectionData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private ActionConnectionAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private ActionConnectionDataType type; + + public ActionConnectionData() {} + + @JsonCreator + public ActionConnectionData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + ActionConnectionAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) ActionConnectionDataType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public ActionConnectionData attributes(ActionConnectionAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * The definition of ActionConnectionAttributes object. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ActionConnectionAttributes getAttributes() { + return attributes; + } + + public void setAttributes(ActionConnectionAttributes attributes) { + this.attributes = attributes; + } + + /** + * The connection identifier + * + * @return id + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getId() { + return id; + } + + public ActionConnectionData type(ActionConnectionDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of ActionConnectionDataType object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ActionConnectionDataType getType() { + return type; + } + + public void setType(ActionConnectionDataType 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 ActionConnectionData + */ + @JsonAnySetter + public ActionConnectionData 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 ActionConnectionData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ActionConnectionData actionConnectionData = (ActionConnectionData) o; + return Objects.equals(this.attributes, actionConnectionData.attributes) + && Objects.equals(this.id, actionConnectionData.id) + && Objects.equals(this.type, actionConnectionData.type) + && Objects.equals(this.additionalProperties, actionConnectionData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ActionConnectionData {\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/ActionConnectionDataType.java b/src/main/java/com/datadog/api/client/v2/model/ActionConnectionDataType.java new file mode 100644 index 00000000000..0c340eeb281 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ActionConnectionDataType.java @@ -0,0 +1,57 @@ +/* + * 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; + +/** The definition of ActionConnectionDataType object. */ +@JsonSerialize(using = ActionConnectionDataType.ActionConnectionDataTypeSerializer.class) +public class ActionConnectionDataType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("action_connection")); + + public static final ActionConnectionDataType ACTION_CONNECTION = + new ActionConnectionDataType("action_connection"); + + ActionConnectionDataType(String value) { + super(value, allowedValues); + } + + public static class ActionConnectionDataTypeSerializer + extends StdSerializer { + public ActionConnectionDataTypeSerializer(Class t) { + super(t); + } + + public ActionConnectionDataTypeSerializer() { + this(null); + } + + @Override + public void serialize( + ActionConnectionDataType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static ActionConnectionDataType fromValue(String value) { + return new ActionConnectionDataType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ActionConnectionDataUpdate.java b/src/main/java/com/datadog/api/client/v2/model/ActionConnectionDataUpdate.java new file mode 100644 index 00000000000..cb1a04289a6 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ActionConnectionDataUpdate.java @@ -0,0 +1,182 @@ +/* + * 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; + +/** Data related to the connection update. */ +@JsonPropertyOrder({ + ActionConnectionDataUpdate.JSON_PROPERTY_ATTRIBUTES, + ActionConnectionDataUpdate.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ActionConnectionDataUpdate { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private ActionConnectionAttributesUpdate attributes; + + public static final String JSON_PROPERTY_TYPE = "type"; + private ActionConnectionDataType type; + + public ActionConnectionDataUpdate() {} + + @JsonCreator + public ActionConnectionDataUpdate( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + ActionConnectionAttributesUpdate attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) ActionConnectionDataType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public ActionConnectionDataUpdate attributes(ActionConnectionAttributesUpdate attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * The definition of ActionConnectionAttributesUpdate object. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ActionConnectionAttributesUpdate getAttributes() { + return attributes; + } + + public void setAttributes(ActionConnectionAttributesUpdate attributes) { + this.attributes = attributes; + } + + public ActionConnectionDataUpdate type(ActionConnectionDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of ActionConnectionDataType object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ActionConnectionDataType getType() { + return type; + } + + public void setType(ActionConnectionDataType 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 ActionConnectionDataUpdate + */ + @JsonAnySetter + public ActionConnectionDataUpdate 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 ActionConnectionDataUpdate object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ActionConnectionDataUpdate actionConnectionDataUpdate = (ActionConnectionDataUpdate) o; + return Objects.equals(this.attributes, actionConnectionDataUpdate.attributes) + && Objects.equals(this.type, actionConnectionDataUpdate.type) + && Objects.equals( + this.additionalProperties, actionConnectionDataUpdate.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ActionConnectionDataUpdate {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).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/ActionConnectionIntegration.java b/src/main/java/com/datadog/api/client/v2/model/ActionConnectionIntegration.java new file mode 100644 index 00000000000..c68f71d6cee --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ActionConnectionIntegration.java @@ -0,0 +1,279 @@ +/* + * 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.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize(using = ActionConnectionIntegration.ActionConnectionIntegrationDeserializer.class) +@JsonSerialize(using = ActionConnectionIntegration.ActionConnectionIntegrationSerializer.class) +public class ActionConnectionIntegration extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(ActionConnectionIntegration.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class ActionConnectionIntegrationSerializer + extends StdSerializer { + public ActionConnectionIntegrationSerializer(Class t) { + super(t); + } + + public ActionConnectionIntegrationSerializer() { + this(null); + } + + @Override + public void serialize( + ActionConnectionIntegration value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class ActionConnectionIntegrationDeserializer + extends StdDeserializer { + public ActionConnectionIntegrationDeserializer() { + this(ActionConnectionIntegration.class); + } + + public ActionConnectionIntegrationDeserializer(Class vc) { + super(vc); + } + + @Override + public ActionConnectionIntegration deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize AWSIntegration + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (AWSIntegration.class.equals(Integer.class) + || AWSIntegration.class.equals(Long.class) + || AWSIntegration.class.equals(Float.class) + || AWSIntegration.class.equals(Double.class) + || AWSIntegration.class.equals(Boolean.class) + || AWSIntegration.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((AWSIntegration.class.equals(Integer.class) + || AWSIntegration.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((AWSIntegration.class.equals(Float.class) + || AWSIntegration.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (AWSIntegration.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (AWSIntegration.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(AWSIntegration.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((AWSIntegration) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'AWSIntegration'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'AWSIntegration'", e); + } + + // deserialize HTTPIntegration + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (HTTPIntegration.class.equals(Integer.class) + || HTTPIntegration.class.equals(Long.class) + || HTTPIntegration.class.equals(Float.class) + || HTTPIntegration.class.equals(Double.class) + || HTTPIntegration.class.equals(Boolean.class) + || HTTPIntegration.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((HTTPIntegration.class.equals(Integer.class) + || HTTPIntegration.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((HTTPIntegration.class.equals(Float.class) + || HTTPIntegration.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (HTTPIntegration.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (HTTPIntegration.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(HTTPIntegration.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((HTTPIntegration) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'HTTPIntegration'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'HTTPIntegration'", e); + } + + ActionConnectionIntegration ret = new ActionConnectionIntegration(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public ActionConnectionIntegration getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException( + ctxt.getParser(), "ActionConnectionIntegration cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public ActionConnectionIntegration() { + super("oneOf", Boolean.FALSE); + } + + public ActionConnectionIntegration(AWSIntegration o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public ActionConnectionIntegration(HTTPIntegration o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("AWSIntegration", new GenericType() {}); + schemas.put("HTTPIntegration", new GenericType() {}); + JSON.registerDescendants( + ActionConnectionIntegration.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return ActionConnectionIntegration.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: AWSIntegration, HTTPIntegration + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(AWSIntegration.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(HTTPIntegration.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException("Invalid instance type. Must be AWSIntegration, HTTPIntegration"); + } + + /** + * Get the actual instance, which can be the following: AWSIntegration, HTTPIntegration + * + * @return The actual instance (AWSIntegration, HTTPIntegration) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `AWSIntegration`. If the actual instance is not `AWSIntegration`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `AWSIntegration` + * @throws ClassCastException if the instance is not `AWSIntegration` + */ + public AWSIntegration getAWSIntegration() throws ClassCastException { + return (AWSIntegration) super.getActualInstance(); + } + + /** + * Get the actual instance of `HTTPIntegration`. If the actual instance is not `HTTPIntegration`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `HTTPIntegration` + * @throws ClassCastException if the instance is not `HTTPIntegration` + */ + public HTTPIntegration getHTTPIntegration() throws ClassCastException { + return (HTTPIntegration) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ActionConnectionIntegrationUpdate.java b/src/main/java/com/datadog/api/client/v2/model/ActionConnectionIntegrationUpdate.java new file mode 100644 index 00000000000..156bcae58b1 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ActionConnectionIntegrationUpdate.java @@ -0,0 +1,286 @@ +/* + * 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.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize( + using = ActionConnectionIntegrationUpdate.ActionConnectionIntegrationUpdateDeserializer.class) +@JsonSerialize( + using = ActionConnectionIntegrationUpdate.ActionConnectionIntegrationUpdateSerializer.class) +public class ActionConnectionIntegrationUpdate extends AbstractOpenApiSchema { + private static final Logger log = + Logger.getLogger(ActionConnectionIntegrationUpdate.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class ActionConnectionIntegrationUpdateSerializer + extends StdSerializer { + public ActionConnectionIntegrationUpdateSerializer(Class t) { + super(t); + } + + public ActionConnectionIntegrationUpdateSerializer() { + this(null); + } + + @Override + public void serialize( + ActionConnectionIntegrationUpdate value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class ActionConnectionIntegrationUpdateDeserializer + extends StdDeserializer { + public ActionConnectionIntegrationUpdateDeserializer() { + this(ActionConnectionIntegrationUpdate.class); + } + + public ActionConnectionIntegrationUpdateDeserializer(Class vc) { + super(vc); + } + + @Override + public ActionConnectionIntegrationUpdate deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize AWSIntegrationUpdate + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (AWSIntegrationUpdate.class.equals(Integer.class) + || AWSIntegrationUpdate.class.equals(Long.class) + || AWSIntegrationUpdate.class.equals(Float.class) + || AWSIntegrationUpdate.class.equals(Double.class) + || AWSIntegrationUpdate.class.equals(Boolean.class) + || AWSIntegrationUpdate.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((AWSIntegrationUpdate.class.equals(Integer.class) + || AWSIntegrationUpdate.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((AWSIntegrationUpdate.class.equals(Float.class) + || AWSIntegrationUpdate.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (AWSIntegrationUpdate.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (AWSIntegrationUpdate.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(AWSIntegrationUpdate.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((AWSIntegrationUpdate) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'AWSIntegrationUpdate'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'AWSIntegrationUpdate'", e); + } + + // deserialize HTTPIntegrationUpdate + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (HTTPIntegrationUpdate.class.equals(Integer.class) + || HTTPIntegrationUpdate.class.equals(Long.class) + || HTTPIntegrationUpdate.class.equals(Float.class) + || HTTPIntegrationUpdate.class.equals(Double.class) + || HTTPIntegrationUpdate.class.equals(Boolean.class) + || HTTPIntegrationUpdate.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((HTTPIntegrationUpdate.class.equals(Integer.class) + || HTTPIntegrationUpdate.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((HTTPIntegrationUpdate.class.equals(Float.class) + || HTTPIntegrationUpdate.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (HTTPIntegrationUpdate.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (HTTPIntegrationUpdate.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(HTTPIntegrationUpdate.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((HTTPIntegrationUpdate) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'HTTPIntegrationUpdate'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'HTTPIntegrationUpdate'", e); + } + + ActionConnectionIntegrationUpdate ret = new ActionConnectionIntegrationUpdate(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public ActionConnectionIntegrationUpdate getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException( + ctxt.getParser(), "ActionConnectionIntegrationUpdate cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public ActionConnectionIntegrationUpdate() { + super("oneOf", Boolean.FALSE); + } + + public ActionConnectionIntegrationUpdate(AWSIntegrationUpdate o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public ActionConnectionIntegrationUpdate(HTTPIntegrationUpdate o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("AWSIntegrationUpdate", new GenericType() {}); + schemas.put("HTTPIntegrationUpdate", new GenericType() {}); + JSON.registerDescendants( + ActionConnectionIntegrationUpdate.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return ActionConnectionIntegrationUpdate.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: AWSIntegrationUpdate, HTTPIntegrationUpdate + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(AWSIntegrationUpdate.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(HTTPIntegrationUpdate.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException( + "Invalid instance type. Must be AWSIntegrationUpdate, HTTPIntegrationUpdate"); + } + + /** + * Get the actual instance, which can be the following: AWSIntegrationUpdate, + * HTTPIntegrationUpdate + * + * @return The actual instance (AWSIntegrationUpdate, HTTPIntegrationUpdate) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `AWSIntegrationUpdate`. If the actual instance is not + * `AWSIntegrationUpdate`, the ClassCastException will be thrown. + * + * @return The actual instance of `AWSIntegrationUpdate` + * @throws ClassCastException if the instance is not `AWSIntegrationUpdate` + */ + public AWSIntegrationUpdate getAWSIntegrationUpdate() throws ClassCastException { + return (AWSIntegrationUpdate) super.getActualInstance(); + } + + /** + * Get the actual instance of `HTTPIntegrationUpdate`. If the actual instance is not + * `HTTPIntegrationUpdate`, the ClassCastException will be thrown. + * + * @return The actual instance of `HTTPIntegrationUpdate` + * @throws ClassCastException if the instance is not `HTTPIntegrationUpdate` + */ + public HTTPIntegrationUpdate getHTTPIntegrationUpdate() throws ClassCastException { + return (HTTPIntegrationUpdate) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CreateActionConnectionRequest.java b/src/main/java/com/datadog/api/client/v2/model/CreateActionConnectionRequest.java new file mode 100644 index 00000000000..832895ae399 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CreateActionConnectionRequest.java @@ -0,0 +1,146 @@ +/* + * 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 used to create an action connection. */ +@JsonPropertyOrder({CreateActionConnectionRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CreateActionConnectionRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private ActionConnectionData data; + + public CreateActionConnectionRequest() {} + + @JsonCreator + public CreateActionConnectionRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) ActionConnectionData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public CreateActionConnectionRequest data(ActionConnectionData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Data related to the connection. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ActionConnectionData getData() { + return data; + } + + public void setData(ActionConnectionData 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 CreateActionConnectionRequest + */ + @JsonAnySetter + public CreateActionConnectionRequest 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 CreateActionConnectionRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateActionConnectionRequest createActionConnectionRequest = (CreateActionConnectionRequest) o; + return Objects.equals(this.data, createActionConnectionRequest.data) + && Objects.equals( + this.additionalProperties, createActionConnectionRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateActionConnectionRequest {\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/CreateActionConnectionResponse.java b/src/main/java/com/datadog/api/client/v2/model/CreateActionConnectionResponse.java new file mode 100644 index 00000000000..1de4b62dd3a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CreateActionConnectionResponse.java @@ -0,0 +1,138 @@ +/* + * 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; + +/** The response for a created connection */ +@JsonPropertyOrder({CreateActionConnectionResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CreateActionConnectionResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private ActionConnectionData data; + + public CreateActionConnectionResponse data(ActionConnectionData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Data related to the connection. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public ActionConnectionData getData() { + return data; + } + + public void setData(ActionConnectionData 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 CreateActionConnectionResponse + */ + @JsonAnySetter + public CreateActionConnectionResponse 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 CreateActionConnectionResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateActionConnectionResponse createActionConnectionResponse = + (CreateActionConnectionResponse) o; + return Objects.equals(this.data, createActionConnectionResponse.data) + && Objects.equals( + this.additionalProperties, createActionConnectionResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateActionConnectionResponse {\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/GetActionConnectionResponse.java b/src/main/java/com/datadog/api/client/v2/model/GetActionConnectionResponse.java new file mode 100644 index 00000000000..6b3345f2fed --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GetActionConnectionResponse.java @@ -0,0 +1,137 @@ +/* + * 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; + +/** The response for found connection */ +@JsonPropertyOrder({GetActionConnectionResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GetActionConnectionResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private ActionConnectionData data; + + public GetActionConnectionResponse data(ActionConnectionData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Data related to the connection. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public ActionConnectionData getData() { + return data; + } + + public void setData(ActionConnectionData 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 GetActionConnectionResponse + */ + @JsonAnySetter + public GetActionConnectionResponse 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 GetActionConnectionResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetActionConnectionResponse getActionConnectionResponse = (GetActionConnectionResponse) o; + return Objects.equals(this.data, getActionConnectionResponse.data) + && Objects.equals( + this.additionalProperties, getActionConnectionResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetActionConnectionResponse {\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/HTTPBody.java b/src/main/java/com/datadog/api/client/v2/model/HTTPBody.java new file mode 100644 index 00000000000..8752a1713e0 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/HTTPBody.java @@ -0,0 +1,161 @@ +/* + * 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; + +/** The definition of HTTPBody object. */ +@JsonPropertyOrder({HTTPBody.JSON_PROPERTY_CONTENT, HTTPBody.JSON_PROPERTY_CONTENT_TYPE}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class HTTPBody { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CONTENT = "content"; + private String content; + + public static final String JSON_PROPERTY_CONTENT_TYPE = "content_type"; + private String contentType; + + public HTTPBody content(String content) { + this.content = content; + return this; + } + + /** + * Serialized body content + * + * @return content + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CONTENT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public HTTPBody contentType(String contentType) { + this.contentType = contentType; + return this; + } + + /** + * Content type of the body + * + * @return contentType + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CONTENT_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getContentType() { + return contentType; + } + + public void setContentType(String contentType) { + this.contentType = contentType; + } + + /** + * 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 HTTPBody + */ + @JsonAnySetter + public HTTPBody 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 HTTPBody object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HTTPBody httpBody = (HTTPBody) o; + return Objects.equals(this.content, httpBody.content) + && Objects.equals(this.contentType, httpBody.contentType) + && Objects.equals(this.additionalProperties, httpBody.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(content, contentType, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class HTTPBody {\n"); + sb.append(" content: ").append(toIndentedString(content)).append("\n"); + sb.append(" contentType: ").append(toIndentedString(contentType)).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/HTTPCredentials.java b/src/main/java/com/datadog/api/client/v2/model/HTTPCredentials.java new file mode 100644 index 00000000000..4931c176c77 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/HTTPCredentials.java @@ -0,0 +1,208 @@ +/* + * 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.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize(using = HTTPCredentials.HTTPCredentialsDeserializer.class) +@JsonSerialize(using = HTTPCredentials.HTTPCredentialsSerializer.class) +public class HTTPCredentials extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(HTTPCredentials.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class HTTPCredentialsSerializer extends StdSerializer { + public HTTPCredentialsSerializer(Class t) { + super(t); + } + + public HTTPCredentialsSerializer() { + this(null); + } + + @Override + public void serialize(HTTPCredentials value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class HTTPCredentialsDeserializer extends StdDeserializer { + public HTTPCredentialsDeserializer() { + this(HTTPCredentials.class); + } + + public HTTPCredentialsDeserializer(Class vc) { + super(vc); + } + + @Override + public HTTPCredentials deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize HTTPTokenAuth + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (HTTPTokenAuth.class.equals(Integer.class) + || HTTPTokenAuth.class.equals(Long.class) + || HTTPTokenAuth.class.equals(Float.class) + || HTTPTokenAuth.class.equals(Double.class) + || HTTPTokenAuth.class.equals(Boolean.class) + || HTTPTokenAuth.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((HTTPTokenAuth.class.equals(Integer.class) + || HTTPTokenAuth.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((HTTPTokenAuth.class.equals(Float.class) + || HTTPTokenAuth.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (HTTPTokenAuth.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (HTTPTokenAuth.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(HTTPTokenAuth.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((HTTPTokenAuth) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'HTTPTokenAuth'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'HTTPTokenAuth'", e); + } + + HTTPCredentials ret = new HTTPCredentials(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public HTTPCredentials getNullValue(DeserializationContext ctxt) throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "HTTPCredentials cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public HTTPCredentials() { + super("oneOf", Boolean.FALSE); + } + + public HTTPCredentials(HTTPTokenAuth o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("HTTPTokenAuth", new GenericType() {}); + JSON.registerDescendants(HTTPCredentials.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return HTTPCredentials.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: HTTPTokenAuth + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(HTTPTokenAuth.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException("Invalid instance type. Must be HTTPTokenAuth"); + } + + /** + * Get the actual instance, which can be the following: HTTPTokenAuth + * + * @return The actual instance (HTTPTokenAuth) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `HTTPTokenAuth`. If the actual instance is not `HTTPTokenAuth`, the + * ClassCastException will be thrown. + * + * @return The actual instance of `HTTPTokenAuth` + * @throws ClassCastException if the instance is not `HTTPTokenAuth` + */ + public HTTPTokenAuth getHTTPTokenAuth() throws ClassCastException { + return (HTTPTokenAuth) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/HTTPCredentialsUpdate.java b/src/main/java/com/datadog/api/client/v2/model/HTTPCredentialsUpdate.java new file mode 100644 index 00000000000..d1e9d096aec --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/HTTPCredentialsUpdate.java @@ -0,0 +1,211 @@ +/* + * 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.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize(using = HTTPCredentialsUpdate.HTTPCredentialsUpdateDeserializer.class) +@JsonSerialize(using = HTTPCredentialsUpdate.HTTPCredentialsUpdateSerializer.class) +public class HTTPCredentialsUpdate extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(HTTPCredentialsUpdate.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class HTTPCredentialsUpdateSerializer extends StdSerializer { + public HTTPCredentialsUpdateSerializer(Class t) { + super(t); + } + + public HTTPCredentialsUpdateSerializer() { + this(null); + } + + @Override + public void serialize( + HTTPCredentialsUpdate value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class HTTPCredentialsUpdateDeserializer + extends StdDeserializer { + public HTTPCredentialsUpdateDeserializer() { + this(HTTPCredentialsUpdate.class); + } + + public HTTPCredentialsUpdateDeserializer(Class vc) { + super(vc); + } + + @Override + public HTTPCredentialsUpdate deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize HTTPTokenAuthUpdate + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (HTTPTokenAuthUpdate.class.equals(Integer.class) + || HTTPTokenAuthUpdate.class.equals(Long.class) + || HTTPTokenAuthUpdate.class.equals(Float.class) + || HTTPTokenAuthUpdate.class.equals(Double.class) + || HTTPTokenAuthUpdate.class.equals(Boolean.class) + || HTTPTokenAuthUpdate.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((HTTPTokenAuthUpdate.class.equals(Integer.class) + || HTTPTokenAuthUpdate.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((HTTPTokenAuthUpdate.class.equals(Float.class) + || HTTPTokenAuthUpdate.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (HTTPTokenAuthUpdate.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (HTTPTokenAuthUpdate.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(HTTPTokenAuthUpdate.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((HTTPTokenAuthUpdate) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'HTTPTokenAuthUpdate'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'HTTPTokenAuthUpdate'", e); + } + + HTTPCredentialsUpdate ret = new HTTPCredentialsUpdate(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public HTTPCredentialsUpdate getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "HTTPCredentialsUpdate cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public HTTPCredentialsUpdate() { + super("oneOf", Boolean.FALSE); + } + + public HTTPCredentialsUpdate(HTTPTokenAuthUpdate o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("HTTPTokenAuthUpdate", new GenericType() {}); + JSON.registerDescendants(HTTPCredentialsUpdate.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return HTTPCredentialsUpdate.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: HTTPTokenAuthUpdate + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(HTTPTokenAuthUpdate.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException("Invalid instance type. Must be HTTPTokenAuthUpdate"); + } + + /** + * Get the actual instance, which can be the following: HTTPTokenAuthUpdate + * + * @return The actual instance (HTTPTokenAuthUpdate) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `HTTPTokenAuthUpdate`. If the actual instance is not + * `HTTPTokenAuthUpdate`, the ClassCastException will be thrown. + * + * @return The actual instance of `HTTPTokenAuthUpdate` + * @throws ClassCastException if the instance is not `HTTPTokenAuthUpdate` + */ + public HTTPTokenAuthUpdate getHTTPTokenAuthUpdate() throws ClassCastException { + return (HTTPTokenAuthUpdate) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/HTTPHeader.java b/src/main/java/com/datadog/api/client/v2/model/HTTPHeader.java new file mode 100644 index 00000000000..75252f31047 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/HTTPHeader.java @@ -0,0 +1,170 @@ +/* + * 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; + +/** The definition of HTTPHeader object. */ +@JsonPropertyOrder({HTTPHeader.JSON_PROPERTY_NAME, HTTPHeader.JSON_PROPERTY_VALUE}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class HTTPHeader { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_VALUE = "value"; + private String value; + + public HTTPHeader() {} + + @JsonCreator + public HTTPHeader( + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name, + @JsonProperty(required = true, value = JSON_PROPERTY_VALUE) String value) { + this.name = name; + this.value = value; + } + + public HTTPHeader name(String name) { + this.name = name; + return this; + } + + /** + * The HTTPHeader name. + * + * @return name + */ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public HTTPHeader value(String value) { + this.value = value; + return this; + } + + /** + * The HTTPHeader value. + * + * @return value + */ + @JsonProperty(JSON_PROPERTY_VALUE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + /** + * 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 HTTPHeader + */ + @JsonAnySetter + public HTTPHeader 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 HTTPHeader object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HTTPHeader httpHeader = (HTTPHeader) o; + return Objects.equals(this.name, httpHeader.name) + && Objects.equals(this.value, httpHeader.value) + && Objects.equals(this.additionalProperties, httpHeader.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(name, value, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class HTTPHeader {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).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/HTTPHeaderUpdate.java b/src/main/java/com/datadog/api/client/v2/model/HTTPHeaderUpdate.java new file mode 100644 index 00000000000..02e328d3203 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/HTTPHeaderUpdate.java @@ -0,0 +1,198 @@ +/* + * 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; + +/** The definition of HTTPHeaderUpdate object. */ +@JsonPropertyOrder({ + HTTPHeaderUpdate.JSON_PROPERTY_DELETED, + HTTPHeaderUpdate.JSON_PROPERTY_NAME, + HTTPHeaderUpdate.JSON_PROPERTY_VALUE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class HTTPHeaderUpdate { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DELETED = "deleted"; + private Boolean deleted; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_VALUE = "value"; + private String value; + + public HTTPHeaderUpdate() {} + + @JsonCreator + public HTTPHeaderUpdate(@JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name) { + this.name = name; + } + + public HTTPHeaderUpdate deleted(Boolean deleted) { + this.deleted = deleted; + return this; + } + + /** + * Should the header be deleted. + * + * @return deleted + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DELETED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getDeleted() { + return deleted; + } + + public void setDeleted(Boolean deleted) { + this.deleted = deleted; + } + + public HTTPHeaderUpdate name(String name) { + this.name = name; + return this; + } + + /** + * The HTTPHeaderUpdate name. + * + * @return name + */ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public HTTPHeaderUpdate value(String value) { + this.value = value; + return this; + } + + /** + * The HTTPHeaderUpdate value. + * + * @return value + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_VALUE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + /** + * 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 HTTPHeaderUpdate + */ + @JsonAnySetter + public HTTPHeaderUpdate 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 HTTPHeaderUpdate object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HTTPHeaderUpdate httpHeaderUpdate = (HTTPHeaderUpdate) o; + return Objects.equals(this.deleted, httpHeaderUpdate.deleted) + && Objects.equals(this.name, httpHeaderUpdate.name) + && Objects.equals(this.value, httpHeaderUpdate.value) + && Objects.equals(this.additionalProperties, httpHeaderUpdate.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(deleted, name, value, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class HTTPHeaderUpdate {\n"); + sb.append(" deleted: ").append(toIndentedString(deleted)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).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/HTTPIntegration.java b/src/main/java/com/datadog/api/client/v2/model/HTTPIntegration.java new file mode 100644 index 00000000000..a3a025047c1 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/HTTPIntegration.java @@ -0,0 +1,208 @@ +/* + * 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; + +/** The definition of HTTPIntegration object. */ +@JsonPropertyOrder({ + HTTPIntegration.JSON_PROPERTY_BASE_URL, + HTTPIntegration.JSON_PROPERTY_CREDENTIALS, + HTTPIntegration.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class HTTPIntegration { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_BASE_URL = "base_url"; + private String baseUrl; + + public static final String JSON_PROPERTY_CREDENTIALS = "credentials"; + private HTTPCredentials credentials; + + public static final String JSON_PROPERTY_TYPE = "type"; + private HTTPIntegrationType type; + + public HTTPIntegration() {} + + @JsonCreator + public HTTPIntegration( + @JsonProperty(required = true, value = JSON_PROPERTY_BASE_URL) String baseUrl, + @JsonProperty(required = true, value = JSON_PROPERTY_CREDENTIALS) HTTPCredentials credentials, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) HTTPIntegrationType type) { + this.baseUrl = baseUrl; + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public HTTPIntegration baseUrl(String baseUrl) { + this.baseUrl = baseUrl; + return this; + } + + /** + * Base HTTP url for the integration + * + * @return baseUrl + */ + @JsonProperty(JSON_PROPERTY_BASE_URL) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getBaseUrl() { + return baseUrl; + } + + public void setBaseUrl(String baseUrl) { + this.baseUrl = baseUrl; + } + + public HTTPIntegration credentials(HTTPCredentials credentials) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + return this; + } + + /** + * The definition of HTTPCredentials object. + * + * @return credentials + */ + @JsonProperty(JSON_PROPERTY_CREDENTIALS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public HTTPCredentials getCredentials() { + return credentials; + } + + public void setCredentials(HTTPCredentials credentials) { + this.credentials = credentials; + } + + public HTTPIntegration type(HTTPIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of HTTPIntegrationType object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public HTTPIntegrationType getType() { + return type; + } + + public void setType(HTTPIntegrationType 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 HTTPIntegration + */ + @JsonAnySetter + public HTTPIntegration 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 HTTPIntegration object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HTTPIntegration httpIntegration = (HTTPIntegration) o; + return Objects.equals(this.baseUrl, httpIntegration.baseUrl) + && Objects.equals(this.credentials, httpIntegration.credentials) + && Objects.equals(this.type, httpIntegration.type) + && Objects.equals(this.additionalProperties, httpIntegration.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(baseUrl, credentials, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class HTTPIntegration {\n"); + sb.append(" baseUrl: ").append(toIndentedString(baseUrl)).append("\n"); + sb.append(" credentials: ").append(toIndentedString(credentials)).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/HTTPIntegrationType.java b/src/main/java/com/datadog/api/client/v2/model/HTTPIntegrationType.java new file mode 100644 index 00000000000..f9902140c14 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/HTTPIntegrationType.java @@ -0,0 +1,54 @@ +/* + * 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; + +/** The definition of HTTPIntegrationType object. */ +@JsonSerialize(using = HTTPIntegrationType.HTTPIntegrationTypeSerializer.class) +public class HTTPIntegrationType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("HTTP")); + + public static final HTTPIntegrationType HTTP = new HTTPIntegrationType("HTTP"); + + HTTPIntegrationType(String value) { + super(value, allowedValues); + } + + public static class HTTPIntegrationTypeSerializer extends StdSerializer { + public HTTPIntegrationTypeSerializer(Class t) { + super(t); + } + + public HTTPIntegrationTypeSerializer() { + this(null); + } + + @Override + public void serialize( + HTTPIntegrationType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static HTTPIntegrationType fromValue(String value) { + return new HTTPIntegrationType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/HTTPIntegrationUpdate.java b/src/main/java/com/datadog/api/client/v2/model/HTTPIntegrationUpdate.java new file mode 100644 index 00000000000..90af6a9fe01 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/HTTPIntegrationUpdate.java @@ -0,0 +1,205 @@ +/* + * 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; + +/** The definition of HTTPIntegrationUpdate object. */ +@JsonPropertyOrder({ + HTTPIntegrationUpdate.JSON_PROPERTY_BASE_URL, + HTTPIntegrationUpdate.JSON_PROPERTY_CREDENTIALS, + HTTPIntegrationUpdate.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class HTTPIntegrationUpdate { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_BASE_URL = "base_url"; + private String baseUrl; + + public static final String JSON_PROPERTY_CREDENTIALS = "credentials"; + private HTTPCredentialsUpdate credentials; + + public static final String JSON_PROPERTY_TYPE = "type"; + private HTTPIntegrationType type; + + public HTTPIntegrationUpdate() {} + + @JsonCreator + public HTTPIntegrationUpdate( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) HTTPIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public HTTPIntegrationUpdate baseUrl(String baseUrl) { + this.baseUrl = baseUrl; + return this; + } + + /** + * Base HTTP url for the integration + * + * @return baseUrl + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_BASE_URL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getBaseUrl() { + return baseUrl; + } + + public void setBaseUrl(String baseUrl) { + this.baseUrl = baseUrl; + } + + public HTTPIntegrationUpdate credentials(HTTPCredentialsUpdate credentials) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + return this; + } + + /** + * The definition of HTTPCredentialsUpdate object. + * + * @return credentials + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CREDENTIALS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public HTTPCredentialsUpdate getCredentials() { + return credentials; + } + + public void setCredentials(HTTPCredentialsUpdate credentials) { + this.credentials = credentials; + } + + public HTTPIntegrationUpdate type(HTTPIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of HTTPIntegrationType object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public HTTPIntegrationType getType() { + return type; + } + + public void setType(HTTPIntegrationType 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 HTTPIntegrationUpdate + */ + @JsonAnySetter + public HTTPIntegrationUpdate 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 HTTPIntegrationUpdate object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HTTPIntegrationUpdate httpIntegrationUpdate = (HTTPIntegrationUpdate) o; + return Objects.equals(this.baseUrl, httpIntegrationUpdate.baseUrl) + && Objects.equals(this.credentials, httpIntegrationUpdate.credentials) + && Objects.equals(this.type, httpIntegrationUpdate.type) + && Objects.equals(this.additionalProperties, httpIntegrationUpdate.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(baseUrl, credentials, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class HTTPIntegrationUpdate {\n"); + sb.append(" baseUrl: ").append(toIndentedString(baseUrl)).append("\n"); + sb.append(" credentials: ").append(toIndentedString(credentials)).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/HTTPToken.java b/src/main/java/com/datadog/api/client/v2/model/HTTPToken.java new file mode 100644 index 00000000000..2bc103efce1 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/HTTPToken.java @@ -0,0 +1,206 @@ +/* + * 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; + +/** The definition of HTTPToken object. */ +@JsonPropertyOrder({ + HTTPToken.JSON_PROPERTY_NAME, + HTTPToken.JSON_PROPERTY_TYPE, + HTTPToken.JSON_PROPERTY_VALUE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class HTTPToken { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_TYPE = "type"; + private TokenType type; + + public static final String JSON_PROPERTY_VALUE = "value"; + private String value; + + public HTTPToken() {} + + @JsonCreator + public HTTPToken( + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) TokenType type, + @JsonProperty(required = true, value = JSON_PROPERTY_VALUE) String value) { + this.name = name; + this.type = type; + this.unparsed |= !type.isValid(); + this.value = value; + } + + public HTTPToken name(String name) { + this.name = name; + return this; + } + + /** + * The HTTPToken name. + * + * @return name + */ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public HTTPToken type(TokenType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of TokenType object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TokenType getType() { + return type; + } + + public void setType(TokenType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + public HTTPToken value(String value) { + this.value = value; + return this; + } + + /** + * The HTTPToken value. + * + * @return value + */ + @JsonProperty(JSON_PROPERTY_VALUE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + /** + * 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 HTTPToken + */ + @JsonAnySetter + public HTTPToken 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 HTTPToken object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HTTPToken httpToken = (HTTPToken) o; + return Objects.equals(this.name, httpToken.name) + && Objects.equals(this.type, httpToken.type) + && Objects.equals(this.value, httpToken.value) + && Objects.equals(this.additionalProperties, httpToken.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(name, type, value, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class HTTPToken {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).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/HTTPTokenAuth.java b/src/main/java/com/datadog/api/client/v2/model/HTTPTokenAuth.java new file mode 100644 index 00000000000..9ec565fa81d --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/HTTPTokenAuth.java @@ -0,0 +1,297 @@ +/* + * 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.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** The definition of HTTPTokenAuth object. */ +@JsonPropertyOrder({ + HTTPTokenAuth.JSON_PROPERTY_BODY, + HTTPTokenAuth.JSON_PROPERTY_HEADERS, + HTTPTokenAuth.JSON_PROPERTY_TOKENS, + HTTPTokenAuth.JSON_PROPERTY_TYPE, + HTTPTokenAuth.JSON_PROPERTY_URL_PARAMETERS +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class HTTPTokenAuth { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_BODY = "body"; + private HTTPBody body; + + public static final String JSON_PROPERTY_HEADERS = "headers"; + private List headers = null; + + public static final String JSON_PROPERTY_TOKENS = "tokens"; + private List tokens = null; + + public static final String JSON_PROPERTY_TYPE = "type"; + private HTTPTokenAuthType type; + + public static final String JSON_PROPERTY_URL_PARAMETERS = "url_parameters"; + private List urlParameters = null; + + public HTTPTokenAuth() {} + + @JsonCreator + public HTTPTokenAuth( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) HTTPTokenAuthType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public HTTPTokenAuth body(HTTPBody body) { + this.body = body; + this.unparsed |= body.unparsed; + return this; + } + + /** + * The definition of HTTPBody object. + * + * @return body + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_BODY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public HTTPBody getBody() { + return body; + } + + public void setBody(HTTPBody body) { + this.body = body; + } + + public HTTPTokenAuth headers(List headers) { + this.headers = headers; + for (HTTPHeader item : headers) { + this.unparsed |= item.unparsed; + } + return this; + } + + public HTTPTokenAuth addHeadersItem(HTTPHeader headersItem) { + if (this.headers == null) { + this.headers = new ArrayList<>(); + } + this.headers.add(headersItem); + this.unparsed |= headersItem.unparsed; + return this; + } + + /** + * The HTTPTokenAuth headers. + * + * @return headers + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_HEADERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getHeaders() { + return headers; + } + + public void setHeaders(List headers) { + this.headers = headers; + } + + public HTTPTokenAuth tokens(List tokens) { + this.tokens = tokens; + for (HTTPToken item : tokens) { + this.unparsed |= item.unparsed; + } + return this; + } + + public HTTPTokenAuth addTokensItem(HTTPToken tokensItem) { + if (this.tokens == null) { + this.tokens = new ArrayList<>(); + } + this.tokens.add(tokensItem); + this.unparsed |= tokensItem.unparsed; + return this; + } + + /** + * The HTTPTokenAuth tokens. + * + * @return tokens + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TOKENS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getTokens() { + return tokens; + } + + public void setTokens(List tokens) { + this.tokens = tokens; + } + + public HTTPTokenAuth type(HTTPTokenAuthType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of HTTPTokenAuthType object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public HTTPTokenAuthType getType() { + return type; + } + + public void setType(HTTPTokenAuthType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + public HTTPTokenAuth urlParameters(List urlParameters) { + this.urlParameters = urlParameters; + for (UrlParam item : urlParameters) { + this.unparsed |= item.unparsed; + } + return this; + } + + public HTTPTokenAuth addUrlParametersItem(UrlParam urlParametersItem) { + if (this.urlParameters == null) { + this.urlParameters = new ArrayList<>(); + } + this.urlParameters.add(urlParametersItem); + this.unparsed |= urlParametersItem.unparsed; + return this; + } + + /** + * The HTTPTokenAuth url_parameters. + * + * @return urlParameters + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_URL_PARAMETERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getUrlParameters() { + return urlParameters; + } + + public void setUrlParameters(List urlParameters) { + this.urlParameters = urlParameters; + } + + /** + * 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 HTTPTokenAuth + */ + @JsonAnySetter + public HTTPTokenAuth 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 HTTPTokenAuth object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HTTPTokenAuth httpTokenAuth = (HTTPTokenAuth) o; + return Objects.equals(this.body, httpTokenAuth.body) + && Objects.equals(this.headers, httpTokenAuth.headers) + && Objects.equals(this.tokens, httpTokenAuth.tokens) + && Objects.equals(this.type, httpTokenAuth.type) + && Objects.equals(this.urlParameters, httpTokenAuth.urlParameters) + && Objects.equals(this.additionalProperties, httpTokenAuth.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(body, headers, tokens, type, urlParameters, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class HTTPTokenAuth {\n"); + sb.append(" body: ").append(toIndentedString(body)).append("\n"); + sb.append(" headers: ").append(toIndentedString(headers)).append("\n"); + sb.append(" tokens: ").append(toIndentedString(tokens)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" urlParameters: ").append(toIndentedString(urlParameters)).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/HTTPTokenAuthType.java b/src/main/java/com/datadog/api/client/v2/model/HTTPTokenAuthType.java new file mode 100644 index 00000000000..6ed101ae047 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/HTTPTokenAuthType.java @@ -0,0 +1,54 @@ +/* + * 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; + +/** The definition of HTTPTokenAuthType object. */ +@JsonSerialize(using = HTTPTokenAuthType.HTTPTokenAuthTypeSerializer.class) +public class HTTPTokenAuthType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("HTTPTokenAuth")); + + public static final HTTPTokenAuthType HTTPTOKENAUTH = new HTTPTokenAuthType("HTTPTokenAuth"); + + HTTPTokenAuthType(String value) { + super(value, allowedValues); + } + + public static class HTTPTokenAuthTypeSerializer extends StdSerializer { + public HTTPTokenAuthTypeSerializer(Class t) { + super(t); + } + + public HTTPTokenAuthTypeSerializer() { + this(null); + } + + @Override + public void serialize(HTTPTokenAuthType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static HTTPTokenAuthType fromValue(String value) { + return new HTTPTokenAuthType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/HTTPTokenAuthUpdate.java b/src/main/java/com/datadog/api/client/v2/model/HTTPTokenAuthUpdate.java new file mode 100644 index 00000000000..0fb050dc19c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/HTTPTokenAuthUpdate.java @@ -0,0 +1,297 @@ +/* + * 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.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** The definition of HTTPTokenAuthUpdate object. */ +@JsonPropertyOrder({ + HTTPTokenAuthUpdate.JSON_PROPERTY_BODY, + HTTPTokenAuthUpdate.JSON_PROPERTY_HEADERS, + HTTPTokenAuthUpdate.JSON_PROPERTY_TOKENS, + HTTPTokenAuthUpdate.JSON_PROPERTY_TYPE, + HTTPTokenAuthUpdate.JSON_PROPERTY_URL_PARAMETERS +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class HTTPTokenAuthUpdate { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_BODY = "body"; + private HTTPBody body; + + public static final String JSON_PROPERTY_HEADERS = "headers"; + private List headers = null; + + public static final String JSON_PROPERTY_TOKENS = "tokens"; + private List tokens = null; + + public static final String JSON_PROPERTY_TYPE = "type"; + private HTTPTokenAuthType type; + + public static final String JSON_PROPERTY_URL_PARAMETERS = "url_parameters"; + private List urlParameters = null; + + public HTTPTokenAuthUpdate() {} + + @JsonCreator + public HTTPTokenAuthUpdate( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) HTTPTokenAuthType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public HTTPTokenAuthUpdate body(HTTPBody body) { + this.body = body; + this.unparsed |= body.unparsed; + return this; + } + + /** + * The definition of HTTPBody object. + * + * @return body + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_BODY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public HTTPBody getBody() { + return body; + } + + public void setBody(HTTPBody body) { + this.body = body; + } + + public HTTPTokenAuthUpdate headers(List headers) { + this.headers = headers; + for (HTTPHeaderUpdate item : headers) { + this.unparsed |= item.unparsed; + } + return this; + } + + public HTTPTokenAuthUpdate addHeadersItem(HTTPHeaderUpdate headersItem) { + if (this.headers == null) { + this.headers = new ArrayList<>(); + } + this.headers.add(headersItem); + this.unparsed |= headersItem.unparsed; + return this; + } + + /** + * The HTTPTokenAuthUpdate headers. + * + * @return headers + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_HEADERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getHeaders() { + return headers; + } + + public void setHeaders(List headers) { + this.headers = headers; + } + + public HTTPTokenAuthUpdate tokens(List tokens) { + this.tokens = tokens; + for (HTTPTokenUpdate item : tokens) { + this.unparsed |= item.unparsed; + } + return this; + } + + public HTTPTokenAuthUpdate addTokensItem(HTTPTokenUpdate tokensItem) { + if (this.tokens == null) { + this.tokens = new ArrayList<>(); + } + this.tokens.add(tokensItem); + this.unparsed |= tokensItem.unparsed; + return this; + } + + /** + * The HTTPTokenAuthUpdate tokens. + * + * @return tokens + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TOKENS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getTokens() { + return tokens; + } + + public void setTokens(List tokens) { + this.tokens = tokens; + } + + public HTTPTokenAuthUpdate type(HTTPTokenAuthType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of HTTPTokenAuthType object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public HTTPTokenAuthType getType() { + return type; + } + + public void setType(HTTPTokenAuthType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + public HTTPTokenAuthUpdate urlParameters(List urlParameters) { + this.urlParameters = urlParameters; + for (UrlParamUpdate item : urlParameters) { + this.unparsed |= item.unparsed; + } + return this; + } + + public HTTPTokenAuthUpdate addUrlParametersItem(UrlParamUpdate urlParametersItem) { + if (this.urlParameters == null) { + this.urlParameters = new ArrayList<>(); + } + this.urlParameters.add(urlParametersItem); + this.unparsed |= urlParametersItem.unparsed; + return this; + } + + /** + * The HTTPTokenAuthUpdate url_parameters. + * + * @return urlParameters + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_URL_PARAMETERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getUrlParameters() { + return urlParameters; + } + + public void setUrlParameters(List urlParameters) { + this.urlParameters = urlParameters; + } + + /** + * 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 HTTPTokenAuthUpdate + */ + @JsonAnySetter + public HTTPTokenAuthUpdate 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 HTTPTokenAuthUpdate object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HTTPTokenAuthUpdate httpTokenAuthUpdate = (HTTPTokenAuthUpdate) o; + return Objects.equals(this.body, httpTokenAuthUpdate.body) + && Objects.equals(this.headers, httpTokenAuthUpdate.headers) + && Objects.equals(this.tokens, httpTokenAuthUpdate.tokens) + && Objects.equals(this.type, httpTokenAuthUpdate.type) + && Objects.equals(this.urlParameters, httpTokenAuthUpdate.urlParameters) + && Objects.equals(this.additionalProperties, httpTokenAuthUpdate.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(body, headers, tokens, type, urlParameters, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class HTTPTokenAuthUpdate {\n"); + sb.append(" body: ").append(toIndentedString(body)).append("\n"); + sb.append(" headers: ").append(toIndentedString(headers)).append("\n"); + sb.append(" tokens: ").append(toIndentedString(tokens)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" urlParameters: ").append(toIndentedString(urlParameters)).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/HTTPTokenUpdate.java b/src/main/java/com/datadog/api/client/v2/model/HTTPTokenUpdate.java new file mode 100644 index 00000000000..3e682d44aa8 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/HTTPTokenUpdate.java @@ -0,0 +1,233 @@ +/* + * 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; + +/** The definition of HTTPTokenUpdate object. */ +@JsonPropertyOrder({ + HTTPTokenUpdate.JSON_PROPERTY_DELETED, + HTTPTokenUpdate.JSON_PROPERTY_NAME, + HTTPTokenUpdate.JSON_PROPERTY_TYPE, + HTTPTokenUpdate.JSON_PROPERTY_VALUE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class HTTPTokenUpdate { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DELETED = "deleted"; + private Boolean deleted; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_TYPE = "type"; + private TokenType type; + + public static final String JSON_PROPERTY_VALUE = "value"; + private String value; + + public HTTPTokenUpdate() {} + + @JsonCreator + public HTTPTokenUpdate( + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) TokenType type, + @JsonProperty(required = true, value = JSON_PROPERTY_VALUE) String value) { + this.name = name; + this.type = type; + this.unparsed |= !type.isValid(); + this.value = value; + } + + public HTTPTokenUpdate deleted(Boolean deleted) { + this.deleted = deleted; + return this; + } + + /** + * Should the header be deleted. + * + * @return deleted + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DELETED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getDeleted() { + return deleted; + } + + public void setDeleted(Boolean deleted) { + this.deleted = deleted; + } + + public HTTPTokenUpdate name(String name) { + this.name = name; + return this; + } + + /** + * The HTTPToken name. + * + * @return name + */ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public HTTPTokenUpdate type(TokenType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of TokenType object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TokenType getType() { + return type; + } + + public void setType(TokenType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + public HTTPTokenUpdate value(String value) { + this.value = value; + return this; + } + + /** + * The HTTPToken value. + * + * @return value + */ + @JsonProperty(JSON_PROPERTY_VALUE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + /** + * 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 HTTPTokenUpdate + */ + @JsonAnySetter + public HTTPTokenUpdate 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 HTTPTokenUpdate object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HTTPTokenUpdate httpTokenUpdate = (HTTPTokenUpdate) o; + return Objects.equals(this.deleted, httpTokenUpdate.deleted) + && Objects.equals(this.name, httpTokenUpdate.name) + && Objects.equals(this.type, httpTokenUpdate.type) + && Objects.equals(this.value, httpTokenUpdate.value) + && Objects.equals(this.additionalProperties, httpTokenUpdate.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(deleted, name, type, value, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class HTTPTokenUpdate {\n"); + sb.append(" deleted: ").append(toIndentedString(deleted)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).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/TokenType.java b/src/main/java/com/datadog/api/client/v2/model/TokenType.java new file mode 100644 index 00000000000..1a42eb22f9d --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TokenType.java @@ -0,0 +1,53 @@ +/* + * 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; + +/** The definition of TokenType object. */ +@JsonSerialize(using = TokenType.TokenTypeSerializer.class) +public class TokenType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("SECRET")); + + public static final TokenType SECRET = new TokenType("SECRET"); + + TokenType(String value) { + super(value, allowedValues); + } + + public static class TokenTypeSerializer extends StdSerializer { + public TokenTypeSerializer(Class t) { + super(t); + } + + public TokenTypeSerializer() { + this(null); + } + + @Override + public void serialize(TokenType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static TokenType fromValue(String value) { + return new TokenType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/UpdateActionConnectionRequest.java b/src/main/java/com/datadog/api/client/v2/model/UpdateActionConnectionRequest.java new file mode 100644 index 00000000000..7a4c6b2ff89 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/UpdateActionConnectionRequest.java @@ -0,0 +1,146 @@ +/* + * 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 used to update an action connection. */ +@JsonPropertyOrder({UpdateActionConnectionRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class UpdateActionConnectionRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private ActionConnectionDataUpdate data; + + public UpdateActionConnectionRequest() {} + + @JsonCreator + public UpdateActionConnectionRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) ActionConnectionDataUpdate data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public UpdateActionConnectionRequest data(ActionConnectionDataUpdate data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Data related to the connection update. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ActionConnectionDataUpdate getData() { + return data; + } + + public void setData(ActionConnectionDataUpdate 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 UpdateActionConnectionRequest + */ + @JsonAnySetter + public UpdateActionConnectionRequest 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 UpdateActionConnectionRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateActionConnectionRequest updateActionConnectionRequest = (UpdateActionConnectionRequest) o; + return Objects.equals(this.data, updateActionConnectionRequest.data) + && Objects.equals( + this.additionalProperties, updateActionConnectionRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateActionConnectionRequest {\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/UpdateActionConnectionResponse.java b/src/main/java/com/datadog/api/client/v2/model/UpdateActionConnectionResponse.java new file mode 100644 index 00000000000..b19f2e7596a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/UpdateActionConnectionResponse.java @@ -0,0 +1,138 @@ +/* + * 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; + +/** The response for an updated connection. */ +@JsonPropertyOrder({UpdateActionConnectionResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class UpdateActionConnectionResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private ActionConnectionData data; + + public UpdateActionConnectionResponse data(ActionConnectionData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Data related to the connection. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public ActionConnectionData getData() { + return data; + } + + public void setData(ActionConnectionData 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 UpdateActionConnectionResponse + */ + @JsonAnySetter + public UpdateActionConnectionResponse 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 UpdateActionConnectionResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateActionConnectionResponse updateActionConnectionResponse = + (UpdateActionConnectionResponse) o; + return Objects.equals(this.data, updateActionConnectionResponse.data) + && Objects.equals( + this.additionalProperties, updateActionConnectionResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateActionConnectionResponse {\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/UrlParam.java b/src/main/java/com/datadog/api/client/v2/model/UrlParam.java new file mode 100644 index 00000000000..b9d7c4733ba --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/UrlParam.java @@ -0,0 +1,170 @@ +/* + * 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; + +/** The definition of UrlParam object. */ +@JsonPropertyOrder({UrlParam.JSON_PROPERTY_NAME, UrlParam.JSON_PROPERTY_VALUE}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class UrlParam { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_VALUE = "value"; + private String value; + + public UrlParam() {} + + @JsonCreator + public UrlParam( + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name, + @JsonProperty(required = true, value = JSON_PROPERTY_VALUE) String value) { + this.name = name; + this.value = value; + } + + public UrlParam name(String name) { + this.name = name; + return this; + } + + /** + * Name for tokens. + * + * @return name + */ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public UrlParam value(String value) { + this.value = value; + return this; + } + + /** + * The UrlParam value. + * + * @return value + */ + @JsonProperty(JSON_PROPERTY_VALUE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + /** + * 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 UrlParam + */ + @JsonAnySetter + public UrlParam 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 UrlParam object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UrlParam urlParam = (UrlParam) o; + return Objects.equals(this.name, urlParam.name) + && Objects.equals(this.value, urlParam.value) + && Objects.equals(this.additionalProperties, urlParam.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(name, value, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UrlParam {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).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/UrlParamUpdate.java b/src/main/java/com/datadog/api/client/v2/model/UrlParamUpdate.java new file mode 100644 index 00000000000..9ff3bf2a037 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/UrlParamUpdate.java @@ -0,0 +1,198 @@ +/* + * 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; + +/** The definition of UrlParamUpdate object. */ +@JsonPropertyOrder({ + UrlParamUpdate.JSON_PROPERTY_DELETED, + UrlParamUpdate.JSON_PROPERTY_NAME, + UrlParamUpdate.JSON_PROPERTY_VALUE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class UrlParamUpdate { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DELETED = "deleted"; + private Boolean deleted; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_VALUE = "value"; + private String value; + + public UrlParamUpdate() {} + + @JsonCreator + public UrlParamUpdate(@JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name) { + this.name = name; + } + + public UrlParamUpdate deleted(Boolean deleted) { + this.deleted = deleted; + return this; + } + + /** + * Should the header be deleted. + * + * @return deleted + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DELETED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getDeleted() { + return deleted; + } + + public void setDeleted(Boolean deleted) { + this.deleted = deleted; + } + + public UrlParamUpdate name(String name) { + this.name = name; + return this; + } + + /** + * Name for tokens. + * + * @return name + */ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public UrlParamUpdate value(String value) { + this.value = value; + return this; + } + + /** + * The UrlParamUpdate value. + * + * @return value + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_VALUE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + /** + * 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 UrlParamUpdate + */ + @JsonAnySetter + public UrlParamUpdate 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 UrlParamUpdate object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UrlParamUpdate urlParamUpdate = (UrlParamUpdate) o; + return Objects.equals(this.deleted, urlParamUpdate.deleted) + && Objects.equals(this.name, urlParamUpdate.name) + && Objects.equals(this.value, urlParamUpdate.value) + && Objects.equals(this.additionalProperties, urlParamUpdate.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(deleted, name, value, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UrlParamUpdate {\n"); + sb.append(" deleted: ").append(toIndentedString(deleted)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).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/test/resources/cassettes/features/v2/Create_a_new_Action_Connection_returns_Bad_Request_response.freeze b/src/test/resources/cassettes/features/v2/Create_a_new_Action_Connection_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..c04237b75ee --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_a_new_Action_Connection_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2025-01-03T17:54:28.593Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Create_a_new_Action_Connection_returns_Bad_Request_response.json b/src/test/resources/cassettes/features/v2/Create_a_new_Action_Connection_returns_Bad_Request_response.json new file mode 100644 index 00000000000..5f33560c8e5 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_a_new_Action_Connection_returns_Bad_Request_response.json @@ -0,0 +1,32 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"integration\":{\"credentials\":{\"account_id\":\"1\",\"role\":\"MyRoleUpdated\",\"type\":\"AWSAssumeRole\"},\"type\":\"AWS\"},\"name\":\"Cassette Connection\"},\"type\":\"action_connection\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/actions/connections", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[{\"title\":\"Generic Error\",\"detail\":\"error creating connection: rpc error: code = InvalidArgument desc = multiple errors: 1 error occurred:\\n\\t* [error_code=8]: invalid CreateCustomConnectionRequest.Data: embedded message failed validation | caused by: invalid CustomConnectionData.Aws: embedded message failed validation | caused by: invalid CustomConnectionData_AwsAuthData.AssumeRole: embedded message failed validation | caused by: invalid CustomConnectionData_AwsAuthData_AssumeRole.AccountId: value does not match regex pattern \\\"^\\\\\\\\d{12}$\\\"\\n\\n\"}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 400, + "reasonPhrase": "Bad Request" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "156f17e1-fd06-950e-6f22-ae3663d66d0b" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Create_a_new_Action_Connection_returns_Successfully_created_Action_Connection_response.freeze b/src/test/resources/cassettes/features/v2/Create_a_new_Action_Connection_returns_Successfully_created_Action_Connection_response.freeze new file mode 100644 index 00000000000..17bd6109de5 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_a_new_Action_Connection_returns_Successfully_created_Action_Connection_response.freeze @@ -0,0 +1 @@ +2025-01-03T17:54:28.861Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Create_a_new_Action_Connection_returns_Successfully_created_Action_Connection_response.json b/src/test/resources/cassettes/features/v2/Create_a_new_Action_Connection_returns_Successfully_created_Action_Connection_response.json new file mode 100644 index 00000000000..0e83f30c8a5 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_a_new_Action_Connection_returns_Successfully_created_Action_Connection_response.json @@ -0,0 +1,53 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"integration\":{\"credentials\":{\"account_id\":\"123456789123\",\"role\":\"MyRoleUpdated\",\"type\":\"AWSAssumeRole\"},\"type\":\"AWS\"},\"name\":\"Cassette Connection DELETE_ME\"},\"type\":\"action_connection\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/actions/connections", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"f3476932-f278-42a4-b47d-64a310f39d00\",\"type\":\"action_connection\",\"attributes\":{\"integration\":{\"credentials\":{\"account_id\":\"123456789123\",\"role\":\"MyRoleUpdated\",\"external_id\":\"636e6e83f06f4cd4b90b18b39c3f0714\",\"principal_id\":\"464622532012\",\"type\":\"AWSAssumeRole\"},\"type\":\"AWS\"},\"name\":\"Cassette Connection DELETE_ME\"}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "143d1c35-6301-e638-823f-d266922b4a2c" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/actions/connections/f3476932-f278-42a4-b47d-64a310f39d00", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "4f5a422f-573c-c297-be55-476b8e134a98" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Delete_an_existing_Action_Connection_returns_Not_Found_response.freeze b/src/test/resources/cassettes/features/v2/Delete_an_existing_Action_Connection_returns_Not_Found_response.freeze new file mode 100644 index 00000000000..51f4fadf418 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Delete_an_existing_Action_Connection_returns_Not_Found_response.freeze @@ -0,0 +1 @@ +2025-01-03T17:54:29.701Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Delete_an_existing_Action_Connection_returns_Not_Found_response.json b/src/test/resources/cassettes/features/v2/Delete_an_existing_Action_Connection_returns_Not_Found_response.json new file mode 100644 index 00000000000..840a8668225 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Delete_an_existing_Action_Connection_returns_Not_Found_response.json @@ -0,0 +1,28 @@ +[ + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/actions/connections/aaa11111-aa11-aa11-aaaa-aaaaaa111111", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[{\"title\":\"Generic Error\",\"detail\":\"error deleting connection: rpc error: code = NotFound desc = connection not found\"}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 404, + "reasonPhrase": "Not Found" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "73a4792d-4a7d-c5b0-e6c5-76a0bf44ef20" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_an_existing_Action_Connection_returns_Bad_Request_response.freeze b/src/test/resources/cassettes/features/v2/Get_an_existing_Action_Connection_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..27ac1ad0fab --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_an_existing_Action_Connection_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2025-01-03T17:54:29.931Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_an_existing_Action_Connection_returns_Bad_Request_response.json b/src/test/resources/cassettes/features/v2/Get_an_existing_Action_Connection_returns_Bad_Request_response.json new file mode 100644 index 00000000000..f4abab1c1a8 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_an_existing_Action_Connection_returns_Bad_Request_response.json @@ -0,0 +1,28 @@ +[ + { + "httpRequest": { + "headers": {}, + "method": "GET", + "path": "/api/v2/actions/connections/bad%20format", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[{\"title\":\"Generic Error\",\"detail\":\"error connectionId not a valid UUID\"}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 400, + "reasonPhrase": "Bad Request" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "231fe517-eb52-4582-1704-a27d17268ca8" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_an_existing_Action_Connection_returns_Not_Found_response.freeze b/src/test/resources/cassettes/features/v2/Get_an_existing_Action_Connection_returns_Not_Found_response.freeze new file mode 100644 index 00000000000..92aba415e54 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_an_existing_Action_Connection_returns_Not_Found_response.freeze @@ -0,0 +1 @@ +2025-01-03T17:54:30.093Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_an_existing_Action_Connection_returns_Not_Found_response.json b/src/test/resources/cassettes/features/v2/Get_an_existing_Action_Connection_returns_Not_Found_response.json new file mode 100644 index 00000000000..bb60a2e0431 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_an_existing_Action_Connection_returns_Not_Found_response.json @@ -0,0 +1,28 @@ +[ + { + "httpRequest": { + "headers": {}, + "method": "GET", + "path": "/api/v2/actions/connections/aaa11111-aa11-aa11-aaaa-aaaaaa111111", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[{\"title\":\"Generic Error\",\"detail\":\"error getting connection: rpc error: code = NotFound desc = connection not found\"}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 404, + "reasonPhrase": "Not Found" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "ec39c262-bc27-539e-b271-3eaecd67d11f" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_an_existing_Action_Connection_returns_Successfully_get_Action_Connection_response.freeze b/src/test/resources/cassettes/features/v2/Get_an_existing_Action_Connection_returns_Successfully_get_Action_Connection_response.freeze new file mode 100644 index 00000000000..e15f28fc55f --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_an_existing_Action_Connection_returns_Successfully_get_Action_Connection_response.freeze @@ -0,0 +1 @@ +2025-01-03T17:54:30.187Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_an_existing_Action_Connection_returns_Successfully_get_Action_Connection_response.json b/src/test/resources/cassettes/features/v2/Get_an_existing_Action_Connection_returns_Successfully_get_Action_Connection_response.json new file mode 100644 index 00000000000..6ca7cb154ea --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_an_existing_Action_Connection_returns_Successfully_get_Action_Connection_response.json @@ -0,0 +1,28 @@ +[ + { + "httpRequest": { + "headers": {}, + "method": "GET", + "path": "/api/v2/actions/connections/cb460d51-3c88-4e87-adac-d47131d0423d", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"cb460d51-3c88-4e87-adac-d47131d0423d\",\"type\":\"action_connection\",\"attributes\":{\"integration\":{\"credentials\":{\"account_id\":\"123456789123\",\"role\":\"MyRoleUpdated\",\"external_id\":\"909b33b1242748cfbef42f20011e2fa0\",\"principal_id\":\"464622532012\",\"type\":\"AWSAssumeRole\"},\"type\":\"AWS\"},\"name\":\"Cassette Connection\"}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "da039dfb-c5ce-393f-ca5e-2efe2618adfc" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_an_existing_Action_Connection_returns_Bad_Request_response.freeze b/src/test/resources/cassettes/features/v2/Update_an_existing_Action_Connection_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..267e68c92e9 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Update_an_existing_Action_Connection_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2025-01-03T17:54:30.291Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_an_existing_Action_Connection_returns_Bad_Request_response.json b/src/test/resources/cassettes/features/v2/Update_an_existing_Action_Connection_returns_Bad_Request_response.json new file mode 100644 index 00000000000..d4ac9de5e1e --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Update_an_existing_Action_Connection_returns_Bad_Request_response.json @@ -0,0 +1,32 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"integration\":{\"credentials\":{\"account_id\":\"1\",\"role\":\"MyRoleUpdated\",\"type\":\"AWSAssumeRole\"},\"type\":\"AWS\"},\"name\":\"Cassette Connection\"},\"type\":\"action_connection\"}}" + }, + "headers": {}, + "method": "PATCH", + "path": "/api/v2/actions/connections/cb460d51-3c88-4e87-adac-d47131d0423d", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[{\"title\":\"Generic Error\",\"detail\":\"error creating connection: rpc error: code = InvalidArgument desc = multiple errors: 1 error occurred:\\n\\t* [error_code=8]: invalid UpdateCustomConnectionRequest.DataUpdate: embedded message failed validation | caused by: invalid CustomConnectionDataUpdate.Aws: embedded message failed validation | caused by: invalid CustomConnectionDataUpdate_AwsAuth.AssumeRole: embedded message failed validation | caused by: invalid CustomConnectionDataUpdate_AwsAuth_AssumeRole.AccountId: value does not match regex pattern \\\"^\\\\\\\\d{12}$\\\"\\n\\n\"}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 400, + "reasonPhrase": "Bad Request" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "a5f930b0-ef1e-06ab-26b3-a7298f5f18d9" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_an_existing_Action_Connection_returns_Not_Found_response.freeze b/src/test/resources/cassettes/features/v2/Update_an_existing_Action_Connection_returns_Not_Found_response.freeze new file mode 100644 index 00000000000..c3bbe094934 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Update_an_existing_Action_Connection_returns_Not_Found_response.freeze @@ -0,0 +1 @@ +2025-01-03T17:54:30.379Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_an_existing_Action_Connection_returns_Not_Found_response.json b/src/test/resources/cassettes/features/v2/Update_an_existing_Action_Connection_returns_Not_Found_response.json new file mode 100644 index 00000000000..9c4b18b6053 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Update_an_existing_Action_Connection_returns_Not_Found_response.json @@ -0,0 +1,32 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"integration\":{\"credentials\":{\"account_id\":\"123456789123\",\"role\":\"MyRoleUpdated\",\"type\":\"AWSAssumeRole\"},\"type\":\"AWS\"},\"name\":\"Cassette Connection\"},\"type\":\"action_connection\"}}" + }, + "headers": {}, + "method": "PATCH", + "path": "/api/v2/actions/connections/aaa11111-aa11-aa11-aaaa-aaaaaa111111", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[{\"title\":\"Generic Error\",\"detail\":\"error creating connection: rpc error: code = NotFound desc = connection not found\"}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 404, + "reasonPhrase": "Not Found" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "6f63be26-588a-90a0-ac45-ac23631657d7" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_an_existing_Action_Connection_returns_Successfully_updated_Action_Connection_response.freeze b/src/test/resources/cassettes/features/v2/Update_an_existing_Action_Connection_returns_Successfully_updated_Action_Connection_response.freeze new file mode 100644 index 00000000000..d2af60d3bc9 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Update_an_existing_Action_Connection_returns_Successfully_updated_Action_Connection_response.freeze @@ -0,0 +1 @@ +2025-01-03T17:54:30.599Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_an_existing_Action_Connection_returns_Successfully_updated_Action_Connection_response.json b/src/test/resources/cassettes/features/v2/Update_an_existing_Action_Connection_returns_Successfully_updated_Action_Connection_response.json new file mode 100644 index 00000000000..9d13ea9fb76 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Update_an_existing_Action_Connection_returns_Successfully_updated_Action_Connection_response.json @@ -0,0 +1,32 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"integration\":{\"credentials\":{\"account_id\":\"123456789123\",\"role\":\"MyRoleUpdated\",\"type\":\"AWSAssumeRole\"},\"type\":\"AWS\"},\"name\":\"Cassette Connection\"},\"type\":\"action_connection\"}}" + }, + "headers": {}, + "method": "PATCH", + "path": "/api/v2/actions/connections/cb460d51-3c88-4e87-adac-d47131d0423d", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"cb460d51-3c88-4e87-adac-d47131d0423d\",\"type\":\"action_connection\",\"attributes\":{\"integration\":{\"credentials\":{\"account_id\":\"123456789123\",\"role\":\"MyRoleUpdated\",\"external_id\":\"909b33b1242748cfbef42f20011e2fa0\",\"principal_id\":\"464622532012\",\"type\":\"AWSAssumeRole\"},\"type\":\"AWS\"},\"name\":\"Cassette Connection\"}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "cf560806-a32f-edb9-ab5d-5ce5fc16eaf6" + } +] \ No newline at end of file diff --git a/src/test/resources/com/datadog/api/client/v2/api/action_connection.feature b/src/test/resources/com/datadog/api/client/v2/api/action_connection.feature new file mode 100644 index 00000000000..7f63502f634 --- /dev/null +++ b/src/test/resources/com/datadog/api/client/v2/api/action_connection.feature @@ -0,0 +1,96 @@ +@endpoint(action-connection) @endpoint(action-connection-v2) +Feature: Action Connection + Action connections extend your installed integrations and allow you to + take action in your third-party systems (e.g. AWS, Gitlab, and Statuspage) + with Datadog’s Workflow Automation and App Builder products. Datadog’s + Integrations automatically provide authentication for Slack, Microsoft + Teams, PagerDuty, Opsgenie, JIRA, GitHub, and Statuspage. You do not need + additional connections in order to access these tools within Workflow + Automation and App Builder. We offer granular access control for editing + and resolving connections. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "ActionConnection" API + + @team:DataDog/workflow-automation-dev + Scenario: Create a new Action Connection returns "Bad Request" response + Given new "CreateActionConnection" request + And body with value {"data":{"type":"action_connection","attributes":{"name":"Cassette Connection","integration":{"type":"AWS","credentials":{"type":"AWSAssumeRole","role":"MyRoleUpdated","account_id":"1"}}}}} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/workflow-automation-dev + Scenario: Create a new Action Connection returns "Successfully created Action Connection" response + Given new "CreateActionConnection" request + And body with value {"data":{"type":"action_connection","attributes":{"name":"Cassette Connection DELETE_ME","integration":{"type":"AWS","credentials":{"type":"AWSAssumeRole","role":"MyRoleUpdated","account_id":"123456789123"}}}}} + When the request is sent + Then the response status is 201 Successfully created Action Connection + + @team:DataDog/workflow-automation-dev + Scenario: Delete an existing Action Connection returns "Not Found" response + Given new "DeleteActionConnection" request + And request contains "connection_id" parameter with value "aaa11111-aa11-aa11-aaaa-aaaaaa111111" + When the request is sent + Then the response status is 404 Not Found + + @skip @team:DataDog/workflow-automation-dev + Scenario: Delete an existing Action Connection returns "Successfully deleted Action Connection" response + Given there is a valid "action_connection" in the system + And new "DeleteActionConnection" request + And request contains "connection_id" parameter from "action_connection.data.id" + When the request is sent + Then the response status is 204 The resource was deleted successfully. + + @generated @skip @team:DataDog/workflow-automation-dev + Scenario: Delete an existing Action Connection returns "The resource was deleted successfully." response + Given new "DeleteActionConnection" request + And request contains "connection_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 204 The resource was deleted successfully. + + @team:DataDog/workflow-automation-dev + Scenario: Get an existing Action Connection returns "Bad Request" response + Given new "GetActionConnection" request + And request contains "connection_id" parameter with value "bad format" + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/workflow-automation-dev + Scenario: Get an existing Action Connection returns "Not Found" response + Given new "GetActionConnection" request + And request contains "connection_id" parameter with value "aaa11111-aa11-aa11-aaaa-aaaaaa111111" + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/workflow-automation-dev + Scenario: Get an existing Action Connection returns "Successfully get Action Connection" response + Given new "GetActionConnection" request + And request contains "connection_id" parameter with value "cb460d51-3c88-4e87-adac-d47131d0423d" + When the request is sent + Then the response status is 200 Successfully get Action Connection + + @team:DataDog/workflow-automation-dev + Scenario: Update an existing Action Connection returns "Bad Request" response + Given new "UpdateActionConnection" request + And request contains "connection_id" parameter with value "cb460d51-3c88-4e87-adac-d47131d0423d" + And body with value {"data":{"type":"action_connection","attributes":{"name":"Cassette Connection","integration":{"type":"AWS","credentials":{"type":"AWSAssumeRole","role":"MyRoleUpdated","account_id":"1"}}}}} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/workflow-automation-dev + Scenario: Update an existing Action Connection returns "Not Found" response + Given new "UpdateActionConnection" request + And request contains "connection_id" parameter with value "aaa11111-aa11-aa11-aaaa-aaaaaa111111" + And body with value {"data":{"type":"action_connection","attributes":{"name":"Cassette Connection","integration":{"type":"AWS","credentials":{"type":"AWSAssumeRole","role":"MyRoleUpdated","account_id":"123456789123"}}}}} + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/workflow-automation-dev + Scenario: Update an existing Action Connection returns "Successfully updated Action Connection" response + Given new "UpdateActionConnection" request + And request contains "connection_id" parameter with value "cb460d51-3c88-4e87-adac-d47131d0423d" + And body with value {"data":{"type":"action_connection","attributes":{"name":"Cassette Connection","integration":{"type":"AWS","credentials":{"type":"AWSAssumeRole","role":"MyRoleUpdated","account_id":"123456789123"}}}}} + When the request is sent + Then the response status is 200 Successfully updated Action Connection diff --git a/src/test/resources/com/datadog/api/client/v2/api/given.json b/src/test/resources/com/datadog/api/client/v2/api/given.json index 29503a6ae7c..4bd8a2cfc63 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/given.json +++ b/src/test/resources/com/datadog/api/client/v2/api/given.json @@ -1,4 +1,16 @@ [ + { + "parameters": [ + { + "name": "body", + "value": "{\n \"data\": {\n \"type\": \"action_connection\",\n \"attributes\": {\n \"name\": \"Cassette Connection DELETE\",\n \"integration\": {\n \"type\": \"AWS\",\n \"credentials\": {\n \"type\": \"AWSAssumeRole\",\n \"role\": \"MyRole\",\n \"account_id\": \"123456789123\"\n }\n }\n }\n }\n}" + } + ], + "step": "there is a valid \"action_connection\" in the system", + "key": "action_connection", + "tag": "Action Connection", + "operationId": "CreateActionConnection" + }, { "parameters": [ { 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 daae080a0ce..7b195aad9ea 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 @@ -1,4 +1,35 @@ { + "CreateActionConnection": { + "tag": "Action Connection", + "undo": { + "operationId": "DeleteActionConnection", + "parameters": [ + { + "name": "connection_id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "DeleteActionConnection": { + "tag": "Action Connection", + "undo": { + "type": "idempotent" + } + }, + "GetActionConnection": { + "tag": "Action Connection", + "undo": { + "type": "safe" + } + }, + "UpdateActionConnection": { + "tag": "Action Connection", + "undo": { + "type": "idempotent" + } + }, "ListAPIKeys": { "tag": "Key Management", "undo": {