diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index e8bb5351a80b..cfc1f47c9f35 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/features/v2/org_groups.feature b/features/v2/org_groups.feature index 46cd5e7d3e69..eda51294b66d 100644 --- a/features/v2/org_groups.feature +++ b/features/v2/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 diff --git a/private/bdd_runner/src/support/scenarios_model_mapping.ts b/private/bdd_runner/src/support/scenarios_model_mapping.ts index 270d6f387a22..8be7c745253c 100644 --- a/private/bdd_runner/src/support/scenarios_model_mapping.ts +++ b/private/bdd_runner/src/support/scenarios_model_mapping.ts @@ -14121,6 +14121,10 @@ export const ScenariosModelMappings: { [key: string]: OperationMapping } = { type: "string", format: "", }, + filterPolicyType: { + type: "OrgGroupPolicyFilterPolicyTypeValue", + format: "", + }, pageNumber: { type: "number", format: "int64", diff --git a/services/org_groups/src/v2/OrgGroupsApi.ts b/services/org_groups/src/v2/OrgGroupsApi.ts index e8629f1d6c0f..685ba3cfab8c 100644 --- a/services/org_groups/src/v2/OrgGroupsApi.ts +++ b/services/org_groups/src/v2/OrgGroupsApi.ts @@ -33,6 +33,7 @@ import { OrgGroupMembershipSortOption } from "./models/OrgGroupMembershipSortOpt import { OrgGroupMembershipUpdateRequest } from "./models/OrgGroupMembershipUpdateRequest"; import { OrgGroupPolicyConfigListResponse } from "./models/OrgGroupPolicyConfigListResponse"; import { OrgGroupPolicyCreateRequest } from "./models/OrgGroupPolicyCreateRequest"; +import { OrgGroupPolicyFilterPolicyTypeValue } from "./models/OrgGroupPolicyFilterPolicyTypeValue"; import { OrgGroupPolicyListResponse } from "./models/OrgGroupPolicyListResponse"; import { OrgGroupPolicyOverrideCreateRequest } from "./models/OrgGroupPolicyOverrideCreateRequest"; import { OrgGroupPolicyOverrideListResponse } from "./models/OrgGroupPolicyOverrideListResponse"; @@ -810,6 +811,7 @@ export class OrgGroupsApiRequestFactory extends BaseAPIRequestFactory { public async listOrgGroupPolicies( filterOrgGroupId: string, filterPolicyName?: string, + filterPolicyType?: OrgGroupPolicyFilterPolicyTypeValue, pageNumber?: number, pageSize?: number, sort?: OrgGroupPolicySortOption, @@ -869,6 +871,18 @@ export class OrgGroupsApiRequestFactory extends BaseAPIRequestFactory { "", ); } + if (filterPolicyType !== undefined) { + requestContext.setQueryParam( + "filter[policy_type]", + serialize( + filterPolicyType, + TypingInfo, + "OrgGroupPolicyFilterPolicyTypeValue", + "", + ), + "", + ); + } if (pageNumber !== undefined) { requestContext.setQueryParam( "page[number]", @@ -3285,6 +3299,11 @@ export interface OrgGroupsApiListOrgGroupPoliciesRequest { * @type string */ filterPolicyName?: string; + /** + * Filter policies by policy type. Supported values are `org_config` and `role`. + * @type OrgGroupPolicyFilterPolicyTypeValue + */ + filterPolicyType?: OrgGroupPolicyFilterPolicyTypeValue; /** * The page number to return. * @type number @@ -3697,6 +3716,7 @@ export class OrgGroupsApi { const requestContextPromise = this.requestFactory.listOrgGroupPolicies( param.filterOrgGroupId, param.filterPolicyName, + param.filterPolicyType, param.pageNumber, param.pageSize, param.sort, diff --git a/services/org_groups/src/v2/index.ts b/services/org_groups/src/v2/index.ts index da8143019399..ab25106c0457 100644 --- a/services/org_groups/src/v2/index.ts +++ b/services/org_groups/src/v2/index.ts @@ -62,6 +62,7 @@ export { OrgGroupPolicyCreateRelationships } from "./models/OrgGroupPolicyCreate export { OrgGroupPolicyCreateRequest } from "./models/OrgGroupPolicyCreateRequest"; export { OrgGroupPolicyData } from "./models/OrgGroupPolicyData"; export { OrgGroupPolicyEnforcementTier } from "./models/OrgGroupPolicyEnforcementTier"; +export { OrgGroupPolicyFilterPolicyTypeValue } from "./models/OrgGroupPolicyFilterPolicyTypeValue"; export { OrgGroupPolicyListResponse } from "./models/OrgGroupPolicyListResponse"; export { OrgGroupPolicyOverrideAttributes } from "./models/OrgGroupPolicyOverrideAttributes"; export { OrgGroupPolicyOverrideCreateAttributes } from "./models/OrgGroupPolicyOverrideCreateAttributes"; diff --git a/services/org_groups/src/v2/models/OrgGroupPolicyAttributes.ts b/services/org_groups/src/v2/models/OrgGroupPolicyAttributes.ts index 2fe1ece06646..4156ee4039a9 100644 --- a/services/org_groups/src/v2/models/OrgGroupPolicyAttributes.ts +++ b/services/org_groups/src/v2/models/OrgGroupPolicyAttributes.ts @@ -8,11 +8,11 @@ import { OrgGroupPolicyPolicyType } from "./OrgGroupPolicyPolicyType"; */ export class OrgGroupPolicyAttributes { /** - * 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": ["", ...]}`). */ "content"?: { [key: string]: any }; /** - * 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. */ "enforcementTier": OrgGroupPolicyEnforcementTier; /** @@ -20,11 +20,11 @@ export class OrgGroupPolicyAttributes { */ "modifiedAt": Date; /** - * 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). */ "policyName": string; /** - * 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. */ "policyType": OrgGroupPolicyPolicyType; /** diff --git a/services/org_groups/src/v2/models/OrgGroupPolicyCreateAttributes.ts b/services/org_groups/src/v2/models/OrgGroupPolicyCreateAttributes.ts index 7a6defeb3773..0375c587958a 100644 --- a/services/org_groups/src/v2/models/OrgGroupPolicyCreateAttributes.ts +++ b/services/org_groups/src/v2/models/OrgGroupPolicyCreateAttributes.ts @@ -4,23 +4,23 @@ import { OrgGroupPolicyEnforcementTier } from "./OrgGroupPolicyEnforcementTier"; import { OrgGroupPolicyPolicyType } from "./OrgGroupPolicyPolicyType"; /** - * 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. */ export class OrgGroupPolicyCreateAttributes { /** - * 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": ["", ...]}`). */ "content": { [key: string]: any }; /** - * 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. */ "enforcementTier"?: OrgGroupPolicyEnforcementTier; /** - * 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). */ "policyName": string; /** - * 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. */ "policyType"?: OrgGroupPolicyPolicyType; /** diff --git a/services/org_groups/src/v2/models/OrgGroupPolicyCreateData.ts b/services/org_groups/src/v2/models/OrgGroupPolicyCreateData.ts index 083d1cc4e3f0..d9307792df72 100644 --- a/services/org_groups/src/v2/models/OrgGroupPolicyCreateData.ts +++ b/services/org_groups/src/v2/models/OrgGroupPolicyCreateData.ts @@ -9,7 +9,7 @@ import { OrgGroupPolicyType } from "./OrgGroupPolicyType"; */ export class OrgGroupPolicyCreateData { /** - * 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. */ "attributes": OrgGroupPolicyCreateAttributes; /** diff --git a/services/org_groups/src/v2/models/OrgGroupPolicyEnforcementTier.ts b/services/org_groups/src/v2/models/OrgGroupPolicyEnforcementTier.ts index d3a2db172a7a..7248276a140c 100644 --- a/services/org_groups/src/v2/models/OrgGroupPolicyEnforcementTier.ts +++ b/services/org_groups/src/v2/models/OrgGroupPolicyEnforcementTier.ts @@ -1,7 +1,7 @@ import { UnparsedObject } from "@datadog/datadog-api-client"; /** - * 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. */ export type OrgGroupPolicyEnforcementTier = | typeof OVERRIDE_ALLOWED diff --git a/services/org_groups/src/v2/models/OrgGroupPolicyFilterPolicyTypeValue.ts b/services/org_groups/src/v2/models/OrgGroupPolicyFilterPolicyTypeValue.ts new file mode 100644 index 000000000000..dfba3ab38943 --- /dev/null +++ b/services/org_groups/src/v2/models/OrgGroupPolicyFilterPolicyTypeValue.ts @@ -0,0 +1,11 @@ +import { UnparsedObject } from "@datadog/datadog-api-client"; + +/** + * 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. + */ +export type OrgGroupPolicyFilterPolicyTypeValue = + | typeof ORG_CONFIG + | typeof ROLE + | UnparsedObject; +export const ORG_CONFIG = "org_config"; +export const ROLE = "role"; diff --git a/services/org_groups/src/v2/models/OrgGroupPolicyPolicyType.ts b/services/org_groups/src/v2/models/OrgGroupPolicyPolicyType.ts index 5140b3612fa8..2c904b96eaf0 100644 --- a/services/org_groups/src/v2/models/OrgGroupPolicyPolicyType.ts +++ b/services/org_groups/src/v2/models/OrgGroupPolicyPolicyType.ts @@ -1,7 +1,11 @@ import { UnparsedObject } from "@datadog/datadog-api-client"; /** - * 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. */ -export type OrgGroupPolicyPolicyType = typeof ORG_CONFIG | UnparsedObject; +export type OrgGroupPolicyPolicyType = + | typeof ORG_CONFIG + | typeof ROLE + | UnparsedObject; export const ORG_CONFIG = "org_config"; +export const ROLE = "role"; diff --git a/services/org_groups/src/v2/models/OrgGroupPolicyUpdateAttributes.ts b/services/org_groups/src/v2/models/OrgGroupPolicyUpdateAttributes.ts index 5944facd9a0e..18cf13ae927a 100644 --- a/services/org_groups/src/v2/models/OrgGroupPolicyUpdateAttributes.ts +++ b/services/org_groups/src/v2/models/OrgGroupPolicyUpdateAttributes.ts @@ -3,17 +3,21 @@ import { AttributeTypeMap } from "@datadog/datadog-api-client"; import { OrgGroupPolicyEnforcementTier } from "./OrgGroupPolicyEnforcementTier"; /** - * 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. */ export class OrgGroupPolicyUpdateAttributes { /** - * 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": ["", ...]}`). */ "content"?: { [key: string]: any }; /** - * 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. */ "enforcementTier"?: OrgGroupPolicyEnforcementTier; + /** + * 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. + */ + "policyName"?: string; /** * A container for additional, undeclared properties. * This is a holder for any undeclared properties as specified with @@ -37,6 +41,10 @@ export class OrgGroupPolicyUpdateAttributes { baseName: "enforcement_tier", type: "OrgGroupPolicyEnforcementTier", }, + policyName: { + baseName: "policy_name", + type: "string", + }, additionalProperties: { baseName: "additionalProperties", type: "{ [key: string]: any; }", diff --git a/services/org_groups/src/v2/models/OrgGroupPolicyUpdateData.ts b/services/org_groups/src/v2/models/OrgGroupPolicyUpdateData.ts index 6325e6996445..3428027019a6 100644 --- a/services/org_groups/src/v2/models/OrgGroupPolicyUpdateData.ts +++ b/services/org_groups/src/v2/models/OrgGroupPolicyUpdateData.ts @@ -8,7 +8,7 @@ import { OrgGroupPolicyUpdateAttributes } from "./OrgGroupPolicyUpdateAttributes */ export class OrgGroupPolicyUpdateData { /** - * 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. */ "attributes": OrgGroupPolicyUpdateAttributes; /** diff --git a/services/org_groups/src/v2/models/TypingInfo.ts b/services/org_groups/src/v2/models/TypingInfo.ts index 2f3f453059a8..2b47cdbaae04 100644 --- a/services/org_groups/src/v2/models/TypingInfo.ts +++ b/services/org_groups/src/v2/models/TypingInfo.ts @@ -77,9 +77,10 @@ export const TypingInfo: ModelTypingInfo = { "GROUP_MANAGED", "DELEGATE", ], + OrgGroupPolicyFilterPolicyTypeValue: ["org_config", "role"], OrgGroupPolicyOverrideSortOption: ["id", "-id", "org_uuid", "-org_uuid"], OrgGroupPolicyOverrideType: ["org_group_policy_overrides"], - OrgGroupPolicyPolicyType: ["org_config"], + OrgGroupPolicyPolicyType: ["org_config", "role"], OrgGroupPolicySortOption: ["id", "-id", "name", "-name"], OrgGroupPolicySuggestionStatus: ["pending", "accepted", "dismissed"], OrgGroupPolicySuggestionType: ["org_group_policy_suggestions"],