diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index af969a3d7f0..df3f0136c94 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -44773,6 +44773,63 @@ components: type: string x-enum-varnames: - PERMISSIONS + PolicyResultAttributesResponse: + description: Attributes of a policy evaluation result. + properties: + active: + description: Whether the policy is active. + example: true + type: boolean + payload: + description: The policy configuration payload. + type: object + policy_type: + description: The type of policy being evaluated. + example: SAML + type: string + reference_org_uuid: + description: The organization UUID reference. + example: 550e8400-e29b-41d4-a716-446655440000 + format: uuid + type: string + required: + - active + - reference_org_uuid + - policy_type + - payload + type: object + PolicyResultDataResponse: + description: Data envelope for policy result response. + properties: + attributes: + $ref: '#/components/schemas/PolicyResultAttributesResponse' + id: + description: The unique identifier of the policy result. + example: result-123 + type: string + type: + $ref: '#/components/schemas/PolicyResultType' + required: + - id + - type + - attributes + type: object + PolicyResultResponse: + description: Response for policy evaluation result. + properties: + data: + $ref: '#/components/schemas/PolicyResultDataResponse' + required: + - data + type: object + PolicyResultType: + description: The type of the resource. The value should always be `policy_result`. + enum: + - policy_result + example: policy_result + type: string + x-enum-varnames: + - POLICY_RESULT PostmortemAttachmentRequest: properties: data: @@ -60789,6 +60846,313 @@ components: type: string x-enum-varnames: - ROW + TagPoliciesResponse: + description: Response for listing tag policies. + properties: + data: + description: List of tag policies. + items: + $ref: '#/components/schemas/TagPolicyDataResponse' + type: array + required: + - data + type: object + TagPolicyAttributesRequest: + description: Attributes for creating or updating a tag policy. + properties: + enabled: + description: Whether the policy is enabled. + example: true + type: boolean + negated: + description: Whether the policy is negated. + example: false + type: boolean + policy_name: + description: The name of the tag policy. + example: production-tags-policy + type: string + required: + description: Whether the tag is required. + example: true + type: boolean + scope: + description: The scope of the tag policy. + example: env + type: string + source: + description: The data source for the tag policy (e.g., logs, metrics). + example: logs + type: string + tag_key: + description: The tag key that the policy applies to. + example: service + type: string + tag_value_patterns: + description: List of patterns that tag values must match. + example: + - api + - web + items: + type: string + type: array + required: + - policy_name + - source + - scope + - tag_key + - tag_value_patterns + - negated + - required + - enabled + type: object + TagPolicyAttributesResponse: + description: Attributes of a tag policy response. + properties: + created_at: + description: Timestamp when the policy was created. + example: '2026-01-13T17:25:38.534Z' + format: date-time + type: string + created_by: + description: User who created the policy. + example: user@example.com + type: string + enabled: + description: Whether the policy is enabled. + example: true + type: boolean + modified_at: + description: Timestamp when the policy was last modified. + example: '2026-01-13T17:25:38.534Z' + format: date-time + type: string + modified_by: + description: User who last modified the policy. + example: user@example.com + type: string + negated: + description: Whether the policy is negated. + example: false + type: boolean + policy_name: + description: The name of the tag policy. + example: production-tags-policy + type: string + required: + description: Whether the tag is required. + example: true + type: boolean + scope: + description: The scope of the tag policy. + example: env + type: string + source: + description: The data source for the tag policy (e.g., logs, metrics). + example: logs + type: string + tag_key: + description: The tag key that the policy applies to. + example: service + type: string + tag_value_patterns: + description: List of patterns that tag values must match. + example: + - api + - web + items: + type: string + type: array + version: + description: The version of the tag policy. + example: 1 + format: int64 + type: integer + required: + - policy_name + - source + - scope + - tag_key + - tag_value_patterns + - negated + - required + - enabled + - version + - created_at + - created_by + - modified_at + - modified_by + type: object + TagPolicyAttributesUpdateRequest: + description: Attributes for updating a tag policy. All fields are optional. + properties: + enabled: + description: Whether the policy is enabled. + example: true + type: boolean + negated: + description: Whether the policy is negated. + example: false + type: boolean + policy_name: + description: The name of the tag policy. + example: production-tags-policy + type: string + required: + description: Whether the tag is required. + example: true + type: boolean + scope: + description: The scope of the tag policy. + example: env + type: string + source: + description: The data source for the tag policy (e.g., logs, metrics). + example: logs + type: string + tag_key: + description: The tag key that the policy applies to. + example: service + type: string + tag_value_patterns: + description: List of patterns that tag values must match. + example: + - api + - web + items: + type: string + type: array + type: object + TagPolicyCreateRequest: + description: Request for creating a tag policy. + properties: + data: + $ref: '#/components/schemas/TagPolicyDataRequest' + required: + - data + type: object + TagPolicyDataRequest: + description: Data envelope for tag policy create request. + properties: + attributes: + $ref: '#/components/schemas/TagPolicyAttributesRequest' + type: + $ref: '#/components/schemas/TagPolicyType' + required: + - type + - attributes + type: object + TagPolicyDataResponse: + description: Data envelope for tag policy response. + properties: + attributes: + $ref: '#/components/schemas/TagPolicyAttributesResponse' + id: + description: The unique identifier of the tag policy. + example: '123' + type: string + type: + $ref: '#/components/schemas/TagPolicyType' + required: + - id + - type + - attributes + type: object + TagPolicyDataUpdateRequest: + description: Data envelope for tag policy update request. + properties: + attributes: + $ref: '#/components/schemas/TagPolicyAttributesUpdateRequest' + type: + $ref: '#/components/schemas/TagPolicyType' + required: + - type + - attributes + type: object + TagPolicyResponse: + description: Response for a single tag policy. + properties: + data: + $ref: '#/components/schemas/TagPolicyDataResponse' + required: + - data + type: object + TagPolicyScoreAttributesResponse: + description: Attributes of a tag policy score. + properties: + score: + description: The compliance score for the tag policy. + example: 0.9 + format: double + type: number + ts_end: + description: End timestamp for the score calculation period. + example: 1768325138485 + format: int64 + type: integer + ts_start: + description: Start timestamp for the score calculation period. + example: 1768238738485 + format: int64 + type: integer + version: + description: The version of the score. + example: 1 + format: int64 + type: integer + required: + - score + - ts_start + - ts_end + type: object + TagPolicyScoreDataResponse: + description: Data envelope for tag policy score response. + properties: + attributes: + $ref: '#/components/schemas/TagPolicyScoreAttributesResponse' + id: + description: The unique identifier of the score. + example: 123-v1-1768238738485-1768325138485 + type: string + type: + $ref: '#/components/schemas/TagPolicyScoreType' + required: + - id + - type + - attributes + type: object + TagPolicyScoreResponse: + description: Response for a tag policy score. + properties: + data: + $ref: '#/components/schemas/TagPolicyScoreDataResponse' + required: + - data + type: object + TagPolicyScoreType: + description: The type of the resource. The value should always be `tag_policy_score`. + enum: + - tag_policy_score + example: tag_policy_score + type: string + x-enum-varnames: + - TAG_POLICY_SCORE + TagPolicyType: + description: The type of the resource. The value should always be `tag_policy`. + enum: + - tag_policy + example: tag_policy + type: string + x-enum-varnames: + - TAG_POLICY + TagPolicyUpdateRequest: + description: Request for updating a tag policy. + properties: + data: + $ref: '#/components/schemas/TagPolicyDataUpdateRequest' + required: + - data + type: object TagsEventAttribute: description: Array of tags associated with your event. example: @@ -85723,6 +86087,54 @@ paths: operator: OR permissions: - user_access_read + /api/v2/policy/{policy_type}/result: + get: + description: Retrieve the evaluation result for a specific policy type. + operationId: EvaluatePolicyResult + parameters: + - description: The type of policy to evaluate (e.g., SAML, HIPAA). + in: path + name: policy_type + required: true + schema: + example: SAML + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PolicyResultResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Evaluate policy result + tags: + - Policy Management + x-unstable: '**Note**: This endpoint is in public beta and is subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' /api/v2/posture_management/findings: get: description: "Get a list of findings. These include both misconfigurations and @@ -96523,6 +96935,285 @@ paths: operator: OR permissions: - synthetics_global_variable_write + /api/v2/tag-policies: + get: + description: Retrieve a list of all tag policies for the organization. + operationId: ListTagPolicies + parameters: + - description: Filter policies by data source (e.g., logs, metrics). + in: query + name: filter[source] + required: false + schema: + example: logs + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/TagPoliciesResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: List tag policies + tags: + - Tag Policies + x-unstable: '**Note**: This endpoint is in public beta and is subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + post: + description: Create a new tag policy for the organization. + operationId: CreateTagPolicy + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/TagPolicyCreateRequest' + required: true + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/TagPolicyResponse' + description: Created + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Create a tag policy + tags: + - Tag Policies + x-unstable: '**Note**: This endpoint is in public beta and is subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/tag-policies/{policy_id}: + delete: + description: Delete a specific tag policy by its ID. + operationId: DeleteTagPolicy + parameters: + - description: The ID of the tag policy. + in: path + name: policy_id + required: true + schema: + example: '123' + type: string + responses: + '204': + description: No Content + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Delete a tag policy + tags: + - Tag Policies + x-unstable: '**Note**: This endpoint is in public beta and is subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + get: + description: Retrieve a specific tag policy by its ID. + operationId: GetTagPolicy + parameters: + - description: The ID of the tag policy. + in: path + name: policy_id + required: true + schema: + example: '123' + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/TagPolicyResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Get a tag policy + tags: + - Tag Policies + x-unstable: '**Note**: This endpoint is in public beta and is subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + patch: + description: Update an existing tag policy by its ID. + operationId: UpdateTagPolicy + parameters: + - description: The ID of the tag policy. + in: path + name: policy_id + required: true + schema: + example: '123' + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/TagPolicyUpdateRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/TagPolicyResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Update a tag policy + tags: + - Tag Policies + x-unstable: '**Note**: This endpoint is in public beta and is subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/tag-policies/{policy_id}/score: + get: + description: Retrieve the compliance score for a specific tag policy. + operationId: GetTagPolicyScore + parameters: + - description: The ID of the tag policy. + in: path + name: policy_id + required: true + schema: + example: '123' + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/TagPolicyScoreResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Unauthorized + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Get tag policy score + tags: + - Tag Policies + x-unstable: '**Note**: This endpoint is in public beta and is subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' /api/v2/tags/enrichment: get: description: List all tag pipeline rulesets - Retrieve a list of all tag pipeline @@ -100611,6 +101302,8 @@ tags: description: Find out more at url: https://docs.datadoghq.com/account_management/multi_organization name: Organizations +- description: Manage and evaluate organizational policies. + name: Policy Management - description: 'The Powerpack endpoints allow you to: @@ -100759,6 +101452,8 @@ tags: use Datadog\u2019s API to\nmanage both test types programmatically.\n\nFor more information about Synthetics, see the [Synthetics overview](https://docs.datadoghq.com/synthetics/)." name: Synthetics +- description: Manage tag policies to enforce tagging standards across your organization. + name: Tag Policies - description: View and manage teams within Datadog. See the [Teams page](https://docs.datadoghq.com/account_management/teams/) for more information. name: Teams diff --git a/examples/v2/policy-management/EvaluatePolicyResult.java b/examples/v2/policy-management/EvaluatePolicyResult.java new file mode 100644 index 00000000000..197f4c80bee --- /dev/null +++ b/examples/v2/policy-management/EvaluatePolicyResult.java @@ -0,0 +1,25 @@ +// Evaluate policy result returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.PolicyManagementApi; +import com.datadog.api.client.v2.model.PolicyResultResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.evaluatePolicyResult", true); + PolicyManagementApi apiInstance = new PolicyManagementApi(defaultClient); + + try { + PolicyResultResponse result = apiInstance.evaluatePolicyResult("SAML"); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PolicyManagementApi#evaluatePolicyResult"); + 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/tag-policies/CreateTagPolicy.java b/examples/v2/tag-policies/CreateTagPolicy.java new file mode 100644 index 00000000000..844007d213f --- /dev/null +++ b/examples/v2/tag-policies/CreateTagPolicy.java @@ -0,0 +1,46 @@ +// Create a tag policy returns "Created" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.TagPoliciesApi; +import com.datadog.api.client.v2.model.TagPolicyAttributesRequest; +import com.datadog.api.client.v2.model.TagPolicyCreateRequest; +import com.datadog.api.client.v2.model.TagPolicyDataRequest; +import com.datadog.api.client.v2.model.TagPolicyResponse; +import com.datadog.api.client.v2.model.TagPolicyType; +import java.util.Arrays; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.createTagPolicy", true); + TagPoliciesApi apiInstance = new TagPoliciesApi(defaultClient); + + TagPolicyCreateRequest body = + new TagPolicyCreateRequest() + .data( + new TagPolicyDataRequest() + .attributes( + new TagPolicyAttributesRequest() + .enabled(true) + .negated(false) + .policyName("production-tags-policy") + .required(true) + .scope("env") + .source("logs") + .tagKey("service") + .tagValuePatterns(Arrays.asList("api", "web"))) + .type(TagPolicyType.TAG_POLICY)); + + try { + TagPolicyResponse result = apiInstance.createTagPolicy(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling TagPoliciesApi#createTagPolicy"); + 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/tag-policies/DeleteTagPolicy.java b/examples/v2/tag-policies/DeleteTagPolicy.java new file mode 100644 index 00000000000..1f99a8f9079 --- /dev/null +++ b/examples/v2/tag-policies/DeleteTagPolicy.java @@ -0,0 +1,23 @@ +// Delete a tag policy returns "No Content" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.TagPoliciesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.deleteTagPolicy", true); + TagPoliciesApi apiInstance = new TagPoliciesApi(defaultClient); + + try { + apiInstance.deleteTagPolicy("123"); + } catch (ApiException e) { + System.err.println("Exception when calling TagPoliciesApi#deleteTagPolicy"); + 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/tag-policies/GetTagPolicy.java b/examples/v2/tag-policies/GetTagPolicy.java new file mode 100644 index 00000000000..b14c1c0139a --- /dev/null +++ b/examples/v2/tag-policies/GetTagPolicy.java @@ -0,0 +1,25 @@ +// Get a tag policy returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.TagPoliciesApi; +import com.datadog.api.client.v2.model.TagPolicyResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.getTagPolicy", true); + TagPoliciesApi apiInstance = new TagPoliciesApi(defaultClient); + + try { + TagPolicyResponse result = apiInstance.getTagPolicy("123"); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling TagPoliciesApi#getTagPolicy"); + 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/tag-policies/GetTagPolicyScore.java b/examples/v2/tag-policies/GetTagPolicyScore.java new file mode 100644 index 00000000000..2f7f68d2a55 --- /dev/null +++ b/examples/v2/tag-policies/GetTagPolicyScore.java @@ -0,0 +1,25 @@ +// Get tag policy score returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.TagPoliciesApi; +import com.datadog.api.client.v2.model.TagPolicyScoreResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.getTagPolicyScore", true); + TagPoliciesApi apiInstance = new TagPoliciesApi(defaultClient); + + try { + TagPolicyScoreResponse result = apiInstance.getTagPolicyScore("123"); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling TagPoliciesApi#getTagPolicyScore"); + 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/tag-policies/ListTagPolicies.java b/examples/v2/tag-policies/ListTagPolicies.java new file mode 100644 index 00000000000..5a7b91bdd48 --- /dev/null +++ b/examples/v2/tag-policies/ListTagPolicies.java @@ -0,0 +1,25 @@ +// List tag policies returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.TagPoliciesApi; +import com.datadog.api.client.v2.model.TagPoliciesResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.listTagPolicies", true); + TagPoliciesApi apiInstance = new TagPoliciesApi(defaultClient); + + try { + TagPoliciesResponse result = apiInstance.listTagPolicies(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling TagPoliciesApi#listTagPolicies"); + 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/tag-policies/UpdateTagPolicy.java b/examples/v2/tag-policies/UpdateTagPolicy.java new file mode 100644 index 00000000000..80e0058e7de --- /dev/null +++ b/examples/v2/tag-policies/UpdateTagPolicy.java @@ -0,0 +1,46 @@ +// Update a tag policy returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.TagPoliciesApi; +import com.datadog.api.client.v2.model.TagPolicyAttributesUpdateRequest; +import com.datadog.api.client.v2.model.TagPolicyDataUpdateRequest; +import com.datadog.api.client.v2.model.TagPolicyResponse; +import com.datadog.api.client.v2.model.TagPolicyType; +import com.datadog.api.client.v2.model.TagPolicyUpdateRequest; +import java.util.Arrays; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.updateTagPolicy", true); + TagPoliciesApi apiInstance = new TagPoliciesApi(defaultClient); + + TagPolicyUpdateRequest body = + new TagPolicyUpdateRequest() + .data( + new TagPolicyDataUpdateRequest() + .attributes( + new TagPolicyAttributesUpdateRequest() + .enabled(true) + .negated(false) + .policyName("production-tags-policy") + .required(true) + .scope("env") + .source("logs") + .tagKey("service") + .tagValuePatterns(Arrays.asList("api", "web"))) + .type(TagPolicyType.TAG_POLICY)); + + try { + TagPolicyResponse result = apiInstance.updateTagPolicy("123", body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling TagPoliciesApi#updateTagPolicy"); + 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/ApiClient.java b/src/main/java/com/datadog/api/client/ApiClient.java index fcadf72e1e8..761013e5728 100644 --- a/src/main/java/com/datadog/api/client/ApiClient.java +++ b/src/main/java/com/datadog/api/client/ApiClient.java @@ -890,6 +890,7 @@ public class ApiClient { put("v2.validateExistingMonitorUserTemplate", false); put("v2.validateMonitorUserTemplate", false); put("v2.listRoleTemplates", false); + put("v2.evaluatePolicyResult", false); put("v2.createConnection", false); put("v2.deleteConnection", false); put("v2.getAccountFacetInfo", false); @@ -931,6 +932,12 @@ public class ApiClient { put("v2.listCustomRuleRevisions", false); put("v2.revertCustomRuleRevision", false); put("v2.updateCustomRuleset", false); + put("v2.createTagPolicy", false); + put("v2.deleteTagPolicy", false); + put("v2.getTagPolicy", false); + put("v2.getTagPolicyScore", false); + put("v2.listTagPolicies", false); + put("v2.updateTagPolicy", false); put("v2.addMemberTeam", false); put("v2.listMemberTeams", false); put("v2.removeMemberTeam", false); diff --git a/src/main/java/com/datadog/api/client/v2/api/PolicyManagementApi.java b/src/main/java/com/datadog/api/client/v2/api/PolicyManagementApi.java new file mode 100644 index 00000000000..21a87bdb7f1 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/api/PolicyManagementApi.java @@ -0,0 +1,201 @@ +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.PolicyResultResponse; +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 PolicyManagementApi { + private ApiClient apiClient; + + public PolicyManagementApi() { + this(ApiClient.getDefaultApiClient()); + } + + public PolicyManagementApi(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; + } + + /** + * Evaluate policy result. + * + *

See {@link #evaluatePolicyResultWithHttpInfo}. + * + * @param policyType The type of policy to evaluate (e.g., SAML, HIPAA). (required) + * @return PolicyResultResponse + * @throws ApiException if fails to make API call + */ + public PolicyResultResponse evaluatePolicyResult(String policyType) throws ApiException { + return evaluatePolicyResultWithHttpInfo(policyType).getData(); + } + + /** + * Evaluate policy result. + * + *

See {@link #evaluatePolicyResultWithHttpInfoAsync}. + * + * @param policyType The type of policy to evaluate (e.g., SAML, HIPAA). (required) + * @return CompletableFuture<PolicyResultResponse> + */ + public CompletableFuture evaluatePolicyResultAsync(String policyType) { + return evaluatePolicyResultWithHttpInfoAsync(policyType) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Retrieve the evaluation result for a specific policy type. + * + * @param policyType The type of policy to evaluate (e.g., SAML, HIPAA). (required) + * @return ApiResponse<PolicyResultResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse evaluatePolicyResultWithHttpInfo(String policyType) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "evaluatePolicyResult"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + + // verify the required parameter 'policyType' is set + if (policyType == null) { + throw new ApiException( + 400, "Missing the required parameter 'policyType' when calling evaluatePolicyResult"); + } + // create path and map variables + String localVarPath = + "/api/v2/policy/{policy_type}/result" + .replaceAll( + "\\{" + "policy_type" + "\\}", apiClient.escapeString(policyType.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.PolicyManagementApi.evaluatePolicyResult", + 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() {}); + } + + /** + * Evaluate policy result. + * + *

See {@link #evaluatePolicyResultWithHttpInfo}. + * + * @param policyType The type of policy to evaluate (e.g., SAML, HIPAA). (required) + * @return CompletableFuture<ApiResponse<PolicyResultResponse>> + */ + public CompletableFuture> evaluatePolicyResultWithHttpInfoAsync( + String policyType) { + // Check if unstable operation is enabled + String operationId = "evaluatePolicyResult"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + + // verify the required parameter 'policyType' is set + if (policyType == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'policyType' when calling evaluatePolicyResult")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/policy/{policy_type}/result" + .replaceAll( + "\\{" + "policy_type" + "\\}", apiClient.escapeString(policyType.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.PolicyManagementApi.evaluatePolicyResult", + 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() {}); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/api/TagPoliciesApi.java b/src/main/java/com/datadog/api/client/v2/api/TagPoliciesApi.java new file mode 100644 index 00000000000..3293f851ede --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/api/TagPoliciesApi.java @@ -0,0 +1,1015 @@ +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.TagPoliciesResponse; +import com.datadog.api.client.v2.model.TagPolicyCreateRequest; +import com.datadog.api.client.v2.model.TagPolicyResponse; +import com.datadog.api.client.v2.model.TagPolicyScoreResponse; +import com.datadog.api.client.v2.model.TagPolicyUpdateRequest; +import jakarta.ws.rs.client.Invocation; +import jakarta.ws.rs.core.GenericType; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +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 TagPoliciesApi { + private ApiClient apiClient; + + public TagPoliciesApi() { + this(ApiClient.getDefaultApiClient()); + } + + public TagPoliciesApi(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 tag policy. + * + *

See {@link #createTagPolicyWithHttpInfo}. + * + * @param body (required) + * @return TagPolicyResponse + * @throws ApiException if fails to make API call + */ + public TagPolicyResponse createTagPolicy(TagPolicyCreateRequest body) throws ApiException { + return createTagPolicyWithHttpInfo(body).getData(); + } + + /** + * Create a tag policy. + * + *

See {@link #createTagPolicyWithHttpInfoAsync}. + * + * @param body (required) + * @return CompletableFuture<TagPolicyResponse> + */ + public CompletableFuture createTagPolicyAsync(TagPolicyCreateRequest body) { + return createTagPolicyWithHttpInfoAsync(body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Create a new tag policy for the organization. + * + * @param body (required) + * @return ApiResponse<TagPolicyResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
201 Created -
400 Bad Request -
403 Forbidden -
429 Too many requests -
+ */ + public ApiResponse createTagPolicyWithHttpInfo(TagPolicyCreateRequest body) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "createTagPolicy"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling createTagPolicy"); + } + // create path and map variables + String localVarPath = "/api/v2/tag-policies"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.TagPoliciesApi.createTagPolicy", + 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 tag policy. + * + *

See {@link #createTagPolicyWithHttpInfo}. + * + * @param body (required) + * @return CompletableFuture<ApiResponse<TagPolicyResponse>> + */ + public CompletableFuture> createTagPolicyWithHttpInfoAsync( + TagPolicyCreateRequest body) { + // Check if unstable operation is enabled + String operationId = "createTagPolicy"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + 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 createTagPolicy")); + return result; + } + // create path and map variables + String localVarPath = "/api/v2/tag-policies"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.TagPoliciesApi.createTagPolicy", + 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 a tag policy. + * + *

See {@link #deleteTagPolicyWithHttpInfo}. + * + * @param policyId The ID of the tag policy. (required) + * @throws ApiException if fails to make API call + */ + public void deleteTagPolicy(String policyId) throws ApiException { + deleteTagPolicyWithHttpInfo(policyId); + } + + /** + * Delete a tag policy. + * + *

See {@link #deleteTagPolicyWithHttpInfoAsync}. + * + * @param policyId The ID of the tag policy. (required) + * @return CompletableFuture + */ + public CompletableFuture deleteTagPolicyAsync(String policyId) { + return deleteTagPolicyWithHttpInfoAsync(policyId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Delete a specific tag policy by its ID. + * + * @param policyId The ID of the tag policy. (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
204 No Content -
400 Bad Request -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse deleteTagPolicyWithHttpInfo(String policyId) throws ApiException { + // Check if unstable operation is enabled + String operationId = "deleteTagPolicy"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + + // verify the required parameter 'policyId' is set + if (policyId == null) { + throw new ApiException( + 400, "Missing the required parameter 'policyId' when calling deleteTagPolicy"); + } + // create path and map variables + String localVarPath = + "/api/v2/tag-policies/{policy_id}" + .replaceAll("\\{" + "policy_id" + "\\}", apiClient.escapeString(policyId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.TagPoliciesApi.deleteTagPolicy", + 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 a tag policy. + * + *

See {@link #deleteTagPolicyWithHttpInfo}. + * + * @param policyId The ID of the tag policy. (required) + * @return CompletableFuture<ApiResponse<Void>> + */ + public CompletableFuture> deleteTagPolicyWithHttpInfoAsync(String policyId) { + // Check if unstable operation is enabled + String operationId = "deleteTagPolicy"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + + // verify the required parameter 'policyId' is set + if (policyId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'policyId' when calling deleteTagPolicy")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/tag-policies/{policy_id}" + .replaceAll("\\{" + "policy_id" + "\\}", apiClient.escapeString(policyId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.TagPoliciesApi.deleteTagPolicy", + 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 a tag policy. + * + *

See {@link #getTagPolicyWithHttpInfo}. + * + * @param policyId The ID of the tag policy. (required) + * @return TagPolicyResponse + * @throws ApiException if fails to make API call + */ + public TagPolicyResponse getTagPolicy(String policyId) throws ApiException { + return getTagPolicyWithHttpInfo(policyId).getData(); + } + + /** + * Get a tag policy. + * + *

See {@link #getTagPolicyWithHttpInfoAsync}. + * + * @param policyId The ID of the tag policy. (required) + * @return CompletableFuture<TagPolicyResponse> + */ + public CompletableFuture getTagPolicyAsync(String policyId) { + return getTagPolicyWithHttpInfoAsync(policyId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Retrieve a specific tag policy by its ID. + * + * @param policyId The ID of the tag policy. (required) + * @return ApiResponse<TagPolicyResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse getTagPolicyWithHttpInfo(String policyId) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "getTagPolicy"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + + // verify the required parameter 'policyId' is set + if (policyId == null) { + throw new ApiException( + 400, "Missing the required parameter 'policyId' when calling getTagPolicy"); + } + // create path and map variables + String localVarPath = + "/api/v2/tag-policies/{policy_id}" + .replaceAll("\\{" + "policy_id" + "\\}", apiClient.escapeString(policyId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.TagPoliciesApi.getTagPolicy", + 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 a tag policy. + * + *

See {@link #getTagPolicyWithHttpInfo}. + * + * @param policyId The ID of the tag policy. (required) + * @return CompletableFuture<ApiResponse<TagPolicyResponse>> + */ + public CompletableFuture> getTagPolicyWithHttpInfoAsync( + String policyId) { + // Check if unstable operation is enabled + String operationId = "getTagPolicy"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + + // verify the required parameter 'policyId' is set + if (policyId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'policyId' when calling getTagPolicy")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/tag-policies/{policy_id}" + .replaceAll("\\{" + "policy_id" + "\\}", apiClient.escapeString(policyId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.TagPoliciesApi.getTagPolicy", + 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() {}); + } + + /** + * Get tag policy score. + * + *

See {@link #getTagPolicyScoreWithHttpInfo}. + * + * @param policyId The ID of the tag policy. (required) + * @return TagPolicyScoreResponse + * @throws ApiException if fails to make API call + */ + public TagPolicyScoreResponse getTagPolicyScore(String policyId) throws ApiException { + return getTagPolicyScoreWithHttpInfo(policyId).getData(); + } + + /** + * Get tag policy score. + * + *

See {@link #getTagPolicyScoreWithHttpInfoAsync}. + * + * @param policyId The ID of the tag policy. (required) + * @return CompletableFuture<TagPolicyScoreResponse> + */ + public CompletableFuture getTagPolicyScoreAsync(String policyId) { + return getTagPolicyScoreWithHttpInfoAsync(policyId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Retrieve the compliance score for a specific tag policy. + * + * @param policyId The ID of the tag policy. (required) + * @return ApiResponse<TagPolicyScoreResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse getTagPolicyScoreWithHttpInfo(String policyId) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "getTagPolicyScore"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + + // verify the required parameter 'policyId' is set + if (policyId == null) { + throw new ApiException( + 400, "Missing the required parameter 'policyId' when calling getTagPolicyScore"); + } + // create path and map variables + String localVarPath = + "/api/v2/tag-policies/{policy_id}/score" + .replaceAll("\\{" + "policy_id" + "\\}", apiClient.escapeString(policyId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.TagPoliciesApi.getTagPolicyScore", + 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 tag policy score. + * + *

See {@link #getTagPolicyScoreWithHttpInfo}. + * + * @param policyId The ID of the tag policy. (required) + * @return CompletableFuture<ApiResponse<TagPolicyScoreResponse>> + */ + public CompletableFuture> getTagPolicyScoreWithHttpInfoAsync( + String policyId) { + // Check if unstable operation is enabled + String operationId = "getTagPolicyScore"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + + // verify the required parameter 'policyId' is set + if (policyId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'policyId' when calling getTagPolicyScore")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/tag-policies/{policy_id}/score" + .replaceAll("\\{" + "policy_id" + "\\}", apiClient.escapeString(policyId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.TagPoliciesApi.getTagPolicyScore", + 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() {}); + } + + /** Manage optional parameters to listTagPolicies. */ + public static class ListTagPoliciesOptionalParameters { + private String filterSource; + + /** + * Set filterSource. + * + * @param filterSource Filter policies by data source (e.g., logs, metrics). (optional) + * @return ListTagPoliciesOptionalParameters + */ + public ListTagPoliciesOptionalParameters filterSource(String filterSource) { + this.filterSource = filterSource; + return this; + } + } + + /** + * List tag policies. + * + *

See {@link #listTagPoliciesWithHttpInfo}. + * + * @return TagPoliciesResponse + * @throws ApiException if fails to make API call + */ + public TagPoliciesResponse listTagPolicies() throws ApiException { + return listTagPoliciesWithHttpInfo(new ListTagPoliciesOptionalParameters()).getData(); + } + + /** + * List tag policies. + * + *

See {@link #listTagPoliciesWithHttpInfoAsync}. + * + * @return CompletableFuture<TagPoliciesResponse> + */ + public CompletableFuture listTagPoliciesAsync() { + return listTagPoliciesWithHttpInfoAsync(new ListTagPoliciesOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * List tag policies. + * + *

See {@link #listTagPoliciesWithHttpInfo}. + * + * @param parameters Optional parameters for the request. + * @return TagPoliciesResponse + * @throws ApiException if fails to make API call + */ + public TagPoliciesResponse listTagPolicies(ListTagPoliciesOptionalParameters parameters) + throws ApiException { + return listTagPoliciesWithHttpInfo(parameters).getData(); + } + + /** + * List tag policies. + * + *

See {@link #listTagPoliciesWithHttpInfoAsync}. + * + * @param parameters Optional parameters for the request. + * @return CompletableFuture<TagPoliciesResponse> + */ + public CompletableFuture listTagPoliciesAsync( + ListTagPoliciesOptionalParameters parameters) { + return listTagPoliciesWithHttpInfoAsync(parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Retrieve a list of all tag policies for the organization. + * + * @param parameters Optional parameters for the request. + * @return ApiResponse<TagPoliciesResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
429 Too many requests -
+ */ + public ApiResponse listTagPoliciesWithHttpInfo( + ListTagPoliciesOptionalParameters parameters) throws ApiException { + // Check if unstable operation is enabled + String operationId = "listTagPolicies"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + String filterSource = parameters.filterSource; + // create path and map variables + String localVarPath = "/api/v2/tag-policies"; + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[source]", filterSource)); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.TagPoliciesApi.listTagPolicies", + localVarPath, + localVarQueryParams, + 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() {}); + } + + /** + * List tag policies. + * + *

See {@link #listTagPoliciesWithHttpInfo}. + * + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<TagPoliciesResponse>> + */ + public CompletableFuture> listTagPoliciesWithHttpInfoAsync( + ListTagPoliciesOptionalParameters parameters) { + // Check if unstable operation is enabled + String operationId = "listTagPolicies"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + String filterSource = parameters.filterSource; + // create path and map variables + String localVarPath = "/api/v2/tag-policies"; + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[source]", filterSource)); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.TagPoliciesApi.listTagPolicies", + localVarPath, + localVarQueryParams, + 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 a tag policy. + * + *

See {@link #updateTagPolicyWithHttpInfo}. + * + * @param policyId The ID of the tag policy. (required) + * @param body (required) + * @return TagPolicyResponse + * @throws ApiException if fails to make API call + */ + public TagPolicyResponse updateTagPolicy(String policyId, TagPolicyUpdateRequest body) + throws ApiException { + return updateTagPolicyWithHttpInfo(policyId, body).getData(); + } + + /** + * Update a tag policy. + * + *

See {@link #updateTagPolicyWithHttpInfoAsync}. + * + * @param policyId The ID of the tag policy. (required) + * @param body (required) + * @return CompletableFuture<TagPolicyResponse> + */ + public CompletableFuture updateTagPolicyAsync( + String policyId, TagPolicyUpdateRequest body) { + return updateTagPolicyWithHttpInfoAsync(policyId, body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Update an existing tag policy by its ID. + * + * @param policyId The ID of the tag policy. (required) + * @param body (required) + * @return ApiResponse<TagPolicyResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse updateTagPolicyWithHttpInfo( + String policyId, TagPolicyUpdateRequest body) throws ApiException { + // Check if unstable operation is enabled + String operationId = "updateTagPolicy"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = body; + + // verify the required parameter 'policyId' is set + if (policyId == null) { + throw new ApiException( + 400, "Missing the required parameter 'policyId' when calling updateTagPolicy"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling updateTagPolicy"); + } + // create path and map variables + String localVarPath = + "/api/v2/tag-policies/{policy_id}" + .replaceAll("\\{" + "policy_id" + "\\}", apiClient.escapeString(policyId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.TagPoliciesApi.updateTagPolicy", + 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 a tag policy. + * + *

See {@link #updateTagPolicyWithHttpInfo}. + * + * @param policyId The ID of the tag policy. (required) + * @param body (required) + * @return CompletableFuture<ApiResponse<TagPolicyResponse>> + */ + public CompletableFuture> updateTagPolicyWithHttpInfoAsync( + String policyId, TagPolicyUpdateRequest body) { + // Check if unstable operation is enabled + String operationId = "updateTagPolicy"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = body; + + // verify the required parameter 'policyId' is set + if (policyId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'policyId' when calling updateTagPolicy")); + 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 updateTagPolicy")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/tag-policies/{policy_id}" + .replaceAll("\\{" + "policy_id" + "\\}", apiClient.escapeString(policyId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.TagPoliciesApi.updateTagPolicy", + 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/PolicyResultAttributesResponse.java b/src/main/java/com/datadog/api/client/v2/model/PolicyResultAttributesResponse.java new file mode 100644 index 00000000000..75df6847c6c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/PolicyResultAttributesResponse.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; +import java.util.UUID; + +/** Attributes of a policy evaluation result. */ +@JsonPropertyOrder({ + PolicyResultAttributesResponse.JSON_PROPERTY_ACTIVE, + PolicyResultAttributesResponse.JSON_PROPERTY_PAYLOAD, + PolicyResultAttributesResponse.JSON_PROPERTY_POLICY_TYPE, + PolicyResultAttributesResponse.JSON_PROPERTY_REFERENCE_ORG_UUID +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class PolicyResultAttributesResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ACTIVE = "active"; + private Boolean active; + + public static final String JSON_PROPERTY_PAYLOAD = "payload"; + private Object payload; + + public static final String JSON_PROPERTY_POLICY_TYPE = "policy_type"; + private String policyType; + + public static final String JSON_PROPERTY_REFERENCE_ORG_UUID = "reference_org_uuid"; + private UUID referenceOrgUuid; + + public PolicyResultAttributesResponse() {} + + @JsonCreator + public PolicyResultAttributesResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_ACTIVE) Boolean active, + @JsonProperty(required = true, value = JSON_PROPERTY_PAYLOAD) Object payload, + @JsonProperty(required = true, value = JSON_PROPERTY_POLICY_TYPE) String policyType, + @JsonProperty(required = true, value = JSON_PROPERTY_REFERENCE_ORG_UUID) + UUID referenceOrgUuid) { + this.active = active; + this.payload = payload; + this.policyType = policyType; + this.referenceOrgUuid = referenceOrgUuid; + } + + public PolicyResultAttributesResponse active(Boolean active) { + this.active = active; + return this; + } + + /** + * Whether the policy is active. + * + * @return active + */ + @JsonProperty(JSON_PROPERTY_ACTIVE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getActive() { + return active; + } + + public void setActive(Boolean active) { + this.active = active; + } + + public PolicyResultAttributesResponse payload(Object payload) { + this.payload = payload; + return this; + } + + /** + * The policy configuration payload. + * + * @return payload + */ + @JsonProperty(JSON_PROPERTY_PAYLOAD) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Object getPayload() { + return payload; + } + + public void setPayload(Object payload) { + this.payload = payload; + } + + public PolicyResultAttributesResponse policyType(String policyType) { + this.policyType = policyType; + return this; + } + + /** + * The type of policy being evaluated. + * + * @return policyType + */ + @JsonProperty(JSON_PROPERTY_POLICY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getPolicyType() { + return policyType; + } + + public void setPolicyType(String policyType) { + this.policyType = policyType; + } + + public PolicyResultAttributesResponse referenceOrgUuid(UUID referenceOrgUuid) { + this.referenceOrgUuid = referenceOrgUuid; + return this; + } + + /** + * The organization UUID reference. + * + * @return referenceOrgUuid + */ + @JsonProperty(JSON_PROPERTY_REFERENCE_ORG_UUID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UUID getReferenceOrgUuid() { + return referenceOrgUuid; + } + + public void setReferenceOrgUuid(UUID referenceOrgUuid) { + this.referenceOrgUuid = referenceOrgUuid; + } + + /** + * 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 PolicyResultAttributesResponse + */ + @JsonAnySetter + public PolicyResultAttributesResponse 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 PolicyResultAttributesResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PolicyResultAttributesResponse policyResultAttributesResponse = + (PolicyResultAttributesResponse) o; + return Objects.equals(this.active, policyResultAttributesResponse.active) + && Objects.equals(this.payload, policyResultAttributesResponse.payload) + && Objects.equals(this.policyType, policyResultAttributesResponse.policyType) + && Objects.equals(this.referenceOrgUuid, policyResultAttributesResponse.referenceOrgUuid) + && Objects.equals( + this.additionalProperties, policyResultAttributesResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(active, payload, policyType, referenceOrgUuid, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PolicyResultAttributesResponse {\n"); + sb.append(" active: ").append(toIndentedString(active)).append("\n"); + sb.append(" payload: ").append(toIndentedString(payload)).append("\n"); + sb.append(" policyType: ").append(toIndentedString(policyType)).append("\n"); + sb.append(" referenceOrgUuid: ").append(toIndentedString(referenceOrgUuid)).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/PolicyResultDataResponse.java b/src/main/java/com/datadog/api/client/v2/model/PolicyResultDataResponse.java new file mode 100644 index 00000000000..cce55fb53d1 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/PolicyResultDataResponse.java @@ -0,0 +1,209 @@ +/* + * 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 envelope for policy result response. */ +@JsonPropertyOrder({ + PolicyResultDataResponse.JSON_PROPERTY_ATTRIBUTES, + PolicyResultDataResponse.JSON_PROPERTY_ID, + PolicyResultDataResponse.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class PolicyResultDataResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private PolicyResultAttributesResponse attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private PolicyResultType type; + + public PolicyResultDataResponse() {} + + @JsonCreator + public PolicyResultDataResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + PolicyResultAttributesResponse attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) PolicyResultType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public PolicyResultDataResponse attributes(PolicyResultAttributesResponse attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes of a policy evaluation result. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public PolicyResultAttributesResponse getAttributes() { + return attributes; + } + + public void setAttributes(PolicyResultAttributesResponse attributes) { + this.attributes = attributes; + } + + public PolicyResultDataResponse id(String id) { + this.id = id; + return this; + } + + /** + * The unique identifier of the policy result. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public PolicyResultDataResponse type(PolicyResultType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The type of the resource. The value should always be policy_result. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public PolicyResultType getType() { + return type; + } + + public void setType(PolicyResultType 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 PolicyResultDataResponse + */ + @JsonAnySetter + public PolicyResultDataResponse 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 PolicyResultDataResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PolicyResultDataResponse policyResultDataResponse = (PolicyResultDataResponse) o; + return Objects.equals(this.attributes, policyResultDataResponse.attributes) + && Objects.equals(this.id, policyResultDataResponse.id) + && Objects.equals(this.type, policyResultDataResponse.type) + && Objects.equals(this.additionalProperties, policyResultDataResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PolicyResultDataResponse {\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/PolicyResultResponse.java b/src/main/java/com/datadog/api/client/v2/model/PolicyResultResponse.java new file mode 100644 index 00000000000..58f1c9b4be8 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/PolicyResultResponse.java @@ -0,0 +1,145 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Response for policy evaluation result. */ +@JsonPropertyOrder({PolicyResultResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class PolicyResultResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private PolicyResultDataResponse data; + + public PolicyResultResponse() {} + + @JsonCreator + public PolicyResultResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) PolicyResultDataResponse data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public PolicyResultResponse data(PolicyResultDataResponse data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Data envelope for policy result response. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public PolicyResultDataResponse getData() { + return data; + } + + public void setData(PolicyResultDataResponse 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 PolicyResultResponse + */ + @JsonAnySetter + public PolicyResultResponse 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 PolicyResultResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PolicyResultResponse policyResultResponse = (PolicyResultResponse) o; + return Objects.equals(this.data, policyResultResponse.data) + && Objects.equals(this.additionalProperties, policyResultResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PolicyResultResponse {\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/PolicyResultType.java b/src/main/java/com/datadog/api/client/v2/model/PolicyResultType.java new file mode 100644 index 00000000000..a4dcd56594a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/PolicyResultType.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 type of the resource. The value should always be policy_result. */ +@JsonSerialize(using = PolicyResultType.PolicyResultTypeSerializer.class) +public class PolicyResultType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("policy_result")); + + public static final PolicyResultType POLICY_RESULT = new PolicyResultType("policy_result"); + + PolicyResultType(String value) { + super(value, allowedValues); + } + + public static class PolicyResultTypeSerializer extends StdSerializer { + public PolicyResultTypeSerializer(Class t) { + super(t); + } + + public PolicyResultTypeSerializer() { + this(null); + } + + @Override + public void serialize(PolicyResultType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static PolicyResultType fromValue(String value) { + return new PolicyResultType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/TagPoliciesResponse.java b/src/main/java/com/datadog/api/client/v2/model/TagPoliciesResponse.java new file mode 100644 index 00000000000..95ea4f68c89 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TagPoliciesResponse.java @@ -0,0 +1,154 @@ +/* + * 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; + +/** Response for listing tag policies. */ +@JsonPropertyOrder({TagPoliciesResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TagPoliciesResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = new ArrayList<>(); + + public TagPoliciesResponse() {} + + @JsonCreator + public TagPoliciesResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) List data) { + this.data = data; + } + + public TagPoliciesResponse data(List data) { + this.data = data; + for (TagPolicyDataResponse item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public TagPoliciesResponse addDataItem(TagPolicyDataResponse dataItem) { + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * List of tag policies. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getData() { + return data; + } + + public void setData(List 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 TagPoliciesResponse + */ + @JsonAnySetter + public TagPoliciesResponse 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 TagPoliciesResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TagPoliciesResponse tagPoliciesResponse = (TagPoliciesResponse) o; + return Objects.equals(this.data, tagPoliciesResponse.data) + && Objects.equals(this.additionalProperties, tagPoliciesResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TagPoliciesResponse {\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/TagPolicyAttributesRequest.java b/src/main/java/com/datadog/api/client/v2/model/TagPolicyAttributesRequest.java new file mode 100644 index 00000000000..a598b7ddda0 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TagPolicyAttributesRequest.java @@ -0,0 +1,359 @@ +/* + * 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; + +/** Attributes for creating or updating a tag policy. */ +@JsonPropertyOrder({ + TagPolicyAttributesRequest.JSON_PROPERTY_ENABLED, + TagPolicyAttributesRequest.JSON_PROPERTY_NEGATED, + TagPolicyAttributesRequest.JSON_PROPERTY_POLICY_NAME, + TagPolicyAttributesRequest.JSON_PROPERTY_REQUIRED, + TagPolicyAttributesRequest.JSON_PROPERTY_SCOPE, + TagPolicyAttributesRequest.JSON_PROPERTY_SOURCE, + TagPolicyAttributesRequest.JSON_PROPERTY_TAG_KEY, + TagPolicyAttributesRequest.JSON_PROPERTY_TAG_VALUE_PATTERNS +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TagPolicyAttributesRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ENABLED = "enabled"; + private Boolean enabled; + + public static final String JSON_PROPERTY_NEGATED = "negated"; + private Boolean negated; + + public static final String JSON_PROPERTY_POLICY_NAME = "policy_name"; + private String policyName; + + public static final String JSON_PROPERTY_REQUIRED = "required"; + private Boolean required; + + public static final String JSON_PROPERTY_SCOPE = "scope"; + private String scope; + + public static final String JSON_PROPERTY_SOURCE = "source"; + private String source; + + public static final String JSON_PROPERTY_TAG_KEY = "tag_key"; + private String tagKey; + + public static final String JSON_PROPERTY_TAG_VALUE_PATTERNS = "tag_value_patterns"; + private List tagValuePatterns = new ArrayList<>(); + + public TagPolicyAttributesRequest() {} + + @JsonCreator + public TagPolicyAttributesRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_ENABLED) Boolean enabled, + @JsonProperty(required = true, value = JSON_PROPERTY_NEGATED) Boolean negated, + @JsonProperty(required = true, value = JSON_PROPERTY_POLICY_NAME) String policyName, + @JsonProperty(required = true, value = JSON_PROPERTY_REQUIRED) Boolean required, + @JsonProperty(required = true, value = JSON_PROPERTY_SCOPE) String scope, + @JsonProperty(required = true, value = JSON_PROPERTY_SOURCE) String source, + @JsonProperty(required = true, value = JSON_PROPERTY_TAG_KEY) String tagKey, + @JsonProperty(required = true, value = JSON_PROPERTY_TAG_VALUE_PATTERNS) + List tagValuePatterns) { + this.enabled = enabled; + this.negated = negated; + this.policyName = policyName; + this.required = required; + this.scope = scope; + this.source = source; + this.tagKey = tagKey; + this.tagValuePatterns = tagValuePatterns; + } + + public TagPolicyAttributesRequest enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Whether the policy is enabled. + * + * @return enabled + */ + @JsonProperty(JSON_PROPERTY_ENABLED) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getEnabled() { + return enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + public TagPolicyAttributesRequest negated(Boolean negated) { + this.negated = negated; + return this; + } + + /** + * Whether the policy is negated. + * + * @return negated + */ + @JsonProperty(JSON_PROPERTY_NEGATED) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getNegated() { + return negated; + } + + public void setNegated(Boolean negated) { + this.negated = negated; + } + + public TagPolicyAttributesRequest policyName(String policyName) { + this.policyName = policyName; + return this; + } + + /** + * The name of the tag policy. + * + * @return policyName + */ + @JsonProperty(JSON_PROPERTY_POLICY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getPolicyName() { + return policyName; + } + + public void setPolicyName(String policyName) { + this.policyName = policyName; + } + + public TagPolicyAttributesRequest required(Boolean required) { + this.required = required; + return this; + } + + /** + * Whether the tag is required. + * + * @return required + */ + @JsonProperty(JSON_PROPERTY_REQUIRED) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getRequired() { + return required; + } + + public void setRequired(Boolean required) { + this.required = required; + } + + public TagPolicyAttributesRequest scope(String scope) { + this.scope = scope; + return this; + } + + /** + * The scope of the tag policy. + * + * @return scope + */ + @JsonProperty(JSON_PROPERTY_SCOPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getScope() { + return scope; + } + + public void setScope(String scope) { + this.scope = scope; + } + + public TagPolicyAttributesRequest source(String source) { + this.source = source; + return this; + } + + /** + * The data source for the tag policy (e.g., logs, metrics). + * + * @return source + */ + @JsonProperty(JSON_PROPERTY_SOURCE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getSource() { + return source; + } + + public void setSource(String source) { + this.source = source; + } + + public TagPolicyAttributesRequest tagKey(String tagKey) { + this.tagKey = tagKey; + return this; + } + + /** + * The tag key that the policy applies to. + * + * @return tagKey + */ + @JsonProperty(JSON_PROPERTY_TAG_KEY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getTagKey() { + return tagKey; + } + + public void setTagKey(String tagKey) { + this.tagKey = tagKey; + } + + public TagPolicyAttributesRequest tagValuePatterns(List tagValuePatterns) { + this.tagValuePatterns = tagValuePatterns; + return this; + } + + public TagPolicyAttributesRequest addTagValuePatternsItem(String tagValuePatternsItem) { + this.tagValuePatterns.add(tagValuePatternsItem); + return this; + } + + /** + * List of patterns that tag values must match. + * + * @return tagValuePatterns + */ + @JsonProperty(JSON_PROPERTY_TAG_VALUE_PATTERNS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getTagValuePatterns() { + return tagValuePatterns; + } + + public void setTagValuePatterns(List tagValuePatterns) { + this.tagValuePatterns = tagValuePatterns; + } + + /** + * 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 TagPolicyAttributesRequest + */ + @JsonAnySetter + public TagPolicyAttributesRequest 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 TagPolicyAttributesRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TagPolicyAttributesRequest tagPolicyAttributesRequest = (TagPolicyAttributesRequest) o; + return Objects.equals(this.enabled, tagPolicyAttributesRequest.enabled) + && Objects.equals(this.negated, tagPolicyAttributesRequest.negated) + && Objects.equals(this.policyName, tagPolicyAttributesRequest.policyName) + && Objects.equals(this.required, tagPolicyAttributesRequest.required) + && Objects.equals(this.scope, tagPolicyAttributesRequest.scope) + && Objects.equals(this.source, tagPolicyAttributesRequest.source) + && Objects.equals(this.tagKey, tagPolicyAttributesRequest.tagKey) + && Objects.equals(this.tagValuePatterns, tagPolicyAttributesRequest.tagValuePatterns) + && Objects.equals( + this.additionalProperties, tagPolicyAttributesRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + enabled, + negated, + policyName, + required, + scope, + source, + tagKey, + tagValuePatterns, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TagPolicyAttributesRequest {\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" negated: ").append(toIndentedString(negated)).append("\n"); + sb.append(" policyName: ").append(toIndentedString(policyName)).append("\n"); + sb.append(" required: ").append(toIndentedString(required)).append("\n"); + sb.append(" scope: ").append(toIndentedString(scope)).append("\n"); + sb.append(" source: ").append(toIndentedString(source)).append("\n"); + sb.append(" tagKey: ").append(toIndentedString(tagKey)).append("\n"); + sb.append(" tagValuePatterns: ").append(toIndentedString(tagValuePatterns)).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/TagPolicyAttributesResponse.java b/src/main/java/com/datadog/api/client/v2/model/TagPolicyAttributesResponse.java new file mode 100644 index 00000000000..10a8f06a2a5 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TagPolicyAttributesResponse.java @@ -0,0 +1,505 @@ +/* + * 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.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Attributes of a tag policy response. */ +@JsonPropertyOrder({ + TagPolicyAttributesResponse.JSON_PROPERTY_CREATED_AT, + TagPolicyAttributesResponse.JSON_PROPERTY_CREATED_BY, + TagPolicyAttributesResponse.JSON_PROPERTY_ENABLED, + TagPolicyAttributesResponse.JSON_PROPERTY_MODIFIED_AT, + TagPolicyAttributesResponse.JSON_PROPERTY_MODIFIED_BY, + TagPolicyAttributesResponse.JSON_PROPERTY_NEGATED, + TagPolicyAttributesResponse.JSON_PROPERTY_POLICY_NAME, + TagPolicyAttributesResponse.JSON_PROPERTY_REQUIRED, + TagPolicyAttributesResponse.JSON_PROPERTY_SCOPE, + TagPolicyAttributesResponse.JSON_PROPERTY_SOURCE, + TagPolicyAttributesResponse.JSON_PROPERTY_TAG_KEY, + TagPolicyAttributesResponse.JSON_PROPERTY_TAG_VALUE_PATTERNS, + TagPolicyAttributesResponse.JSON_PROPERTY_VERSION +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TagPolicyAttributesResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREATED_AT = "created_at"; + private OffsetDateTime createdAt; + + public static final String JSON_PROPERTY_CREATED_BY = "created_by"; + private String createdBy; + + public static final String JSON_PROPERTY_ENABLED = "enabled"; + private Boolean enabled; + + public static final String JSON_PROPERTY_MODIFIED_AT = "modified_at"; + private OffsetDateTime modifiedAt; + + public static final String JSON_PROPERTY_MODIFIED_BY = "modified_by"; + private String modifiedBy; + + public static final String JSON_PROPERTY_NEGATED = "negated"; + private Boolean negated; + + public static final String JSON_PROPERTY_POLICY_NAME = "policy_name"; + private String policyName; + + public static final String JSON_PROPERTY_REQUIRED = "required"; + private Boolean required; + + public static final String JSON_PROPERTY_SCOPE = "scope"; + private String scope; + + public static final String JSON_PROPERTY_SOURCE = "source"; + private String source; + + public static final String JSON_PROPERTY_TAG_KEY = "tag_key"; + private String tagKey; + + public static final String JSON_PROPERTY_TAG_VALUE_PATTERNS = "tag_value_patterns"; + private List tagValuePatterns = new ArrayList<>(); + + public static final String JSON_PROPERTY_VERSION = "version"; + private Long version; + + public TagPolicyAttributesResponse() {} + + @JsonCreator + public TagPolicyAttributesResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_CREATED_AT) OffsetDateTime createdAt, + @JsonProperty(required = true, value = JSON_PROPERTY_CREATED_BY) String createdBy, + @JsonProperty(required = true, value = JSON_PROPERTY_ENABLED) Boolean enabled, + @JsonProperty(required = true, value = JSON_PROPERTY_MODIFIED_AT) OffsetDateTime modifiedAt, + @JsonProperty(required = true, value = JSON_PROPERTY_MODIFIED_BY) String modifiedBy, + @JsonProperty(required = true, value = JSON_PROPERTY_NEGATED) Boolean negated, + @JsonProperty(required = true, value = JSON_PROPERTY_POLICY_NAME) String policyName, + @JsonProperty(required = true, value = JSON_PROPERTY_REQUIRED) Boolean required, + @JsonProperty(required = true, value = JSON_PROPERTY_SCOPE) String scope, + @JsonProperty(required = true, value = JSON_PROPERTY_SOURCE) String source, + @JsonProperty(required = true, value = JSON_PROPERTY_TAG_KEY) String tagKey, + @JsonProperty(required = true, value = JSON_PROPERTY_TAG_VALUE_PATTERNS) + List tagValuePatterns, + @JsonProperty(required = true, value = JSON_PROPERTY_VERSION) Long version) { + this.createdAt = createdAt; + this.createdBy = createdBy; + this.enabled = enabled; + this.modifiedAt = modifiedAt; + this.modifiedBy = modifiedBy; + this.negated = negated; + this.policyName = policyName; + this.required = required; + this.scope = scope; + this.source = source; + this.tagKey = tagKey; + this.tagValuePatterns = tagValuePatterns; + this.version = version; + } + + public TagPolicyAttributesResponse createdAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Timestamp when the policy was created. + * + * @return createdAt + */ + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + public TagPolicyAttributesResponse createdBy(String createdBy) { + this.createdBy = createdBy; + return this; + } + + /** + * User who created the policy. + * + * @return createdBy + */ + @JsonProperty(JSON_PROPERTY_CREATED_BY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getCreatedBy() { + return createdBy; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public TagPolicyAttributesResponse enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Whether the policy is enabled. + * + * @return enabled + */ + @JsonProperty(JSON_PROPERTY_ENABLED) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getEnabled() { + return enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + public TagPolicyAttributesResponse modifiedAt(OffsetDateTime modifiedAt) { + this.modifiedAt = modifiedAt; + return this; + } + + /** + * Timestamp when the policy was last modified. + * + * @return modifiedAt + */ + @JsonProperty(JSON_PROPERTY_MODIFIED_AT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getModifiedAt() { + return modifiedAt; + } + + public void setModifiedAt(OffsetDateTime modifiedAt) { + this.modifiedAt = modifiedAt; + } + + public TagPolicyAttributesResponse modifiedBy(String modifiedBy) { + this.modifiedBy = modifiedBy; + return this; + } + + /** + * User who last modified the policy. + * + * @return modifiedBy + */ + @JsonProperty(JSON_PROPERTY_MODIFIED_BY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getModifiedBy() { + return modifiedBy; + } + + public void setModifiedBy(String modifiedBy) { + this.modifiedBy = modifiedBy; + } + + public TagPolicyAttributesResponse negated(Boolean negated) { + this.negated = negated; + return this; + } + + /** + * Whether the policy is negated. + * + * @return negated + */ + @JsonProperty(JSON_PROPERTY_NEGATED) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getNegated() { + return negated; + } + + public void setNegated(Boolean negated) { + this.negated = negated; + } + + public TagPolicyAttributesResponse policyName(String policyName) { + this.policyName = policyName; + return this; + } + + /** + * The name of the tag policy. + * + * @return policyName + */ + @JsonProperty(JSON_PROPERTY_POLICY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getPolicyName() { + return policyName; + } + + public void setPolicyName(String policyName) { + this.policyName = policyName; + } + + public TagPolicyAttributesResponse required(Boolean required) { + this.required = required; + return this; + } + + /** + * Whether the tag is required. + * + * @return required + */ + @JsonProperty(JSON_PROPERTY_REQUIRED) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getRequired() { + return required; + } + + public void setRequired(Boolean required) { + this.required = required; + } + + public TagPolicyAttributesResponse scope(String scope) { + this.scope = scope; + return this; + } + + /** + * The scope of the tag policy. + * + * @return scope + */ + @JsonProperty(JSON_PROPERTY_SCOPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getScope() { + return scope; + } + + public void setScope(String scope) { + this.scope = scope; + } + + public TagPolicyAttributesResponse source(String source) { + this.source = source; + return this; + } + + /** + * The data source for the tag policy (e.g., logs, metrics). + * + * @return source + */ + @JsonProperty(JSON_PROPERTY_SOURCE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getSource() { + return source; + } + + public void setSource(String source) { + this.source = source; + } + + public TagPolicyAttributesResponse tagKey(String tagKey) { + this.tagKey = tagKey; + return this; + } + + /** + * The tag key that the policy applies to. + * + * @return tagKey + */ + @JsonProperty(JSON_PROPERTY_TAG_KEY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getTagKey() { + return tagKey; + } + + public void setTagKey(String tagKey) { + this.tagKey = tagKey; + } + + public TagPolicyAttributesResponse tagValuePatterns(List tagValuePatterns) { + this.tagValuePatterns = tagValuePatterns; + return this; + } + + public TagPolicyAttributesResponse addTagValuePatternsItem(String tagValuePatternsItem) { + this.tagValuePatterns.add(tagValuePatternsItem); + return this; + } + + /** + * List of patterns that tag values must match. + * + * @return tagValuePatterns + */ + @JsonProperty(JSON_PROPERTY_TAG_VALUE_PATTERNS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getTagValuePatterns() { + return tagValuePatterns; + } + + public void setTagValuePatterns(List tagValuePatterns) { + this.tagValuePatterns = tagValuePatterns; + } + + public TagPolicyAttributesResponse version(Long version) { + this.version = version; + return this; + } + + /** + * The version of the tag policy. + * + * @return version + */ + @JsonProperty(JSON_PROPERTY_VERSION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getVersion() { + return version; + } + + public void setVersion(Long version) { + this.version = version; + } + + /** + * 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 TagPolicyAttributesResponse + */ + @JsonAnySetter + public TagPolicyAttributesResponse 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 TagPolicyAttributesResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TagPolicyAttributesResponse tagPolicyAttributesResponse = (TagPolicyAttributesResponse) o; + return Objects.equals(this.createdAt, tagPolicyAttributesResponse.createdAt) + && Objects.equals(this.createdBy, tagPolicyAttributesResponse.createdBy) + && Objects.equals(this.enabled, tagPolicyAttributesResponse.enabled) + && Objects.equals(this.modifiedAt, tagPolicyAttributesResponse.modifiedAt) + && Objects.equals(this.modifiedBy, tagPolicyAttributesResponse.modifiedBy) + && Objects.equals(this.negated, tagPolicyAttributesResponse.negated) + && Objects.equals(this.policyName, tagPolicyAttributesResponse.policyName) + && Objects.equals(this.required, tagPolicyAttributesResponse.required) + && Objects.equals(this.scope, tagPolicyAttributesResponse.scope) + && Objects.equals(this.source, tagPolicyAttributesResponse.source) + && Objects.equals(this.tagKey, tagPolicyAttributesResponse.tagKey) + && Objects.equals(this.tagValuePatterns, tagPolicyAttributesResponse.tagValuePatterns) + && Objects.equals(this.version, tagPolicyAttributesResponse.version) + && Objects.equals( + this.additionalProperties, tagPolicyAttributesResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + createdAt, + createdBy, + enabled, + modifiedAt, + modifiedBy, + negated, + policyName, + required, + scope, + source, + tagKey, + tagValuePatterns, + version, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TagPolicyAttributesResponse {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" createdBy: ").append(toIndentedString(createdBy)).append("\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" modifiedAt: ").append(toIndentedString(modifiedAt)).append("\n"); + sb.append(" modifiedBy: ").append(toIndentedString(modifiedBy)).append("\n"); + sb.append(" negated: ").append(toIndentedString(negated)).append("\n"); + sb.append(" policyName: ").append(toIndentedString(policyName)).append("\n"); + sb.append(" required: ").append(toIndentedString(required)).append("\n"); + sb.append(" scope: ").append(toIndentedString(scope)).append("\n"); + sb.append(" source: ").append(toIndentedString(source)).append("\n"); + sb.append(" tagKey: ").append(toIndentedString(tagKey)).append("\n"); + sb.append(" tagValuePatterns: ").append(toIndentedString(tagValuePatterns)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).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/TagPolicyAttributesUpdateRequest.java b/src/main/java/com/datadog/api/client/v2/model/TagPolicyAttributesUpdateRequest.java new file mode 100644 index 00000000000..317a3a21776 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TagPolicyAttributesUpdateRequest.java @@ -0,0 +1,347 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Attributes for updating a tag policy. All fields are optional. */ +@JsonPropertyOrder({ + TagPolicyAttributesUpdateRequest.JSON_PROPERTY_ENABLED, + TagPolicyAttributesUpdateRequest.JSON_PROPERTY_NEGATED, + TagPolicyAttributesUpdateRequest.JSON_PROPERTY_POLICY_NAME, + TagPolicyAttributesUpdateRequest.JSON_PROPERTY_REQUIRED, + TagPolicyAttributesUpdateRequest.JSON_PROPERTY_SCOPE, + TagPolicyAttributesUpdateRequest.JSON_PROPERTY_SOURCE, + TagPolicyAttributesUpdateRequest.JSON_PROPERTY_TAG_KEY, + TagPolicyAttributesUpdateRequest.JSON_PROPERTY_TAG_VALUE_PATTERNS +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TagPolicyAttributesUpdateRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ENABLED = "enabled"; + private Boolean enabled; + + public static final String JSON_PROPERTY_NEGATED = "negated"; + private Boolean negated; + + public static final String JSON_PROPERTY_POLICY_NAME = "policy_name"; + private String policyName; + + public static final String JSON_PROPERTY_REQUIRED = "required"; + private Boolean required; + + public static final String JSON_PROPERTY_SCOPE = "scope"; + private String scope; + + public static final String JSON_PROPERTY_SOURCE = "source"; + private String source; + + public static final String JSON_PROPERTY_TAG_KEY = "tag_key"; + private String tagKey; + + public static final String JSON_PROPERTY_TAG_VALUE_PATTERNS = "tag_value_patterns"; + private List tagValuePatterns = null; + + public TagPolicyAttributesUpdateRequest enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Whether the policy is enabled. + * + * @return enabled + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ENABLED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getEnabled() { + return enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + public TagPolicyAttributesUpdateRequest negated(Boolean negated) { + this.negated = negated; + return this; + } + + /** + * Whether the policy is negated. + * + * @return negated + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NEGATED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getNegated() { + return negated; + } + + public void setNegated(Boolean negated) { + this.negated = negated; + } + + public TagPolicyAttributesUpdateRequest policyName(String policyName) { + this.policyName = policyName; + return this; + } + + /** + * The name of the tag policy. + * + * @return policyName + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_POLICY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getPolicyName() { + return policyName; + } + + public void setPolicyName(String policyName) { + this.policyName = policyName; + } + + public TagPolicyAttributesUpdateRequest required(Boolean required) { + this.required = required; + return this; + } + + /** + * Whether the tag is required. + * + * @return required + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_REQUIRED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getRequired() { + return required; + } + + public void setRequired(Boolean required) { + this.required = required; + } + + public TagPolicyAttributesUpdateRequest scope(String scope) { + this.scope = scope; + return this; + } + + /** + * The scope of the tag policy. + * + * @return scope + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SCOPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getScope() { + return scope; + } + + public void setScope(String scope) { + this.scope = scope; + } + + public TagPolicyAttributesUpdateRequest source(String source) { + this.source = source; + return this; + } + + /** + * The data source for the tag policy (e.g., logs, metrics). + * + * @return source + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SOURCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getSource() { + return source; + } + + public void setSource(String source) { + this.source = source; + } + + public TagPolicyAttributesUpdateRequest tagKey(String tagKey) { + this.tagKey = tagKey; + return this; + } + + /** + * The tag key that the policy applies to. + * + * @return tagKey + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TAG_KEY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getTagKey() { + return tagKey; + } + + public void setTagKey(String tagKey) { + this.tagKey = tagKey; + } + + public TagPolicyAttributesUpdateRequest tagValuePatterns(List tagValuePatterns) { + this.tagValuePatterns = tagValuePatterns; + return this; + } + + public TagPolicyAttributesUpdateRequest addTagValuePatternsItem(String tagValuePatternsItem) { + if (this.tagValuePatterns == null) { + this.tagValuePatterns = new ArrayList<>(); + } + this.tagValuePatterns.add(tagValuePatternsItem); + return this; + } + + /** + * List of patterns that tag values must match. + * + * @return tagValuePatterns + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TAG_VALUE_PATTERNS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getTagValuePatterns() { + return tagValuePatterns; + } + + public void setTagValuePatterns(List tagValuePatterns) { + this.tagValuePatterns = tagValuePatterns; + } + + /** + * 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 TagPolicyAttributesUpdateRequest + */ + @JsonAnySetter + public TagPolicyAttributesUpdateRequest 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 TagPolicyAttributesUpdateRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TagPolicyAttributesUpdateRequest tagPolicyAttributesUpdateRequest = + (TagPolicyAttributesUpdateRequest) o; + return Objects.equals(this.enabled, tagPolicyAttributesUpdateRequest.enabled) + && Objects.equals(this.negated, tagPolicyAttributesUpdateRequest.negated) + && Objects.equals(this.policyName, tagPolicyAttributesUpdateRequest.policyName) + && Objects.equals(this.required, tagPolicyAttributesUpdateRequest.required) + && Objects.equals(this.scope, tagPolicyAttributesUpdateRequest.scope) + && Objects.equals(this.source, tagPolicyAttributesUpdateRequest.source) + && Objects.equals(this.tagKey, tagPolicyAttributesUpdateRequest.tagKey) + && Objects.equals(this.tagValuePatterns, tagPolicyAttributesUpdateRequest.tagValuePatterns) + && Objects.equals( + this.additionalProperties, tagPolicyAttributesUpdateRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + enabled, + negated, + policyName, + required, + scope, + source, + tagKey, + tagValuePatterns, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TagPolicyAttributesUpdateRequest {\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" negated: ").append(toIndentedString(negated)).append("\n"); + sb.append(" policyName: ").append(toIndentedString(policyName)).append("\n"); + sb.append(" required: ").append(toIndentedString(required)).append("\n"); + sb.append(" scope: ").append(toIndentedString(scope)).append("\n"); + sb.append(" source: ").append(toIndentedString(source)).append("\n"); + sb.append(" tagKey: ").append(toIndentedString(tagKey)).append("\n"); + sb.append(" tagValuePatterns: ").append(toIndentedString(tagValuePatterns)).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/TagPolicyCreateRequest.java b/src/main/java/com/datadog/api/client/v2/model/TagPolicyCreateRequest.java new file mode 100644 index 00000000000..8338800045e --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TagPolicyCreateRequest.java @@ -0,0 +1,145 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Request for creating a tag policy. */ +@JsonPropertyOrder({TagPolicyCreateRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TagPolicyCreateRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private TagPolicyDataRequest data; + + public TagPolicyCreateRequest() {} + + @JsonCreator + public TagPolicyCreateRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) TagPolicyDataRequest data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public TagPolicyCreateRequest data(TagPolicyDataRequest data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Data envelope for tag policy create request. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TagPolicyDataRequest getData() { + return data; + } + + public void setData(TagPolicyDataRequest 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 TagPolicyCreateRequest + */ + @JsonAnySetter + public TagPolicyCreateRequest 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 TagPolicyCreateRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TagPolicyCreateRequest tagPolicyCreateRequest = (TagPolicyCreateRequest) o; + return Objects.equals(this.data, tagPolicyCreateRequest.data) + && Objects.equals(this.additionalProperties, tagPolicyCreateRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TagPolicyCreateRequest {\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/TagPolicyDataRequest.java b/src/main/java/com/datadog/api/client/v2/model/TagPolicyDataRequest.java new file mode 100644 index 00000000000..6eb97b102b9 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TagPolicyDataRequest.java @@ -0,0 +1,181 @@ +/* + * 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 envelope for tag policy create request. */ +@JsonPropertyOrder({ + TagPolicyDataRequest.JSON_PROPERTY_ATTRIBUTES, + TagPolicyDataRequest.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TagPolicyDataRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private TagPolicyAttributesRequest attributes; + + public static final String JSON_PROPERTY_TYPE = "type"; + private TagPolicyType type; + + public TagPolicyDataRequest() {} + + @JsonCreator + public TagPolicyDataRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + TagPolicyAttributesRequest attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) TagPolicyType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public TagPolicyDataRequest attributes(TagPolicyAttributesRequest attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes for creating or updating a tag policy. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TagPolicyAttributesRequest getAttributes() { + return attributes; + } + + public void setAttributes(TagPolicyAttributesRequest attributes) { + this.attributes = attributes; + } + + public TagPolicyDataRequest type(TagPolicyType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The type of the resource. The value should always be tag_policy. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TagPolicyType getType() { + return type; + } + + public void setType(TagPolicyType 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 TagPolicyDataRequest + */ + @JsonAnySetter + public TagPolicyDataRequest 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 TagPolicyDataRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TagPolicyDataRequest tagPolicyDataRequest = (TagPolicyDataRequest) o; + return Objects.equals(this.attributes, tagPolicyDataRequest.attributes) + && Objects.equals(this.type, tagPolicyDataRequest.type) + && Objects.equals(this.additionalProperties, tagPolicyDataRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TagPolicyDataRequest {\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/TagPolicyDataResponse.java b/src/main/java/com/datadog/api/client/v2/model/TagPolicyDataResponse.java new file mode 100644 index 00000000000..61b676a2c59 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TagPolicyDataResponse.java @@ -0,0 +1,209 @@ +/* + * 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 envelope for tag policy response. */ +@JsonPropertyOrder({ + TagPolicyDataResponse.JSON_PROPERTY_ATTRIBUTES, + TagPolicyDataResponse.JSON_PROPERTY_ID, + TagPolicyDataResponse.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TagPolicyDataResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private TagPolicyAttributesResponse attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private TagPolicyType type; + + public TagPolicyDataResponse() {} + + @JsonCreator + public TagPolicyDataResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + TagPolicyAttributesResponse attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) TagPolicyType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public TagPolicyDataResponse attributes(TagPolicyAttributesResponse attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes of a tag policy response. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TagPolicyAttributesResponse getAttributes() { + return attributes; + } + + public void setAttributes(TagPolicyAttributesResponse attributes) { + this.attributes = attributes; + } + + public TagPolicyDataResponse id(String id) { + this.id = id; + return this; + } + + /** + * The unique identifier of the tag policy. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public TagPolicyDataResponse type(TagPolicyType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The type of the resource. The value should always be tag_policy. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TagPolicyType getType() { + return type; + } + + public void setType(TagPolicyType 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 TagPolicyDataResponse + */ + @JsonAnySetter + public TagPolicyDataResponse 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 TagPolicyDataResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TagPolicyDataResponse tagPolicyDataResponse = (TagPolicyDataResponse) o; + return Objects.equals(this.attributes, tagPolicyDataResponse.attributes) + && Objects.equals(this.id, tagPolicyDataResponse.id) + && Objects.equals(this.type, tagPolicyDataResponse.type) + && Objects.equals(this.additionalProperties, tagPolicyDataResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TagPolicyDataResponse {\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/TagPolicyDataUpdateRequest.java b/src/main/java/com/datadog/api/client/v2/model/TagPolicyDataUpdateRequest.java new file mode 100644 index 00000000000..6b203145903 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TagPolicyDataUpdateRequest.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 envelope for tag policy update request. */ +@JsonPropertyOrder({ + TagPolicyDataUpdateRequest.JSON_PROPERTY_ATTRIBUTES, + TagPolicyDataUpdateRequest.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TagPolicyDataUpdateRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private TagPolicyAttributesUpdateRequest attributes; + + public static final String JSON_PROPERTY_TYPE = "type"; + private TagPolicyType type; + + public TagPolicyDataUpdateRequest() {} + + @JsonCreator + public TagPolicyDataUpdateRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + TagPolicyAttributesUpdateRequest attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) TagPolicyType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public TagPolicyDataUpdateRequest attributes(TagPolicyAttributesUpdateRequest attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes for updating a tag policy. All fields are optional. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TagPolicyAttributesUpdateRequest getAttributes() { + return attributes; + } + + public void setAttributes(TagPolicyAttributesUpdateRequest attributes) { + this.attributes = attributes; + } + + public TagPolicyDataUpdateRequest type(TagPolicyType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The type of the resource. The value should always be tag_policy. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TagPolicyType getType() { + return type; + } + + public void setType(TagPolicyType 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 TagPolicyDataUpdateRequest + */ + @JsonAnySetter + public TagPolicyDataUpdateRequest 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 TagPolicyDataUpdateRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TagPolicyDataUpdateRequest tagPolicyDataUpdateRequest = (TagPolicyDataUpdateRequest) o; + return Objects.equals(this.attributes, tagPolicyDataUpdateRequest.attributes) + && Objects.equals(this.type, tagPolicyDataUpdateRequest.type) + && Objects.equals( + this.additionalProperties, tagPolicyDataUpdateRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TagPolicyDataUpdateRequest {\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/TagPolicyResponse.java b/src/main/java/com/datadog/api/client/v2/model/TagPolicyResponse.java new file mode 100644 index 00000000000..f3061884e0c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TagPolicyResponse.java @@ -0,0 +1,145 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Response for a single tag policy. */ +@JsonPropertyOrder({TagPolicyResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TagPolicyResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private TagPolicyDataResponse data; + + public TagPolicyResponse() {} + + @JsonCreator + public TagPolicyResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) TagPolicyDataResponse data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public TagPolicyResponse data(TagPolicyDataResponse data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Data envelope for tag policy response. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TagPolicyDataResponse getData() { + return data; + } + + public void setData(TagPolicyDataResponse 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 TagPolicyResponse + */ + @JsonAnySetter + public TagPolicyResponse 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 TagPolicyResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TagPolicyResponse tagPolicyResponse = (TagPolicyResponse) o; + return Objects.equals(this.data, tagPolicyResponse.data) + && Objects.equals(this.additionalProperties, tagPolicyResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TagPolicyResponse {\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/TagPolicyScoreAttributesResponse.java b/src/main/java/com/datadog/api/client/v2/model/TagPolicyScoreAttributesResponse.java new file mode 100644 index 00000000000..e548444d681 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TagPolicyScoreAttributesResponse.java @@ -0,0 +1,230 @@ +/* + * 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; + +/** Attributes of a tag policy score. */ +@JsonPropertyOrder({ + TagPolicyScoreAttributesResponse.JSON_PROPERTY_SCORE, + TagPolicyScoreAttributesResponse.JSON_PROPERTY_TS_END, + TagPolicyScoreAttributesResponse.JSON_PROPERTY_TS_START, + TagPolicyScoreAttributesResponse.JSON_PROPERTY_VERSION +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TagPolicyScoreAttributesResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_SCORE = "score"; + private Double score; + + public static final String JSON_PROPERTY_TS_END = "ts_end"; + private Long tsEnd; + + public static final String JSON_PROPERTY_TS_START = "ts_start"; + private Long tsStart; + + public static final String JSON_PROPERTY_VERSION = "version"; + private Long version; + + public TagPolicyScoreAttributesResponse() {} + + @JsonCreator + public TagPolicyScoreAttributesResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_SCORE) Double score, + @JsonProperty(required = true, value = JSON_PROPERTY_TS_END) Long tsEnd, + @JsonProperty(required = true, value = JSON_PROPERTY_TS_START) Long tsStart) { + this.score = score; + this.tsEnd = tsEnd; + this.tsStart = tsStart; + } + + public TagPolicyScoreAttributesResponse score(Double score) { + this.score = score; + return this; + } + + /** + * The compliance score for the tag policy. + * + * @return score + */ + @JsonProperty(JSON_PROPERTY_SCORE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Double getScore() { + return score; + } + + public void setScore(Double score) { + this.score = score; + } + + public TagPolicyScoreAttributesResponse tsEnd(Long tsEnd) { + this.tsEnd = tsEnd; + return this; + } + + /** + * End timestamp for the score calculation period. + * + * @return tsEnd + */ + @JsonProperty(JSON_PROPERTY_TS_END) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getTsEnd() { + return tsEnd; + } + + public void setTsEnd(Long tsEnd) { + this.tsEnd = tsEnd; + } + + public TagPolicyScoreAttributesResponse tsStart(Long tsStart) { + this.tsStart = tsStart; + return this; + } + + /** + * Start timestamp for the score calculation period. + * + * @return tsStart + */ + @JsonProperty(JSON_PROPERTY_TS_START) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getTsStart() { + return tsStart; + } + + public void setTsStart(Long tsStart) { + this.tsStart = tsStart; + } + + public TagPolicyScoreAttributesResponse version(Long version) { + this.version = version; + return this; + } + + /** + * The version of the score. + * + * @return version + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_VERSION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getVersion() { + return version; + } + + public void setVersion(Long version) { + this.version = version; + } + + /** + * 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 TagPolicyScoreAttributesResponse + */ + @JsonAnySetter + public TagPolicyScoreAttributesResponse 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 TagPolicyScoreAttributesResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TagPolicyScoreAttributesResponse tagPolicyScoreAttributesResponse = + (TagPolicyScoreAttributesResponse) o; + return Objects.equals(this.score, tagPolicyScoreAttributesResponse.score) + && Objects.equals(this.tsEnd, tagPolicyScoreAttributesResponse.tsEnd) + && Objects.equals(this.tsStart, tagPolicyScoreAttributesResponse.tsStart) + && Objects.equals(this.version, tagPolicyScoreAttributesResponse.version) + && Objects.equals( + this.additionalProperties, tagPolicyScoreAttributesResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(score, tsEnd, tsStart, version, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TagPolicyScoreAttributesResponse {\n"); + sb.append(" score: ").append(toIndentedString(score)).append("\n"); + sb.append(" tsEnd: ").append(toIndentedString(tsEnd)).append("\n"); + sb.append(" tsStart: ").append(toIndentedString(tsStart)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).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/TagPolicyScoreDataResponse.java b/src/main/java/com/datadog/api/client/v2/model/TagPolicyScoreDataResponse.java new file mode 100644 index 00000000000..a82bcf2ba1a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TagPolicyScoreDataResponse.java @@ -0,0 +1,210 @@ +/* + * 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 envelope for tag policy score response. */ +@JsonPropertyOrder({ + TagPolicyScoreDataResponse.JSON_PROPERTY_ATTRIBUTES, + TagPolicyScoreDataResponse.JSON_PROPERTY_ID, + TagPolicyScoreDataResponse.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TagPolicyScoreDataResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private TagPolicyScoreAttributesResponse attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private TagPolicyScoreType type; + + public TagPolicyScoreDataResponse() {} + + @JsonCreator + public TagPolicyScoreDataResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + TagPolicyScoreAttributesResponse attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) TagPolicyScoreType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public TagPolicyScoreDataResponse attributes(TagPolicyScoreAttributesResponse attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes of a tag policy score. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TagPolicyScoreAttributesResponse getAttributes() { + return attributes; + } + + public void setAttributes(TagPolicyScoreAttributesResponse attributes) { + this.attributes = attributes; + } + + public TagPolicyScoreDataResponse id(String id) { + this.id = id; + return this; + } + + /** + * The unique identifier of the score. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public TagPolicyScoreDataResponse type(TagPolicyScoreType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The type of the resource. The value should always be tag_policy_score. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TagPolicyScoreType getType() { + return type; + } + + public void setType(TagPolicyScoreType 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 TagPolicyScoreDataResponse + */ + @JsonAnySetter + public TagPolicyScoreDataResponse 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 TagPolicyScoreDataResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TagPolicyScoreDataResponse tagPolicyScoreDataResponse = (TagPolicyScoreDataResponse) o; + return Objects.equals(this.attributes, tagPolicyScoreDataResponse.attributes) + && Objects.equals(this.id, tagPolicyScoreDataResponse.id) + && Objects.equals(this.type, tagPolicyScoreDataResponse.type) + && Objects.equals( + this.additionalProperties, tagPolicyScoreDataResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TagPolicyScoreDataResponse {\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/TagPolicyScoreResponse.java b/src/main/java/com/datadog/api/client/v2/model/TagPolicyScoreResponse.java new file mode 100644 index 00000000000..d883c0e8882 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TagPolicyScoreResponse.java @@ -0,0 +1,145 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Response for a tag policy score. */ +@JsonPropertyOrder({TagPolicyScoreResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TagPolicyScoreResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private TagPolicyScoreDataResponse data; + + public TagPolicyScoreResponse() {} + + @JsonCreator + public TagPolicyScoreResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) TagPolicyScoreDataResponse data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public TagPolicyScoreResponse data(TagPolicyScoreDataResponse data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Data envelope for tag policy score response. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TagPolicyScoreDataResponse getData() { + return data; + } + + public void setData(TagPolicyScoreDataResponse 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 TagPolicyScoreResponse + */ + @JsonAnySetter + public TagPolicyScoreResponse 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 TagPolicyScoreResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TagPolicyScoreResponse tagPolicyScoreResponse = (TagPolicyScoreResponse) o; + return Objects.equals(this.data, tagPolicyScoreResponse.data) + && Objects.equals(this.additionalProperties, tagPolicyScoreResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TagPolicyScoreResponse {\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/TagPolicyScoreType.java b/src/main/java/com/datadog/api/client/v2/model/TagPolicyScoreType.java new file mode 100644 index 00000000000..a5666abde50 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TagPolicyScoreType.java @@ -0,0 +1,55 @@ +/* + * 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 type of the resource. The value should always be tag_policy_score. */ +@JsonSerialize(using = TagPolicyScoreType.TagPolicyScoreTypeSerializer.class) +public class TagPolicyScoreType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("tag_policy_score")); + + public static final TagPolicyScoreType TAG_POLICY_SCORE = + new TagPolicyScoreType("tag_policy_score"); + + TagPolicyScoreType(String value) { + super(value, allowedValues); + } + + public static class TagPolicyScoreTypeSerializer extends StdSerializer { + public TagPolicyScoreTypeSerializer(Class t) { + super(t); + } + + public TagPolicyScoreTypeSerializer() { + this(null); + } + + @Override + public void serialize(TagPolicyScoreType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static TagPolicyScoreType fromValue(String value) { + return new TagPolicyScoreType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/TagPolicyType.java b/src/main/java/com/datadog/api/client/v2/model/TagPolicyType.java new file mode 100644 index 00000000000..5d966f3a0da --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TagPolicyType.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 type of the resource. The value should always be tag_policy. */ +@JsonSerialize(using = TagPolicyType.TagPolicyTypeSerializer.class) +public class TagPolicyType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("tag_policy")); + + public static final TagPolicyType TAG_POLICY = new TagPolicyType("tag_policy"); + + TagPolicyType(String value) { + super(value, allowedValues); + } + + public static class TagPolicyTypeSerializer extends StdSerializer { + public TagPolicyTypeSerializer(Class t) { + super(t); + } + + public TagPolicyTypeSerializer() { + this(null); + } + + @Override + public void serialize(TagPolicyType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static TagPolicyType fromValue(String value) { + return new TagPolicyType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/TagPolicyUpdateRequest.java b/src/main/java/com/datadog/api/client/v2/model/TagPolicyUpdateRequest.java new file mode 100644 index 00000000000..d86b1d2faf4 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TagPolicyUpdateRequest.java @@ -0,0 +1,145 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Request for updating a tag policy. */ +@JsonPropertyOrder({TagPolicyUpdateRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TagPolicyUpdateRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private TagPolicyDataUpdateRequest data; + + public TagPolicyUpdateRequest() {} + + @JsonCreator + public TagPolicyUpdateRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) TagPolicyDataUpdateRequest data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public TagPolicyUpdateRequest data(TagPolicyDataUpdateRequest data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Data envelope for tag policy update request. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TagPolicyDataUpdateRequest getData() { + return data; + } + + public void setData(TagPolicyDataUpdateRequest 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 TagPolicyUpdateRequest + */ + @JsonAnySetter + public TagPolicyUpdateRequest 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 TagPolicyUpdateRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TagPolicyUpdateRequest tagPolicyUpdateRequest = (TagPolicyUpdateRequest) o; + return Objects.equals(this.data, tagPolicyUpdateRequest.data) + && Objects.equals(this.additionalProperties, tagPolicyUpdateRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TagPolicyUpdateRequest {\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/test/resources/com/datadog/api/client/v2/api/policy_management.feature b/src/test/resources/com/datadog/api/client/v2/api/policy_management.feature new file mode 100644 index 00000000000..fbfbcd308f8 --- /dev/null +++ b/src/test/resources/com/datadog/api/client/v2/api/policy_management.feature @@ -0,0 +1,28 @@ +@endpoint(policy-management) @endpoint(policy-management-v2) +Feature: Policy Management + Manage and evaluate organizational policies. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "PolicyManagement" API + And operation "EvaluatePolicyResult" enabled + And new "EvaluatePolicyResult" request + + @generated @skip @team:DataDog/aaa-omg + Scenario: Evaluate policy result returns "Bad Request" response + Given request contains "policy_type" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-omg + Scenario: Evaluate policy result returns "Not Found" response + Given request contains "policy_type" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/aaa-omg + Scenario: Evaluate policy result returns "OK" response + Given request contains "policy_type" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK diff --git a/src/test/resources/com/datadog/api/client/v2/api/tag_policies.feature b/src/test/resources/com/datadog/api/client/v2/api/tag_policies.feature new file mode 100644 index 00000000000..e81e05e5077 --- /dev/null +++ b/src/test/resources/com/datadog/api/client/v2/api/tag_policies.feature @@ -0,0 +1,137 @@ +@endpoint(tag-policies) @endpoint(tag-policies-v2) +Feature: Tag Policies + Manage tag policies to enforce tagging standards across your organization. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "TagPolicies" API + + @generated @skip @team:DataDog/aaa-omg + Scenario: Create a tag policy returns "Bad Request" response + Given operation "CreateTagPolicy" enabled + And new "CreateTagPolicy" request + And body with value {"data": {"attributes": {"enabled": true, "negated": false, "policy_name": "production-tags-policy", "required": true, "scope": "env", "source": "logs", "tag_key": "service", "tag_value_patterns": ["api", "web"]}, "type": "tag_policy"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-omg + Scenario: Create a tag policy returns "Created" response + Given operation "CreateTagPolicy" enabled + And new "CreateTagPolicy" request + And body with value {"data": {"attributes": {"enabled": true, "negated": false, "policy_name": "production-tags-policy", "required": true, "scope": "env", "source": "logs", "tag_key": "service", "tag_value_patterns": ["api", "web"]}, "type": "tag_policy"}} + When the request is sent + Then the response status is 201 Created + + @generated @skip @team:DataDog/aaa-omg + Scenario: Delete a tag policy returns "Bad Request" response + Given operation "DeleteTagPolicy" enabled + And new "DeleteTagPolicy" request + And request contains "policy_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-omg + Scenario: Delete a tag policy returns "No Content" response + Given operation "DeleteTagPolicy" enabled + And new "DeleteTagPolicy" request + And request contains "policy_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 204 No Content + + @generated @skip @team:DataDog/aaa-omg + Scenario: Delete a tag policy returns "Not Found" response + Given operation "DeleteTagPolicy" enabled + And new "DeleteTagPolicy" request + And request contains "policy_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/aaa-omg + Scenario: Get a tag policy returns "Bad Request" response + Given operation "GetTagPolicy" enabled + And new "GetTagPolicy" request + And request contains "policy_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-omg + Scenario: Get a tag policy returns "Not Found" response + Given operation "GetTagPolicy" enabled + And new "GetTagPolicy" request + And request contains "policy_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/aaa-omg + Scenario: Get a tag policy returns "OK" response + Given operation "GetTagPolicy" enabled + And new "GetTagPolicy" request + And request contains "policy_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/aaa-omg + Scenario: Get tag policy score returns "Bad Request" response + Given operation "GetTagPolicyScore" enabled + And new "GetTagPolicyScore" request + And request contains "policy_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-omg + Scenario: Get tag policy score returns "Not Found" response + Given operation "GetTagPolicyScore" enabled + And new "GetTagPolicyScore" request + And request contains "policy_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/aaa-omg + Scenario: Get tag policy score returns "OK" response + Given operation "GetTagPolicyScore" enabled + And new "GetTagPolicyScore" request + And request contains "policy_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/aaa-omg + Scenario: List tag policies returns "Bad Request" response + Given operation "ListTagPolicies" enabled + And new "ListTagPolicies" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-omg + Scenario: List tag policies returns "OK" response + Given operation "ListTagPolicies" enabled + And new "ListTagPolicies" request + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/aaa-omg + Scenario: Update a tag policy returns "Bad Request" response + Given operation "UpdateTagPolicy" enabled + And new "UpdateTagPolicy" request + And request contains "policy_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"enabled": true, "negated": false, "policy_name": "production-tags-policy", "required": true, "scope": "env", "source": "logs", "tag_key": "service", "tag_value_patterns": ["api", "web"]}, "type": "tag_policy"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-omg + Scenario: Update a tag policy returns "Not Found" response + Given operation "UpdateTagPolicy" enabled + And new "UpdateTagPolicy" request + And request contains "policy_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"enabled": true, "negated": false, "policy_name": "production-tags-policy", "required": true, "scope": "env", "source": "logs", "tag_key": "service", "tag_value_patterns": ["api", "web"]}, "type": "tag_policy"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/aaa-omg + Scenario: Update a tag policy returns "OK" response + Given operation "UpdateTagPolicy" enabled + And new "UpdateTagPolicy" request + And request contains "policy_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"enabled": true, "negated": false, "policy_name": "production-tags-policy", "required": true, "scope": "env", "source": "logs", "tag_key": "service", "tag_value_patterns": ["api", "web"]}, "type": "tag_policy"}} + When the request is sent + Then the response status is 200 OK 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 c0ec7dbe41a..8eebe1e6788 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 @@ -3344,6 +3344,12 @@ "type": "safe" } }, + "EvaluatePolicyResult": { + "tag": "Policy Management", + "undo": { + "type": "safe" + } + }, "ListFindings": { "tag": "Security Monitoring", "undo": { @@ -5060,6 +5066,49 @@ "type": "safe" } }, + "ListTagPolicies": { + "tag": "Tag Policies", + "undo": { + "type": "safe" + } + }, + "CreateTagPolicy": { + "tag": "Tag Policies", + "undo": { + "operationId": "DeleteTagPolicy", + "parameters": [ + { + "name": "policy_id", + "source": "" + } + ], + "type": "unsafe" + } + }, + "DeleteTagPolicy": { + "tag": "Tag Policies", + "undo": { + "type": "idempotent" + } + }, + "GetTagPolicy": { + "tag": "Tag Policies", + "undo": { + "type": "safe" + } + }, + "UpdateTagPolicy": { + "tag": "Tag Policies", + "undo": { + "type": "idempotent" + } + }, + "GetTagPolicyScore": { + "tag": "Tag Policies", + "undo": { + "type": "safe" + } + }, "ListTagPipelinesRulesets": { "tag": "Cloud Cost Management", "undo": {