diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 37b23f3961d..7ab82fd266b 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -16546,10 +16546,12 @@ components: properties: completed_date: description: Timestamp of when the maintenance was completed. + example: "2026-02-18T19:51:13.332360075Z" format: date-time type: string completed_description: description: The description shown when the maintenance is completed. + example: "We have completed maintenance on the API to improve performance." type: string components_affected: description: The components affected by the maintenance. @@ -16558,12 +16560,15 @@ components: type: array in_progress_description: description: The description shown while the maintenance is in progress. + example: "We are currently performing maintenance on the API to improve performance." type: string scheduled_description: description: The description shown when the maintenance is scheduled. + example: "We will be performing maintenance on the API to improve performance." type: string start_date: description: Timestamp of when the maintenance is scheduled to start. + example: "2026-02-18T19:21:13.332360075Z" format: date-time type: string title: @@ -16573,6 +16578,11 @@ components: required: - components_affected - title + - completed_date + - completed_description + - scheduled_description + - start_date + - in_progress_description type: object CreateMaintenanceRequestDataAttributesComponentsAffectedItems: description: A component affected by a maintenance. @@ -31093,7 +31103,7 @@ components: properties: org_site: description: The site of the organization. - example: "datadoghq.com" + example: "us1" type: string org_uuid: description: The UUID of the organization. @@ -51401,7 +51411,7 @@ components: type: string owner_org_site: description: The site of the organization that owns this org group. - example: "datadoghq.com" + example: "us1" type: string owner_org_uuid: description: The UUID of the organization that owns this org group. @@ -51507,7 +51517,7 @@ components: type: string org_site: description: The site of the member organization. - example: "datadoghq.com" + example: "us1" type: string org_uuid: description: The UUID of the member organization. @@ -51728,11 +51738,8 @@ components: example: value: "UTC" type: object - enforced_at: - description: Timestamp when the policy was enforced. - example: "2024-01-15T10:30:00Z" - format: date-time - type: string + enforcement_tier: + $ref: "#/components/schemas/OrgGroupPolicyEnforcementTier" modified_at: description: Timestamp when the policy was last modified. example: "2024-01-15T10:30:00Z" @@ -51742,9 +51749,12 @@ components: description: The name of the policy. example: "monitor_timezone" type: string + policy_type: + $ref: "#/components/schemas/OrgGroupPolicyPolicyType" required: - policy_name - - enforced_at + - policy_type + - enforcement_tier - modified_at type: object OrgGroupPolicyConfigAttributes: @@ -51815,7 +51825,8 @@ components: x-enum-varnames: - ORG_GROUP_POLICY_CONFIGS OrgGroupPolicyCreateAttributes: - description: Attributes for creating an org group policy. + description: >- + Attributes for creating an org group policy. If `policy_type` or `enforcement_tier` are not provided, they default to `org_config` and `DEFAULT` respectively. properties: content: additionalProperties: {} @@ -51823,10 +51834,14 @@ components: example: value: "UTC" type: object + enforcement_tier: + $ref: "#/components/schemas/OrgGroupPolicyEnforcementTier" policy_name: description: The name of the policy. example: "monitor_timezone" type: string + policy_type: + $ref: "#/components/schemas/OrgGroupPolicyPolicyType" required: - policy_name - content @@ -51880,6 +51895,20 @@ components: - type - attributes type: object + OrgGroupPolicyEnforcementTier: + default: DEFAULT + description: >- + The enforcement tier of the policy. `DEFAULT` means the policy is set but member orgs may mutate it. `ENFORCE` means the policy is strictly controlled and mutations are blocked for affected orgs. `DELEGATE` means each member org controls its own value. + enum: + - DEFAULT + - ENFORCE + - DELEGATE + example: DEFAULT + type: string + x-enum-varnames: + - DEFAULT + - ENFORCE + - DELEGATE OrgGroupPolicyListResponse: description: Response containing a list of org group policies. properties: @@ -51912,7 +51941,7 @@ components: type: string org_site: description: The site of the organization that has the override. - example: "datadoghq.com" + example: "us1" type: string org_uuid: description: The UUID of the organization that has the override. @@ -51930,7 +51959,7 @@ components: properties: org_site: description: The site of the organization. - example: "datadoghq.com" + example: "us1" type: string org_uuid: description: The UUID of the organization to grant the override. @@ -52046,11 +52075,12 @@ components: x-enum-varnames: - ORG_GROUP_POLICY_OVERRIDES OrgGroupPolicyOverrideUpdateAttributes: - description: Attributes for updating a policy override. + description: >- + Attributes for updating a policy override. The `org_uuid` and `org_site` fields must match the existing override and cannot be changed. properties: org_site: description: The site of the organization. - example: "datadoghq.com" + example: "us1" type: string org_uuid: description: The UUID of the organization. @@ -52086,6 +52116,16 @@ components: required: - data type: object + OrgGroupPolicyPolicyType: + default: org_config + description: >- + The type of the policy. Only `org_config` is supported, indicating a policy backed by an organization configuration setting. + enum: + - org_config + example: org_config + type: string + x-enum-varnames: + - ORG_CONFIG OrgGroupPolicyRelationshipToOne: description: Relationship to a single org group policy. properties: @@ -52154,6 +52194,8 @@ components: example: value: "UTC" type: object + enforcement_tier: + $ref: "#/components/schemas/OrgGroupPolicyEnforcementTier" type: object OrgGroupPolicyUpdateData: description: Data for updating an org group policy. @@ -90975,11 +91017,11 @@ paths: - **PERCENT**: Allocates fixed percentages to specific tags. Requires: allocated_by (array of percentage allocations). **Filter Conditions:** - - Use **value** for single-value conditions: "is", "is not", "contains", "does not contain", "=", "!=", "like", "not like", "is all values", "is untagged" + - Use **value** for single-value conditions: "is", "is not", "contains", "=", "!=", "like", "not like" - Use **values** for multi-value conditions: "in", "not in" - Cannot use both value and values simultaneously. - **Supported operators**: is, is not, is all values, is untagged, contains, does not contain, in, not in, =, !=, like, not like + **Supported operators**: is, is not, contains, in, not in, =, !=, like, not like operationId: CreateCustomAllocationRule requestBody: content: @@ -91147,11 +91189,11 @@ paths: - **USAGE_METRIC**: Allocates based on usage metrics (implementation varies). **Filter Conditions:** - - Use **value** for single-value conditions: "is", "is not", "contains", "does not contain", "=", "!=", "like", "not like", "is all values", "is untagged" + - Use **value** for single-value conditions: "is", "is not", "contains", "=", "!=", "like", "not like" - Use **values** for multi-value conditions: "in", "not in" - Cannot use both value and values simultaneously. - **Supported operators**: is, is not, is all values, is untagged, contains, does not contain, in, not in, =, !=, like, not like + **Supported operators**: is, is not, contains, in, not in, =, !=, like, not like operationId: UpdateCustomAllocationRule parameters: - description: The unique identifier of the custom allocation rule @@ -110343,7 +110385,7 @@ paths: created_at: "2024-01-15T10:30:00Z" modified_at: "2024-01-15T10:30:00Z" org_name: "Acme Corp" - org_site: "datadoghq.com" + org_site: "us1" org_uuid: "c3d4e5f6-a7b8-9012-cdef-012345678901" id: "f1e2d3c4-b5a6-7890-1234-567890abcdef" relationships: @@ -110401,7 +110443,7 @@ paths: data: attributes: orgs: - - org_site: "datadoghq.com" + - org_site: "us1" org_uuid: "c3d4e5f6-a7b8-9012-cdef-012345678901" relationships: source_org_group: @@ -110428,7 +110470,7 @@ paths: created_at: "2024-01-15T10:30:00Z" modified_at: "2024-01-16T14:00:00Z" org_name: "Acme Corp" - org_site: "datadoghq.com" + org_site: "us1" org_uuid: "c3d4e5f6-a7b8-9012-cdef-012345678901" id: "f1e2d3c4-b5a6-7890-1234-567890abcdef" relationships: @@ -110493,7 +110535,7 @@ paths: created_at: "2024-01-15T10:30:00Z" modified_at: "2024-01-15T10:30:00Z" org_name: "Acme Corp" - org_site: "datadoghq.com" + org_site: "us1" org_uuid: "c3d4e5f6-a7b8-9012-cdef-012345678901" id: "f1e2d3c4-b5a6-7890-1234-567890abcdef" relationships: @@ -110574,7 +110616,7 @@ paths: created_at: "2024-01-15T10:30:00Z" modified_at: "2024-01-16T14:00:00Z" org_name: "Acme Corp" - org_site: "datadoghq.com" + org_site: "us1" org_uuid: "c3d4e5f6-a7b8-9012-cdef-012345678901" id: "f1e2d3c4-b5a6-7890-1234-567890abcdef" relationships: @@ -110642,9 +110684,10 @@ paths: - attributes: content: value: "UTC" - enforced_at: "2024-01-15T10:30:00Z" + enforcement_tier: "DEFAULT" modified_at: "2024-01-15T10:30:00Z" policy_name: "monitor_timezone" + policy_type: "org_config" id: "1a2b3c4d-5e6f-7890-abcd-ef0123456789" relationships: org_group: @@ -110700,7 +110743,9 @@ paths: attributes: content: value: "UTC" + enforcement_tier: "DEFAULT" policy_name: "monitor_timezone" + policy_type: "org_config" relationships: org_group: data: @@ -110721,9 +110766,10 @@ paths: attributes: content: value: "UTC" - enforced_at: "2024-01-15T10:30:00Z" + enforcement_tier: "DEFAULT" modified_at: "2024-01-15T10:30:00Z" policy_name: "monitor_timezone" + policy_type: "org_config" id: "1a2b3c4d-5e6f-7890-abcd-ef0123456789" relationships: org_group: @@ -110813,8 +110859,73 @@ paths: x-unstable: |- **Note**: This endpoint is in preview and is subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + get: + description: Get a specific organization group policy by its ID. + operationId: GetOrgGroupPolicy + parameters: + - $ref: "#/components/parameters/OrgGroupPolicyId" + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + content: + value: "UTC" + enforcement_tier: "DEFAULT" + modified_at: "2024-01-15T10:30:00Z" + policy_name: "monitor_timezone" + policy_type: "org_config" + id: "1a2b3c4d-5e6f-7890-abcd-ef0123456789" + relationships: + org_group: + data: + id: "a1b2c3d4-e5f6-7890-abcd-ef0123456789" + type: org_groups + type: org_group_policies + schema: + $ref: "#/components/schemas/OrgGroupPolicyResponse" + 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" + summary: Get an org group policy + tags: [Org Groups] + "x-permission": + operator: OR + permissions: + - org_group_read + x-unstable: |- + **Note**: This endpoint is in Preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). patch: - description: Update the content of an existing organization group policy. + description: Update an existing organization group policy. operationId: UpdateOrgGroupPolicy parameters: - $ref: "#/components/parameters/OrgGroupPolicyId" @@ -110828,6 +110939,7 @@ paths: attributes: content: value: "US/Eastern" + enforcement_tier: "ENFORCE" id: "1a2b3c4d-5e6f-7890-abcd-ef0123456789" type: org_group_policies schema: @@ -110844,9 +110956,10 @@ paths: attributes: content: value: "US/Eastern" - enforced_at: "2024-01-15T10:30:00Z" + enforcement_tier: "ENFORCE" modified_at: "2024-01-16T14:00:00Z" policy_name: "monitor_timezone" + policy_type: "org_config" id: "1a2b3c4d-5e6f-7890-abcd-ef0123456789" relationships: org_group: @@ -110960,7 +111073,7 @@ paths: - attributes: created_at: "2024-01-15T10:30:00Z" modified_at: "2024-01-15T10:30:00Z" - org_site: "datadoghq.com" + org_site: "us1" org_uuid: "c3d4e5f6-a7b8-9012-cdef-012345678901" id: "9f8e7d6c-5b4a-3210-fedc-ba0987654321" relationships: @@ -111019,7 +111132,7 @@ paths: value: data: attributes: - org_site: "datadoghq.com" + org_site: "us1" org_uuid: "c3d4e5f6-a7b8-9012-cdef-012345678901" relationships: org_group: @@ -111045,7 +111158,7 @@ paths: attributes: created_at: "2024-01-15T10:30:00Z" modified_at: "2024-01-15T10:30:00Z" - org_site: "datadoghq.com" + org_site: "us1" org_uuid: "c3d4e5f6-a7b8-9012-cdef-012345678901" id: "9f8e7d6c-5b4a-3210-fedc-ba0987654321" relationships: @@ -111140,6 +111253,73 @@ paths: x-unstable: |- **Note**: This endpoint is in preview and is subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + get: + description: Get a specific organization group policy override by its ID. + operationId: GetOrgGroupPolicyOverride + parameters: + - $ref: "#/components/parameters/OrgGroupPolicyOverrideId" + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + created_at: "2024-01-15T10:30:00Z" + modified_at: "2024-01-15T10:30:00Z" + org_site: "us1" + org_uuid: "c3d4e5f6-a7b8-9012-cdef-012345678901" + id: "9f8e7d6c-5b4a-3210-fedc-ba0987654321" + relationships: + org_group: + data: + id: "a1b2c3d4-e5f6-7890-abcd-ef0123456789" + type: org_groups + org_group_policy: + data: + id: "1a2b3c4d-5e6f-7890-abcd-ef0123456789" + type: org_group_policies + type: org_group_policy_overrides + schema: + $ref: "#/components/schemas/OrgGroupPolicyOverrideResponse" + 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" + summary: Get an org group policy override + tags: [Org Groups] + "x-permission": + operator: OR + permissions: + - org_group_read + x-unstable: |- + **Note**: This endpoint is in Preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). patch: description: Update an existing organization group policy override. operationId: UpdateOrgGroupPolicyOverride @@ -111153,7 +111333,7 @@ paths: value: data: attributes: - org_site: "datadoghq.com" + org_site: "us1" org_uuid: "c3d4e5f6-a7b8-9012-cdef-012345678901" id: "9f8e7d6c-5b4a-3210-fedc-ba0987654321" type: org_group_policy_overrides @@ -111171,7 +111351,7 @@ paths: attributes: created_at: "2024-01-15T10:30:00Z" modified_at: "2024-01-16T14:00:00Z" - org_site: "datadoghq.com" + org_site: "us1" org_uuid: "c3d4e5f6-a7b8-9012-cdef-012345678901" id: "9f8e7d6c-5b4a-3210-fedc-ba0987654321" relationships: @@ -111243,7 +111423,7 @@ paths: created_at: "2024-01-15T10:30:00Z" modified_at: "2024-01-15T10:30:00Z" name: "My Org Group" - owner_org_site: "datadoghq.com" + owner_org_site: "us1" owner_org_uuid: "b2c3d4e5-f6a7-8901-bcde-f01234567890" id: "a1b2c3d4-e5f6-7890-abcd-ef0123456789" type: org_groups @@ -111310,7 +111490,7 @@ paths: created_at: "2024-01-15T10:30:00Z" modified_at: "2024-01-15T10:30:00Z" name: "My Org Group" - owner_org_site: "datadoghq.com" + owner_org_site: "us1" owner_org_uuid: "b2c3d4e5-f6a7-8901-bcde-f01234567890" id: "a1b2c3d4-e5f6-7890-abcd-ef0123456789" type: org_groups @@ -111413,7 +111593,7 @@ paths: created_at: "2024-01-15T10:30:00Z" modified_at: "2024-01-15T10:30:00Z" name: "My Org Group" - owner_org_site: "datadoghq.com" + owner_org_site: "us1" owner_org_uuid: "b2c3d4e5-f6a7-8901-bcde-f01234567890" id: "a1b2c3d4-e5f6-7890-abcd-ef0123456789" type: org_groups @@ -111486,7 +111666,7 @@ paths: created_at: "2024-01-15T10:30:00Z" modified_at: "2024-01-16T14:00:00Z" name: "Updated Org Group Name" - owner_org_site: "datadoghq.com" + owner_org_site: "us1" owner_org_uuid: "b2c3d4e5-f6a7-8901-bcde-f01234567890" id: "a1b2c3d4-e5f6-7890-abcd-ef0123456789" type: org_groups diff --git a/CHANGELOG.md b/CHANGELOG.md index 97ce17f5473..c7245e79a86 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,31 @@ # CHANGELOG +## 2.59.0/2026-04-24 + +### Changed +* Add GET OrgGroupPolicy and OrgGroupPolicyOverride, Add policy_type/enforcement_tier fields, Remove enforced_at field [#3999](https://github.com/DataDog/datadog-api-client-go/pull/3999) +* Rename pat_uuid to pat_id and remove alias field from PAT spec [#3989](https://github.com/DataDog/datadog-api-client-go/pull/3989) +* Add GET OrgGroupPolicy and OrgGroupPolicyOverride, Add policy_type/enforcement_tier fields, Remove enforced_at field [#3973](https://github.com/DataDog/datadog-api-client-go/pull/3973) +* Rename pat_uuid to pat_id and remove alias field from PAT spec [#3969](https://github.com/DataDog/datadog-api-client-go/pull/3969) +* Security Monitoring - Revert rename of historical job API endpoints to threat hunting [#3956](https://github.com/DataDog/datadog-api-client-go/pull/3956) + +### Removed +* Remove unsupported operators from CCM Custom Allocation Rules feature [#3987](https://github.com/DataDog/datadog-api-client-go/pull/3987) + +### Added +* Add us2.ddog-gov.com. [#3984](https://github.com/DataDog/datadog-api-client-go/pull/3984) +* Add OpenAPI documentation for LLM Observability eval config CRUD endpoints [#3980](https://github.com/DataDog/datadog-api-client-go/pull/3980) +* Add OpenAPI spec for v2 Synthetics test result endpoints [#3978](https://github.com/DataDog/datadog-api-client-go/pull/3978) +* Document signals triage update endpoints [#3977](https://github.com/DataDog/datadog-api-client-go/pull/3977) +* Security notifications - Add SAST and secret rule types [#3971](https://github.com/DataDog/datadog-api-client-go/pull/3971) +* Add OpenAPI documentation for list and get indicators of compromise endpoints [#3967](https://github.com/DataDog/datadog-api-client-go/pull/3967) +* Cloud SIEM - Document content packs SIEM endpoints [#3965](https://github.com/DataDog/datadog-api-client-go/pull/3965) +* Add API spec for security monitoring terraform export endpoints [#3954](https://github.com/DataDog/datadog-api-client-go/pull/3954) +* Add team and assignee filters for Search Error Tracking Issues API [#3953](https://github.com/DataDog/datadog-api-client-go/pull/3953) +* Add missing params to ListCustomCostsFiles [#3950](https://github.com/DataDog/datadog-api-client-go/pull/3950) +* Add unstable PUT /api/v2/anonymize_users endpoint [#3934](https://github.com/DataDog/datadog-api-client-go/pull/3934) +* Add query type schemas for timeseries-query data sources [#3917](https://github.com/DataDog/datadog-api-client-go/pull/3917) + ## 2.58.0/2026-04-16 ### Added diff --git a/api/datadog/configuration.go b/api/datadog/configuration.go index 11e2ca2f4f3..f25b6ecb84a 100644 --- a/api/datadog/configuration.go +++ b/api/datadog/configuration.go @@ -880,6 +880,8 @@ func NewConfiguration() *Configuration { "v2.DeleteOrgGroupPolicyOverride": false, "v2.GetOrgGroup": false, "v2.GetOrgGroupMembership": false, + "v2.GetOrgGroupPolicy": false, + "v2.GetOrgGroupPolicyOverride": false, "v2.ListOrgGroupMemberships": false, "v2.ListOrgGroupPolicies": false, "v2.ListOrgGroupPolicyConfigs": false, diff --git a/api/datadogV2/api_cloud_cost_management.go b/api/datadogV2/api_cloud_cost_management.go index 5fc7662382b..eae5f011aac 100644 --- a/api/datadogV2/api_cloud_cost_management.go +++ b/api/datadogV2/api_cloud_cost_management.go @@ -265,11 +265,11 @@ func (a *CloudCostManagementApi) CreateCostGCPUsageCostConfig(ctx _context.Conte // - **PERCENT**: Allocates fixed percentages to specific tags. Requires: allocated_by (array of percentage allocations). // // **Filter Conditions:** -// - Use **value** for single-value conditions: "is", "is not", "contains", "does not contain", "=", "!=", "like", "not like", "is all values", "is untagged" +// - Use **value** for single-value conditions: "is", "is not", "contains", "=", "!=", "like", "not like" // - Use **values** for multi-value conditions: "in", "not in" // - Cannot use both value and values simultaneously. // -// **Supported operators**: is, is not, is all values, is untagged, contains, does not contain, in, not in, =, !=, like, not like +// **Supported operators**: is, is not, contains, in, not in, =, !=, like, not like func (a *CloudCostManagementApi) CreateCustomAllocationRule(ctx _context.Context, body ArbitraryCostUpsertRequest) (ArbitraryRuleResponse, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost @@ -2474,11 +2474,11 @@ func (a *CloudCostManagementApi) UpdateCostGCPUsageCostConfig(ctx _context.Conte // - **USAGE_METRIC**: Allocates based on usage metrics (implementation varies). // // **Filter Conditions:** -// - Use **value** for single-value conditions: "is", "is not", "contains", "does not contain", "=", "!=", "like", "not like", "is all values", "is untagged" +// - Use **value** for single-value conditions: "is", "is not", "contains", "=", "!=", "like", "not like" // - Use **values** for multi-value conditions: "in", "not in" // - Cannot use both value and values simultaneously. // -// **Supported operators**: is, is not, is all values, is untagged, contains, does not contain, in, not in, =, !=, like, not like +// **Supported operators**: is, is not, contains, in, not in, =, !=, like, not like func (a *CloudCostManagementApi) UpdateCustomAllocationRule(ctx _context.Context, ruleId int64, body ArbitraryCostUpsertRequest) (ArbitraryRuleResponse, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPatch diff --git a/api/datadogV2/api_org_groups.go b/api/datadogV2/api_org_groups.go index c9cf0509896..94c720f3116 100644 --- a/api/datadogV2/api_org_groups.go +++ b/api/datadogV2/api_org_groups.go @@ -860,6 +860,198 @@ func (a *OrgGroupsApi) GetOrgGroupMembership(ctx _context.Context, orgGroupMembe return localVarReturnValue, localVarHTTPResponse, nil } +// GetOrgGroupPolicy Get an org group policy. +// Get a specific organization group policy by its ID. +func (a *OrgGroupsApi) GetOrgGroupPolicy(ctx _context.Context, orgGroupPolicyId uuid.UUID) (OrgGroupPolicyResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue OrgGroupPolicyResponse + ) + + operationId := "v2.GetOrgGroupPolicy" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.OrgGroupsApi.GetOrgGroupPolicy") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/org_group_policies/{org_group_policy_id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{org_group_policy_id}", _neturl.PathEscape(datadog.ParameterToString(orgGroupPolicyId, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 { + var v JSONAPIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// GetOrgGroupPolicyOverride Get an org group policy override. +// Get a specific organization group policy override by its ID. +func (a *OrgGroupsApi) GetOrgGroupPolicyOverride(ctx _context.Context, orgGroupPolicyOverrideId uuid.UUID) (OrgGroupPolicyOverrideResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue OrgGroupPolicyOverrideResponse + ) + + operationId := "v2.GetOrgGroupPolicyOverride" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.OrgGroupsApi.GetOrgGroupPolicyOverride") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/org_group_policy_overrides/{org_group_policy_override_id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{org_group_policy_override_id}", _neturl.PathEscape(datadog.ParameterToString(orgGroupPolicyOverrideId, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 { + var v JSONAPIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + // ListOrgGroupMembershipsOptionalParameters holds optional parameters for ListOrgGroupMemberships. type ListOrgGroupMembershipsOptionalParameters struct { FilterOrgGroupId *uuid.UUID @@ -1778,7 +1970,7 @@ func (a *OrgGroupsApi) UpdateOrgGroupMembership(ctx _context.Context, orgGroupMe } // UpdateOrgGroupPolicy Update an org group policy. -// Update the content of an existing organization group policy. +// Update an existing organization group policy. func (a *OrgGroupsApi) UpdateOrgGroupPolicy(ctx _context.Context, orgGroupPolicyId uuid.UUID, body OrgGroupPolicyUpdateRequest) (OrgGroupPolicyResponse, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPatch diff --git a/api/datadogV2/doc.go b/api/datadogV2/doc.go index 541c18d862c..6f8bcc7bcda 100644 --- a/api/datadogV2/doc.go +++ b/api/datadogV2/doc.go @@ -619,6 +619,8 @@ // - [OrgGroupsApi.DeleteOrgGroupPolicyOverride] // - [OrgGroupsApi.GetOrgGroup] // - [OrgGroupsApi.GetOrgGroupMembership] +// - [OrgGroupsApi.GetOrgGroupPolicy] +// - [OrgGroupsApi.GetOrgGroupPolicyOverride] // - [OrgGroupsApi.ListOrgGroupMemberships] // - [OrgGroupsApi.ListOrgGroupPolicies] // - [OrgGroupsApi.ListOrgGroupPolicyConfigs] diff --git a/api/datadogV2/model_create_maintenance_request_data_attributes.go b/api/datadogV2/model_create_maintenance_request_data_attributes.go index f7c3485c6ed..0b8080da994 100644 --- a/api/datadogV2/model_create_maintenance_request_data_attributes.go +++ b/api/datadogV2/model_create_maintenance_request_data_attributes.go @@ -14,17 +14,17 @@ import ( // CreateMaintenanceRequestDataAttributes The supported attributes for creating a maintenance. type CreateMaintenanceRequestDataAttributes struct { // Timestamp of when the maintenance was completed. - CompletedDate *time.Time `json:"completed_date,omitempty"` + CompletedDate time.Time `json:"completed_date"` // The description shown when the maintenance is completed. - CompletedDescription *string `json:"completed_description,omitempty"` + CompletedDescription string `json:"completed_description"` // The components affected by the maintenance. ComponentsAffected []CreateMaintenanceRequestDataAttributesComponentsAffectedItems `json:"components_affected"` // The description shown while the maintenance is in progress. - InProgressDescription *string `json:"in_progress_description,omitempty"` + InProgressDescription string `json:"in_progress_description"` // The description shown when the maintenance is scheduled. - ScheduledDescription *string `json:"scheduled_description,omitempty"` + ScheduledDescription string `json:"scheduled_description"` // Timestamp of when the maintenance is scheduled to start. - StartDate *time.Time `json:"start_date,omitempty"` + StartDate time.Time `json:"start_date"` // The title of the maintenance. Title string `json:"title"` // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct @@ -36,9 +36,14 @@ type CreateMaintenanceRequestDataAttributes struct { // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed. -func NewCreateMaintenanceRequestDataAttributes(componentsAffected []CreateMaintenanceRequestDataAttributesComponentsAffectedItems, title string) *CreateMaintenanceRequestDataAttributes { +func NewCreateMaintenanceRequestDataAttributes(completedDate time.Time, completedDescription string, componentsAffected []CreateMaintenanceRequestDataAttributesComponentsAffectedItems, inProgressDescription string, scheduledDescription string, startDate time.Time, title string) *CreateMaintenanceRequestDataAttributes { this := CreateMaintenanceRequestDataAttributes{} + this.CompletedDate = completedDate + this.CompletedDescription = completedDescription this.ComponentsAffected = componentsAffected + this.InProgressDescription = inProgressDescription + this.ScheduledDescription = scheduledDescription + this.StartDate = startDate this.Title = title return &this } @@ -51,60 +56,50 @@ func NewCreateMaintenanceRequestDataAttributesWithDefaults() *CreateMaintenanceR return &this } -// GetCompletedDate returns the CompletedDate field value if set, zero value otherwise. +// GetCompletedDate returns the CompletedDate field value. func (o *CreateMaintenanceRequestDataAttributes) GetCompletedDate() time.Time { - if o == nil || o.CompletedDate == nil { + if o == nil { var ret time.Time return ret } - return *o.CompletedDate + return o.CompletedDate } -// GetCompletedDateOk returns a tuple with the CompletedDate field value if set, nil otherwise +// GetCompletedDateOk returns a tuple with the CompletedDate field value // and a boolean to check if the value has been set. func (o *CreateMaintenanceRequestDataAttributes) GetCompletedDateOk() (*time.Time, bool) { - if o == nil || o.CompletedDate == nil { + if o == nil { return nil, false } - return o.CompletedDate, true -} - -// HasCompletedDate returns a boolean if a field has been set. -func (o *CreateMaintenanceRequestDataAttributes) HasCompletedDate() bool { - return o != nil && o.CompletedDate != nil + return &o.CompletedDate, true } -// SetCompletedDate gets a reference to the given time.Time and assigns it to the CompletedDate field. +// SetCompletedDate sets field value. func (o *CreateMaintenanceRequestDataAttributes) SetCompletedDate(v time.Time) { - o.CompletedDate = &v + o.CompletedDate = v } -// GetCompletedDescription returns the CompletedDescription field value if set, zero value otherwise. +// GetCompletedDescription returns the CompletedDescription field value. func (o *CreateMaintenanceRequestDataAttributes) GetCompletedDescription() string { - if o == nil || o.CompletedDescription == nil { + if o == nil { var ret string return ret } - return *o.CompletedDescription + return o.CompletedDescription } -// GetCompletedDescriptionOk returns a tuple with the CompletedDescription field value if set, nil otherwise +// GetCompletedDescriptionOk returns a tuple with the CompletedDescription field value // and a boolean to check if the value has been set. func (o *CreateMaintenanceRequestDataAttributes) GetCompletedDescriptionOk() (*string, bool) { - if o == nil || o.CompletedDescription == nil { + if o == nil { return nil, false } - return o.CompletedDescription, true -} - -// HasCompletedDescription returns a boolean if a field has been set. -func (o *CreateMaintenanceRequestDataAttributes) HasCompletedDescription() bool { - return o != nil && o.CompletedDescription != nil + return &o.CompletedDescription, true } -// SetCompletedDescription gets a reference to the given string and assigns it to the CompletedDescription field. +// SetCompletedDescription sets field value. func (o *CreateMaintenanceRequestDataAttributes) SetCompletedDescription(v string) { - o.CompletedDescription = &v + o.CompletedDescription = v } // GetComponentsAffected returns the ComponentsAffected field value. @@ -130,88 +125,73 @@ func (o *CreateMaintenanceRequestDataAttributes) SetComponentsAffected(v []Creat o.ComponentsAffected = v } -// GetInProgressDescription returns the InProgressDescription field value if set, zero value otherwise. +// GetInProgressDescription returns the InProgressDescription field value. func (o *CreateMaintenanceRequestDataAttributes) GetInProgressDescription() string { - if o == nil || o.InProgressDescription == nil { + if o == nil { var ret string return ret } - return *o.InProgressDescription + return o.InProgressDescription } -// GetInProgressDescriptionOk returns a tuple with the InProgressDescription field value if set, nil otherwise +// GetInProgressDescriptionOk returns a tuple with the InProgressDescription field value // and a boolean to check if the value has been set. func (o *CreateMaintenanceRequestDataAttributes) GetInProgressDescriptionOk() (*string, bool) { - if o == nil || o.InProgressDescription == nil { + if o == nil { return nil, false } - return o.InProgressDescription, true -} - -// HasInProgressDescription returns a boolean if a field has been set. -func (o *CreateMaintenanceRequestDataAttributes) HasInProgressDescription() bool { - return o != nil && o.InProgressDescription != nil + return &o.InProgressDescription, true } -// SetInProgressDescription gets a reference to the given string and assigns it to the InProgressDescription field. +// SetInProgressDescription sets field value. func (o *CreateMaintenanceRequestDataAttributes) SetInProgressDescription(v string) { - o.InProgressDescription = &v + o.InProgressDescription = v } -// GetScheduledDescription returns the ScheduledDescription field value if set, zero value otherwise. +// GetScheduledDescription returns the ScheduledDescription field value. func (o *CreateMaintenanceRequestDataAttributes) GetScheduledDescription() string { - if o == nil || o.ScheduledDescription == nil { + if o == nil { var ret string return ret } - return *o.ScheduledDescription + return o.ScheduledDescription } -// GetScheduledDescriptionOk returns a tuple with the ScheduledDescription field value if set, nil otherwise +// GetScheduledDescriptionOk returns a tuple with the ScheduledDescription field value // and a boolean to check if the value has been set. func (o *CreateMaintenanceRequestDataAttributes) GetScheduledDescriptionOk() (*string, bool) { - if o == nil || o.ScheduledDescription == nil { + if o == nil { return nil, false } - return o.ScheduledDescription, true -} - -// HasScheduledDescription returns a boolean if a field has been set. -func (o *CreateMaintenanceRequestDataAttributes) HasScheduledDescription() bool { - return o != nil && o.ScheduledDescription != nil + return &o.ScheduledDescription, true } -// SetScheduledDescription gets a reference to the given string and assigns it to the ScheduledDescription field. +// SetScheduledDescription sets field value. func (o *CreateMaintenanceRequestDataAttributes) SetScheduledDescription(v string) { - o.ScheduledDescription = &v + o.ScheduledDescription = v } -// GetStartDate returns the StartDate field value if set, zero value otherwise. +// GetStartDate returns the StartDate field value. func (o *CreateMaintenanceRequestDataAttributes) GetStartDate() time.Time { - if o == nil || o.StartDate == nil { + if o == nil { var ret time.Time return ret } - return *o.StartDate + return o.StartDate } -// GetStartDateOk returns a tuple with the StartDate field value if set, nil otherwise +// GetStartDateOk returns a tuple with the StartDate field value // and a boolean to check if the value has been set. func (o *CreateMaintenanceRequestDataAttributes) GetStartDateOk() (*time.Time, bool) { - if o == nil || o.StartDate == nil { + if o == nil { return nil, false } - return o.StartDate, true -} - -// HasStartDate returns a boolean if a field has been set. -func (o *CreateMaintenanceRequestDataAttributes) HasStartDate() bool { - return o != nil && o.StartDate != nil + return &o.StartDate, true } -// SetStartDate gets a reference to the given time.Time and assigns it to the StartDate field. +// SetStartDate sets field value. func (o *CreateMaintenanceRequestDataAttributes) SetStartDate(v time.Time) { - o.StartDate = &v + o.StartDate = v } // GetTitle returns the Title field value. @@ -243,29 +223,19 @@ func (o CreateMaintenanceRequestDataAttributes) MarshalJSON() ([]byte, error) { if o.UnparsedObject != nil { return datadog.Marshal(o.UnparsedObject) } - if o.CompletedDate != nil { - if o.CompletedDate.Nanosecond() == 0 { - toSerialize["completed_date"] = o.CompletedDate.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["completed_date"] = o.CompletedDate.Format("2006-01-02T15:04:05.000Z07:00") - } - } - if o.CompletedDescription != nil { - toSerialize["completed_description"] = o.CompletedDescription + if o.CompletedDate.Nanosecond() == 0 { + toSerialize["completed_date"] = o.CompletedDate.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["completed_date"] = o.CompletedDate.Format("2006-01-02T15:04:05.000Z07:00") } + toSerialize["completed_description"] = o.CompletedDescription toSerialize["components_affected"] = o.ComponentsAffected - if o.InProgressDescription != nil { - toSerialize["in_progress_description"] = o.InProgressDescription - } - if o.ScheduledDescription != nil { - toSerialize["scheduled_description"] = o.ScheduledDescription - } - if o.StartDate != nil { - if o.StartDate.Nanosecond() == 0 { - toSerialize["start_date"] = o.StartDate.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["start_date"] = o.StartDate.Format("2006-01-02T15:04:05.000Z07:00") - } + toSerialize["in_progress_description"] = o.InProgressDescription + toSerialize["scheduled_description"] = o.ScheduledDescription + if o.StartDate.Nanosecond() == 0 { + toSerialize["start_date"] = o.StartDate.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["start_date"] = o.StartDate.Format("2006-01-02T15:04:05.000Z07:00") } toSerialize["title"] = o.Title @@ -278,20 +248,35 @@ func (o CreateMaintenanceRequestDataAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CreateMaintenanceRequestDataAttributes) UnmarshalJSON(bytes []byte) (err error) { all := struct { - CompletedDate *time.Time `json:"completed_date,omitempty"` - CompletedDescription *string `json:"completed_description,omitempty"` + CompletedDate *time.Time `json:"completed_date"` + CompletedDescription *string `json:"completed_description"` ComponentsAffected *[]CreateMaintenanceRequestDataAttributesComponentsAffectedItems `json:"components_affected"` - InProgressDescription *string `json:"in_progress_description,omitempty"` - ScheduledDescription *string `json:"scheduled_description,omitempty"` - StartDate *time.Time `json:"start_date,omitempty"` + InProgressDescription *string `json:"in_progress_description"` + ScheduledDescription *string `json:"scheduled_description"` + StartDate *time.Time `json:"start_date"` Title *string `json:"title"` }{} if err = datadog.Unmarshal(bytes, &all); err != nil { return datadog.Unmarshal(bytes, &o.UnparsedObject) } + if all.CompletedDate == nil { + return fmt.Errorf("required field completed_date missing") + } + if all.CompletedDescription == nil { + return fmt.Errorf("required field completed_description missing") + } if all.ComponentsAffected == nil { return fmt.Errorf("required field components_affected missing") } + if all.InProgressDescription == nil { + return fmt.Errorf("required field in_progress_description missing") + } + if all.ScheduledDescription == nil { + return fmt.Errorf("required field scheduled_description missing") + } + if all.StartDate == nil { + return fmt.Errorf("required field start_date missing") + } if all.Title == nil { return fmt.Errorf("required field title missing") } @@ -301,12 +286,12 @@ func (o *CreateMaintenanceRequestDataAttributes) UnmarshalJSON(bytes []byte) (er } else { return err } - o.CompletedDate = all.CompletedDate - o.CompletedDescription = all.CompletedDescription + o.CompletedDate = *all.CompletedDate + o.CompletedDescription = *all.CompletedDescription o.ComponentsAffected = *all.ComponentsAffected - o.InProgressDescription = all.InProgressDescription - o.ScheduledDescription = all.ScheduledDescription - o.StartDate = all.StartDate + o.InProgressDescription = *all.InProgressDescription + o.ScheduledDescription = *all.ScheduledDescription + o.StartDate = *all.StartDate o.Title = *all.Title if len(additionalProperties) > 0 { diff --git a/api/datadogV2/model_org_group_policy_attributes.go b/api/datadogV2/model_org_group_policy_attributes.go index 7e8dbbd5985..991bcf818bf 100644 --- a/api/datadogV2/model_org_group_policy_attributes.go +++ b/api/datadogV2/model_org_group_policy_attributes.go @@ -15,12 +15,14 @@ import ( type OrgGroupPolicyAttributes struct { // The policy content as key-value pairs. Content map[string]interface{} `json:"content,omitempty"` - // Timestamp when the policy was enforced. - EnforcedAt time.Time `json:"enforced_at"` + // The enforcement tier of the policy. `DEFAULT` means the policy is set but member orgs may mutate it. `ENFORCE` means the policy is strictly controlled and mutations are blocked for affected orgs. `DELEGATE` means each member org controls its own value. + EnforcementTier OrgGroupPolicyEnforcementTier `json:"enforcement_tier"` // Timestamp when the policy was last modified. ModifiedAt time.Time `json:"modified_at"` // The name of the policy. PolicyName string `json:"policy_name"` + // The type of the policy. Only `org_config` is supported, indicating a policy backed by an organization configuration setting. + PolicyType OrgGroupPolicyPolicyType `json:"policy_type"` // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct UnparsedObject map[string]interface{} `json:"-"` AdditionalProperties map[string]interface{} `json:"-"` @@ -30,11 +32,12 @@ type OrgGroupPolicyAttributes struct { // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed. -func NewOrgGroupPolicyAttributes(enforcedAt time.Time, modifiedAt time.Time, policyName string) *OrgGroupPolicyAttributes { +func NewOrgGroupPolicyAttributes(enforcementTier OrgGroupPolicyEnforcementTier, modifiedAt time.Time, policyName string, policyType OrgGroupPolicyPolicyType) *OrgGroupPolicyAttributes { this := OrgGroupPolicyAttributes{} - this.EnforcedAt = enforcedAt + this.EnforcementTier = enforcementTier this.ModifiedAt = modifiedAt this.PolicyName = policyName + this.PolicyType = policyType return &this } @@ -43,6 +46,10 @@ func NewOrgGroupPolicyAttributes(enforcedAt time.Time, modifiedAt time.Time, pol // but it doesn't guarantee that properties required by API are set. func NewOrgGroupPolicyAttributesWithDefaults() *OrgGroupPolicyAttributes { this := OrgGroupPolicyAttributes{} + var enforcementTier OrgGroupPolicyEnforcementTier = ORGGROUPPOLICYENFORCEMENTTIER_DEFAULT + this.EnforcementTier = enforcementTier + var policyType OrgGroupPolicyPolicyType = ORGGROUPPOLICYPOLICYTYPE_ORG_CONFIG + this.PolicyType = policyType return &this } @@ -74,27 +81,27 @@ func (o *OrgGroupPolicyAttributes) SetContent(v map[string]interface{}) { o.Content = v } -// GetEnforcedAt returns the EnforcedAt field value. -func (o *OrgGroupPolicyAttributes) GetEnforcedAt() time.Time { +// GetEnforcementTier returns the EnforcementTier field value. +func (o *OrgGroupPolicyAttributes) GetEnforcementTier() OrgGroupPolicyEnforcementTier { if o == nil { - var ret time.Time + var ret OrgGroupPolicyEnforcementTier return ret } - return o.EnforcedAt + return o.EnforcementTier } -// GetEnforcedAtOk returns a tuple with the EnforcedAt field value +// GetEnforcementTierOk returns a tuple with the EnforcementTier field value // and a boolean to check if the value has been set. -func (o *OrgGroupPolicyAttributes) GetEnforcedAtOk() (*time.Time, bool) { +func (o *OrgGroupPolicyAttributes) GetEnforcementTierOk() (*OrgGroupPolicyEnforcementTier, bool) { if o == nil { return nil, false } - return &o.EnforcedAt, true + return &o.EnforcementTier, true } -// SetEnforcedAt sets field value. -func (o *OrgGroupPolicyAttributes) SetEnforcedAt(v time.Time) { - o.EnforcedAt = v +// SetEnforcementTier sets field value. +func (o *OrgGroupPolicyAttributes) SetEnforcementTier(v OrgGroupPolicyEnforcementTier) { + o.EnforcementTier = v } // GetModifiedAt returns the ModifiedAt field value. @@ -143,6 +150,29 @@ func (o *OrgGroupPolicyAttributes) SetPolicyName(v string) { o.PolicyName = v } +// GetPolicyType returns the PolicyType field value. +func (o *OrgGroupPolicyAttributes) GetPolicyType() OrgGroupPolicyPolicyType { + if o == nil { + var ret OrgGroupPolicyPolicyType + return ret + } + return o.PolicyType +} + +// GetPolicyTypeOk returns a tuple with the PolicyType field value +// and a boolean to check if the value has been set. +func (o *OrgGroupPolicyAttributes) GetPolicyTypeOk() (*OrgGroupPolicyPolicyType, bool) { + if o == nil { + return nil, false + } + return &o.PolicyType, true +} + +// SetPolicyType sets field value. +func (o *OrgGroupPolicyAttributes) SetPolicyType(v OrgGroupPolicyPolicyType) { + o.PolicyType = v +} + // MarshalJSON serializes the struct using spec logic. func (o OrgGroupPolicyAttributes) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} @@ -152,17 +182,14 @@ func (o OrgGroupPolicyAttributes) MarshalJSON() ([]byte, error) { if o.Content != nil { toSerialize["content"] = o.Content } - if o.EnforcedAt.Nanosecond() == 0 { - toSerialize["enforced_at"] = o.EnforcedAt.Format("2006-01-02T15:04:05Z07:00") - } else { - toSerialize["enforced_at"] = o.EnforcedAt.Format("2006-01-02T15:04:05.000Z07:00") - } + toSerialize["enforcement_tier"] = o.EnforcementTier if o.ModifiedAt.Nanosecond() == 0 { toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05Z07:00") } else { toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05.000Z07:00") } toSerialize["policy_name"] = o.PolicyName + toSerialize["policy_type"] = o.PolicyType for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -173,16 +200,17 @@ func (o OrgGroupPolicyAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *OrgGroupPolicyAttributes) UnmarshalJSON(bytes []byte) (err error) { all := struct { - Content map[string]interface{} `json:"content,omitempty"` - EnforcedAt *time.Time `json:"enforced_at"` - ModifiedAt *time.Time `json:"modified_at"` - PolicyName *string `json:"policy_name"` + Content map[string]interface{} `json:"content,omitempty"` + EnforcementTier *OrgGroupPolicyEnforcementTier `json:"enforcement_tier"` + ModifiedAt *time.Time `json:"modified_at"` + PolicyName *string `json:"policy_name"` + PolicyType *OrgGroupPolicyPolicyType `json:"policy_type"` }{} if err = datadog.Unmarshal(bytes, &all); err != nil { return datadog.Unmarshal(bytes, &o.UnparsedObject) } - if all.EnforcedAt == nil { - return fmt.Errorf("required field enforced_at missing") + if all.EnforcementTier == nil { + return fmt.Errorf("required field enforcement_tier missing") } if all.ModifiedAt == nil { return fmt.Errorf("required field modified_at missing") @@ -190,20 +218,38 @@ func (o *OrgGroupPolicyAttributes) UnmarshalJSON(bytes []byte) (err error) { if all.PolicyName == nil { return fmt.Errorf("required field policy_name missing") } + if all.PolicyType == nil { + return fmt.Errorf("required field policy_type missing") + } additionalProperties := make(map[string]interface{}) if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"content", "enforced_at", "modified_at", "policy_name"}) + datadog.DeleteKeys(additionalProperties, &[]string{"content", "enforcement_tier", "modified_at", "policy_name", "policy_type"}) } else { return err } + + hasInvalidField := false o.Content = all.Content - o.EnforcedAt = *all.EnforcedAt + if !all.EnforcementTier.IsValid() { + hasInvalidField = true + } else { + o.EnforcementTier = *all.EnforcementTier + } o.ModifiedAt = *all.ModifiedAt o.PolicyName = *all.PolicyName + if !all.PolicyType.IsValid() { + hasInvalidField = true + } else { + o.PolicyType = *all.PolicyType + } if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/api/datadogV2/model_org_group_policy_create_attributes.go b/api/datadogV2/model_org_group_policy_create_attributes.go index 750d72688b7..6abfed21957 100644 --- a/api/datadogV2/model_org_group_policy_create_attributes.go +++ b/api/datadogV2/model_org_group_policy_create_attributes.go @@ -10,12 +10,16 @@ import ( "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) -// OrgGroupPolicyCreateAttributes Attributes for creating an org group policy. +// OrgGroupPolicyCreateAttributes Attributes for creating an org group policy. If `policy_type` or `enforcement_tier` are not provided, they default to `org_config` and `DEFAULT` respectively. type OrgGroupPolicyCreateAttributes struct { // The policy content as key-value pairs. Content map[string]interface{} `json:"content"` + // The enforcement tier of the policy. `DEFAULT` means the policy is set but member orgs may mutate it. `ENFORCE` means the policy is strictly controlled and mutations are blocked for affected orgs. `DELEGATE` means each member org controls its own value. + EnforcementTier *OrgGroupPolicyEnforcementTier `json:"enforcement_tier,omitempty"` // The name of the policy. PolicyName string `json:"policy_name"` + // The type of the policy. Only `org_config` is supported, indicating a policy backed by an organization configuration setting. + PolicyType *OrgGroupPolicyPolicyType `json:"policy_type,omitempty"` // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct UnparsedObject map[string]interface{} `json:"-"` AdditionalProperties map[string]interface{} `json:"-"` @@ -28,7 +32,11 @@ type OrgGroupPolicyCreateAttributes struct { func NewOrgGroupPolicyCreateAttributes(content map[string]interface{}, policyName string) *OrgGroupPolicyCreateAttributes { this := OrgGroupPolicyCreateAttributes{} this.Content = content + var enforcementTier OrgGroupPolicyEnforcementTier = ORGGROUPPOLICYENFORCEMENTTIER_DEFAULT + this.EnforcementTier = &enforcementTier this.PolicyName = policyName + var policyType OrgGroupPolicyPolicyType = ORGGROUPPOLICYPOLICYTYPE_ORG_CONFIG + this.PolicyType = &policyType return &this } @@ -37,6 +45,10 @@ func NewOrgGroupPolicyCreateAttributes(content map[string]interface{}, policyNam // but it doesn't guarantee that properties required by API are set. func NewOrgGroupPolicyCreateAttributesWithDefaults() *OrgGroupPolicyCreateAttributes { this := OrgGroupPolicyCreateAttributes{} + var enforcementTier OrgGroupPolicyEnforcementTier = ORGGROUPPOLICYENFORCEMENTTIER_DEFAULT + this.EnforcementTier = &enforcementTier + var policyType OrgGroupPolicyPolicyType = ORGGROUPPOLICYPOLICYTYPE_ORG_CONFIG + this.PolicyType = &policyType return &this } @@ -63,6 +75,34 @@ func (o *OrgGroupPolicyCreateAttributes) SetContent(v map[string]interface{}) { o.Content = v } +// GetEnforcementTier returns the EnforcementTier field value if set, zero value otherwise. +func (o *OrgGroupPolicyCreateAttributes) GetEnforcementTier() OrgGroupPolicyEnforcementTier { + if o == nil || o.EnforcementTier == nil { + var ret OrgGroupPolicyEnforcementTier + return ret + } + return *o.EnforcementTier +} + +// GetEnforcementTierOk returns a tuple with the EnforcementTier field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OrgGroupPolicyCreateAttributes) GetEnforcementTierOk() (*OrgGroupPolicyEnforcementTier, bool) { + if o == nil || o.EnforcementTier == nil { + return nil, false + } + return o.EnforcementTier, true +} + +// HasEnforcementTier returns a boolean if a field has been set. +func (o *OrgGroupPolicyCreateAttributes) HasEnforcementTier() bool { + return o != nil && o.EnforcementTier != nil +} + +// SetEnforcementTier gets a reference to the given OrgGroupPolicyEnforcementTier and assigns it to the EnforcementTier field. +func (o *OrgGroupPolicyCreateAttributes) SetEnforcementTier(v OrgGroupPolicyEnforcementTier) { + o.EnforcementTier = &v +} + // GetPolicyName returns the PolicyName field value. func (o *OrgGroupPolicyCreateAttributes) GetPolicyName() string { if o == nil { @@ -86,6 +126,34 @@ func (o *OrgGroupPolicyCreateAttributes) SetPolicyName(v string) { o.PolicyName = v } +// GetPolicyType returns the PolicyType field value if set, zero value otherwise. +func (o *OrgGroupPolicyCreateAttributes) GetPolicyType() OrgGroupPolicyPolicyType { + if o == nil || o.PolicyType == nil { + var ret OrgGroupPolicyPolicyType + return ret + } + return *o.PolicyType +} + +// GetPolicyTypeOk returns a tuple with the PolicyType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OrgGroupPolicyCreateAttributes) GetPolicyTypeOk() (*OrgGroupPolicyPolicyType, bool) { + if o == nil || o.PolicyType == nil { + return nil, false + } + return o.PolicyType, true +} + +// HasPolicyType returns a boolean if a field has been set. +func (o *OrgGroupPolicyCreateAttributes) HasPolicyType() bool { + return o != nil && o.PolicyType != nil +} + +// SetPolicyType gets a reference to the given OrgGroupPolicyPolicyType and assigns it to the PolicyType field. +func (o *OrgGroupPolicyCreateAttributes) SetPolicyType(v OrgGroupPolicyPolicyType) { + o.PolicyType = &v +} + // MarshalJSON serializes the struct using spec logic. func (o OrgGroupPolicyCreateAttributes) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} @@ -93,7 +161,13 @@ func (o OrgGroupPolicyCreateAttributes) MarshalJSON() ([]byte, error) { return datadog.Marshal(o.UnparsedObject) } toSerialize["content"] = o.Content + if o.EnforcementTier != nil { + toSerialize["enforcement_tier"] = o.EnforcementTier + } toSerialize["policy_name"] = o.PolicyName + if o.PolicyType != nil { + toSerialize["policy_type"] = o.PolicyType + } for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -104,8 +178,10 @@ func (o OrgGroupPolicyCreateAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *OrgGroupPolicyCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { all := struct { - Content *map[string]interface{} `json:"content"` - PolicyName *string `json:"policy_name"` + Content *map[string]interface{} `json:"content"` + EnforcementTier *OrgGroupPolicyEnforcementTier `json:"enforcement_tier,omitempty"` + PolicyName *string `json:"policy_name"` + PolicyType *OrgGroupPolicyPolicyType `json:"policy_type,omitempty"` }{} if err = datadog.Unmarshal(bytes, &all); err != nil { return datadog.Unmarshal(bytes, &o.UnparsedObject) @@ -118,16 +194,32 @@ func (o *OrgGroupPolicyCreateAttributes) UnmarshalJSON(bytes []byte) (err error) } additionalProperties := make(map[string]interface{}) if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"content", "policy_name"}) + datadog.DeleteKeys(additionalProperties, &[]string{"content", "enforcement_tier", "policy_name", "policy_type"}) } else { return err } + + hasInvalidField := false o.Content = *all.Content + if all.EnforcementTier != nil && !all.EnforcementTier.IsValid() { + hasInvalidField = true + } else { + o.EnforcementTier = all.EnforcementTier + } o.PolicyName = *all.PolicyName + if all.PolicyType != nil && !all.PolicyType.IsValid() { + hasInvalidField = true + } else { + o.PolicyType = all.PolicyType + } if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/api/datadogV2/model_org_group_policy_create_data.go b/api/datadogV2/model_org_group_policy_create_data.go index 17c95127d1c..0cacd6cdb3f 100644 --- a/api/datadogV2/model_org_group_policy_create_data.go +++ b/api/datadogV2/model_org_group_policy_create_data.go @@ -12,7 +12,7 @@ import ( // OrgGroupPolicyCreateData Data for creating an org group policy. type OrgGroupPolicyCreateData struct { - // Attributes for creating an org group policy. + // Attributes for creating an org group policy. If `policy_type` or `enforcement_tier` are not provided, they default to `org_config` and `DEFAULT` respectively. Attributes OrgGroupPolicyCreateAttributes `json:"attributes"` // Relationships for creating a policy. Relationships OrgGroupPolicyCreateRelationships `json:"relationships"` diff --git a/api/datadogV2/model_org_group_policy_enforcement_tier.go b/api/datadogV2/model_org_group_policy_enforcement_tier.go new file mode 100644 index 00000000000..be22bd23928 --- /dev/null +++ b/api/datadogV2/model_org_group_policy_enforcement_tier.go @@ -0,0 +1,68 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// OrgGroupPolicyEnforcementTier The enforcement tier of the policy. `DEFAULT` means the policy is set but member orgs may mutate it. `ENFORCE` means the policy is strictly controlled and mutations are blocked for affected orgs. `DELEGATE` means each member org controls its own value. +type OrgGroupPolicyEnforcementTier string + +// List of OrgGroupPolicyEnforcementTier. +const ( + ORGGROUPPOLICYENFORCEMENTTIER_DEFAULT OrgGroupPolicyEnforcementTier = "DEFAULT" + ORGGROUPPOLICYENFORCEMENTTIER_ENFORCE OrgGroupPolicyEnforcementTier = "ENFORCE" + ORGGROUPPOLICYENFORCEMENTTIER_DELEGATE OrgGroupPolicyEnforcementTier = "DELEGATE" +) + +var allowedOrgGroupPolicyEnforcementTierEnumValues = []OrgGroupPolicyEnforcementTier{ + ORGGROUPPOLICYENFORCEMENTTIER_DEFAULT, + ORGGROUPPOLICYENFORCEMENTTIER_ENFORCE, + ORGGROUPPOLICYENFORCEMENTTIER_DELEGATE, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *OrgGroupPolicyEnforcementTier) GetAllowedValues() []OrgGroupPolicyEnforcementTier { + return allowedOrgGroupPolicyEnforcementTierEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *OrgGroupPolicyEnforcementTier) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = OrgGroupPolicyEnforcementTier(value) + return nil +} + +// NewOrgGroupPolicyEnforcementTierFromValue returns a pointer to a valid OrgGroupPolicyEnforcementTier +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewOrgGroupPolicyEnforcementTierFromValue(v string) (*OrgGroupPolicyEnforcementTier, error) { + ev := OrgGroupPolicyEnforcementTier(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for OrgGroupPolicyEnforcementTier: valid values are %v", v, allowedOrgGroupPolicyEnforcementTierEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v OrgGroupPolicyEnforcementTier) IsValid() bool { + for _, existing := range allowedOrgGroupPolicyEnforcementTierEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to OrgGroupPolicyEnforcementTier value. +func (v OrgGroupPolicyEnforcementTier) Ptr() *OrgGroupPolicyEnforcementTier { + return &v +} diff --git a/api/datadogV2/model_org_group_policy_override_update_attributes.go b/api/datadogV2/model_org_group_policy_override_update_attributes.go index 79826362c25..13c1f39dca8 100644 --- a/api/datadogV2/model_org_group_policy_override_update_attributes.go +++ b/api/datadogV2/model_org_group_policy_override_update_attributes.go @@ -12,7 +12,7 @@ import ( "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) -// OrgGroupPolicyOverrideUpdateAttributes Attributes for updating a policy override. +// OrgGroupPolicyOverrideUpdateAttributes Attributes for updating a policy override. The `org_uuid` and `org_site` fields must match the existing override and cannot be changed. type OrgGroupPolicyOverrideUpdateAttributes struct { // The site of the organization. OrgSite string `json:"org_site"` diff --git a/api/datadogV2/model_org_group_policy_override_update_data.go b/api/datadogV2/model_org_group_policy_override_update_data.go index 387cda78190..a3d2667eb71 100644 --- a/api/datadogV2/model_org_group_policy_override_update_data.go +++ b/api/datadogV2/model_org_group_policy_override_update_data.go @@ -14,7 +14,7 @@ import ( // OrgGroupPolicyOverrideUpdateData Data for updating a policy override. type OrgGroupPolicyOverrideUpdateData struct { - // Attributes for updating a policy override. + // Attributes for updating a policy override. The `org_uuid` and `org_site` fields must match the existing override and cannot be changed. Attributes OrgGroupPolicyOverrideUpdateAttributes `json:"attributes"` // The ID of the policy override. Id uuid.UUID `json:"id"` diff --git a/api/datadogV2/model_org_group_policy_policy_type.go b/api/datadogV2/model_org_group_policy_policy_type.go new file mode 100644 index 00000000000..347d0a4038c --- /dev/null +++ b/api/datadogV2/model_org_group_policy_policy_type.go @@ -0,0 +1,64 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// OrgGroupPolicyPolicyType The type of the policy. Only `org_config` is supported, indicating a policy backed by an organization configuration setting. +type OrgGroupPolicyPolicyType string + +// List of OrgGroupPolicyPolicyType. +const ( + ORGGROUPPOLICYPOLICYTYPE_ORG_CONFIG OrgGroupPolicyPolicyType = "org_config" +) + +var allowedOrgGroupPolicyPolicyTypeEnumValues = []OrgGroupPolicyPolicyType{ + ORGGROUPPOLICYPOLICYTYPE_ORG_CONFIG, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *OrgGroupPolicyPolicyType) GetAllowedValues() []OrgGroupPolicyPolicyType { + return allowedOrgGroupPolicyPolicyTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *OrgGroupPolicyPolicyType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = OrgGroupPolicyPolicyType(value) + return nil +} + +// NewOrgGroupPolicyPolicyTypeFromValue returns a pointer to a valid OrgGroupPolicyPolicyType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewOrgGroupPolicyPolicyTypeFromValue(v string) (*OrgGroupPolicyPolicyType, error) { + ev := OrgGroupPolicyPolicyType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for OrgGroupPolicyPolicyType: valid values are %v", v, allowedOrgGroupPolicyPolicyTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v OrgGroupPolicyPolicyType) IsValid() bool { + for _, existing := range allowedOrgGroupPolicyPolicyTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to OrgGroupPolicyPolicyType value. +func (v OrgGroupPolicyPolicyType) Ptr() *OrgGroupPolicyPolicyType { + return &v +} diff --git a/api/datadogV2/model_org_group_policy_update_attributes.go b/api/datadogV2/model_org_group_policy_update_attributes.go index 834e6e129f7..7435909b3d5 100644 --- a/api/datadogV2/model_org_group_policy_update_attributes.go +++ b/api/datadogV2/model_org_group_policy_update_attributes.go @@ -12,6 +12,8 @@ import ( type OrgGroupPolicyUpdateAttributes struct { // The policy content as key-value pairs. Content map[string]interface{} `json:"content,omitempty"` + // The enforcement tier of the policy. `DEFAULT` means the policy is set but member orgs may mutate it. `ENFORCE` means the policy is strictly controlled and mutations are blocked for affected orgs. `DELEGATE` means each member org controls its own value. + EnforcementTier *OrgGroupPolicyEnforcementTier `json:"enforcement_tier,omitempty"` // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct UnparsedObject map[string]interface{} `json:"-"` AdditionalProperties map[string]interface{} `json:"-"` @@ -23,6 +25,8 @@ type OrgGroupPolicyUpdateAttributes struct { // will change when the set of required properties is changed. func NewOrgGroupPolicyUpdateAttributes() *OrgGroupPolicyUpdateAttributes { this := OrgGroupPolicyUpdateAttributes{} + var enforcementTier OrgGroupPolicyEnforcementTier = ORGGROUPPOLICYENFORCEMENTTIER_DEFAULT + this.EnforcementTier = &enforcementTier return &this } @@ -31,6 +35,8 @@ func NewOrgGroupPolicyUpdateAttributes() *OrgGroupPolicyUpdateAttributes { // but it doesn't guarantee that properties required by API are set. func NewOrgGroupPolicyUpdateAttributesWithDefaults() *OrgGroupPolicyUpdateAttributes { this := OrgGroupPolicyUpdateAttributes{} + var enforcementTier OrgGroupPolicyEnforcementTier = ORGGROUPPOLICYENFORCEMENTTIER_DEFAULT + this.EnforcementTier = &enforcementTier return &this } @@ -62,6 +68,34 @@ func (o *OrgGroupPolicyUpdateAttributes) SetContent(v map[string]interface{}) { o.Content = v } +// GetEnforcementTier returns the EnforcementTier field value if set, zero value otherwise. +func (o *OrgGroupPolicyUpdateAttributes) GetEnforcementTier() OrgGroupPolicyEnforcementTier { + if o == nil || o.EnforcementTier == nil { + var ret OrgGroupPolicyEnforcementTier + return ret + } + return *o.EnforcementTier +} + +// GetEnforcementTierOk returns a tuple with the EnforcementTier field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OrgGroupPolicyUpdateAttributes) GetEnforcementTierOk() (*OrgGroupPolicyEnforcementTier, bool) { + if o == nil || o.EnforcementTier == nil { + return nil, false + } + return o.EnforcementTier, true +} + +// HasEnforcementTier returns a boolean if a field has been set. +func (o *OrgGroupPolicyUpdateAttributes) HasEnforcementTier() bool { + return o != nil && o.EnforcementTier != nil +} + +// SetEnforcementTier gets a reference to the given OrgGroupPolicyEnforcementTier and assigns it to the EnforcementTier field. +func (o *OrgGroupPolicyUpdateAttributes) SetEnforcementTier(v OrgGroupPolicyEnforcementTier) { + o.EnforcementTier = &v +} + // MarshalJSON serializes the struct using spec logic. func (o OrgGroupPolicyUpdateAttributes) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} @@ -71,6 +105,9 @@ func (o OrgGroupPolicyUpdateAttributes) MarshalJSON() ([]byte, error) { if o.Content != nil { toSerialize["content"] = o.Content } + if o.EnforcementTier != nil { + toSerialize["enforcement_tier"] = o.EnforcementTier + } for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -81,22 +118,34 @@ func (o OrgGroupPolicyUpdateAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *OrgGroupPolicyUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { all := struct { - Content map[string]interface{} `json:"content,omitempty"` + Content map[string]interface{} `json:"content,omitempty"` + EnforcementTier *OrgGroupPolicyEnforcementTier `json:"enforcement_tier,omitempty"` }{} if err = datadog.Unmarshal(bytes, &all); err != nil { return datadog.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"content"}) + datadog.DeleteKeys(additionalProperties, &[]string{"content", "enforcement_tier"}) } else { return err } + + hasInvalidField := false o.Content = all.Content + if all.EnforcementTier != nil && !all.EnforcementTier.IsValid() { + hasInvalidField = true + } else { + o.EnforcementTier = all.EnforcementTier + } if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/examples/v2/org-groups/BulkUpdateOrgGroupMemberships.go b/examples/v2/org-groups/BulkUpdateOrgGroupMemberships.go index 6dce74c1774..10a0c578460 100644 --- a/examples/v2/org-groups/BulkUpdateOrgGroupMemberships.go +++ b/examples/v2/org-groups/BulkUpdateOrgGroupMemberships.go @@ -19,7 +19,7 @@ func main() { Attributes: datadogV2.OrgGroupMembershipBulkUpdateAttributes{ Orgs: []datadogV2.GlobalOrgIdentifier{ { - OrgSite: "datadoghq.com", + OrgSite: "us1", OrgUuid: uuid.MustParse("c3d4e5f6-a7b8-9012-cdef-012345678901"), }, }, diff --git a/examples/v2/org-groups/CreateOrgGroupPolicy.go b/examples/v2/org-groups/CreateOrgGroupPolicy.go index 0636dd5fc10..629d0a7b6d1 100644 --- a/examples/v2/org-groups/CreateOrgGroupPolicy.go +++ b/examples/v2/org-groups/CreateOrgGroupPolicy.go @@ -20,7 +20,9 @@ func main() { Content: map[string]interface{}{ "value": "UTC", }, - PolicyName: "monitor_timezone", + EnforcementTier: datadogV2.ORGGROUPPOLICYENFORCEMENTTIER_DEFAULT.Ptr(), + PolicyName: "monitor_timezone", + PolicyType: datadogV2.ORGGROUPPOLICYPOLICYTYPE_ORG_CONFIG.Ptr(), }, Relationships: datadogV2.OrgGroupPolicyCreateRelationships{ OrgGroup: datadogV2.OrgGroupRelationshipToOne{ diff --git a/examples/v2/org-groups/CreateOrgGroupPolicyOverride.go b/examples/v2/org-groups/CreateOrgGroupPolicyOverride.go index 025656732b4..3c11e16ba52 100644 --- a/examples/v2/org-groups/CreateOrgGroupPolicyOverride.go +++ b/examples/v2/org-groups/CreateOrgGroupPolicyOverride.go @@ -17,7 +17,7 @@ func main() { body := datadogV2.OrgGroupPolicyOverrideCreateRequest{ Data: datadogV2.OrgGroupPolicyOverrideCreateData{ Attributes: datadogV2.OrgGroupPolicyOverrideCreateAttributes{ - OrgSite: "datadoghq.com", + OrgSite: "us1", OrgUuid: uuid.MustParse("c3d4e5f6-a7b8-9012-cdef-012345678901"), }, Relationships: datadogV2.OrgGroupPolicyOverrideCreateRelationships{ diff --git a/examples/v2/org-groups/GetOrgGroupPolicy.go b/examples/v2/org-groups/GetOrgGroupPolicy.go new file mode 100644 index 00000000000..93bcc2447ec --- /dev/null +++ b/examples/v2/org-groups/GetOrgGroupPolicy.go @@ -0,0 +1,31 @@ +// Get an org group policy returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" + "github.com/google/uuid" +) + +func main() { + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.GetOrgGroupPolicy", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewOrgGroupsApi(apiClient) + resp, r, err := api.GetOrgGroupPolicy(ctx, uuid.MustParse("1a2b3c4d-5e6f-7890-abcd-ef0123456789")) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `OrgGroupsApi.GetOrgGroupPolicy`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `OrgGroupsApi.GetOrgGroupPolicy`:\n%s\n", responseContent) +} diff --git a/examples/v2/org-groups/GetOrgGroupPolicyOverride.go b/examples/v2/org-groups/GetOrgGroupPolicyOverride.go new file mode 100644 index 00000000000..f97bb267ba4 --- /dev/null +++ b/examples/v2/org-groups/GetOrgGroupPolicyOverride.go @@ -0,0 +1,31 @@ +// Get an org group policy override returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" + "github.com/google/uuid" +) + +func main() { + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.GetOrgGroupPolicyOverride", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewOrgGroupsApi(apiClient) + resp, r, err := api.GetOrgGroupPolicyOverride(ctx, uuid.MustParse("9f8e7d6c-5b4a-3210-fedc-ba0987654321")) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `OrgGroupsApi.GetOrgGroupPolicyOverride`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `OrgGroupsApi.GetOrgGroupPolicyOverride`:\n%s\n", responseContent) +} diff --git a/examples/v2/org-groups/UpdateOrgGroupPolicy.go b/examples/v2/org-groups/UpdateOrgGroupPolicy.go index 07ae331e69a..8e368f5dbce 100644 --- a/examples/v2/org-groups/UpdateOrgGroupPolicy.go +++ b/examples/v2/org-groups/UpdateOrgGroupPolicy.go @@ -20,6 +20,7 @@ func main() { Content: map[string]interface{}{ "value": "UTC", }, + EnforcementTier: datadogV2.ORGGROUPPOLICYENFORCEMENTTIER_DEFAULT.Ptr(), }, Id: uuid.MustParse("1a2b3c4d-5e6f-7890-abcd-ef0123456789"), Type: datadogV2.ORGGROUPPOLICYTYPE_ORG_GROUP_POLICIES, diff --git a/examples/v2/org-groups/UpdateOrgGroupPolicyOverride.go b/examples/v2/org-groups/UpdateOrgGroupPolicyOverride.go index 1f8bbeef01b..3d43d9b4856 100644 --- a/examples/v2/org-groups/UpdateOrgGroupPolicyOverride.go +++ b/examples/v2/org-groups/UpdateOrgGroupPolicyOverride.go @@ -17,7 +17,7 @@ func main() { body := datadogV2.OrgGroupPolicyOverrideUpdateRequest{ Data: datadogV2.OrgGroupPolicyOverrideUpdateData{ Attributes: datadogV2.OrgGroupPolicyOverrideUpdateAttributes{ - OrgSite: "datadoghq.com", + OrgSite: "us1", OrgUuid: uuid.MustParse("c3d4e5f6-a7b8-9012-cdef-012345678901"), }, Id: uuid.MustParse("9f8e7d6c-5b4a-3210-fedc-ba0987654321"), diff --git a/examples/v2/status-pages/CreateMaintenance.go b/examples/v2/status-pages/CreateMaintenance.go index 2a8cc5e48ec..23204f5a870 100644 --- a/examples/v2/status-pages/CreateMaintenance.go +++ b/examples/v2/status-pages/CreateMaintenance.go @@ -18,17 +18,17 @@ func main() { body := datadogV2.CreateMaintenanceRequest{ Data: &datadogV2.CreateMaintenanceRequestData{ Attributes: datadogV2.CreateMaintenanceRequestDataAttributes{ - CompletedDate: datadog.PtrTime(time.Date(2026, 2, 18, 19, 51, 13, 332360, time.UTC)), - CompletedDescription: datadog.PtrString("We have completed maintenance on the API to improve performance."), + CompletedDate: time.Date(2026, 2, 18, 19, 51, 13, 332360, time.UTC), + CompletedDescription: "We have completed maintenance on the API to improve performance.", ComponentsAffected: []datadogV2.CreateMaintenanceRequestDataAttributesComponentsAffectedItems{ { Id: uuid.MustParse("1234abcd-12ab-34cd-56ef-123456abcdef"), Status: datadogV2.PATCHMAINTENANCEREQUESTDATAATTRIBUTESCOMPONENTSAFFECTEDITEMSSTATUS_OPERATIONAL, }, }, - InProgressDescription: datadog.PtrString("We are currently performing maintenance on the API to improve performance."), - ScheduledDescription: datadog.PtrString("We will be performing maintenance on the API to improve performance."), - StartDate: datadog.PtrTime(time.Date(2026, 2, 18, 19, 21, 13, 332360, time.UTC)), + InProgressDescription: "We are currently performing maintenance on the API to improve performance.", + ScheduledDescription: "We will be performing maintenance on the API to improve performance.", + StartDate: time.Date(2026, 2, 18, 19, 21, 13, 332360, time.UTC), Title: "API Maintenance", }, Type: datadogV2.PATCHMAINTENANCEREQUESTDATATYPE_MAINTENANCES, diff --git a/examples/v2/status-pages/CreateMaintenance_2202276054.go b/examples/v2/status-pages/CreateMaintenance_2202276054.go index 802d425b72a..26220190411 100644 --- a/examples/v2/status-pages/CreateMaintenance_2202276054.go +++ b/examples/v2/status-pages/CreateMaintenance_2202276054.go @@ -23,11 +23,11 @@ func main() { Data: &datadogV2.CreateMaintenanceRequestData{ Attributes: datadogV2.CreateMaintenanceRequestDataAttributes{ Title: "API Maintenance", - ScheduledDescription: datadog.PtrString("We will be performing maintenance on the API to improve performance."), - InProgressDescription: datadog.PtrString("We are currently performing maintenance on the API to improve performance."), - CompletedDescription: datadog.PtrString("We have completed maintenance on the API to improve performance."), - StartDate: datadog.PtrTime(time.Now().Add(time.Hour * 1)), - CompletedDate: datadog.PtrTime(time.Now().Add(time.Hour * 2)), + ScheduledDescription: "We will be performing maintenance on the API to improve performance.", + InProgressDescription: "We are currently performing maintenance on the API to improve performance.", + CompletedDescription: "We have completed maintenance on the API to improve performance.", + StartDate: time.Now().Add(time.Hour * 1), + CompletedDate: time.Now().Add(time.Hour * 2), ComponentsAffected: []datadogV2.CreateMaintenanceRequestDataAttributesComponentsAffectedItems{ { Id: StatusPageDataAttributesComponents0Components0ID, diff --git a/tests/scenarios/features/v2/org_groups.feature b/tests/scenarios/features/v2/org_groups.feature index 73cce63cd8e..b8c5fe1b61d 100644 --- a/tests/scenarios/features/v2/org_groups.feature +++ b/tests/scenarios/features/v2/org_groups.feature @@ -12,7 +12,7 @@ Feature: Org Groups Scenario: Bulk update org group memberships returns "Bad Request" response Given operation "BulkUpdateOrgGroupMemberships" enabled And new "BulkUpdateOrgGroupMemberships" request - And body with value {"data": {"attributes": {"orgs": [{"org_site": "datadoghq.com", "org_uuid": "c3d4e5f6-a7b8-9012-cdef-012345678901"}]}, "relationships": {"source_org_group": {"data": {"id": "a1b2c3d4-e5f6-7890-abcd-ef0123456789", "type": "org_groups"}}, "target_org_group": {"data": {"id": "a1b2c3d4-e5f6-7890-abcd-ef0123456789", "type": "org_groups"}}}, "type": "org_group_membership_bulk_updates"}} + And body with value {"data": {"attributes": {"orgs": [{"org_site": "us1", "org_uuid": "c3d4e5f6-a7b8-9012-cdef-012345678901"}]}, "relationships": {"source_org_group": {"data": {"id": "a1b2c3d4-e5f6-7890-abcd-ef0123456789", "type": "org_groups"}}, "target_org_group": {"data": {"id": "a1b2c3d4-e5f6-7890-abcd-ef0123456789", "type": "org_groups"}}}, "type": "org_group_membership_bulk_updates"}} When the request is sent Then the response status is 400 Bad Request @@ -20,7 +20,7 @@ Feature: Org Groups Scenario: Bulk update org group memberships returns "Not Found" response Given operation "BulkUpdateOrgGroupMemberships" enabled And new "BulkUpdateOrgGroupMemberships" request - And body with value {"data": {"attributes": {"orgs": [{"org_site": "datadoghq.com", "org_uuid": "c3d4e5f6-a7b8-9012-cdef-012345678901"}]}, "relationships": {"source_org_group": {"data": {"id": "a1b2c3d4-e5f6-7890-abcd-ef0123456789", "type": "org_groups"}}, "target_org_group": {"data": {"id": "a1b2c3d4-e5f6-7890-abcd-ef0123456789", "type": "org_groups"}}}, "type": "org_group_membership_bulk_updates"}} + And body with value {"data": {"attributes": {"orgs": [{"org_site": "us1", "org_uuid": "c3d4e5f6-a7b8-9012-cdef-012345678901"}]}, "relationships": {"source_org_group": {"data": {"id": "a1b2c3d4-e5f6-7890-abcd-ef0123456789", "type": "org_groups"}}, "target_org_group": {"data": {"id": "a1b2c3d4-e5f6-7890-abcd-ef0123456789", "type": "org_groups"}}}, "type": "org_group_membership_bulk_updates"}} When the request is sent Then the response status is 404 Not Found @@ -28,7 +28,7 @@ Feature: Org Groups Scenario: Bulk update org group memberships returns "OK" response Given operation "BulkUpdateOrgGroupMemberships" enabled And new "BulkUpdateOrgGroupMemberships" request - And body with value {"data": {"attributes": {"orgs": [{"org_site": "datadoghq.com", "org_uuid": "c3d4e5f6-a7b8-9012-cdef-012345678901"}]}, "relationships": {"source_org_group": {"data": {"id": "a1b2c3d4-e5f6-7890-abcd-ef0123456789", "type": "org_groups"}}, "target_org_group": {"data": {"id": "a1b2c3d4-e5f6-7890-abcd-ef0123456789", "type": "org_groups"}}}, "type": "org_group_membership_bulk_updates"}} + And body with value {"data": {"attributes": {"orgs": [{"org_site": "us1", "org_uuid": "c3d4e5f6-a7b8-9012-cdef-012345678901"}]}, "relationships": {"source_org_group": {"data": {"id": "a1b2c3d4-e5f6-7890-abcd-ef0123456789", "type": "org_groups"}}, "target_org_group": {"data": {"id": "a1b2c3d4-e5f6-7890-abcd-ef0123456789", "type": "org_groups"}}}, "type": "org_group_membership_bulk_updates"}} When the request is sent Then the response status is 200 OK @@ -36,7 +36,7 @@ Feature: Org Groups Scenario: Create an org group policy override returns "Bad Request" response Given operation "CreateOrgGroupPolicyOverride" enabled And new "CreateOrgGroupPolicyOverride" request - And body with value {"data": {"attributes": {"org_site": "datadoghq.com", "org_uuid": "c3d4e5f6-a7b8-9012-cdef-012345678901"}, "relationships": {"org_group": {"data": {"id": "a1b2c3d4-e5f6-7890-abcd-ef0123456789", "type": "org_groups"}}, "org_group_policy": {"data": {"id": "1a2b3c4d-5e6f-7890-abcd-ef0123456789", "type": "org_group_policies"}}}, "type": "org_group_policy_overrides"}} + And body with value {"data": {"attributes": {"org_site": "us1", "org_uuid": "c3d4e5f6-a7b8-9012-cdef-012345678901"}, "relationships": {"org_group": {"data": {"id": "a1b2c3d4-e5f6-7890-abcd-ef0123456789", "type": "org_groups"}}, "org_group_policy": {"data": {"id": "1a2b3c4d-5e6f-7890-abcd-ef0123456789", "type": "org_group_policies"}}}, "type": "org_group_policy_overrides"}} When the request is sent Then the response status is 400 Bad Request @@ -44,7 +44,7 @@ Feature: Org Groups Scenario: Create an org group policy override returns "Conflict" response Given operation "CreateOrgGroupPolicyOverride" enabled And new "CreateOrgGroupPolicyOverride" request - And body with value {"data": {"attributes": {"org_site": "datadoghq.com", "org_uuid": "c3d4e5f6-a7b8-9012-cdef-012345678901"}, "relationships": {"org_group": {"data": {"id": "a1b2c3d4-e5f6-7890-abcd-ef0123456789", "type": "org_groups"}}, "org_group_policy": {"data": {"id": "1a2b3c4d-5e6f-7890-abcd-ef0123456789", "type": "org_group_policies"}}}, "type": "org_group_policy_overrides"}} + And body with value {"data": {"attributes": {"org_site": "us1", "org_uuid": "c3d4e5f6-a7b8-9012-cdef-012345678901"}, "relationships": {"org_group": {"data": {"id": "a1b2c3d4-e5f6-7890-abcd-ef0123456789", "type": "org_groups"}}, "org_group_policy": {"data": {"id": "1a2b3c4d-5e6f-7890-abcd-ef0123456789", "type": "org_group_policies"}}}, "type": "org_group_policy_overrides"}} When the request is sent Then the response status is 409 Conflict @@ -52,7 +52,7 @@ Feature: Org Groups Scenario: Create an org group policy override returns "Created" response Given operation "CreateOrgGroupPolicyOverride" enabled And new "CreateOrgGroupPolicyOverride" request - And body with value {"data": {"attributes": {"org_site": "datadoghq.com", "org_uuid": "c3d4e5f6-a7b8-9012-cdef-012345678901"}, "relationships": {"org_group": {"data": {"id": "a1b2c3d4-e5f6-7890-abcd-ef0123456789", "type": "org_groups"}}, "org_group_policy": {"data": {"id": "1a2b3c4d-5e6f-7890-abcd-ef0123456789", "type": "org_group_policies"}}}, "type": "org_group_policy_overrides"}} + And body with value {"data": {"attributes": {"org_site": "us1", "org_uuid": "c3d4e5f6-a7b8-9012-cdef-012345678901"}, "relationships": {"org_group": {"data": {"id": "a1b2c3d4-e5f6-7890-abcd-ef0123456789", "type": "org_groups"}}, "org_group_policy": {"data": {"id": "1a2b3c4d-5e6f-7890-abcd-ef0123456789", "type": "org_group_policies"}}}, "type": "org_group_policy_overrides"}} When the request is sent Then the response status is 201 Created @@ -60,7 +60,7 @@ Feature: Org Groups Scenario: Create an org group policy returns "Bad Request" response Given operation "CreateOrgGroupPolicy" enabled And new "CreateOrgGroupPolicy" request - And body with value {"data": {"attributes": {"content": {"value": "UTC"}, "policy_name": "monitor_timezone"}, "relationships": {"org_group": {"data": {"id": "a1b2c3d4-e5f6-7890-abcd-ef0123456789", "type": "org_groups"}}}, "type": "org_group_policies"}} + And body with value {"data": {"attributes": {"content": {"value": "UTC"}, "enforcement_tier": "DEFAULT", "policy_name": "monitor_timezone", "policy_type": "org_config"}, "relationships": {"org_group": {"data": {"id": "a1b2c3d4-e5f6-7890-abcd-ef0123456789", "type": "org_groups"}}}, "type": "org_group_policies"}} When the request is sent Then the response status is 400 Bad Request @@ -68,7 +68,7 @@ Feature: Org Groups Scenario: Create an org group policy returns "Conflict" response Given operation "CreateOrgGroupPolicy" enabled And new "CreateOrgGroupPolicy" request - And body with value {"data": {"attributes": {"content": {"value": "UTC"}, "policy_name": "monitor_timezone"}, "relationships": {"org_group": {"data": {"id": "a1b2c3d4-e5f6-7890-abcd-ef0123456789", "type": "org_groups"}}}, "type": "org_group_policies"}} + And body with value {"data": {"attributes": {"content": {"value": "UTC"}, "enforcement_tier": "DEFAULT", "policy_name": "monitor_timezone", "policy_type": "org_config"}, "relationships": {"org_group": {"data": {"id": "a1b2c3d4-e5f6-7890-abcd-ef0123456789", "type": "org_groups"}}}, "type": "org_group_policies"}} When the request is sent Then the response status is 409 Conflict @@ -76,7 +76,7 @@ Feature: Org Groups Scenario: Create an org group policy returns "Created" response Given operation "CreateOrgGroupPolicy" enabled And new "CreateOrgGroupPolicy" request - And body with value {"data": {"attributes": {"content": {"value": "UTC"}, "policy_name": "monitor_timezone"}, "relationships": {"org_group": {"data": {"id": "a1b2c3d4-e5f6-7890-abcd-ef0123456789", "type": "org_groups"}}}, "type": "org_group_policies"}} + And body with value {"data": {"attributes": {"content": {"value": "UTC"}, "enforcement_tier": "DEFAULT", "policy_name": "monitor_timezone", "policy_type": "org_config"}, "relationships": {"org_group": {"data": {"id": "a1b2c3d4-e5f6-7890-abcd-ef0123456789", "type": "org_groups"}}}, "type": "org_group_policies"}} When the request is sent Then the response status is 201 Created @@ -200,6 +200,54 @@ Feature: Org Groups When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/org-management + Scenario: Get an org group policy override returns "Bad Request" response + Given operation "GetOrgGroupPolicyOverride" enabled + And new "GetOrgGroupPolicyOverride" request + And request contains "org_group_policy_override_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/org-management + Scenario: Get an org group policy override returns "Not Found" response + Given operation "GetOrgGroupPolicyOverride" enabled + And new "GetOrgGroupPolicyOverride" request + And request contains "org_group_policy_override_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/org-management + Scenario: Get an org group policy override returns "OK" response + Given operation "GetOrgGroupPolicyOverride" enabled + And new "GetOrgGroupPolicyOverride" request + And request contains "org_group_policy_override_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/org-management + Scenario: Get an org group policy returns "Bad Request" response + Given operation "GetOrgGroupPolicy" enabled + And new "GetOrgGroupPolicy" request + And request contains "org_group_policy_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/org-management + Scenario: Get an org group policy returns "Not Found" response + Given operation "GetOrgGroupPolicy" enabled + And new "GetOrgGroupPolicy" request + And request contains "org_group_policy_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/org-management + Scenario: Get an org group policy returns "OK" response + Given operation "GetOrgGroupPolicy" enabled + And new "GetOrgGroupPolicy" request + And request contains "org_group_policy_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/org-management Scenario: Get an org group returns "Bad Request" response Given operation "GetOrgGroup" enabled @@ -323,7 +371,7 @@ Feature: Org Groups Given operation "UpdateOrgGroupPolicyOverride" enabled And new "UpdateOrgGroupPolicyOverride" request And request contains "org_group_policy_override_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"org_site": "datadoghq.com", "org_uuid": "c3d4e5f6-a7b8-9012-cdef-012345678901"}, "id": "9f8e7d6c-5b4a-3210-fedc-ba0987654321", "type": "org_group_policy_overrides"}} + And body with value {"data": {"attributes": {"org_site": "us1", "org_uuid": "c3d4e5f6-a7b8-9012-cdef-012345678901"}, "id": "9f8e7d6c-5b4a-3210-fedc-ba0987654321", "type": "org_group_policy_overrides"}} When the request is sent Then the response status is 400 Bad Request @@ -332,7 +380,7 @@ Feature: Org Groups Given operation "UpdateOrgGroupPolicyOverride" enabled And new "UpdateOrgGroupPolicyOverride" request And request contains "org_group_policy_override_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"org_site": "datadoghq.com", "org_uuid": "c3d4e5f6-a7b8-9012-cdef-012345678901"}, "id": "9f8e7d6c-5b4a-3210-fedc-ba0987654321", "type": "org_group_policy_overrides"}} + And body with value {"data": {"attributes": {"org_site": "us1", "org_uuid": "c3d4e5f6-a7b8-9012-cdef-012345678901"}, "id": "9f8e7d6c-5b4a-3210-fedc-ba0987654321", "type": "org_group_policy_overrides"}} When the request is sent Then the response status is 404 Not Found @@ -341,7 +389,7 @@ Feature: Org Groups Given operation "UpdateOrgGroupPolicyOverride" enabled And new "UpdateOrgGroupPolicyOverride" request And request contains "org_group_policy_override_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"org_site": "datadoghq.com", "org_uuid": "c3d4e5f6-a7b8-9012-cdef-012345678901"}, "id": "9f8e7d6c-5b4a-3210-fedc-ba0987654321", "type": "org_group_policy_overrides"}} + And body with value {"data": {"attributes": {"org_site": "us1", "org_uuid": "c3d4e5f6-a7b8-9012-cdef-012345678901"}, "id": "9f8e7d6c-5b4a-3210-fedc-ba0987654321", "type": "org_group_policy_overrides"}} When the request is sent Then the response status is 200 OK @@ -350,7 +398,7 @@ Feature: Org Groups Given operation "UpdateOrgGroupPolicy" enabled And new "UpdateOrgGroupPolicy" request And request contains "org_group_policy_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"content": {"value": "UTC"}}, "id": "1a2b3c4d-5e6f-7890-abcd-ef0123456789", "type": "org_group_policies"}} + And body with value {"data": {"attributes": {"content": {"value": "UTC"}, "enforcement_tier": "DEFAULT"}, "id": "1a2b3c4d-5e6f-7890-abcd-ef0123456789", "type": "org_group_policies"}} When the request is sent Then the response status is 400 Bad Request @@ -359,7 +407,7 @@ Feature: Org Groups Given operation "UpdateOrgGroupPolicy" enabled And new "UpdateOrgGroupPolicy" request And request contains "org_group_policy_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"content": {"value": "UTC"}}, "id": "1a2b3c4d-5e6f-7890-abcd-ef0123456789", "type": "org_group_policies"}} + And body with value {"data": {"attributes": {"content": {"value": "UTC"}, "enforcement_tier": "DEFAULT"}, "id": "1a2b3c4d-5e6f-7890-abcd-ef0123456789", "type": "org_group_policies"}} When the request is sent Then the response status is 404 Not Found @@ -368,7 +416,7 @@ Feature: Org Groups Given operation "UpdateOrgGroupPolicy" enabled And new "UpdateOrgGroupPolicy" request And request contains "org_group_policy_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"content": {"value": "UTC"}}, "id": "1a2b3c4d-5e6f-7890-abcd-ef0123456789", "type": "org_group_policies"}} + And body with value {"data": {"attributes": {"content": {"value": "UTC"}, "enforcement_tier": "DEFAULT"}, "id": "1a2b3c4d-5e6f-7890-abcd-ef0123456789", "type": "org_group_policies"}} When the request is sent Then the response status is 200 OK diff --git a/tests/scenarios/features/v2/undo.json b/tests/scenarios/features/v2/undo.json index aa37a18fc34..71b0e9ba7af 100644 --- a/tests/scenarios/features/v2/undo.json +++ b/tests/scenarios/features/v2/undo.json @@ -4228,6 +4228,12 @@ "type": "unsafe" } }, + "GetOrgGroupPolicy": { + "tag": "Org Groups", + "undo": { + "type": "safe" + } + }, "UpdateOrgGroupPolicy": { "tag": "Org Groups", "undo": { @@ -4264,6 +4270,12 @@ "type": "unsafe" } }, + "GetOrgGroupPolicyOverride": { + "tag": "Org Groups", + "undo": { + "type": "safe" + } + }, "UpdateOrgGroupPolicyOverride": { "tag": "Org Groups", "undo": { diff --git a/version.go b/version.go index 20c1bf40e40..e6f5580d474 100644 --- a/version.go +++ b/version.go @@ -1,4 +1,4 @@ package client // Version used in User-Agent header. -const Version = "2.58.0" +const Version = "2.59.0"