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.rb b/examples/v2/policy-management/EvaluatePolicyResult.rb new file mode 100644 index 00000000000..34d68ab8945 --- /dev/null +++ b/examples/v2/policy-management/EvaluatePolicyResult.rb @@ -0,0 +1,8 @@ +# Evaluate policy result returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.evaluate_policy_result".to_sym] = true +end +api_instance = DatadogAPIClient::V2::PolicyManagementAPI.new +p api_instance.evaluate_policy_result("SAML") diff --git a/examples/v2/tag-policies/CreateTagPolicy.rb b/examples/v2/tag-policies/CreateTagPolicy.rb new file mode 100644 index 00000000000..bd63b8fa8fb --- /dev/null +++ b/examples/v2/tag-policies/CreateTagPolicy.rb @@ -0,0 +1,27 @@ +# Create a tag policy returns "Created" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.create_tag_policy".to_sym] = true +end +api_instance = DatadogAPIClient::V2::TagPoliciesAPI.new + +body = DatadogAPIClient::V2::TagPolicyCreateRequest.new({ + data: DatadogAPIClient::V2::TagPolicyDataRequest.new({ + attributes: DatadogAPIClient::V2::TagPolicyAttributesRequest.new({ + enabled: true, + negated: false, + policy_name: "production-tags-policy", + required: true, + scope: "env", + source: "logs", + tag_key: "service", + tag_value_patterns: [ + "api", + "web", + ], + }), + type: DatadogAPIClient::V2::TagPolicyType::TAG_POLICY, + }), +}) +p api_instance.create_tag_policy(body) diff --git a/examples/v2/tag-policies/DeleteTagPolicy.rb b/examples/v2/tag-policies/DeleteTagPolicy.rb new file mode 100644 index 00000000000..21a7ea03a8a --- /dev/null +++ b/examples/v2/tag-policies/DeleteTagPolicy.rb @@ -0,0 +1,8 @@ +# Delete a tag policy returns "No Content" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.delete_tag_policy".to_sym] = true +end +api_instance = DatadogAPIClient::V2::TagPoliciesAPI.new +api_instance.delete_tag_policy("123") diff --git a/examples/v2/tag-policies/GetTagPolicy.rb b/examples/v2/tag-policies/GetTagPolicy.rb new file mode 100644 index 00000000000..c00f95c172d --- /dev/null +++ b/examples/v2/tag-policies/GetTagPolicy.rb @@ -0,0 +1,8 @@ +# Get a tag policy returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.get_tag_policy".to_sym] = true +end +api_instance = DatadogAPIClient::V2::TagPoliciesAPI.new +p api_instance.get_tag_policy("123") diff --git a/examples/v2/tag-policies/GetTagPolicyScore.rb b/examples/v2/tag-policies/GetTagPolicyScore.rb new file mode 100644 index 00000000000..58684e72713 --- /dev/null +++ b/examples/v2/tag-policies/GetTagPolicyScore.rb @@ -0,0 +1,8 @@ +# Get tag policy score returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.get_tag_policy_score".to_sym] = true +end +api_instance = DatadogAPIClient::V2::TagPoliciesAPI.new +p api_instance.get_tag_policy_score("123") diff --git a/examples/v2/tag-policies/ListTagPolicies.rb b/examples/v2/tag-policies/ListTagPolicies.rb new file mode 100644 index 00000000000..04aa25b0257 --- /dev/null +++ b/examples/v2/tag-policies/ListTagPolicies.rb @@ -0,0 +1,8 @@ +# List tag policies returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.list_tag_policies".to_sym] = true +end +api_instance = DatadogAPIClient::V2::TagPoliciesAPI.new +p api_instance.list_tag_policies() diff --git a/examples/v2/tag-policies/UpdateTagPolicy.rb b/examples/v2/tag-policies/UpdateTagPolicy.rb new file mode 100644 index 00000000000..3473f16b9de --- /dev/null +++ b/examples/v2/tag-policies/UpdateTagPolicy.rb @@ -0,0 +1,27 @@ +# Update a tag policy returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.update_tag_policy".to_sym] = true +end +api_instance = DatadogAPIClient::V2::TagPoliciesAPI.new + +body = DatadogAPIClient::V2::TagPolicyUpdateRequest.new({ + data: DatadogAPIClient::V2::TagPolicyDataUpdateRequest.new({ + attributes: DatadogAPIClient::V2::TagPolicyAttributesUpdateRequest.new({ + enabled: true, + negated: false, + policy_name: "production-tags-policy", + required: true, + scope: "env", + source: "logs", + tag_key: "service", + tag_value_patterns: [ + "api", + "web", + ], + }), + type: DatadogAPIClient::V2::TagPolicyType::TAG_POLICY, + }), +}) +p api_instance.update_tag_policy("123", body) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index d1a0604126c..f6785f76d65 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -2947,6 +2947,9 @@ "role_id" => "String", "body" => "RelationshipToUser", }, + "v2.EvaluatePolicyResult" => { + "policy_type" => "String", + }, "v2.ListPowerpacks" => { "page_limit" => "Integer", "page_offset" => "Integer", @@ -3518,6 +3521,25 @@ "variable_id" => "String", "body" => "GlobalVariableJsonPatchRequest", }, + "v2.ListTagPolicies" => { + "filter_source" => "String", + }, + "v2.CreateTagPolicy" => { + "body" => "TagPolicyCreateRequest", + }, + "v2.DeleteTagPolicy" => { + "policy_id" => "String", + }, + "v2.GetTagPolicy" => { + "policy_id" => "String", + }, + "v2.UpdateTagPolicy" => { + "policy_id" => "String", + "body" => "TagPolicyUpdateRequest", + }, + "v2.GetTagPolicyScore" => { + "policy_id" => "String", + }, "v2.ListTeams" => { "page_number" => "Integer", "page_size" => "Integer", diff --git a/features/v2/policy_management.feature b/features/v2/policy_management.feature new file mode 100644 index 00000000000..fbfbcd308f8 --- /dev/null +++ b/features/v2/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/features/v2/tag_policies.feature b/features/v2/tag_policies.feature new file mode 100644 index 00000000000..e81e05e5077 --- /dev/null +++ b/features/v2/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/features/v2/undo.json b/features/v2/undo.json index c0ec7dbe41a..8eebe1e6788 100644 --- a/features/v2/undo.json +++ b/features/v2/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": { diff --git a/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index f2cdbcd8b56..5db4cf50c46 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -323,6 +323,7 @@ def initialize "v2.validate_existing_monitor_user_template": false, "v2.validate_monitor_user_template": false, "v2.list_role_templates": false, + "v2.evaluate_policy_result": false, "v2.create_connection": false, "v2.delete_connection": false, "v2.get_account_facet_info": false, @@ -364,6 +365,12 @@ def initialize "v2.list_custom_rule_revisions": false, "v2.revert_custom_rule_revision": false, "v2.update_custom_ruleset": false, + "v2.create_tag_policy": false, + "v2.delete_tag_policy": false, + "v2.get_tag_policy": false, + "v2.get_tag_policy_score": false, + "v2.list_tag_policies": false, + "v2.update_tag_policy": false, "v2.add_member_team": false, "v2.list_member_teams": false, "v2.remove_member_team": false, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index dee0c5c9f1d..6caf380ab9d 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -3746,6 +3746,10 @@ def overrides "v2.permission_attributes" => "PermissionAttributes", "v2.permissions_response" => "PermissionsResponse", "v2.permissions_type" => "PermissionsType", + "v2.policy_result_attributes_response" => "PolicyResultAttributesResponse", + "v2.policy_result_data_response" => "PolicyResultDataResponse", + "v2.policy_result_response" => "PolicyResultResponse", + "v2.policy_result_type" => "PolicyResultType", "v2.postmortem_attachment_request" => "PostmortemAttachmentRequest", "v2.postmortem_attachment_request_attributes" => "PostmortemAttachmentRequestAttributes", "v2.postmortem_attachment_request_data" => "PostmortemAttachmentRequestData", @@ -4772,6 +4776,21 @@ def overrides "v2.table_row_resource_data" => "TableRowResourceData", "v2.table_row_resource_data_attributes" => "TableRowResourceDataAttributes", "v2.table_row_resource_data_type" => "TableRowResourceDataType", + "v2.tag_policies_response" => "TagPoliciesResponse", + "v2.tag_policy_attributes_request" => "TagPolicyAttributesRequest", + "v2.tag_policy_attributes_response" => "TagPolicyAttributesResponse", + "v2.tag_policy_attributes_update_request" => "TagPolicyAttributesUpdateRequest", + "v2.tag_policy_create_request" => "TagPolicyCreateRequest", + "v2.tag_policy_data_request" => "TagPolicyDataRequest", + "v2.tag_policy_data_response" => "TagPolicyDataResponse", + "v2.tag_policy_data_update_request" => "TagPolicyDataUpdateRequest", + "v2.tag_policy_response" => "TagPolicyResponse", + "v2.tag_policy_score_attributes_response" => "TagPolicyScoreAttributesResponse", + "v2.tag_policy_score_data_response" => "TagPolicyScoreDataResponse", + "v2.tag_policy_score_response" => "TagPolicyScoreResponse", + "v2.tag_policy_score_type" => "TagPolicyScoreType", + "v2.tag_policy_type" => "TagPolicyType", + "v2.tag_policy_update_request" => "TagPolicyUpdateRequest", "v2.team" => "Team", "v2.team_attributes" => "TeamAttributes", "v2.team_connection" => "TeamConnection", @@ -5215,6 +5234,7 @@ def overrides "v2.opsgenie_integration_api" => "OpsgenieIntegrationAPI", "v2.org_connections_api" => "OrgConnectionsAPI", "v2.organizations_api" => "OrganizationsAPI", + "v2.policy_management_api" => "PolicyManagementAPI", "v2.powerpack_api" => "PowerpackAPI", "v2.processes_api" => "ProcessesAPI", "v2.product_analytics_api" => "ProductAnalyticsAPI", @@ -5239,6 +5259,7 @@ def overrides "v2.static_analysis_api" => "StaticAnalysisAPI", "v2.status_pages_api" => "StatusPagesAPI", "v2.synthetics_api" => "SyntheticsAPI", + "v2.tag_policies_api" => "TagPoliciesAPI", "v2.teams_api" => "TeamsAPI", "v2.test_optimization_api" => "TestOptimizationAPI", "v2.usage_metering_api" => "UsageMeteringAPI", diff --git a/lib/datadog_api_client/v2/api/policy_management_api.rb b/lib/datadog_api_client/v2/api/policy_management_api.rb new file mode 100644 index 00000000000..18a2c7e5803 --- /dev/null +++ b/lib/datadog_api_client/v2/api/policy_management_api.rb @@ -0,0 +1,97 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'cgi' + +module DatadogAPIClient::V2 + class PolicyManagementAPI + attr_accessor :api_client + + def initialize(api_client = DatadogAPIClient::APIClient.default) + @api_client = api_client + end + + # Evaluate policy result. + # + # @see #evaluate_policy_result_with_http_info + def evaluate_policy_result(policy_type, opts = {}) + data, _status_code, _headers = evaluate_policy_result_with_http_info(policy_type, opts) + data + end + + # Evaluate policy result. + # + # Retrieve the evaluation result for a specific policy type. + # + # @param policy_type [String] The type of policy to evaluate (e.g., SAML, HIPAA). + # @param opts [Hash] the optional parameters + # @return [Array<(PolicyResultResponse, Integer, Hash)>] PolicyResultResponse data, response status code and response headers + def evaluate_policy_result_with_http_info(policy_type, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.evaluate_policy_result".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.evaluate_policy_result") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.evaluate_policy_result")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: PolicyManagementAPI.evaluate_policy_result ...' + end + # verify the required parameter 'policy_type' is set + if @api_client.config.client_side_validation && policy_type.nil? + fail ArgumentError, "Missing the required parameter 'policy_type' when calling PolicyManagementAPI.evaluate_policy_result" + end + # resource path + local_var_path = '/api/v2/policy/{policy_type}/result'.sub('{policy_type}', CGI.escape(policy_type.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'PolicyResultResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :evaluate_policy_result, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: PolicyManagementAPI#evaluate_policy_result\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/datadog_api_client/v2/api/tag_policies_api.rb b/lib/datadog_api_client/v2/api/tag_policies_api.rb new file mode 100644 index 00000000000..7cef084ee7c --- /dev/null +++ b/lib/datadog_api_client/v2/api/tag_policies_api.rb @@ -0,0 +1,458 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'cgi' + +module DatadogAPIClient::V2 + class TagPoliciesAPI + attr_accessor :api_client + + def initialize(api_client = DatadogAPIClient::APIClient.default) + @api_client = api_client + end + + # Create a tag policy. + # + # @see #create_tag_policy_with_http_info + def create_tag_policy(body, opts = {}) + data, _status_code, _headers = create_tag_policy_with_http_info(body, opts) + data + end + + # Create a tag policy. + # + # Create a new tag policy for the organization. + # + # @param body [TagPolicyCreateRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(TagPolicyResponse, Integer, Hash)>] TagPolicyResponse data, response status code and response headers + def create_tag_policy_with_http_info(body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.create_tag_policy".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.create_tag_policy") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.create_tag_policy")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: TagPoliciesAPI.create_tag_policy ...' + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling TagPoliciesAPI.create_tag_policy" + end + # resource path + local_var_path = '/api/v2/tag-policies' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'TagPolicyResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :create_tag_policy, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: TagPoliciesAPI#create_tag_policy\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Delete a tag policy. + # + # @see #delete_tag_policy_with_http_info + def delete_tag_policy(policy_id, opts = {}) + delete_tag_policy_with_http_info(policy_id, opts) + nil + end + + # Delete a tag policy. + # + # Delete a specific tag policy by its ID. + # + # @param policy_id [String] The ID of the tag policy. + # @param opts [Hash] the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def delete_tag_policy_with_http_info(policy_id, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.delete_tag_policy".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.delete_tag_policy") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.delete_tag_policy")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: TagPoliciesAPI.delete_tag_policy ...' + end + # verify the required parameter 'policy_id' is set + if @api_client.config.client_side_validation && policy_id.nil? + fail ArgumentError, "Missing the required parameter 'policy_id' when calling TagPoliciesAPI.delete_tag_policy" + end + # resource path + local_var_path = '/api/v2/tag-policies/{policy_id}'.sub('{policy_id}', CGI.escape(policy_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['*/*']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :delete_tag_policy, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Delete, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: TagPoliciesAPI#delete_tag_policy\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get a tag policy. + # + # @see #get_tag_policy_with_http_info + def get_tag_policy(policy_id, opts = {}) + data, _status_code, _headers = get_tag_policy_with_http_info(policy_id, opts) + data + end + + # Get a tag policy. + # + # Retrieve a specific tag policy by its ID. + # + # @param policy_id [String] The ID of the tag policy. + # @param opts [Hash] the optional parameters + # @return [Array<(TagPolicyResponse, Integer, Hash)>] TagPolicyResponse data, response status code and response headers + def get_tag_policy_with_http_info(policy_id, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.get_tag_policy".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.get_tag_policy") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.get_tag_policy")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: TagPoliciesAPI.get_tag_policy ...' + end + # verify the required parameter 'policy_id' is set + if @api_client.config.client_side_validation && policy_id.nil? + fail ArgumentError, "Missing the required parameter 'policy_id' when calling TagPoliciesAPI.get_tag_policy" + end + # resource path + local_var_path = '/api/v2/tag-policies/{policy_id}'.sub('{policy_id}', CGI.escape(policy_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'TagPolicyResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :get_tag_policy, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: TagPoliciesAPI#get_tag_policy\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get tag policy score. + # + # @see #get_tag_policy_score_with_http_info + def get_tag_policy_score(policy_id, opts = {}) + data, _status_code, _headers = get_tag_policy_score_with_http_info(policy_id, opts) + data + end + + # Get tag policy score. + # + # Retrieve the compliance score for a specific tag policy. + # + # @param policy_id [String] The ID of the tag policy. + # @param opts [Hash] the optional parameters + # @return [Array<(TagPolicyScoreResponse, Integer, Hash)>] TagPolicyScoreResponse data, response status code and response headers + def get_tag_policy_score_with_http_info(policy_id, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.get_tag_policy_score".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.get_tag_policy_score") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.get_tag_policy_score")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: TagPoliciesAPI.get_tag_policy_score ...' + end + # verify the required parameter 'policy_id' is set + if @api_client.config.client_side_validation && policy_id.nil? + fail ArgumentError, "Missing the required parameter 'policy_id' when calling TagPoliciesAPI.get_tag_policy_score" + end + # resource path + local_var_path = '/api/v2/tag-policies/{policy_id}/score'.sub('{policy_id}', CGI.escape(policy_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'TagPolicyScoreResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :get_tag_policy_score, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: TagPoliciesAPI#get_tag_policy_score\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List tag policies. + # + # @see #list_tag_policies_with_http_info + def list_tag_policies(opts = {}) + data, _status_code, _headers = list_tag_policies_with_http_info(opts) + data + end + + # List tag policies. + # + # Retrieve a list of all tag policies for the organization. + # + # @param opts [Hash] the optional parameters + # @option opts [String] :filter_source Filter policies by data source (e.g., logs, metrics). + # @return [Array<(TagPoliciesResponse, Integer, Hash)>] TagPoliciesResponse data, response status code and response headers + def list_tag_policies_with_http_info(opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.list_tag_policies".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.list_tag_policies") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.list_tag_policies")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: TagPoliciesAPI.list_tag_policies ...' + end + # resource path + local_var_path = '/api/v2/tag-policies' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'filter[source]'] = opts[:'filter_source'] if !opts[:'filter_source'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'TagPoliciesResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :list_tag_policies, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: TagPoliciesAPI#list_tag_policies\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Update a tag policy. + # + # @see #update_tag_policy_with_http_info + def update_tag_policy(policy_id, body, opts = {}) + data, _status_code, _headers = update_tag_policy_with_http_info(policy_id, body, opts) + data + end + + # Update a tag policy. + # + # Update an existing tag policy by its ID. + # + # @param policy_id [String] The ID of the tag policy. + # @param body [TagPolicyUpdateRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(TagPolicyResponse, Integer, Hash)>] TagPolicyResponse data, response status code and response headers + def update_tag_policy_with_http_info(policy_id, body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.update_tag_policy".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.update_tag_policy") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.update_tag_policy")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: TagPoliciesAPI.update_tag_policy ...' + end + # verify the required parameter 'policy_id' is set + if @api_client.config.client_side_validation && policy_id.nil? + fail ArgumentError, "Missing the required parameter 'policy_id' when calling TagPoliciesAPI.update_tag_policy" + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling TagPoliciesAPI.update_tag_policy" + end + # resource path + local_var_path = '/api/v2/tag-policies/{policy_id}'.sub('{policy_id}', CGI.escape(policy_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'TagPolicyResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :update_tag_policy, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Patch, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: TagPoliciesAPI#update_tag_policy\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/datadog_api_client/v2/models/policy_result_attributes_response.rb b/lib/datadog_api_client/v2/models/policy_result_attributes_response.rb new file mode 100644 index 00000000000..1b1c9c37e12 --- /dev/null +++ b/lib/datadog_api_client/v2/models/policy_result_attributes_response.rb @@ -0,0 +1,186 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes of a policy evaluation result. + class PolicyResultAttributesResponse + include BaseGenericModel + + # Whether the policy is active. + attr_reader :active + + # The policy configuration payload. + attr_reader :payload + + # The type of policy being evaluated. + attr_reader :policy_type + + # The organization UUID reference. + attr_reader :reference_org_uuid + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'active' => :'active', + :'payload' => :'payload', + :'policy_type' => :'policy_type', + :'reference_org_uuid' => :'reference_org_uuid' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'active' => :'Boolean', + :'payload' => :'Object', + :'policy_type' => :'String', + :'reference_org_uuid' => :'UUID' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::PolicyResultAttributesResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'active') + self.active = attributes[:'active'] + end + + if attributes.key?(:'payload') + self.payload = attributes[:'payload'] + end + + if attributes.key?(:'policy_type') + self.policy_type = attributes[:'policy_type'] + end + + if attributes.key?(:'reference_org_uuid') + self.reference_org_uuid = attributes[:'reference_org_uuid'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @active.nil? + return false if @payload.nil? + return false if @policy_type.nil? + return false if @reference_org_uuid.nil? + true + end + + # Custom attribute writer method with validation + # @param active [Object] Object to be assigned + # @!visibility private + def active=(active) + if active.nil? + fail ArgumentError, 'invalid value for "active", active cannot be nil.' + end + @active = active + end + + # Custom attribute writer method with validation + # @param payload [Object] Object to be assigned + # @!visibility private + def payload=(payload) + if payload.nil? + fail ArgumentError, 'invalid value for "payload", payload cannot be nil.' + end + @payload = payload + end + + # Custom attribute writer method with validation + # @param policy_type [Object] Object to be assigned + # @!visibility private + def policy_type=(policy_type) + if policy_type.nil? + fail ArgumentError, 'invalid value for "policy_type", policy_type cannot be nil.' + end + @policy_type = policy_type + end + + # Custom attribute writer method with validation + # @param reference_org_uuid [Object] Object to be assigned + # @!visibility private + def reference_org_uuid=(reference_org_uuid) + if reference_org_uuid.nil? + fail ArgumentError, 'invalid value for "reference_org_uuid", reference_org_uuid cannot be nil.' + end + @reference_org_uuid = reference_org_uuid + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + active == o.active && + payload == o.payload && + policy_type == o.policy_type && + reference_org_uuid == o.reference_org_uuid && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [active, payload, policy_type, reference_org_uuid, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/policy_result_data_response.rb b/lib/datadog_api_client/v2/models/policy_result_data_response.rb new file mode 100644 index 00000000000..312797129fa --- /dev/null +++ b/lib/datadog_api_client/v2/models/policy_result_data_response.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Data envelope for policy result response. + class PolicyResultDataResponse + include BaseGenericModel + + # Attributes of a policy evaluation result. + attr_reader :attributes + + # The unique identifier of the policy result. + attr_reader :id + + # The type of the resource. The value should always be `policy_result`. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'PolicyResultAttributesResponse', + :'id' => :'String', + :'type' => :'PolicyResultType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::PolicyResultDataResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/policy_result_response.rb b/lib/datadog_api_client/v2/models/policy_result_response.rb new file mode 100644 index 00000000000..5b49f780882 --- /dev/null +++ b/lib/datadog_api_client/v2/models/policy_result_response.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Response for policy evaluation result. + class PolicyResultResponse + include BaseGenericModel + + # Data envelope for policy result response. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'PolicyResultDataResponse' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::PolicyResultResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/policy_result_type.rb b/lib/datadog_api_client/v2/models/policy_result_type.rb new file mode 100644 index 00000000000..cbbc6176f50 --- /dev/null +++ b/lib/datadog_api_client/v2/models/policy_result_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The type of the resource. The value should always be `policy_result`. + class PolicyResultType + include BaseEnumModel + + POLICY_RESULT = "policy_result".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/tag_policies_response.rb b/lib/datadog_api_client/v2/models/tag_policies_response.rb new file mode 100644 index 00000000000..7e0b152018b --- /dev/null +++ b/lib/datadog_api_client/v2/models/tag_policies_response.rb @@ -0,0 +1,125 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Response for listing tag policies. + class TagPoliciesResponse + include BaseGenericModel + + # List of tag policies. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TagPoliciesResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/tag_policy_attributes_request.rb b/lib/datadog_api_client/v2/models/tag_policy_attributes_request.rb new file mode 100644 index 00000000000..18c83cda48c --- /dev/null +++ b/lib/datadog_api_client/v2/models/tag_policy_attributes_request.rb @@ -0,0 +1,272 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes for creating or updating a tag policy. + class TagPolicyAttributesRequest + include BaseGenericModel + + # Whether the policy is enabled. + attr_reader :enabled + + # Whether the policy is negated. + attr_reader :negated + + # The name of the tag policy. + attr_reader :policy_name + + # Whether the tag is required. + attr_reader :required + + # The scope of the tag policy. + attr_reader :scope + + # The data source for the tag policy (e.g., logs, metrics). + attr_reader :source + + # The tag key that the policy applies to. + attr_reader :tag_key + + # List of patterns that tag values must match. + attr_reader :tag_value_patterns + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'enabled' => :'enabled', + :'negated' => :'negated', + :'policy_name' => :'policy_name', + :'required' => :'required', + :'scope' => :'scope', + :'source' => :'source', + :'tag_key' => :'tag_key', + :'tag_value_patterns' => :'tag_value_patterns' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'enabled' => :'Boolean', + :'negated' => :'Boolean', + :'policy_name' => :'String', + :'required' => :'Boolean', + :'scope' => :'String', + :'source' => :'String', + :'tag_key' => :'String', + :'tag_value_patterns' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TagPolicyAttributesRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'enabled') + self.enabled = attributes[:'enabled'] + end + + if attributes.key?(:'negated') + self.negated = attributes[:'negated'] + end + + if attributes.key?(:'policy_name') + self.policy_name = attributes[:'policy_name'] + end + + if attributes.key?(:'required') + self.required = attributes[:'required'] + end + + if attributes.key?(:'scope') + self.scope = attributes[:'scope'] + end + + if attributes.key?(:'source') + self.source = attributes[:'source'] + end + + if attributes.key?(:'tag_key') + self.tag_key = attributes[:'tag_key'] + end + + if attributes.key?(:'tag_value_patterns') + if (value = attributes[:'tag_value_patterns']).is_a?(Array) + self.tag_value_patterns = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @enabled.nil? + return false if @negated.nil? + return false if @policy_name.nil? + return false if @required.nil? + return false if @scope.nil? + return false if @source.nil? + return false if @tag_key.nil? + return false if @tag_value_patterns.nil? + true + end + + # Custom attribute writer method with validation + # @param enabled [Object] Object to be assigned + # @!visibility private + def enabled=(enabled) + if enabled.nil? + fail ArgumentError, 'invalid value for "enabled", enabled cannot be nil.' + end + @enabled = enabled + end + + # Custom attribute writer method with validation + # @param negated [Object] Object to be assigned + # @!visibility private + def negated=(negated) + if negated.nil? + fail ArgumentError, 'invalid value for "negated", negated cannot be nil.' + end + @negated = negated + end + + # Custom attribute writer method with validation + # @param policy_name [Object] Object to be assigned + # @!visibility private + def policy_name=(policy_name) + if policy_name.nil? + fail ArgumentError, 'invalid value for "policy_name", policy_name cannot be nil.' + end + @policy_name = policy_name + end + + # Custom attribute writer method with validation + # @param required [Object] Object to be assigned + # @!visibility private + def required=(required) + if required.nil? + fail ArgumentError, 'invalid value for "required", required cannot be nil.' + end + @required = required + end + + # Custom attribute writer method with validation + # @param scope [Object] Object to be assigned + # @!visibility private + def scope=(scope) + if scope.nil? + fail ArgumentError, 'invalid value for "scope", scope cannot be nil.' + end + @scope = scope + end + + # Custom attribute writer method with validation + # @param source [Object] Object to be assigned + # @!visibility private + def source=(source) + if source.nil? + fail ArgumentError, 'invalid value for "source", source cannot be nil.' + end + @source = source + end + + # Custom attribute writer method with validation + # @param tag_key [Object] Object to be assigned + # @!visibility private + def tag_key=(tag_key) + if tag_key.nil? + fail ArgumentError, 'invalid value for "tag_key", tag_key cannot be nil.' + end + @tag_key = tag_key + end + + # Custom attribute writer method with validation + # @param tag_value_patterns [Object] Object to be assigned + # @!visibility private + def tag_value_patterns=(tag_value_patterns) + if tag_value_patterns.nil? + fail ArgumentError, 'invalid value for "tag_value_patterns", tag_value_patterns cannot be nil.' + end + @tag_value_patterns = tag_value_patterns + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + enabled == o.enabled && + negated == o.negated && + policy_name == o.policy_name && + required == o.required && + scope == o.scope && + source == o.source && + tag_key == o.tag_key && + tag_value_patterns == o.tag_value_patterns && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [enabled, negated, policy_name, required, scope, source, tag_key, tag_value_patterns, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/tag_policy_attributes_response.rb b/lib/datadog_api_client/v2/models/tag_policy_attributes_response.rb new file mode 100644 index 00000000000..e13227d40e5 --- /dev/null +++ b/lib/datadog_api_client/v2/models/tag_policy_attributes_response.rb @@ -0,0 +1,377 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes of a tag policy response. + class TagPolicyAttributesResponse + include BaseGenericModel + + # Timestamp when the policy was created. + attr_reader :created_at + + # User who created the policy. + attr_reader :created_by + + # Whether the policy is enabled. + attr_reader :enabled + + # Timestamp when the policy was last modified. + attr_reader :modified_at + + # User who last modified the policy. + attr_reader :modified_by + + # Whether the policy is negated. + attr_reader :negated + + # The name of the tag policy. + attr_reader :policy_name + + # Whether the tag is required. + attr_reader :required + + # The scope of the tag policy. + attr_reader :scope + + # The data source for the tag policy (e.g., logs, metrics). + attr_reader :source + + # The tag key that the policy applies to. + attr_reader :tag_key + + # List of patterns that tag values must match. + attr_reader :tag_value_patterns + + # The version of the tag policy. + attr_reader :version + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'created_at' => :'created_at', + :'created_by' => :'created_by', + :'enabled' => :'enabled', + :'modified_at' => :'modified_at', + :'modified_by' => :'modified_by', + :'negated' => :'negated', + :'policy_name' => :'policy_name', + :'required' => :'required', + :'scope' => :'scope', + :'source' => :'source', + :'tag_key' => :'tag_key', + :'tag_value_patterns' => :'tag_value_patterns', + :'version' => :'version' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'created_at' => :'Time', + :'created_by' => :'String', + :'enabled' => :'Boolean', + :'modified_at' => :'Time', + :'modified_by' => :'String', + :'negated' => :'Boolean', + :'policy_name' => :'String', + :'required' => :'Boolean', + :'scope' => :'String', + :'source' => :'String', + :'tag_key' => :'String', + :'tag_value_patterns' => :'Array', + :'version' => :'Integer' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TagPolicyAttributesResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'created_by') + self.created_by = attributes[:'created_by'] + end + + if attributes.key?(:'enabled') + self.enabled = attributes[:'enabled'] + end + + if attributes.key?(:'modified_at') + self.modified_at = attributes[:'modified_at'] + end + + if attributes.key?(:'modified_by') + self.modified_by = attributes[:'modified_by'] + end + + if attributes.key?(:'negated') + self.negated = attributes[:'negated'] + end + + if attributes.key?(:'policy_name') + self.policy_name = attributes[:'policy_name'] + end + + if attributes.key?(:'required') + self.required = attributes[:'required'] + end + + if attributes.key?(:'scope') + self.scope = attributes[:'scope'] + end + + if attributes.key?(:'source') + self.source = attributes[:'source'] + end + + if attributes.key?(:'tag_key') + self.tag_key = attributes[:'tag_key'] + end + + if attributes.key?(:'tag_value_patterns') + if (value = attributes[:'tag_value_patterns']).is_a?(Array) + self.tag_value_patterns = value + end + end + + if attributes.key?(:'version') + self.version = attributes[:'version'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @created_at.nil? + return false if @created_by.nil? + return false if @enabled.nil? + return false if @modified_at.nil? + return false if @modified_by.nil? + return false if @negated.nil? + return false if @policy_name.nil? + return false if @required.nil? + return false if @scope.nil? + return false if @source.nil? + return false if @tag_key.nil? + return false if @tag_value_patterns.nil? + return false if @version.nil? + true + end + + # Custom attribute writer method with validation + # @param created_at [Object] Object to be assigned + # @!visibility private + def created_at=(created_at) + if created_at.nil? + fail ArgumentError, 'invalid value for "created_at", created_at cannot be nil.' + end + @created_at = created_at + end + + # Custom attribute writer method with validation + # @param created_by [Object] Object to be assigned + # @!visibility private + def created_by=(created_by) + if created_by.nil? + fail ArgumentError, 'invalid value for "created_by", created_by cannot be nil.' + end + @created_by = created_by + end + + # Custom attribute writer method with validation + # @param enabled [Object] Object to be assigned + # @!visibility private + def enabled=(enabled) + if enabled.nil? + fail ArgumentError, 'invalid value for "enabled", enabled cannot be nil.' + end + @enabled = enabled + end + + # Custom attribute writer method with validation + # @param modified_at [Object] Object to be assigned + # @!visibility private + def modified_at=(modified_at) + if modified_at.nil? + fail ArgumentError, 'invalid value for "modified_at", modified_at cannot be nil.' + end + @modified_at = modified_at + end + + # Custom attribute writer method with validation + # @param modified_by [Object] Object to be assigned + # @!visibility private + def modified_by=(modified_by) + if modified_by.nil? + fail ArgumentError, 'invalid value for "modified_by", modified_by cannot be nil.' + end + @modified_by = modified_by + end + + # Custom attribute writer method with validation + # @param negated [Object] Object to be assigned + # @!visibility private + def negated=(negated) + if negated.nil? + fail ArgumentError, 'invalid value for "negated", negated cannot be nil.' + end + @negated = negated + end + + # Custom attribute writer method with validation + # @param policy_name [Object] Object to be assigned + # @!visibility private + def policy_name=(policy_name) + if policy_name.nil? + fail ArgumentError, 'invalid value for "policy_name", policy_name cannot be nil.' + end + @policy_name = policy_name + end + + # Custom attribute writer method with validation + # @param required [Object] Object to be assigned + # @!visibility private + def required=(required) + if required.nil? + fail ArgumentError, 'invalid value for "required", required cannot be nil.' + end + @required = required + end + + # Custom attribute writer method with validation + # @param scope [Object] Object to be assigned + # @!visibility private + def scope=(scope) + if scope.nil? + fail ArgumentError, 'invalid value for "scope", scope cannot be nil.' + end + @scope = scope + end + + # Custom attribute writer method with validation + # @param source [Object] Object to be assigned + # @!visibility private + def source=(source) + if source.nil? + fail ArgumentError, 'invalid value for "source", source cannot be nil.' + end + @source = source + end + + # Custom attribute writer method with validation + # @param tag_key [Object] Object to be assigned + # @!visibility private + def tag_key=(tag_key) + if tag_key.nil? + fail ArgumentError, 'invalid value for "tag_key", tag_key cannot be nil.' + end + @tag_key = tag_key + end + + # Custom attribute writer method with validation + # @param tag_value_patterns [Object] Object to be assigned + # @!visibility private + def tag_value_patterns=(tag_value_patterns) + if tag_value_patterns.nil? + fail ArgumentError, 'invalid value for "tag_value_patterns", tag_value_patterns cannot be nil.' + end + @tag_value_patterns = tag_value_patterns + end + + # Custom attribute writer method with validation + # @param version [Object] Object to be assigned + # @!visibility private + def version=(version) + if version.nil? + fail ArgumentError, 'invalid value for "version", version cannot be nil.' + end + @version = version + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + created_at == o.created_at && + created_by == o.created_by && + enabled == o.enabled && + modified_at == o.modified_at && + modified_by == o.modified_by && + negated == o.negated && + policy_name == o.policy_name && + required == o.required && + scope == o.scope && + source == o.source && + tag_key == o.tag_key && + tag_value_patterns == o.tag_value_patterns && + version == o.version && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [created_at, created_by, enabled, modified_at, modified_by, negated, policy_name, required, scope, source, tag_key, tag_value_patterns, version, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/tag_policy_attributes_update_request.rb b/lib/datadog_api_client/v2/models/tag_policy_attributes_update_request.rb new file mode 100644 index 00000000000..1713f1ccc85 --- /dev/null +++ b/lib/datadog_api_client/v2/models/tag_policy_attributes_update_request.rb @@ -0,0 +1,177 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes for updating a tag policy. All fields are optional. + class TagPolicyAttributesUpdateRequest + include BaseGenericModel + + # Whether the policy is enabled. + attr_accessor :enabled + + # Whether the policy is negated. + attr_accessor :negated + + # The name of the tag policy. + attr_accessor :policy_name + + # Whether the tag is required. + attr_accessor :required + + # The scope of the tag policy. + attr_accessor :scope + + # The data source for the tag policy (e.g., logs, metrics). + attr_accessor :source + + # The tag key that the policy applies to. + attr_accessor :tag_key + + # List of patterns that tag values must match. + attr_accessor :tag_value_patterns + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'enabled' => :'enabled', + :'negated' => :'negated', + :'policy_name' => :'policy_name', + :'required' => :'required', + :'scope' => :'scope', + :'source' => :'source', + :'tag_key' => :'tag_key', + :'tag_value_patterns' => :'tag_value_patterns' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'enabled' => :'Boolean', + :'negated' => :'Boolean', + :'policy_name' => :'String', + :'required' => :'Boolean', + :'scope' => :'String', + :'source' => :'String', + :'tag_key' => :'String', + :'tag_value_patterns' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TagPolicyAttributesUpdateRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'enabled') + self.enabled = attributes[:'enabled'] + end + + if attributes.key?(:'negated') + self.negated = attributes[:'negated'] + end + + if attributes.key?(:'policy_name') + self.policy_name = attributes[:'policy_name'] + end + + if attributes.key?(:'required') + self.required = attributes[:'required'] + end + + if attributes.key?(:'scope') + self.scope = attributes[:'scope'] + end + + if attributes.key?(:'source') + self.source = attributes[:'source'] + end + + if attributes.key?(:'tag_key') + self.tag_key = attributes[:'tag_key'] + end + + if attributes.key?(:'tag_value_patterns') + if (value = attributes[:'tag_value_patterns']).is_a?(Array) + self.tag_value_patterns = value + end + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + enabled == o.enabled && + negated == o.negated && + policy_name == o.policy_name && + required == o.required && + scope == o.scope && + source == o.source && + tag_key == o.tag_key && + tag_value_patterns == o.tag_value_patterns && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [enabled, negated, policy_name, required, scope, source, tag_key, tag_value_patterns, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/tag_policy_create_request.rb b/lib/datadog_api_client/v2/models/tag_policy_create_request.rb new file mode 100644 index 00000000000..8b5ddc50d44 --- /dev/null +++ b/lib/datadog_api_client/v2/models/tag_policy_create_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Request for creating a tag policy. + class TagPolicyCreateRequest + include BaseGenericModel + + # Data envelope for tag policy create request. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'TagPolicyDataRequest' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TagPolicyCreateRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/tag_policy_data_request.rb b/lib/datadog_api_client/v2/models/tag_policy_data_request.rb new file mode 100644 index 00000000000..561031b1d5e --- /dev/null +++ b/lib/datadog_api_client/v2/models/tag_policy_data_request.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Data envelope for tag policy create request. + class TagPolicyDataRequest + include BaseGenericModel + + # Attributes for creating or updating a tag policy. + attr_reader :attributes + + # The type of the resource. The value should always be `tag_policy`. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'TagPolicyAttributesRequest', + :'type' => :'TagPolicyType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TagPolicyDataRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/tag_policy_data_response.rb b/lib/datadog_api_client/v2/models/tag_policy_data_response.rb new file mode 100644 index 00000000000..3b9c50473ca --- /dev/null +++ b/lib/datadog_api_client/v2/models/tag_policy_data_response.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Data envelope for tag policy response. + class TagPolicyDataResponse + include BaseGenericModel + + # Attributes of a tag policy response. + attr_reader :attributes + + # The unique identifier of the tag policy. + attr_reader :id + + # The type of the resource. The value should always be `tag_policy`. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'TagPolicyAttributesResponse', + :'id' => :'String', + :'type' => :'TagPolicyType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TagPolicyDataResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/tag_policy_data_update_request.rb b/lib/datadog_api_client/v2/models/tag_policy_data_update_request.rb new file mode 100644 index 00000000000..9f60237afcd --- /dev/null +++ b/lib/datadog_api_client/v2/models/tag_policy_data_update_request.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Data envelope for tag policy update request. + class TagPolicyDataUpdateRequest + include BaseGenericModel + + # Attributes for updating a tag policy. All fields are optional. + attr_reader :attributes + + # The type of the resource. The value should always be `tag_policy`. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'TagPolicyAttributesUpdateRequest', + :'type' => :'TagPolicyType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TagPolicyDataUpdateRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/tag_policy_response.rb b/lib/datadog_api_client/v2/models/tag_policy_response.rb new file mode 100644 index 00000000000..341412501ac --- /dev/null +++ b/lib/datadog_api_client/v2/models/tag_policy_response.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Response for a single tag policy. + class TagPolicyResponse + include BaseGenericModel + + # Data envelope for tag policy response. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'TagPolicyDataResponse' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TagPolicyResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/tag_policy_score_attributes_response.rb b/lib/datadog_api_client/v2/models/tag_policy_score_attributes_response.rb new file mode 100644 index 00000000000..35897ffcbdc --- /dev/null +++ b/lib/datadog_api_client/v2/models/tag_policy_score_attributes_response.rb @@ -0,0 +1,175 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes of a tag policy score. + class TagPolicyScoreAttributesResponse + include BaseGenericModel + + # The compliance score for the tag policy. + attr_reader :score + + # End timestamp for the score calculation period. + attr_reader :ts_end + + # Start timestamp for the score calculation period. + attr_reader :ts_start + + # The version of the score. + attr_accessor :version + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'score' => :'score', + :'ts_end' => :'ts_end', + :'ts_start' => :'ts_start', + :'version' => :'version' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'score' => :'Float', + :'ts_end' => :'Integer', + :'ts_start' => :'Integer', + :'version' => :'Integer' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TagPolicyScoreAttributesResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'score') + self.score = attributes[:'score'] + end + + if attributes.key?(:'ts_end') + self.ts_end = attributes[:'ts_end'] + end + + if attributes.key?(:'ts_start') + self.ts_start = attributes[:'ts_start'] + end + + if attributes.key?(:'version') + self.version = attributes[:'version'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @score.nil? + return false if @ts_end.nil? + return false if @ts_start.nil? + true + end + + # Custom attribute writer method with validation + # @param score [Object] Object to be assigned + # @!visibility private + def score=(score) + if score.nil? + fail ArgumentError, 'invalid value for "score", score cannot be nil.' + end + @score = score + end + + # Custom attribute writer method with validation + # @param ts_end [Object] Object to be assigned + # @!visibility private + def ts_end=(ts_end) + if ts_end.nil? + fail ArgumentError, 'invalid value for "ts_end", ts_end cannot be nil.' + end + @ts_end = ts_end + end + + # Custom attribute writer method with validation + # @param ts_start [Object] Object to be assigned + # @!visibility private + def ts_start=(ts_start) + if ts_start.nil? + fail ArgumentError, 'invalid value for "ts_start", ts_start cannot be nil.' + end + @ts_start = ts_start + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + score == o.score && + ts_end == o.ts_end && + ts_start == o.ts_start && + version == o.version && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [score, ts_end, ts_start, version, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/tag_policy_score_data_response.rb b/lib/datadog_api_client/v2/models/tag_policy_score_data_response.rb new file mode 100644 index 00000000000..4ee1d10038c --- /dev/null +++ b/lib/datadog_api_client/v2/models/tag_policy_score_data_response.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Data envelope for tag policy score response. + class TagPolicyScoreDataResponse + include BaseGenericModel + + # Attributes of a tag policy score. + attr_reader :attributes + + # The unique identifier of the score. + attr_reader :id + + # The type of the resource. The value should always be `tag_policy_score`. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'TagPolicyScoreAttributesResponse', + :'id' => :'String', + :'type' => :'TagPolicyScoreType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TagPolicyScoreDataResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/tag_policy_score_response.rb b/lib/datadog_api_client/v2/models/tag_policy_score_response.rb new file mode 100644 index 00000000000..ae179208f4e --- /dev/null +++ b/lib/datadog_api_client/v2/models/tag_policy_score_response.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Response for a tag policy score. + class TagPolicyScoreResponse + include BaseGenericModel + + # Data envelope for tag policy score response. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'TagPolicyScoreDataResponse' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TagPolicyScoreResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/tag_policy_score_type.rb b/lib/datadog_api_client/v2/models/tag_policy_score_type.rb new file mode 100644 index 00000000000..90874a350e6 --- /dev/null +++ b/lib/datadog_api_client/v2/models/tag_policy_score_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The type of the resource. The value should always be `tag_policy_score`. + class TagPolicyScoreType + include BaseEnumModel + + TAG_POLICY_SCORE = "tag_policy_score".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/tag_policy_type.rb b/lib/datadog_api_client/v2/models/tag_policy_type.rb new file mode 100644 index 00000000000..d0cc5476fc4 --- /dev/null +++ b/lib/datadog_api_client/v2/models/tag_policy_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The type of the resource. The value should always be `tag_policy`. + class TagPolicyType + include BaseEnumModel + + TAG_POLICY = "tag_policy".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/tag_policy_update_request.rb b/lib/datadog_api_client/v2/models/tag_policy_update_request.rb new file mode 100644 index 00000000000..55cb2c6585e --- /dev/null +++ b/lib/datadog_api_client/v2/models/tag_policy_update_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Request for updating a tag policy. + class TagPolicyUpdateRequest + include BaseGenericModel + + # Data envelope for tag policy update request. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'TagPolicyDataUpdateRequest' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TagPolicyUpdateRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end