diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index af969a3d7f..df3f0136c9 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/docs/datadog_api_client.v2.api.rst b/docs/datadog_api_client.v2.api.rst index 1bb879078c..c504c324f8 100644 --- a/docs/datadog_api_client.v2.api.rst +++ b/docs/datadog_api_client.v2.api.rst @@ -438,6 +438,13 @@ datadog\_api\_client.v2.api.organizations\_api module :members: :show-inheritance: +datadog\_api\_client.v2.api.policy\_management\_api module +---------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.api.policy_management_api + :members: + :show-inheritance: + datadog\_api\_client.v2.api.powerpack\_api module ------------------------------------------------- @@ -606,6 +613,13 @@ datadog\_api\_client.v2.api.synthetics\_api module :members: :show-inheritance: +datadog\_api\_client.v2.api.tag\_policies\_api module +----------------------------------------------------- + +.. automodule:: datadog_api_client.v2.api.tag_policies_api + :members: + :show-inheritance: + datadog\_api\_client.v2.api.teams\_api module --------------------------------------------- diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index 538d5aa411..7ed26dd1af 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -19478,6 +19478,34 @@ datadog\_api\_client.v2.model.permissions\_type module :members: :show-inheritance: +datadog\_api\_client.v2.model.policy\_result\_attributes\_response module +------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.policy_result_attributes_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.policy\_result\_data\_response module +------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.policy_result_data_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.policy\_result\_response module +------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.policy_result_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.policy\_result\_type module +--------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.policy_result_type + :members: + :show-inheritance: + datadog\_api\_client.v2.model.postmortem\_attachment\_request module -------------------------------------------------------------------- @@ -26667,6 +26695,111 @@ datadog\_api\_client.v2.model.table\_row\_resource\_data\_type module :members: :show-inheritance: +datadog\_api\_client.v2.model.tag\_policies\_response module +------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.tag_policies_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.tag\_policy\_attributes\_request module +--------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.tag_policy_attributes_request + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.tag\_policy\_attributes\_response module +---------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.tag_policy_attributes_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.tag\_policy\_attributes\_update\_request module +----------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.tag_policy_attributes_update_request + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.tag\_policy\_create\_request module +----------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.tag_policy_create_request + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.tag\_policy\_data\_request module +--------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.tag_policy_data_request + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.tag\_policy\_data\_response module +---------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.tag_policy_data_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.tag\_policy\_data\_update\_request module +----------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.tag_policy_data_update_request + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.tag\_policy\_response module +---------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.tag_policy_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.tag\_policy\_score\_attributes\_response module +----------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.tag_policy_score_attributes_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.tag\_policy\_score\_data\_response module +----------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.tag_policy_score_data_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.tag\_policy\_score\_response module +----------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.tag_policy_score_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.tag\_policy\_score\_type module +------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.tag_policy_score_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.tag\_policy\_type module +------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.tag_policy_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.tag\_policy\_update\_request module +----------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.tag_policy_update_request + :members: + :show-inheritance: + datadog\_api\_client.v2.model.tags\_event\_attribute module ----------------------------------------------------------- diff --git a/examples/v2/policy-management/EvaluatePolicyResult.py b/examples/v2/policy-management/EvaluatePolicyResult.py new file mode 100644 index 0000000000..d7681dbf4c --- /dev/null +++ b/examples/v2/policy-management/EvaluatePolicyResult.py @@ -0,0 +1,16 @@ +""" +Evaluate policy result returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.policy_management_api import PolicyManagementApi + +configuration = Configuration() +configuration.unstable_operations["evaluate_policy_result"] = True +with ApiClient(configuration) as api_client: + api_instance = PolicyManagementApi(api_client) + response = api_instance.evaluate_policy_result( + policy_type="SAML", + ) + + print(response) diff --git a/examples/v2/tag-policies/CreateTagPolicy.py b/examples/v2/tag-policies/CreateTagPolicy.py new file mode 100644 index 0000000000..566ce6270e --- /dev/null +++ b/examples/v2/tag-policies/CreateTagPolicy.py @@ -0,0 +1,37 @@ +""" +Create a tag policy returns "Created" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.tag_policies_api import TagPoliciesApi +from datadog_api_client.v2.model.tag_policy_attributes_request import TagPolicyAttributesRequest +from datadog_api_client.v2.model.tag_policy_create_request import TagPolicyCreateRequest +from datadog_api_client.v2.model.tag_policy_data_request import TagPolicyDataRequest +from datadog_api_client.v2.model.tag_policy_type import TagPolicyType + +body = TagPolicyCreateRequest( + data=TagPolicyDataRequest( + attributes=TagPolicyAttributesRequest( + enabled=True, + negated=False, + policy_name="production-tags-policy", + required=True, + scope="env", + source="logs", + tag_key="service", + tag_value_patterns=[ + "api", + "web", + ], + ), + type=TagPolicyType.TAG_POLICY, + ), +) + +configuration = Configuration() +configuration.unstable_operations["create_tag_policy"] = True +with ApiClient(configuration) as api_client: + api_instance = TagPoliciesApi(api_client) + response = api_instance.create_tag_policy(body=body) + + print(response) diff --git a/examples/v2/tag-policies/DeleteTagPolicy.py b/examples/v2/tag-policies/DeleteTagPolicy.py new file mode 100644 index 0000000000..7c361459ea --- /dev/null +++ b/examples/v2/tag-policies/DeleteTagPolicy.py @@ -0,0 +1,14 @@ +""" +Delete a tag policy returns "No Content" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.tag_policies_api import TagPoliciesApi + +configuration = Configuration() +configuration.unstable_operations["delete_tag_policy"] = True +with ApiClient(configuration) as api_client: + api_instance = TagPoliciesApi(api_client) + api_instance.delete_tag_policy( + policy_id="123", + ) diff --git a/examples/v2/tag-policies/GetTagPolicy.py b/examples/v2/tag-policies/GetTagPolicy.py new file mode 100644 index 0000000000..9a63c97ca1 --- /dev/null +++ b/examples/v2/tag-policies/GetTagPolicy.py @@ -0,0 +1,16 @@ +""" +Get a tag policy returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.tag_policies_api import TagPoliciesApi + +configuration = Configuration() +configuration.unstable_operations["get_tag_policy"] = True +with ApiClient(configuration) as api_client: + api_instance = TagPoliciesApi(api_client) + response = api_instance.get_tag_policy( + policy_id="123", + ) + + print(response) diff --git a/examples/v2/tag-policies/GetTagPolicyScore.py b/examples/v2/tag-policies/GetTagPolicyScore.py new file mode 100644 index 0000000000..629003b78b --- /dev/null +++ b/examples/v2/tag-policies/GetTagPolicyScore.py @@ -0,0 +1,16 @@ +""" +Get tag policy score returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.tag_policies_api import TagPoliciesApi + +configuration = Configuration() +configuration.unstable_operations["get_tag_policy_score"] = True +with ApiClient(configuration) as api_client: + api_instance = TagPoliciesApi(api_client) + response = api_instance.get_tag_policy_score( + policy_id="123", + ) + + print(response) diff --git a/examples/v2/tag-policies/ListTagPolicies.py b/examples/v2/tag-policies/ListTagPolicies.py new file mode 100644 index 0000000000..822c24d305 --- /dev/null +++ b/examples/v2/tag-policies/ListTagPolicies.py @@ -0,0 +1,14 @@ +""" +List tag policies returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.tag_policies_api import TagPoliciesApi + +configuration = Configuration() +configuration.unstable_operations["list_tag_policies"] = True +with ApiClient(configuration) as api_client: + api_instance = TagPoliciesApi(api_client) + response = api_instance.list_tag_policies() + + print(response) diff --git a/examples/v2/tag-policies/UpdateTagPolicy.py b/examples/v2/tag-policies/UpdateTagPolicy.py new file mode 100644 index 0000000000..7acdbe228c --- /dev/null +++ b/examples/v2/tag-policies/UpdateTagPolicy.py @@ -0,0 +1,37 @@ +""" +Update a tag policy returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.tag_policies_api import TagPoliciesApi +from datadog_api_client.v2.model.tag_policy_attributes_update_request import TagPolicyAttributesUpdateRequest +from datadog_api_client.v2.model.tag_policy_data_update_request import TagPolicyDataUpdateRequest +from datadog_api_client.v2.model.tag_policy_type import TagPolicyType +from datadog_api_client.v2.model.tag_policy_update_request import TagPolicyUpdateRequest + +body = TagPolicyUpdateRequest( + data=TagPolicyDataUpdateRequest( + attributes=TagPolicyAttributesUpdateRequest( + enabled=True, + negated=False, + policy_name="production-tags-policy", + required=True, + scope="env", + source="logs", + tag_key="service", + tag_value_patterns=[ + "api", + "web", + ], + ), + type=TagPolicyType.TAG_POLICY, + ), +) + +configuration = Configuration() +configuration.unstable_operations["update_tag_policy"] = True +with ApiClient(configuration) as api_client: + api_instance = TagPoliciesApi(api_client) + response = api_instance.update_tag_policy(policy_id="123", body=body) + + print(response) diff --git a/src/datadog_api_client/configuration.py b/src/datadog_api_client/configuration.py index 02c6e7a9be..6b421841d3 100644 --- a/src/datadog_api_client/configuration.py +++ b/src/datadog_api_client/configuration.py @@ -381,6 +381,7 @@ def __init__( "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, @@ -422,6 +423,12 @@ def __init__( "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/src/datadog_api_client/v2/api/policy_management_api.py b/src/datadog_api_client/v2/api/policy_management_api.py new file mode 100644 index 0000000000..884d913657 --- /dev/null +++ b/src/datadog_api_client/v2/api/policy_management_api.py @@ -0,0 +1,61 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Any, Dict + +from datadog_api_client.api_client import ApiClient, Endpoint as _Endpoint +from datadog_api_client.configuration import Configuration +from datadog_api_client.v2.model.policy_result_response import PolicyResultResponse + + +class PolicyManagementApi: + """ + Manage and evaluate organizational policies. + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient(Configuration()) + self.api_client = api_client + + self._evaluate_policy_result_endpoint = _Endpoint( + settings={ + "response_type": (PolicyResultResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/policy/{policy_type}/result", + "operation_id": "evaluate_policy_result", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "policy_type": { + "required": True, + "openapi_types": (str,), + "attribute": "policy_type", + "location": "path", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + + def evaluate_policy_result( + self, + policy_type: str, + ) -> PolicyResultResponse: + """Evaluate policy result. + + Retrieve the evaluation result for a specific policy type. + + :param policy_type: The type of policy to evaluate (e.g., SAML, HIPAA). + :type policy_type: str + :rtype: PolicyResultResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["policy_type"] = policy_type + + return self._evaluate_policy_result_endpoint.call_with_http_info(**kwargs) diff --git a/src/datadog_api_client/v2/api/tag_policies_api.py b/src/datadog_api_client/v2/api/tag_policies_api.py new file mode 100644 index 0000000000..6a28004d3a --- /dev/null +++ b/src/datadog_api_client/v2/api/tag_policies_api.py @@ -0,0 +1,273 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Any, Dict, Union + +from datadog_api_client.api_client import ApiClient, Endpoint as _Endpoint +from datadog_api_client.configuration import Configuration +from datadog_api_client.model_utils import ( + UnsetType, + unset, +) +from datadog_api_client.v2.model.tag_policies_response import TagPoliciesResponse +from datadog_api_client.v2.model.tag_policy_response import TagPolicyResponse +from datadog_api_client.v2.model.tag_policy_create_request import TagPolicyCreateRequest +from datadog_api_client.v2.model.tag_policy_update_request import TagPolicyUpdateRequest +from datadog_api_client.v2.model.tag_policy_score_response import TagPolicyScoreResponse + + +class TagPoliciesApi: + """ + Manage tag policies to enforce tagging standards across your organization. + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient(Configuration()) + self.api_client = api_client + + self._create_tag_policy_endpoint = _Endpoint( + settings={ + "response_type": (TagPolicyResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/tag-policies", + "operation_id": "create_tag_policy", + "http_method": "POST", + "version": "v2", + }, + params_map={ + "body": { + "required": True, + "openapi_types": (TagPolicyCreateRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + + self._delete_tag_policy_endpoint = _Endpoint( + settings={ + "response_type": None, + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/tag-policies/{policy_id}", + "operation_id": "delete_tag_policy", + "http_method": "DELETE", + "version": "v2", + }, + params_map={ + "policy_id": { + "required": True, + "openapi_types": (str,), + "attribute": "policy_id", + "location": "path", + }, + }, + headers_map={ + "accept": ["*/*"], + }, + api_client=api_client, + ) + + self._get_tag_policy_endpoint = _Endpoint( + settings={ + "response_type": (TagPolicyResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/tag-policies/{policy_id}", + "operation_id": "get_tag_policy", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "policy_id": { + "required": True, + "openapi_types": (str,), + "attribute": "policy_id", + "location": "path", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + + self._get_tag_policy_score_endpoint = _Endpoint( + settings={ + "response_type": (TagPolicyScoreResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/tag-policies/{policy_id}/score", + "operation_id": "get_tag_policy_score", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "policy_id": { + "required": True, + "openapi_types": (str,), + "attribute": "policy_id", + "location": "path", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + + self._list_tag_policies_endpoint = _Endpoint( + settings={ + "response_type": (TagPoliciesResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/tag-policies", + "operation_id": "list_tag_policies", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "filter_source": { + "openapi_types": (str,), + "attribute": "filter[source]", + "location": "query", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + + self._update_tag_policy_endpoint = _Endpoint( + settings={ + "response_type": (TagPolicyResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/tag-policies/{policy_id}", + "operation_id": "update_tag_policy", + "http_method": "PATCH", + "version": "v2", + }, + params_map={ + "policy_id": { + "required": True, + "openapi_types": (str,), + "attribute": "policy_id", + "location": "path", + }, + "body": { + "required": True, + "openapi_types": (TagPolicyUpdateRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + + def create_tag_policy( + self, + body: TagPolicyCreateRequest, + ) -> TagPolicyResponse: + """Create a tag policy. + + Create a new tag policy for the organization. + + :type body: TagPolicyCreateRequest + :rtype: TagPolicyResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["body"] = body + + return self._create_tag_policy_endpoint.call_with_http_info(**kwargs) + + def delete_tag_policy( + self, + policy_id: str, + ) -> None: + """Delete a tag policy. + + Delete a specific tag policy by its ID. + + :param policy_id: The ID of the tag policy. + :type policy_id: str + :rtype: None + """ + kwargs: Dict[str, Any] = {} + kwargs["policy_id"] = policy_id + + return self._delete_tag_policy_endpoint.call_with_http_info(**kwargs) + + def get_tag_policy( + self, + policy_id: str, + ) -> TagPolicyResponse: + """Get a tag policy. + + Retrieve a specific tag policy by its ID. + + :param policy_id: The ID of the tag policy. + :type policy_id: str + :rtype: TagPolicyResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["policy_id"] = policy_id + + return self._get_tag_policy_endpoint.call_with_http_info(**kwargs) + + def get_tag_policy_score( + self, + policy_id: str, + ) -> TagPolicyScoreResponse: + """Get tag policy score. + + Retrieve the compliance score for a specific tag policy. + + :param policy_id: The ID of the tag policy. + :type policy_id: str + :rtype: TagPolicyScoreResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["policy_id"] = policy_id + + return self._get_tag_policy_score_endpoint.call_with_http_info(**kwargs) + + def list_tag_policies( + self, + *, + filter_source: Union[str, UnsetType] = unset, + ) -> TagPoliciesResponse: + """List tag policies. + + Retrieve a list of all tag policies for the organization. + + :param filter_source: Filter policies by data source (e.g., logs, metrics). + :type filter_source: str, optional + :rtype: TagPoliciesResponse + """ + kwargs: Dict[str, Any] = {} + if filter_source is not unset: + kwargs["filter_source"] = filter_source + + return self._list_tag_policies_endpoint.call_with_http_info(**kwargs) + + def update_tag_policy( + self, + policy_id: str, + body: TagPolicyUpdateRequest, + ) -> TagPolicyResponse: + """Update a tag policy. + + Update an existing tag policy by its ID. + + :param policy_id: The ID of the tag policy. + :type policy_id: str + :type body: TagPolicyUpdateRequest + :rtype: TagPolicyResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["policy_id"] = policy_id + + kwargs["body"] = body + + return self._update_tag_policy_endpoint.call_with_http_info(**kwargs) diff --git a/src/datadog_api_client/v2/apis/__init__.py b/src/datadog_api_client/v2/apis/__init__.py index a1f0834a09..90f1561374 100644 --- a/src/datadog_api_client/v2/apis/__init__.py +++ b/src/datadog_api_client/v2/apis/__init__.py @@ -60,6 +60,7 @@ from datadog_api_client.v2.api.opsgenie_integration_api import OpsgenieIntegrationApi from datadog_api_client.v2.api.org_connections_api import OrgConnectionsApi from datadog_api_client.v2.api.organizations_api import OrganizationsApi +from datadog_api_client.v2.api.policy_management_api import PolicyManagementApi from datadog_api_client.v2.api.powerpack_api import PowerpackApi from datadog_api_client.v2.api.processes_api import ProcessesApi from datadog_api_client.v2.api.product_analytics_api import ProductAnalyticsApi @@ -84,6 +85,7 @@ from datadog_api_client.v2.api.static_analysis_api import StaticAnalysisApi from datadog_api_client.v2.api.status_pages_api import StatusPagesApi from datadog_api_client.v2.api.synthetics_api import SyntheticsApi +from datadog_api_client.v2.api.tag_policies_api import TagPoliciesApi from datadog_api_client.v2.api.teams_api import TeamsApi from datadog_api_client.v2.api.test_optimization_api import TestOptimizationApi from datadog_api_client.v2.api.usage_metering_api import UsageMeteringApi @@ -154,6 +156,7 @@ "OpsgenieIntegrationApi", "OrgConnectionsApi", "OrganizationsApi", + "PolicyManagementApi", "PowerpackApi", "ProcessesApi", "ProductAnalyticsApi", @@ -178,6 +181,7 @@ "StaticAnalysisApi", "StatusPagesApi", "SyntheticsApi", + "TagPoliciesApi", "TeamsApi", "TestOptimizationApi", "UsageMeteringApi", diff --git a/src/datadog_api_client/v2/model/policy_result_attributes_response.py b/src/datadog_api_client/v2/model/policy_result_attributes_response.py new file mode 100644 index 0000000000..51ceaa8963 --- /dev/null +++ b/src/datadog_api_client/v2/model/policy_result_attributes_response.py @@ -0,0 +1,52 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + UUID, +) + + +class PolicyResultAttributesResponse(ModelNormal): + @cached_property + def openapi_types(_): + return { + "active": (bool,), + "payload": (dict,), + "policy_type": (str,), + "reference_org_uuid": (UUID,), + } + + attribute_map = { + "active": "active", + "payload": "payload", + "policy_type": "policy_type", + "reference_org_uuid": "reference_org_uuid", + } + + def __init__(self_, active: bool, payload: dict, policy_type: str, reference_org_uuid: UUID, **kwargs): + """ + Attributes of a policy evaluation result. + + :param active: Whether the policy is active. + :type active: bool + + :param payload: The policy configuration payload. + :type payload: dict + + :param policy_type: The type of policy being evaluated. + :type policy_type: str + + :param reference_org_uuid: The organization UUID reference. + :type reference_org_uuid: UUID + """ + super().__init__(kwargs) + + self_.active = active + self_.payload = payload + self_.policy_type = policy_type + self_.reference_org_uuid = reference_org_uuid diff --git a/src/datadog_api_client/v2/model/policy_result_data_response.py b/src/datadog_api_client/v2/model/policy_result_data_response.py new file mode 100644 index 0000000000..e283eb9b12 --- /dev/null +++ b/src/datadog_api_client/v2/model/policy_result_data_response.py @@ -0,0 +1,54 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.policy_result_attributes_response import PolicyResultAttributesResponse + from datadog_api_client.v2.model.policy_result_type import PolicyResultType + + +class PolicyResultDataResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.policy_result_attributes_response import PolicyResultAttributesResponse + from datadog_api_client.v2.model.policy_result_type import PolicyResultType + + return { + "attributes": (PolicyResultAttributesResponse,), + "id": (str,), + "type": (PolicyResultType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__(self_, attributes: PolicyResultAttributesResponse, id: str, type: PolicyResultType, **kwargs): + """ + Data envelope for policy result response. + + :param attributes: Attributes of a policy evaluation result. + :type attributes: PolicyResultAttributesResponse + + :param id: The unique identifier of the policy result. + :type id: str + + :param type: The type of the resource. The value should always be ``policy_result``. + :type type: PolicyResultType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/policy_result_response.py b/src/datadog_api_client/v2/model/policy_result_response.py new file mode 100644 index 0000000000..b42dc5a92b --- /dev/null +++ b/src/datadog_api_client/v2/model/policy_result_response.py @@ -0,0 +1,40 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.policy_result_data_response import PolicyResultDataResponse + + +class PolicyResultResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.policy_result_data_response import PolicyResultDataResponse + + return { + "data": (PolicyResultDataResponse,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: PolicyResultDataResponse, **kwargs): + """ + Response for policy evaluation result. + + :param data: Data envelope for policy result response. + :type data: PolicyResultDataResponse + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/policy_result_type.py b/src/datadog_api_client/v2/model/policy_result_type.py new file mode 100644 index 0000000000..bbb03be607 --- /dev/null +++ b/src/datadog_api_client/v2/model/policy_result_type.py @@ -0,0 +1,35 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class PolicyResultType(ModelSimple): + """ + The type of the resource. The value should always be `policy_result`. + + :param value: If omitted defaults to "policy_result". Must be one of ["policy_result"]. + :type value: str + """ + + allowed_values = { + "policy_result", + } + POLICY_RESULT: ClassVar["PolicyResultType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +PolicyResultType.POLICY_RESULT = PolicyResultType("policy_result") diff --git a/src/datadog_api_client/v2/model/tag_policies_response.py b/src/datadog_api_client/v2/model/tag_policies_response.py new file mode 100644 index 0000000000..7812cc31b5 --- /dev/null +++ b/src/datadog_api_client/v2/model/tag_policies_response.py @@ -0,0 +1,40 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.tag_policy_data_response import TagPolicyDataResponse + + +class TagPoliciesResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.tag_policy_data_response import TagPolicyDataResponse + + return { + "data": ([TagPolicyDataResponse],), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: List[TagPolicyDataResponse], **kwargs): + """ + Response for listing tag policies. + + :param data: List of tag policies. + :type data: [TagPolicyDataResponse] + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/tag_policy_attributes_request.py b/src/datadog_api_client/v2/model/tag_policy_attributes_request.py new file mode 100644 index 0000000000..3944d29d9b --- /dev/null +++ b/src/datadog_api_client/v2/model/tag_policy_attributes_request.py @@ -0,0 +1,87 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +class TagPolicyAttributesRequest(ModelNormal): + @cached_property + def openapi_types(_): + return { + "enabled": (bool,), + "negated": (bool,), + "policy_name": (str,), + "required": (bool,), + "scope": (str,), + "source": (str,), + "tag_key": (str,), + "tag_value_patterns": ([str],), + } + + 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", + } + + def __init__( + self_, + enabled: bool, + negated: bool, + policy_name: str, + required: bool, + scope: str, + source: str, + tag_key: str, + tag_value_patterns: List[str], + **kwargs, + ): + """ + Attributes for creating or updating a tag policy. + + :param enabled: Whether the policy is enabled. + :type enabled: bool + + :param negated: Whether the policy is negated. + :type negated: bool + + :param policy_name: The name of the tag policy. + :type policy_name: str + + :param required: Whether the tag is required. + :type required: bool + + :param scope: The scope of the tag policy. + :type scope: str + + :param source: The data source for the tag policy (e.g., logs, metrics). + :type source: str + + :param tag_key: The tag key that the policy applies to. + :type tag_key: str + + :param tag_value_patterns: List of patterns that tag values must match. + :type tag_value_patterns: [str] + """ + super().__init__(kwargs) + + self_.enabled = enabled + self_.negated = negated + self_.policy_name = policy_name + self_.required = required + self_.scope = scope + self_.source = source + self_.tag_key = tag_key + self_.tag_value_patterns = tag_value_patterns diff --git a/src/datadog_api_client/v2/model/tag_policy_attributes_response.py b/src/datadog_api_client/v2/model/tag_policy_attributes_response.py new file mode 100644 index 0000000000..50ba538c9e --- /dev/null +++ b/src/datadog_api_client/v2/model/tag_policy_attributes_response.py @@ -0,0 +1,123 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + datetime, +) + + +class TagPolicyAttributesResponse(ModelNormal): + @cached_property + def openapi_types(_): + return { + "created_at": (datetime,), + "created_by": (str,), + "enabled": (bool,), + "modified_at": (datetime,), + "modified_by": (str,), + "negated": (bool,), + "policy_name": (str,), + "required": (bool,), + "scope": (str,), + "source": (str,), + "tag_key": (str,), + "tag_value_patterns": ([str],), + "version": (int,), + } + + 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", + } + + def __init__( + self_, + created_at: datetime, + created_by: str, + enabled: bool, + modified_at: datetime, + modified_by: str, + negated: bool, + policy_name: str, + required: bool, + scope: str, + source: str, + tag_key: str, + tag_value_patterns: List[str], + version: int, + **kwargs, + ): + """ + Attributes of a tag policy response. + + :param created_at: Timestamp when the policy was created. + :type created_at: datetime + + :param created_by: User who created the policy. + :type created_by: str + + :param enabled: Whether the policy is enabled. + :type enabled: bool + + :param modified_at: Timestamp when the policy was last modified. + :type modified_at: datetime + + :param modified_by: User who last modified the policy. + :type modified_by: str + + :param negated: Whether the policy is negated. + :type negated: bool + + :param policy_name: The name of the tag policy. + :type policy_name: str + + :param required: Whether the tag is required. + :type required: bool + + :param scope: The scope of the tag policy. + :type scope: str + + :param source: The data source for the tag policy (e.g., logs, metrics). + :type source: str + + :param tag_key: The tag key that the policy applies to. + :type tag_key: str + + :param tag_value_patterns: List of patterns that tag values must match. + :type tag_value_patterns: [str] + + :param version: The version of the tag policy. + :type version: int + """ + super().__init__(kwargs) + + self_.created_at = created_at + self_.created_by = created_by + self_.enabled = enabled + self_.modified_at = modified_at + self_.modified_by = modified_by + self_.negated = negated + self_.policy_name = policy_name + self_.required = required + self_.scope = scope + self_.source = source + self_.tag_key = tag_key + self_.tag_value_patterns = tag_value_patterns + self_.version = version diff --git a/src/datadog_api_client/v2/model/tag_policy_attributes_update_request.py b/src/datadog_api_client/v2/model/tag_policy_attributes_update_request.py new file mode 100644 index 0000000000..aa44d902e4 --- /dev/null +++ b/src/datadog_api_client/v2/model/tag_policy_attributes_update_request.py @@ -0,0 +1,96 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class TagPolicyAttributesUpdateRequest(ModelNormal): + @cached_property + def openapi_types(_): + return { + "enabled": (bool,), + "negated": (bool,), + "policy_name": (str,), + "required": (bool,), + "scope": (str,), + "source": (str,), + "tag_key": (str,), + "tag_value_patterns": ([str],), + } + + 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", + } + + def __init__( + self_, + enabled: Union[bool, UnsetType] = unset, + negated: Union[bool, UnsetType] = unset, + policy_name: Union[str, UnsetType] = unset, + required: Union[bool, UnsetType] = unset, + scope: Union[str, UnsetType] = unset, + source: Union[str, UnsetType] = unset, + tag_key: Union[str, UnsetType] = unset, + tag_value_patterns: Union[List[str], UnsetType] = unset, + **kwargs, + ): + """ + Attributes for updating a tag policy. All fields are optional. + + :param enabled: Whether the policy is enabled. + :type enabled: bool, optional + + :param negated: Whether the policy is negated. + :type negated: bool, optional + + :param policy_name: The name of the tag policy. + :type policy_name: str, optional + + :param required: Whether the tag is required. + :type required: bool, optional + + :param scope: The scope of the tag policy. + :type scope: str, optional + + :param source: The data source for the tag policy (e.g., logs, metrics). + :type source: str, optional + + :param tag_key: The tag key that the policy applies to. + :type tag_key: str, optional + + :param tag_value_patterns: List of patterns that tag values must match. + :type tag_value_patterns: [str], optional + """ + if enabled is not unset: + kwargs["enabled"] = enabled + if negated is not unset: + kwargs["negated"] = negated + if policy_name is not unset: + kwargs["policy_name"] = policy_name + if required is not unset: + kwargs["required"] = required + if scope is not unset: + kwargs["scope"] = scope + if source is not unset: + kwargs["source"] = source + if tag_key is not unset: + kwargs["tag_key"] = tag_key + if tag_value_patterns is not unset: + kwargs["tag_value_patterns"] = tag_value_patterns + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/tag_policy_create_request.py b/src/datadog_api_client/v2/model/tag_policy_create_request.py new file mode 100644 index 0000000000..051d87f623 --- /dev/null +++ b/src/datadog_api_client/v2/model/tag_policy_create_request.py @@ -0,0 +1,40 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.tag_policy_data_request import TagPolicyDataRequest + + +class TagPolicyCreateRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.tag_policy_data_request import TagPolicyDataRequest + + return { + "data": (TagPolicyDataRequest,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: TagPolicyDataRequest, **kwargs): + """ + Request for creating a tag policy. + + :param data: Data envelope for tag policy create request. + :type data: TagPolicyDataRequest + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/tag_policy_data_request.py b/src/datadog_api_client/v2/model/tag_policy_data_request.py new file mode 100644 index 0000000000..6ec57c02a5 --- /dev/null +++ b/src/datadog_api_client/v2/model/tag_policy_data_request.py @@ -0,0 +1,48 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.tag_policy_attributes_request import TagPolicyAttributesRequest + from datadog_api_client.v2.model.tag_policy_type import TagPolicyType + + +class TagPolicyDataRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.tag_policy_attributes_request import TagPolicyAttributesRequest + from datadog_api_client.v2.model.tag_policy_type import TagPolicyType + + return { + "attributes": (TagPolicyAttributesRequest,), + "type": (TagPolicyType,), + } + + attribute_map = { + "attributes": "attributes", + "type": "type", + } + + def __init__(self_, attributes: TagPolicyAttributesRequest, type: TagPolicyType, **kwargs): + """ + Data envelope for tag policy create request. + + :param attributes: Attributes for creating or updating a tag policy. + :type attributes: TagPolicyAttributesRequest + + :param type: The type of the resource. The value should always be ``tag_policy``. + :type type: TagPolicyType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.type = type diff --git a/src/datadog_api_client/v2/model/tag_policy_data_response.py b/src/datadog_api_client/v2/model/tag_policy_data_response.py new file mode 100644 index 0000000000..0112866ce1 --- /dev/null +++ b/src/datadog_api_client/v2/model/tag_policy_data_response.py @@ -0,0 +1,54 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.tag_policy_attributes_response import TagPolicyAttributesResponse + from datadog_api_client.v2.model.tag_policy_type import TagPolicyType + + +class TagPolicyDataResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.tag_policy_attributes_response import TagPolicyAttributesResponse + from datadog_api_client.v2.model.tag_policy_type import TagPolicyType + + return { + "attributes": (TagPolicyAttributesResponse,), + "id": (str,), + "type": (TagPolicyType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__(self_, attributes: TagPolicyAttributesResponse, id: str, type: TagPolicyType, **kwargs): + """ + Data envelope for tag policy response. + + :param attributes: Attributes of a tag policy response. + :type attributes: TagPolicyAttributesResponse + + :param id: The unique identifier of the tag policy. + :type id: str + + :param type: The type of the resource. The value should always be ``tag_policy``. + :type type: TagPolicyType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/tag_policy_data_update_request.py b/src/datadog_api_client/v2/model/tag_policy_data_update_request.py new file mode 100644 index 0000000000..fdbf721a1c --- /dev/null +++ b/src/datadog_api_client/v2/model/tag_policy_data_update_request.py @@ -0,0 +1,48 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.tag_policy_attributes_update_request import TagPolicyAttributesUpdateRequest + from datadog_api_client.v2.model.tag_policy_type import TagPolicyType + + +class TagPolicyDataUpdateRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.tag_policy_attributes_update_request import TagPolicyAttributesUpdateRequest + from datadog_api_client.v2.model.tag_policy_type import TagPolicyType + + return { + "attributes": (TagPolicyAttributesUpdateRequest,), + "type": (TagPolicyType,), + } + + attribute_map = { + "attributes": "attributes", + "type": "type", + } + + def __init__(self_, attributes: TagPolicyAttributesUpdateRequest, type: TagPolicyType, **kwargs): + """ + Data envelope for tag policy update request. + + :param attributes: Attributes for updating a tag policy. All fields are optional. + :type attributes: TagPolicyAttributesUpdateRequest + + :param type: The type of the resource. The value should always be ``tag_policy``. + :type type: TagPolicyType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.type = type diff --git a/src/datadog_api_client/v2/model/tag_policy_response.py b/src/datadog_api_client/v2/model/tag_policy_response.py new file mode 100644 index 0000000000..2c4870d0fd --- /dev/null +++ b/src/datadog_api_client/v2/model/tag_policy_response.py @@ -0,0 +1,40 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.tag_policy_data_response import TagPolicyDataResponse + + +class TagPolicyResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.tag_policy_data_response import TagPolicyDataResponse + + return { + "data": (TagPolicyDataResponse,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: TagPolicyDataResponse, **kwargs): + """ + Response for a single tag policy. + + :param data: Data envelope for tag policy response. + :type data: TagPolicyDataResponse + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/tag_policy_score_attributes_response.py b/src/datadog_api_client/v2/model/tag_policy_score_attributes_response.py new file mode 100644 index 0000000000..fd2231fbbf --- /dev/null +++ b/src/datadog_api_client/v2/model/tag_policy_score_attributes_response.py @@ -0,0 +1,55 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class TagPolicyScoreAttributesResponse(ModelNormal): + @cached_property + def openapi_types(_): + return { + "score": (float,), + "ts_end": (int,), + "ts_start": (int,), + "version": (int,), + } + + attribute_map = { + "score": "score", + "ts_end": "ts_end", + "ts_start": "ts_start", + "version": "version", + } + + def __init__(self_, score: float, ts_end: int, ts_start: int, version: Union[int, UnsetType] = unset, **kwargs): + """ + Attributes of a tag policy score. + + :param score: The compliance score for the tag policy. + :type score: float + + :param ts_end: End timestamp for the score calculation period. + :type ts_end: int + + :param ts_start: Start timestamp for the score calculation period. + :type ts_start: int + + :param version: The version of the score. + :type version: int, optional + """ + if version is not unset: + kwargs["version"] = version + super().__init__(kwargs) + + self_.score = score + self_.ts_end = ts_end + self_.ts_start = ts_start diff --git a/src/datadog_api_client/v2/model/tag_policy_score_data_response.py b/src/datadog_api_client/v2/model/tag_policy_score_data_response.py new file mode 100644 index 0000000000..530557baad --- /dev/null +++ b/src/datadog_api_client/v2/model/tag_policy_score_data_response.py @@ -0,0 +1,54 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.tag_policy_score_attributes_response import TagPolicyScoreAttributesResponse + from datadog_api_client.v2.model.tag_policy_score_type import TagPolicyScoreType + + +class TagPolicyScoreDataResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.tag_policy_score_attributes_response import TagPolicyScoreAttributesResponse + from datadog_api_client.v2.model.tag_policy_score_type import TagPolicyScoreType + + return { + "attributes": (TagPolicyScoreAttributesResponse,), + "id": (str,), + "type": (TagPolicyScoreType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__(self_, attributes: TagPolicyScoreAttributesResponse, id: str, type: TagPolicyScoreType, **kwargs): + """ + Data envelope for tag policy score response. + + :param attributes: Attributes of a tag policy score. + :type attributes: TagPolicyScoreAttributesResponse + + :param id: The unique identifier of the score. + :type id: str + + :param type: The type of the resource. The value should always be ``tag_policy_score``. + :type type: TagPolicyScoreType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/tag_policy_score_response.py b/src/datadog_api_client/v2/model/tag_policy_score_response.py new file mode 100644 index 0000000000..6cd62c7e4e --- /dev/null +++ b/src/datadog_api_client/v2/model/tag_policy_score_response.py @@ -0,0 +1,40 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.tag_policy_score_data_response import TagPolicyScoreDataResponse + + +class TagPolicyScoreResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.tag_policy_score_data_response import TagPolicyScoreDataResponse + + return { + "data": (TagPolicyScoreDataResponse,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: TagPolicyScoreDataResponse, **kwargs): + """ + Response for a tag policy score. + + :param data: Data envelope for tag policy score response. + :type data: TagPolicyScoreDataResponse + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/tag_policy_score_type.py b/src/datadog_api_client/v2/model/tag_policy_score_type.py new file mode 100644 index 0000000000..255f9def80 --- /dev/null +++ b/src/datadog_api_client/v2/model/tag_policy_score_type.py @@ -0,0 +1,35 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class TagPolicyScoreType(ModelSimple): + """ + The type of the resource. The value should always be `tag_policy_score`. + + :param value: If omitted defaults to "tag_policy_score". Must be one of ["tag_policy_score"]. + :type value: str + """ + + allowed_values = { + "tag_policy_score", + } + TAG_POLICY_SCORE: ClassVar["TagPolicyScoreType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +TagPolicyScoreType.TAG_POLICY_SCORE = TagPolicyScoreType("tag_policy_score") diff --git a/src/datadog_api_client/v2/model/tag_policy_type.py b/src/datadog_api_client/v2/model/tag_policy_type.py new file mode 100644 index 0000000000..6779ff777d --- /dev/null +++ b/src/datadog_api_client/v2/model/tag_policy_type.py @@ -0,0 +1,35 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class TagPolicyType(ModelSimple): + """ + The type of the resource. The value should always be `tag_policy`. + + :param value: If omitted defaults to "tag_policy". Must be one of ["tag_policy"]. + :type value: str + """ + + allowed_values = { + "tag_policy", + } + TAG_POLICY: ClassVar["TagPolicyType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +TagPolicyType.TAG_POLICY = TagPolicyType("tag_policy") diff --git a/src/datadog_api_client/v2/model/tag_policy_update_request.py b/src/datadog_api_client/v2/model/tag_policy_update_request.py new file mode 100644 index 0000000000..d62e286b4f --- /dev/null +++ b/src/datadog_api_client/v2/model/tag_policy_update_request.py @@ -0,0 +1,40 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.tag_policy_data_update_request import TagPolicyDataUpdateRequest + + +class TagPolicyUpdateRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.tag_policy_data_update_request import TagPolicyDataUpdateRequest + + return { + "data": (TagPolicyDataUpdateRequest,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: TagPolicyDataUpdateRequest, **kwargs): + """ + Request for updating a tag policy. + + :param data: Data envelope for tag policy update request. + :type data: TagPolicyDataUpdateRequest + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index 7587d2f4e0..05ef677fa9 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -3988,6 +3988,10 @@ from datadog_api_client.v2.model.permission_attributes import PermissionAttributes from datadog_api_client.v2.model.permissions_response import PermissionsResponse from datadog_api_client.v2.model.permissions_type import PermissionsType +from datadog_api_client.v2.model.policy_result_attributes_response import PolicyResultAttributesResponse +from datadog_api_client.v2.model.policy_result_data_response import PolicyResultDataResponse +from datadog_api_client.v2.model.policy_result_response import PolicyResultResponse +from datadog_api_client.v2.model.policy_result_type import PolicyResultType from datadog_api_client.v2.model.postmortem_attachment_request import PostmortemAttachmentRequest from datadog_api_client.v2.model.postmortem_attachment_request_attributes import PostmortemAttachmentRequestAttributes from datadog_api_client.v2.model.postmortem_attachment_request_data import PostmortemAttachmentRequestData @@ -5426,6 +5430,21 @@ from datadog_api_client.v2.model.table_row_resource_data import TableRowResourceData from datadog_api_client.v2.model.table_row_resource_data_attributes import TableRowResourceDataAttributes from datadog_api_client.v2.model.table_row_resource_data_type import TableRowResourceDataType +from datadog_api_client.v2.model.tag_policies_response import TagPoliciesResponse +from datadog_api_client.v2.model.tag_policy_attributes_request import TagPolicyAttributesRequest +from datadog_api_client.v2.model.tag_policy_attributes_response import TagPolicyAttributesResponse +from datadog_api_client.v2.model.tag_policy_attributes_update_request import TagPolicyAttributesUpdateRequest +from datadog_api_client.v2.model.tag_policy_create_request import TagPolicyCreateRequest +from datadog_api_client.v2.model.tag_policy_data_request import TagPolicyDataRequest +from datadog_api_client.v2.model.tag_policy_data_response import TagPolicyDataResponse +from datadog_api_client.v2.model.tag_policy_data_update_request import TagPolicyDataUpdateRequest +from datadog_api_client.v2.model.tag_policy_response import TagPolicyResponse +from datadog_api_client.v2.model.tag_policy_score_attributes_response import TagPolicyScoreAttributesResponse +from datadog_api_client.v2.model.tag_policy_score_data_response import TagPolicyScoreDataResponse +from datadog_api_client.v2.model.tag_policy_score_response import TagPolicyScoreResponse +from datadog_api_client.v2.model.tag_policy_score_type import TagPolicyScoreType +from datadog_api_client.v2.model.tag_policy_type import TagPolicyType +from datadog_api_client.v2.model.tag_policy_update_request import TagPolicyUpdateRequest from datadog_api_client.v2.model.tags_event_attribute import TagsEventAttribute from datadog_api_client.v2.model.team import Team from datadog_api_client.v2.model.team_attributes import TeamAttributes @@ -8640,6 +8659,10 @@ "PermissionAttributes", "PermissionsResponse", "PermissionsType", + "PolicyResultAttributesResponse", + "PolicyResultDataResponse", + "PolicyResultResponse", + "PolicyResultType", "PostmortemAttachmentRequest", "PostmortemAttachmentRequestAttributes", "PostmortemAttachmentRequestData", @@ -9672,6 +9695,21 @@ "TableRowResourceData", "TableRowResourceDataAttributes", "TableRowResourceDataType", + "TagPoliciesResponse", + "TagPolicyAttributesRequest", + "TagPolicyAttributesResponse", + "TagPolicyAttributesUpdateRequest", + "TagPolicyCreateRequest", + "TagPolicyDataRequest", + "TagPolicyDataResponse", + "TagPolicyDataUpdateRequest", + "TagPolicyResponse", + "TagPolicyScoreAttributesResponse", + "TagPolicyScoreDataResponse", + "TagPolicyScoreResponse", + "TagPolicyScoreType", + "TagPolicyType", + "TagPolicyUpdateRequest", "TagsEventAttribute", "Team", "TeamAttributes", diff --git a/tests/v2/features/policy_management.feature b/tests/v2/features/policy_management.feature new file mode 100644 index 0000000000..fbfbcd308f --- /dev/null +++ b/tests/v2/features/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/tests/v2/features/tag_policies.feature b/tests/v2/features/tag_policies.feature new file mode 100644 index 0000000000..e81e05e507 --- /dev/null +++ b/tests/v2/features/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/tests/v2/features/undo.json b/tests/v2/features/undo.json index c0ec7dbe41..8eebe1e678 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/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": {