From abd8e2c811bfd03e4d385138df856a45c60bf8c7 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Wed, 2 Sep 2026 18:48:16 +0000 Subject: [PATCH] Regenerate client from commit 0ca16fc of spec repo --- .generator/schemas/v2/openapi.yaml | 123 ++++++++++++++++-- .../v2/org-groups/UpdateOrgGroupPolicy.java | 3 +- .../api/client/v2/api/OrgGroupsApi.java | 21 +++ .../v2/model/OrgGroupPolicyAttributes.java | 20 ++- .../model/OrgGroupPolicyCreateAttributes.java | 26 ++-- .../v2/model/OrgGroupPolicyCreateData.java | 6 +- .../model/OrgGroupPolicyEnforcementTier.java | 5 +- .../OrgGroupPolicyFilterPolicyTypeValue.java | 65 +++++++++ .../v2/model/OrgGroupPolicyPolicyType.java | 8 +- .../model/OrgGroupPolicyUpdateAttributes.java | 51 +++++++- .../v2/model/OrgGroupPolicyUpdateData.java | 3 +- .../api/client/v2/api/org_groups.feature | 6 +- 12 files changed, 289 insertions(+), 48 deletions(-) create mode 100644 src/main/java/com/datadog/api/client/v2/model/OrgGroupPolicyFilterPolicyTypeValue.java diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index e8bb5351a80..cfc1f47c9f3 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -1394,6 +1394,16 @@ components: schema: example: monitor_timezone type: string + OrgGroupPolicyFilterPolicyType: + description: Filter policies by policy type. Supported values are `org_config` and `role`. + in: query + name: filter[policy_type] + required: false + schema: + $ref: "#/components/schemas/OrgGroupPolicyFilterPolicyTypeValue" + x-enum-varnames: + - ORG_CONFIG + - ROLE OrgGroupPolicyId: description: The ID of the org group policy. in: path @@ -79520,7 +79530,8 @@ components: properties: content: additionalProperties: {} - description: The policy content as key-value pairs. + description: >- + The policy content as key-value pairs. For `org_config` policies, an arbitrary key-value map (for example, `{"value": "UTC"}`). For `role` policies, a `permissions` key containing an array of permission UUIDs (for example, `{"permissions": ["", ...]}`). example: value: "UTC" type: object @@ -79532,7 +79543,8 @@ components: format: date-time type: string policy_name: - description: The name of the policy. + description: >- + The name of the policy. This becomes the name of the resource created across orgs in the group (for example, for `role` policies, the name of the created role). example: "monitor_timezone" type: string policy_type: @@ -79612,18 +79624,20 @@ components: - ORG_GROUP_POLICY_CONFIGS OrgGroupPolicyCreateAttributes: 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. + Attributes for creating an org group policy. If `policy_type` is not provided, it defaults to `org_config`. `enforcement_tier` is optional; if not provided, the resulting value depends on `policy_type` and is otherwise unspecified. properties: content: additionalProperties: {} - description: The policy content as key-value pairs. + description: >- + The policy content as key-value pairs. For `org_config` policies, an arbitrary key-value map (for example, `{"value": "UTC"}`). For `role` policies, a `permissions` key containing an array of permission UUIDs (for example, `{"permissions": ["", ...]}`). example: value: "UTC" type: object enforcement_tier: $ref: "#/components/schemas/OrgGroupPolicyEnforcementTier" policy_name: - description: The name of the policy. + description: >- + The name of the policy. This becomes the name of the resource created across orgs in the group (for example, for `role` policies, the name of the created role). example: "monitor_timezone" type: string policy_type: @@ -79682,9 +79696,8 @@ components: - attributes type: object OrgGroupPolicyEnforcementTier: - default: OVERRIDE_ALLOWED description: >- - The enforcement tier of the policy. `OVERRIDE_ALLOWED` means the policy is set but member orgs may mutate it. `GROUP_MANAGED` means the policy is strictly controlled and mutations are blocked for affected orgs. `DELEGATE` means each member org controls its own value. + The enforcement tier of the policy. `OVERRIDE_ALLOWED` means the policy is set but member orgs may mutate it. `GROUP_MANAGED` means the policy is strictly controlled and mutations are blocked for affected orgs. `DELEGATE` means each member org controls its own value. `role` policies only support `GROUP_MANAGED` and `DELEGATE` — `OVERRIDE_ALLOWED` is rejected for this policy type. Transitioning a `role` policy to `DELEGATE` (disabling it) is one-way — the policy cannot be transitioned back to `GROUP_MANAGED` afterward. enum: - OVERRIDE_ALLOWED - GROUP_MANAGED @@ -79695,6 +79708,17 @@ components: - OVERRIDE_ALLOWED - GROUP_MANAGED - DELEGATE + OrgGroupPolicyFilterPolicyTypeValue: + description: >- + The type of the policy to filter by. `org_config` indicates a policy backed by an organization configuration setting. `role` indicates a policy backed by a Datadog custom role. + enum: + - org_config + - role + example: org_config + type: string + x-enum-varnames: + - ORG_CONFIG + - ROLE OrgGroupPolicyListResponse: description: Response containing a list of org group policies. properties: @@ -79909,13 +79933,15 @@ components: OrgGroupPolicyPolicyType: default: org_config description: >- - The type of the policy. Only `org_config` is supported, indicating a policy backed by an organization configuration setting. + The type of the policy. `org_config` indicates a policy backed by an organization configuration setting. `role` indicates a policy backed by a Datadog custom role. enum: - org_config + - role example: org_config type: string x-enum-varnames: - ORG_CONFIG + - ROLE OrgGroupPolicyRelationshipToOne: description: Relationship to a single org group policy. properties: @@ -80056,16 +80082,23 @@ components: x-enum-varnames: - ORG_GROUP_POLICIES OrgGroupPolicyUpdateAttributes: - description: Attributes for updating an org group policy. + description: >- + Attributes for updating an org group policy. `policy_name`, `content`, and `enforcement_tier` may be omitted individually to leave them unchanged. properties: content: additionalProperties: {} - description: The policy content as key-value pairs. + description: >- + The policy content as key-value pairs. For `org_config` policies, an arbitrary key-value map (for example, `{"value": "UTC"}`). For `role` policies, a `permissions` key containing an array of permission UUIDs (for example, `{"permissions": ["", ...]}`). example: value: "UTC" type: object enforcement_tier: $ref: "#/components/schemas/OrgGroupPolicyEnforcementTier" + policy_name: + description: >- + The name of the policy. This becomes the name of the resource created across orgs in the group (for example, for `role` policies, the name of the created role). Omit to leave unchanged. + example: "monitor_timezone" + type: string type: object OrgGroupPolicyUpdateData: description: Data for updating an org group policy. @@ -182060,6 +182093,7 @@ paths: parameters: - $ref: "#/components/parameters/OrgGroupPolicyFilterOrgGroupId" - $ref: "#/components/parameters/OrgGroupPolicyFilterPolicyName" + - $ref: "#/components/parameters/OrgGroupPolicyFilterPolicyType" - $ref: "#/components/parameters/OrgGroupPageNumber" - $ref: "#/components/parameters/OrgGroupPageSize" - $ref: "#/components/parameters/PolicySort" @@ -182140,7 +182174,7 @@ paths: content: application/json: examples: - default: + org_config: value: data: attributes: @@ -182155,6 +182189,22 @@ paths: id: "a1b2c3d4-e5f6-7890-abcd-ef0123456789" type: org_groups type: org_group_policies + role: + value: + data: + attributes: + content: + permissions: + - "1a2b3c4d-5e6f-7890-abcd-ef0123456789" + enforcement_tier: "GROUP_MANAGED" + policy_name: "finance_read_only" + policy_type: "role" + relationships: + org_group: + data: + id: "a1b2c3d4-e5f6-7890-abcd-ef0123456789" + type: org_groups + type: org_group_policies schema: $ref: "#/components/schemas/OrgGroupPolicyCreateRequest" required: true @@ -182180,6 +182230,24 @@ paths: id: "a1b2c3d4-e5f6-7890-abcd-ef0123456789" type: org_groups type: org_group_policies + role: + value: + data: + attributes: + content: + permissions: + - "1a2b3c4d-5e6f-7890-abcd-ef0123456789" + enforcement_tier: "GROUP_MANAGED" + modified_at: "2024-01-15T10:30:00Z" + policy_name: "finance_read_only" + policy_type: "role" + 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: Created @@ -182336,13 +182404,25 @@ paths: content: application/json: examples: - default: + org_config: value: data: attributes: content: value: "US/Eastern" enforcement_tier: "GROUP_MANAGED" + policy_name: "monitor_timezone" + id: "1a2b3c4d-5e6f-7890-abcd-ef0123456789" + type: org_group_policies + role: + value: + data: + attributes: + content: + permissions: + - "1a2b3c4d-5e6f-7890-abcd-ef0123456789" + - "2b3c4d5e-6f78-90ab-cdef-0123456789ab" + enforcement_tier: "GROUP_MANAGED" id: "1a2b3c4d-5e6f-7890-abcd-ef0123456789" type: org_group_policies schema: @@ -182370,6 +182450,25 @@ paths: id: "a1b2c3d4-e5f6-7890-abcd-ef0123456789" type: org_groups type: org_group_policies + role: + value: + data: + attributes: + content: + permissions: + - "1a2b3c4d-5e6f-7890-abcd-ef0123456789" + - "2b3c4d5e-6f78-90ab-cdef-0123456789ab" + enforcement_tier: "GROUP_MANAGED" + modified_at: "2024-01-16T14:00:00Z" + policy_name: "finance_read_only" + policy_type: "role" + 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 diff --git a/examples/v2/org-groups/UpdateOrgGroupPolicy.java b/examples/v2/org-groups/UpdateOrgGroupPolicy.java index c5854130156..1639146dd72 100644 --- a/examples/v2/org-groups/UpdateOrgGroupPolicy.java +++ b/examples/v2/org-groups/UpdateOrgGroupPolicy.java @@ -25,7 +25,8 @@ public static void main(String[] args) { .attributes( new OrgGroupPolicyUpdateAttributes() .content(Map.ofEntries(Map.entry("value", "UTC"))) - .enforcementTier(OrgGroupPolicyEnforcementTier.OVERRIDE_ALLOWED)) + .enforcementTier(OrgGroupPolicyEnforcementTier.OVERRIDE_ALLOWED) + .policyName("monitor_timezone")) .id(UUID.fromString("1a2b3c4d-5e6f-7890-abcd-ef0123456789")) .type(OrgGroupPolicyType.ORG_GROUP_POLICIES)); diff --git a/src/main/java/com/datadog/api/client/v2/api/OrgGroupsApi.java b/src/main/java/com/datadog/api/client/v2/api/OrgGroupsApi.java index 5d87e7c34ee..5910a73953d 100644 --- a/src/main/java/com/datadog/api/client/v2/api/OrgGroupsApi.java +++ b/src/main/java/com/datadog/api/client/v2/api/OrgGroupsApi.java @@ -13,6 +13,7 @@ import com.datadog.api.client.v2.model.OrgGroupMembershipUpdateRequest; import com.datadog.api.client.v2.model.OrgGroupPolicyConfigListResponse; import com.datadog.api.client.v2.model.OrgGroupPolicyCreateRequest; +import com.datadog.api.client.v2.model.OrgGroupPolicyFilterPolicyTypeValue; import com.datadog.api.client.v2.model.OrgGroupPolicyListResponse; import com.datadog.api.client.v2.model.OrgGroupPolicyOverrideCreateRequest; import com.datadog.api.client.v2.model.OrgGroupPolicyOverrideListResponse; @@ -2066,6 +2067,7 @@ public ApiResponse listOrgGroupMembershipsWithHt /** Manage optional parameters to listOrgGroupPolicies. */ public static class ListOrgGroupPoliciesOptionalParameters { private String filterPolicyName; + private OrgGroupPolicyFilterPolicyTypeValue filterPolicyType; private Long pageNumber; private Long pageSize; private OrgGroupPolicySortOption sort; @@ -2081,6 +2083,19 @@ public ListOrgGroupPoliciesOptionalParameters filterPolicyName(String filterPoli return this; } + /** + * Set filterPolicyType. + * + * @param filterPolicyType Filter policies by policy type. Supported values are org_config + * and role. (optional) + * @return ListOrgGroupPoliciesOptionalParameters + */ + public ListOrgGroupPoliciesOptionalParameters filterPolicyType( + OrgGroupPolicyFilterPolicyTypeValue filterPolicyType) { + this.filterPolicyType = filterPolicyType; + return this; + } + /** * Set pageNumber. * @@ -2222,6 +2237,7 @@ public ApiResponse listOrgGroupPoliciesWithHttpInfo( "Missing the required parameter 'filterOrgGroupId' when calling listOrgGroupPolicies"); } String filterPolicyName = parameters.filterPolicyName; + OrgGroupPolicyFilterPolicyTypeValue filterPolicyType = parameters.filterPolicyType; Long pageNumber = parameters.pageNumber; Long pageSize = parameters.pageSize; OrgGroupPolicySortOption sort = parameters.sort; @@ -2235,6 +2251,8 @@ public ApiResponse listOrgGroupPoliciesWithHttpInfo( apiClient.parameterToPairs("", "filter[org_group_id]", filterOrgGroupId)); localVarQueryParams.addAll( apiClient.parameterToPairs("", "filter[policy_name]", filterPolicyName)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "filter[policy_type]", filterPolicyType)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[number]", pageNumber)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[size]", pageSize)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "sort", sort)); @@ -2294,6 +2312,7 @@ public ApiResponse listOrgGroupPoliciesWithHttpInfo( return result; } String filterPolicyName = parameters.filterPolicyName; + OrgGroupPolicyFilterPolicyTypeValue filterPolicyType = parameters.filterPolicyType; Long pageNumber = parameters.pageNumber; Long pageSize = parameters.pageSize; OrgGroupPolicySortOption sort = parameters.sort; @@ -2307,6 +2326,8 @@ public ApiResponse listOrgGroupPoliciesWithHttpInfo( apiClient.parameterToPairs("", "filter[org_group_id]", filterOrgGroupId)); localVarQueryParams.addAll( apiClient.parameterToPairs("", "filter[policy_name]", filterPolicyName)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "filter[policy_type]", filterPolicyType)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[number]", pageNumber)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[size]", pageSize)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "sort", sort)); diff --git a/src/main/java/com/datadog/api/client/v2/model/OrgGroupPolicyAttributes.java b/src/main/java/com/datadog/api/client/v2/model/OrgGroupPolicyAttributes.java index 624b28f007a..83cd7a855b7 100644 --- a/src/main/java/com/datadog/api/client/v2/model/OrgGroupPolicyAttributes.java +++ b/src/main/java/com/datadog/api/client/v2/model/OrgGroupPolicyAttributes.java @@ -34,8 +34,7 @@ public class OrgGroupPolicyAttributes { private Map content = null; public static final String JSON_PROPERTY_ENFORCEMENT_TIER = "enforcement_tier"; - private OrgGroupPolicyEnforcementTier enforcementTier = - OrgGroupPolicyEnforcementTier.OVERRIDE_ALLOWED; + private OrgGroupPolicyEnforcementTier enforcementTier; public static final String JSON_PROPERTY_MODIFIED_AT = "modified_at"; private OffsetDateTime modifiedAt; @@ -78,7 +77,10 @@ public OrgGroupPolicyAttributes putContentItem(String key, Object contentItem) { } /** - * The policy content as key-value pairs. + * The policy content as key-value pairs. For org_config policies, an arbitrary + * key-value map (for example, {"value": "UTC"}). For role policies, a + * permissions key containing an array of permission UUIDs (for example, + * {"permissions": ["<uuid>", ...]}). * * @return content */ @@ -103,7 +105,10 @@ public OrgGroupPolicyAttributes enforcementTier(OrgGroupPolicyEnforcementTier en * The enforcement tier of the policy. OVERRIDE_ALLOWED means the policy is set but * member orgs may mutate it. GROUP_MANAGED means the policy is strictly controlled * and mutations are blocked for affected orgs. DELEGATE means each member org - * controls its own value. + * controls its own value. role policies only support GROUP_MANAGED and + * DELEGATEOVERRIDE_ALLOWED is rejected for this policy type. + * Transitioning a role policy to DELEGATE (disabling it) is one-way — + * the policy cannot be transitioned back to GROUP_MANAGED afterward. * * @return enforcementTier */ @@ -146,7 +151,8 @@ public OrgGroupPolicyAttributes policyName(String policyName) { } /** - * The name of the policy. + * The name of the policy. This becomes the name of the resource created across orgs in the group + * (for example, for role policies, the name of the created role). * * @return policyName */ @@ -167,8 +173,8 @@ public OrgGroupPolicyAttributes policyType(OrgGroupPolicyPolicyType policyType) } /** - * The type of the policy. Only org_config is supported, indicating a policy backed - * by an organization configuration setting. + * The type of the policy. org_config indicates a policy backed by an organization + * configuration setting. role indicates a policy backed by a Datadog custom role. * * @return policyType */ diff --git a/src/main/java/com/datadog/api/client/v2/model/OrgGroupPolicyCreateAttributes.java b/src/main/java/com/datadog/api/client/v2/model/OrgGroupPolicyCreateAttributes.java index 52dbb017087..fb674b6b10c 100644 --- a/src/main/java/com/datadog/api/client/v2/model/OrgGroupPolicyCreateAttributes.java +++ b/src/main/java/com/datadog/api/client/v2/model/OrgGroupPolicyCreateAttributes.java @@ -18,9 +18,9 @@ import java.util.Objects; /** - * 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 for creating an org group policy. If policy_type is not provided, it + * defaults to org_config. enforcement_tier is optional; if not provided, + * the resulting value depends on policy_type and is otherwise unspecified. */ @JsonPropertyOrder({ OrgGroupPolicyCreateAttributes.JSON_PROPERTY_CONTENT, @@ -36,8 +36,7 @@ public class OrgGroupPolicyCreateAttributes { private Map content = new HashMap(); public static final String JSON_PROPERTY_ENFORCEMENT_TIER = "enforcement_tier"; - private OrgGroupPolicyEnforcementTier enforcementTier = - OrgGroupPolicyEnforcementTier.OVERRIDE_ALLOWED; + private OrgGroupPolicyEnforcementTier enforcementTier; public static final String JSON_PROPERTY_POLICY_NAME = "policy_name"; private String policyName; @@ -66,7 +65,10 @@ public OrgGroupPolicyCreateAttributes putContentItem(String key, Object contentI } /** - * The policy content as key-value pairs. + * The policy content as key-value pairs. For org_config policies, an arbitrary + * key-value map (for example, {"value": "UTC"}). For role policies, a + * permissions key containing an array of permission UUIDs (for example, + * {"permissions": ["<uuid>", ...]}). * * @return content */ @@ -91,7 +93,10 @@ public OrgGroupPolicyCreateAttributes enforcementTier( * The enforcement tier of the policy. OVERRIDE_ALLOWED means the policy is set but * member orgs may mutate it. GROUP_MANAGED means the policy is strictly controlled * and mutations are blocked for affected orgs. DELEGATE means each member org - * controls its own value. + * controls its own value. role policies only support GROUP_MANAGED and + * DELEGATEOVERRIDE_ALLOWED is rejected for this policy type. + * Transitioning a role policy to DELEGATE (disabling it) is one-way — + * the policy cannot be transitioned back to GROUP_MANAGED afterward. * * @return enforcementTier */ @@ -115,7 +120,8 @@ public OrgGroupPolicyCreateAttributes policyName(String policyName) { } /** - * The name of the policy. + * The name of the policy. This becomes the name of the resource created across orgs in the group + * (for example, for role policies, the name of the created role). * * @return policyName */ @@ -136,8 +142,8 @@ public OrgGroupPolicyCreateAttributes policyType(OrgGroupPolicyPolicyType policy } /** - * The type of the policy. Only org_config is supported, indicating a policy backed - * by an organization configuration setting. + * The type of the policy. org_config indicates a policy backed by an organization + * configuration setting. role indicates a policy backed by a Datadog custom role. * * @return policyType */ diff --git a/src/main/java/com/datadog/api/client/v2/model/OrgGroupPolicyCreateData.java b/src/main/java/com/datadog/api/client/v2/model/OrgGroupPolicyCreateData.java index f3623943eee..7dbb3d55cc2 100644 --- a/src/main/java/com/datadog/api/client/v2/model/OrgGroupPolicyCreateData.java +++ b/src/main/java/com/datadog/api/client/v2/model/OrgGroupPolicyCreateData.java @@ -60,9 +60,9 @@ public OrgGroupPolicyCreateData attributes(OrgGroupPolicyCreateAttributes attrib } /** - * 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 for creating an org group policy. If policy_type is not provided, it + * defaults to org_config. enforcement_tier is optional; if not + * provided, the resulting value depends on policy_type and is otherwise unspecified. * * @return attributes */ diff --git a/src/main/java/com/datadog/api/client/v2/model/OrgGroupPolicyEnforcementTier.java b/src/main/java/com/datadog/api/client/v2/model/OrgGroupPolicyEnforcementTier.java index 3c54efe27f6..2ece1e1f9a1 100644 --- a/src/main/java/com/datadog/api/client/v2/model/OrgGroupPolicyEnforcementTier.java +++ b/src/main/java/com/datadog/api/client/v2/model/OrgGroupPolicyEnforcementTier.java @@ -22,7 +22,10 @@ * The enforcement tier of the policy. OVERRIDE_ALLOWED means the policy is set but * member orgs may mutate it. GROUP_MANAGED means the policy is strictly controlled and * mutations are blocked for affected orgs. DELEGATE means each member org controls its - * own value. + * own value. role policies only support GROUP_MANAGED and DELEGATE + * OVERRIDE_ALLOWED is rejected for this policy type. Transitioning a + * role policy to DELEGATE (disabling it) is one-way — the policy cannot be + * transitioned back to GROUP_MANAGED afterward. */ @JsonSerialize(using = OrgGroupPolicyEnforcementTier.OrgGroupPolicyEnforcementTierSerializer.class) public class OrgGroupPolicyEnforcementTier extends ModelEnum { diff --git a/src/main/java/com/datadog/api/client/v2/model/OrgGroupPolicyFilterPolicyTypeValue.java b/src/main/java/com/datadog/api/client/v2/model/OrgGroupPolicyFilterPolicyTypeValue.java new file mode 100644 index 00000000000..f9e30ccc98d --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OrgGroupPolicyFilterPolicyTypeValue.java @@ -0,0 +1,65 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** + * The type of the policy to filter by. org_config indicates a policy backed by an + * organization configuration setting. role indicates a policy backed by a Datadog + * custom role. + */ +@JsonSerialize( + using = OrgGroupPolicyFilterPolicyTypeValue.OrgGroupPolicyFilterPolicyTypeValueSerializer.class) +public class OrgGroupPolicyFilterPolicyTypeValue extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("org_config", "role")); + + public static final OrgGroupPolicyFilterPolicyTypeValue ORG_CONFIG = + new OrgGroupPolicyFilterPolicyTypeValue("org_config"); + public static final OrgGroupPolicyFilterPolicyTypeValue ROLE = + new OrgGroupPolicyFilterPolicyTypeValue("role"); + + OrgGroupPolicyFilterPolicyTypeValue(String value) { + super(value, allowedValues); + } + + public static class OrgGroupPolicyFilterPolicyTypeValueSerializer + extends StdSerializer { + public OrgGroupPolicyFilterPolicyTypeValueSerializer( + Class t) { + super(t); + } + + public OrgGroupPolicyFilterPolicyTypeValueSerializer() { + this(null); + } + + @Override + public void serialize( + OrgGroupPolicyFilterPolicyTypeValue value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static OrgGroupPolicyFilterPolicyTypeValue fromValue(String value) { + return new OrgGroupPolicyFilterPolicyTypeValue(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/OrgGroupPolicyPolicyType.java b/src/main/java/com/datadog/api/client/v2/model/OrgGroupPolicyPolicyType.java index ad8ee90b73d..9065bb73cec 100644 --- a/src/main/java/com/datadog/api/client/v2/model/OrgGroupPolicyPolicyType.java +++ b/src/main/java/com/datadog/api/client/v2/model/OrgGroupPolicyPolicyType.java @@ -19,16 +19,18 @@ import java.util.Set; /** - * The type of the policy. Only org_config is supported, indicating a policy backed by - * an organization configuration setting. + * The type of the policy. org_config indicates a policy backed by an organization + * configuration setting. role indicates a policy backed by a Datadog custom role. */ @JsonSerialize(using = OrgGroupPolicyPolicyType.OrgGroupPolicyPolicyTypeSerializer.class) public class OrgGroupPolicyPolicyType extends ModelEnum { - private static final Set allowedValues = new HashSet(Arrays.asList("org_config")); + private static final Set allowedValues = + new HashSet(Arrays.asList("org_config", "role")); public static final OrgGroupPolicyPolicyType ORG_CONFIG = new OrgGroupPolicyPolicyType("org_config"); + public static final OrgGroupPolicyPolicyType ROLE = new OrgGroupPolicyPolicyType("role"); OrgGroupPolicyPolicyType(String value) { super(value, allowedValues); diff --git a/src/main/java/com/datadog/api/client/v2/model/OrgGroupPolicyUpdateAttributes.java b/src/main/java/com/datadog/api/client/v2/model/OrgGroupPolicyUpdateAttributes.java index 8d60f1a3705..0dca1310883 100644 --- a/src/main/java/com/datadog/api/client/v2/model/OrgGroupPolicyUpdateAttributes.java +++ b/src/main/java/com/datadog/api/client/v2/model/OrgGroupPolicyUpdateAttributes.java @@ -16,10 +16,14 @@ import java.util.Map; import java.util.Objects; -/** Attributes for updating an org group policy. */ +/** + * Attributes for updating an org group policy. policy_name, content, and + * enforcement_tier may be omitted individually to leave them unchanged. + */ @JsonPropertyOrder({ OrgGroupPolicyUpdateAttributes.JSON_PROPERTY_CONTENT, - OrgGroupPolicyUpdateAttributes.JSON_PROPERTY_ENFORCEMENT_TIER + OrgGroupPolicyUpdateAttributes.JSON_PROPERTY_ENFORCEMENT_TIER, + OrgGroupPolicyUpdateAttributes.JSON_PROPERTY_POLICY_NAME }) @jakarta.annotation.Generated( value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") @@ -29,8 +33,10 @@ public class OrgGroupPolicyUpdateAttributes { private Map content = null; public static final String JSON_PROPERTY_ENFORCEMENT_TIER = "enforcement_tier"; - private OrgGroupPolicyEnforcementTier enforcementTier = - OrgGroupPolicyEnforcementTier.OVERRIDE_ALLOWED; + private OrgGroupPolicyEnforcementTier enforcementTier; + + public static final String JSON_PROPERTY_POLICY_NAME = "policy_name"; + private String policyName; public OrgGroupPolicyUpdateAttributes content(Map content) { this.content = content; @@ -46,7 +52,10 @@ public OrgGroupPolicyUpdateAttributes putContentItem(String key, Object contentI } /** - * The policy content as key-value pairs. + * The policy content as key-value pairs. For org_config policies, an arbitrary + * key-value map (for example, {"value": "UTC"}). For role policies, a + * permissions key containing an array of permission UUIDs (for example, + * {"permissions": ["<uuid>", ...]}). * * @return content */ @@ -72,7 +81,10 @@ public OrgGroupPolicyUpdateAttributes enforcementTier( * The enforcement tier of the policy. OVERRIDE_ALLOWED means the policy is set but * member orgs may mutate it. GROUP_MANAGED means the policy is strictly controlled * and mutations are blocked for affected orgs. DELEGATE means each member org - * controls its own value. + * controls its own value. role policies only support GROUP_MANAGED and + * DELEGATEOVERRIDE_ALLOWED is rejected for this policy type. + * Transitioning a role policy to DELEGATE (disabling it) is one-way — + * the policy cannot be transitioned back to GROUP_MANAGED afterward. * * @return enforcementTier */ @@ -90,6 +102,29 @@ public void setEnforcementTier(OrgGroupPolicyEnforcementTier enforcementTier) { this.enforcementTier = enforcementTier; } + public OrgGroupPolicyUpdateAttributes policyName(String policyName) { + this.policyName = policyName; + return this; + } + + /** + * The name of the policy. This becomes the name of the resource created across orgs in the group + * (for example, for role policies, the name of the created role). Omit to leave + * unchanged. + * + * @return policyName + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_POLICY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getPolicyName() { + return policyName; + } + + public void setPolicyName(String policyName) { + this.policyName = policyName; + } + /** * A container for additional, undeclared properties. This is a holder for any undeclared * properties as specified with the 'additionalProperties' keyword in the OAS document. @@ -149,13 +184,14 @@ public boolean equals(Object o) { (OrgGroupPolicyUpdateAttributes) o; return Objects.equals(this.content, orgGroupPolicyUpdateAttributes.content) && Objects.equals(this.enforcementTier, orgGroupPolicyUpdateAttributes.enforcementTier) + && Objects.equals(this.policyName, orgGroupPolicyUpdateAttributes.policyName) && Objects.equals( this.additionalProperties, orgGroupPolicyUpdateAttributes.additionalProperties); } @Override public int hashCode() { - return Objects.hash(content, enforcementTier, additionalProperties); + return Objects.hash(content, enforcementTier, policyName, additionalProperties); } @Override @@ -164,6 +200,7 @@ public String toString() { sb.append("class OrgGroupPolicyUpdateAttributes {\n"); sb.append(" content: ").append(toIndentedString(content)).append("\n"); sb.append(" enforcementTier: ").append(toIndentedString(enforcementTier)).append("\n"); + sb.append(" policyName: ").append(toIndentedString(policyName)).append("\n"); sb.append(" additionalProperties: ") .append(toIndentedString(additionalProperties)) .append("\n"); diff --git a/src/main/java/com/datadog/api/client/v2/model/OrgGroupPolicyUpdateData.java b/src/main/java/com/datadog/api/client/v2/model/OrgGroupPolicyUpdateData.java index 050b7119660..b8f5ac3098b 100644 --- a/src/main/java/com/datadog/api/client/v2/model/OrgGroupPolicyUpdateData.java +++ b/src/main/java/com/datadog/api/client/v2/model/OrgGroupPolicyUpdateData.java @@ -59,7 +59,8 @@ public OrgGroupPolicyUpdateData attributes(OrgGroupPolicyUpdateAttributes attrib } /** - * Attributes for updating an org group policy. + * Attributes for updating an org group policy. policy_name, content, + * and enforcement_tier may be omitted individually to leave them unchanged. * * @return attributes */ diff --git a/src/test/resources/com/datadog/api/client/v2/api/org_groups.feature b/src/test/resources/com/datadog/api/client/v2/api/org_groups.feature index 46cd5e7d3e6..eda51294b66 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/org_groups.feature +++ b/src/test/resources/com/datadog/api/client/v2/api/org_groups.feature @@ -414,7 +414,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"}, "enforcement_tier": "OVERRIDE_ALLOWED"}, "id": "1a2b3c4d-5e6f-7890-abcd-ef0123456789", "type": "org_group_policies"}} + And body with value {"data": {"attributes": {"content": {"value": "UTC"}, "enforcement_tier": "OVERRIDE_ALLOWED", "policy_name": "monitor_timezone"}, "id": "1a2b3c4d-5e6f-7890-abcd-ef0123456789", "type": "org_group_policies"}} When the request is sent Then the response status is 400 Bad Request @@ -423,7 +423,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"}, "enforcement_tier": "OVERRIDE_ALLOWED"}, "id": "1a2b3c4d-5e6f-7890-abcd-ef0123456789", "type": "org_group_policies"}} + And body with value {"data": {"attributes": {"content": {"value": "UTC"}, "enforcement_tier": "OVERRIDE_ALLOWED", "policy_name": "monitor_timezone"}, "id": "1a2b3c4d-5e6f-7890-abcd-ef0123456789", "type": "org_group_policies"}} When the request is sent Then the response status is 404 Not Found @@ -432,7 +432,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"}, "enforcement_tier": "OVERRIDE_ALLOWED"}, "id": "1a2b3c4d-5e6f-7890-abcd-ef0123456789", "type": "org_group_policies"}} + And body with value {"data": {"attributes": {"content": {"value": "UTC"}, "enforcement_tier": "OVERRIDE_ALLOWED", "policy_name": "monitor_timezone"}, "id": "1a2b3c4d-5e6f-7890-abcd-ef0123456789", "type": "org_group_policies"}} When the request is sent Then the response status is 200 OK