diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 1606032e9da3..640b527849fa 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -1335,6 +1335,15 @@ components: example: "a1b2c3d4-e5f6-7890-abcd-ef0123456789" format: uuid type: string + OrgGroupMembershipDeleteFilterOrgGroupId: + description: The ID of the org group the memberships belong to. + in: query + name: filter[org_group_id] + required: true + schema: + example: "a1b2c3d4-e5f6-7890-abcd-ef0123456789" + format: uuid + type: string OrgGroupMembershipFilterOrgGroupId: description: Filter memberships by org group ID. Required when `filter[org_uuid]` is not provided. in: query @@ -89902,14 +89911,47 @@ components: - created_at - modified_at type: object + OrgGroupMembershipBulkDeleteRequest: + description: Request to delete a batch of org group memberships. + properties: + data: + description: >- + The memberships to delete, as membership resource identifiers. Between 1 and 100 unique membership IDs per request. + items: + $ref: "#/components/schemas/OrgGroupMembershipBulkDeleteRequestData" + maxItems: 100 + minItems: 1 + type: array + uniqueItems: true + required: + - data + type: object + OrgGroupMembershipBulkDeleteRequestData: + description: A resource identifier for an org group membership to delete. + properties: + id: + description: The ID of the org group membership. + example: "f1e2d3c4-b5a6-7890-1234-567890abcdef" + format: uuid + type: string + type: + $ref: "#/components/schemas/OrgGroupMembershipType" + required: + - id + - type + type: object OrgGroupMembershipBulkUpdateAttributes: description: Attributes for bulk updating org group memberships. properties: orgs: - description: List of organizations to move. Maximum 100 per request. + description: >- + List of organizations to move. Between 1 and 100 per request. Each `org_uuid` and `org_site` pair must be unique. items: $ref: "#/components/schemas/GlobalOrgIdentifier" + maxItems: 100 + minItems: 1 type: array + uniqueItems: true required: - orgs type: object @@ -89954,6 +89996,51 @@ components: type: string x-enum-varnames: - ORG_GROUP_MEMBERSHIP_BULK_UPDATES + OrgGroupMembershipCreateAttributes: + description: Attributes for adding organizations to an org group. + properties: + orgs: + description: >- + List of organizations to add. Between 1 and 100 per request. Each `org_uuid` and `org_site` pair must be unique. + items: + $ref: "#/components/schemas/GlobalOrgIdentifier" + maxItems: 100 + minItems: 1 + type: array + uniqueItems: true + required: + - orgs + type: object + OrgGroupMembershipCreateData: + description: Data for adding organizations to an org group. + properties: + attributes: + $ref: "#/components/schemas/OrgGroupMembershipCreateAttributes" + relationships: + $ref: "#/components/schemas/OrgGroupMembershipCreateRelationships" + type: + $ref: "#/components/schemas/OrgGroupMembershipType" + required: + - type + - attributes + - relationships + type: object + OrgGroupMembershipCreateRelationships: + description: Relationships for adding organizations to an org group. + properties: + org_group: + $ref: "#/components/schemas/OrgGroupRelationshipToOne" + required: + - org_group + type: object + OrgGroupMembershipCreateRequest: + description: Request to add organizations to an org group. + properties: + data: + $ref: "#/components/schemas/OrgGroupMembershipCreateData" + required: + - data + type: object OrgGroupMembershipData: description: An org group membership resource. properties: @@ -202622,10 +202709,72 @@ 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/). + post: + description: >- + Add a batch of organizations to an existing org group. This is an atomic operation: either all organizations are added or none are. Between 1 and 100 organizations may be provided per request. Each organization must be identified by a unique `org_uuid` and `org_site` pair, and must be in the same site as the requesting organization. The requesting organization must own the org group. + operationId: CreateOrgGroupMemberships + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + orgs: + - org_site: "us1" + org_uuid: "c3d4e5f6-a7b8-9012-cdef-012345678901" + relationships: + org_group: + data: + id: "a1b2c3d4-e5f6-7890-abcd-ef0123456789" + type: org_groups + type: org_group_memberships + schema: + $ref: "#/components/schemas/OrgGroupMembershipCreateRequest" + required: true + responses: + "201": + description: Created + "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: Create org group memberships + tags: [Org Groups] + "x-permission": + operator: OR + permissions: + - org_group_write + 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/). /api/v2/org_group_memberships/bulk: patch: description: >- - Move a batch of organizations from one org group to another. This is an atomic operation. Maximum 100 orgs per request. + Move a batch of organizations from one org group to another. This is an atomic operation. Between 1 and 100 organizations may be provided per request. Each organization must be identified by a unique `org_uuid` and `org_site` pair, and must be in the same site as the requesting organization. operationId: BulkUpdateOrgGroupMemberships requestBody: content: @@ -202710,7 +202859,113 @@ 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/). + /api/v2/org_group_memberships/bulk_delete: + post: + description: >- + Delete a batch of memberships from an org group. The memberships to delete are provided as membership resource identifiers, and the org group they belong to must be provided with `filter[org_group_id]`. Between 1 and 100 unique membership IDs may be provided per request, and the requesting organization must own the org group. Membership IDs that were already deleted, do not exist, or do not belong to the org group do not cause the request to fail. + operationId: BulkDeleteOrgGroupMemberships + parameters: + - $ref: "#/components/parameters/OrgGroupMembershipDeleteFilterOrgGroupId" + requestBody: + content: + application/json: + examples: + default: + value: + data: + - id: "f1e2d3c4-b5a6-7890-1234-567890abcdef" + type: org_group_memberships + - id: "e2d3c4b5-a6f7-8901-2345-67890abcdef1" + type: org_group_memberships + - id: "d3c4b5a6-f7e8-9012-3456-7890abcdef12" + type: org_group_memberships + schema: + $ref: "#/components/schemas/OrgGroupMembershipBulkDeleteRequest" + required: true + responses: + "204": + description: No Content + "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: Bulk delete org group memberships + tags: [Org Groups] + "x-permission": + operator: OR + permissions: + - org_group_write + 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/). /api/v2/org_group_memberships/{org_group_membership_id}: + delete: + description: >- + Remove an organization from an org group by deleting its membership. The org group the membership belongs to must be provided with `filter[org_group_id]`, and the requesting organization must own that org group. Returns `404` if the membership does not exist, was already removed, or does not belong to the org group. + operationId: DeleteOrgGroupMembership + parameters: + - $ref: "#/components/parameters/OrgGroupMembershipId" + - $ref: "#/components/parameters/OrgGroupMembershipDeleteFilterOrgGroupId" + responses: + "204": + description: No Content + "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: Delete an org group membership + tags: [Org Groups] + "x-permission": + operator: OR + permissions: + - org_group_write + 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 membership by its ID. operationId: GetOrgGroupMembership diff --git a/examples/v2/org-groups/BulkDeleteOrgGroupMemberships.ts b/examples/v2/org-groups/BulkDeleteOrgGroupMemberships.ts new file mode 100644 index 000000000000..bdbee589a5c5 --- /dev/null +++ b/examples/v2/org-groups/BulkDeleteOrgGroupMemberships.ts @@ -0,0 +1,36 @@ +/** + * Bulk delete org group memberships returns "No Content" response + */ + +import { client, v2 } from "@datadog/datadog-api-client"; + +const configuration = client.createConfiguration({ + authMethods: { + AuthZ: { + accessToken: process.env.DD_BEARER_TOKEN as string, + }, + }, +}); +configuration.unstableOperations["v2.bulkDeleteOrgGroupMemberships"] = true; +const apiInstance = new v2.OrgGroupsApi(configuration); + +const params: v2.OrgGroupsApiBulkDeleteOrgGroupMembershipsRequest = { + body: { + data: [ + { + id: "f1e2d3c4-b5a6-7890-1234-567890abcdef", + type: "org_group_memberships", + }, + ], + }, + filterOrgGroupId: "a1b2c3d4-e5f6-7890-abcd-ef0123456789", +}; + +apiInstance + .bulkDeleteOrgGroupMemberships(params) + .then((data: any) => { + console.log( + "API called successfully. Returned data: " + JSON.stringify(data) + ); + }) + .catch((error: any) => console.error(error)); diff --git a/examples/v2/org-groups/CreateOrgGroupMemberships.ts b/examples/v2/org-groups/CreateOrgGroupMemberships.ts new file mode 100644 index 000000000000..669ec3be1f46 --- /dev/null +++ b/examples/v2/org-groups/CreateOrgGroupMemberships.ts @@ -0,0 +1,48 @@ +/** + * Create org group memberships returns "Created" response + */ + +import { client, v2 } from "@datadog/datadog-api-client"; + +const configuration = client.createConfiguration({ + authMethods: { + AuthZ: { + accessToken: process.env.DD_BEARER_TOKEN as string, + }, + }, +}); +configuration.unstableOperations["v2.createOrgGroupMemberships"] = true; +const apiInstance = new v2.OrgGroupsApi(configuration); + +const params: v2.OrgGroupsApiCreateOrgGroupMembershipsRequest = { + body: { + data: { + attributes: { + orgs: [ + { + orgSite: "us1", + orgUuid: "c3d4e5f6-a7b8-9012-cdef-012345678901", + }, + ], + }, + relationships: { + orgGroup: { + data: { + id: "a1b2c3d4-e5f6-7890-abcd-ef0123456789", + type: "org_groups", + }, + }, + }, + type: "org_group_memberships", + }, + }, +}; + +apiInstance + .createOrgGroupMemberships(params) + .then((data: any) => { + console.log( + "API called successfully. Returned data: " + JSON.stringify(data) + ); + }) + .catch((error: any) => console.error(error)); diff --git a/examples/v2/org-groups/DeleteOrgGroupMembership.ts b/examples/v2/org-groups/DeleteOrgGroupMembership.ts new file mode 100644 index 000000000000..6dc96cfb8c09 --- /dev/null +++ b/examples/v2/org-groups/DeleteOrgGroupMembership.ts @@ -0,0 +1,29 @@ +/** + * Delete an org group membership returns "No Content" response + */ + +import { client, v2 } from "@datadog/datadog-api-client"; + +const configuration = client.createConfiguration({ + authMethods: { + AuthZ: { + accessToken: process.env.DD_BEARER_TOKEN as string, + }, + }, +}); +configuration.unstableOperations["v2.deleteOrgGroupMembership"] = true; +const apiInstance = new v2.OrgGroupsApi(configuration); + +const params: v2.OrgGroupsApiDeleteOrgGroupMembershipRequest = { + orgGroupMembershipId: "f1e2d3c4-b5a6-7890-1234-567890abcdef", + filterOrgGroupId: "a1b2c3d4-e5f6-7890-abcd-ef0123456789", +}; + +apiInstance + .deleteOrgGroupMembership(params) + .then((data: any) => { + console.log( + "API called successfully. Returned data: " + JSON.stringify(data) + ); + }) + .catch((error: any) => console.error(error)); diff --git a/features/support/scenarios_model_mapping.ts b/features/support/scenarios_model_mapping.ts index b46bce900c70..ad4d84e35c19 100644 --- a/features/support/scenarios_model_mapping.ts +++ b/features/support/scenarios_model_mapping.ts @@ -15076,6 +15076,13 @@ export const ScenariosModelMappings: {[key: string]: {[key: string]: any}} = { }, "operationResponseType": "OrgGroupMembershipListResponse", }, + "v2.CreateOrgGroupMemberships": { + "body": { + "type": "OrgGroupMembershipCreateRequest", + "format": "", + }, + "operationResponseType": "{}", + }, "v2.BulkUpdateOrgGroupMemberships": { "body": { "type": "OrgGroupMembershipBulkUpdateRequest", @@ -15083,6 +15090,17 @@ export const ScenariosModelMappings: {[key: string]: {[key: string]: any}} = { }, "operationResponseType": "OrgGroupMembershipListResponse", }, + "v2.BulkDeleteOrgGroupMemberships": { + "filterOrgGroupId": { + "type": "string", + "format": "uuid", + }, + "body": { + "type": "OrgGroupMembershipBulkDeleteRequest", + "format": "", + }, + "operationResponseType": "{}", + }, "v2.GetOrgGroupMembership": { "orgGroupMembershipId": { "type": "string", @@ -15090,6 +15108,17 @@ export const ScenariosModelMappings: {[key: string]: {[key: string]: any}} = { }, "operationResponseType": "OrgGroupMembershipResponse", }, + "v2.DeleteOrgGroupMembership": { + "orgGroupMembershipId": { + "type": "string", + "format": "uuid", + }, + "filterOrgGroupId": { + "type": "string", + "format": "uuid", + }, + "operationResponseType": "{}", + }, "v2.UpdateOrgGroupMembership": { "orgGroupMembershipId": { "type": "string", diff --git a/features/v2/org_groups.feature b/features/v2/org_groups.feature index 493875e38beb..298f1e7759d0 100644 --- a/features/v2/org_groups.feature +++ b/features/v2/org_groups.feature @@ -8,6 +8,33 @@ Feature: Org Groups And a valid "appKeyAuth" key in the system And an instance of "OrgGroups" API + @generated @skip @team:ddoghq/org-management + Scenario: Bulk delete org group memberships returns "Bad Request" response + Given operation "BulkDeleteOrgGroupMemberships" enabled + And new "BulkDeleteOrgGroupMemberships" request + And request contains "filter[org_group_id]" parameter from "REPLACE.ME" + And body with value {"data": [{"id": "f1e2d3c4-b5a6-7890-1234-567890abcdef", "type": "org_group_memberships"}]} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:ddoghq/org-management + Scenario: Bulk delete org group memberships returns "No Content" response + Given operation "BulkDeleteOrgGroupMemberships" enabled + And new "BulkDeleteOrgGroupMemberships" request + And request contains "filter[org_group_id]" parameter from "REPLACE.ME" + And body with value {"data": [{"id": "f1e2d3c4-b5a6-7890-1234-567890abcdef", "type": "org_group_memberships"}]} + When the request is sent + Then the response status is 204 No Content + + @generated @skip @team:ddoghq/org-management + Scenario: Bulk delete org group memberships returns "Not Found" response + Given operation "BulkDeleteOrgGroupMemberships" enabled + And new "BulkDeleteOrgGroupMemberships" request + And request contains "filter[org_group_id]" parameter from "REPLACE.ME" + And body with value {"data": [{"id": "f1e2d3c4-b5a6-7890-1234-567890abcdef", "type": "org_group_memberships"}]} + When the request is sent + Then the response status is 404 Not Found + @generated @skip @team:ddoghq/org-management Scenario: Bulk update org group memberships returns "Bad Request" response Given operation "BulkUpdateOrgGroupMemberships" enabled @@ -104,6 +131,57 @@ Feature: Org Groups When the request is sent Then the response status is 201 Created + @generated @skip @team:ddoghq/org-management + Scenario: Create org group memberships returns "Bad Request" response + Given operation "CreateOrgGroupMemberships" enabled + And new "CreateOrgGroupMemberships" request + And body with value {"data": {"attributes": {"orgs": [{"org_site": "us1", "org_uuid": "c3d4e5f6-a7b8-9012-cdef-012345678901"}]}, "relationships": {"org_group": {"data": {"id": "a1b2c3d4-e5f6-7890-abcd-ef0123456789", "type": "org_groups"}}}, "type": "org_group_memberships"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:ddoghq/org-management + Scenario: Create org group memberships returns "Created" response + Given operation "CreateOrgGroupMemberships" enabled + And new "CreateOrgGroupMemberships" request + And body with value {"data": {"attributes": {"orgs": [{"org_site": "us1", "org_uuid": "c3d4e5f6-a7b8-9012-cdef-012345678901"}]}, "relationships": {"org_group": {"data": {"id": "a1b2c3d4-e5f6-7890-abcd-ef0123456789", "type": "org_groups"}}}, "type": "org_group_memberships"}} + When the request is sent + Then the response status is 201 Created + + @generated @skip @team:ddoghq/org-management + Scenario: Create org group memberships returns "Not Found" response + Given operation "CreateOrgGroupMemberships" enabled + And new "CreateOrgGroupMemberships" request + And body with value {"data": {"attributes": {"orgs": [{"org_site": "us1", "org_uuid": "c3d4e5f6-a7b8-9012-cdef-012345678901"}]}, "relationships": {"org_group": {"data": {"id": "a1b2c3d4-e5f6-7890-abcd-ef0123456789", "type": "org_groups"}}}, "type": "org_group_memberships"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:ddoghq/org-management + Scenario: Delete an org group membership returns "Bad Request" response + Given operation "DeleteOrgGroupMembership" enabled + And new "DeleteOrgGroupMembership" request + And request contains "org_group_membership_id" parameter from "REPLACE.ME" + And request contains "filter[org_group_id]" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:ddoghq/org-management + Scenario: Delete an org group membership returns "No Content" response + Given operation "DeleteOrgGroupMembership" enabled + And new "DeleteOrgGroupMembership" request + And request contains "org_group_membership_id" parameter from "REPLACE.ME" + And request contains "filter[org_group_id]" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 204 No Content + + @generated @skip @team:ddoghq/org-management + Scenario: Delete an org group membership returns "Not Found" response + Given operation "DeleteOrgGroupMembership" enabled + And new "DeleteOrgGroupMembership" request + And request contains "org_group_membership_id" parameter from "REPLACE.ME" + And request contains "filter[org_group_id]" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + @generated @skip @team:ddoghq/org-management Scenario: Delete an org group policy override returns "Bad Request" response Given operation "DeleteOrgGroupPolicyOverride" enabled diff --git a/features/v2/undo.json b/features/v2/undo.json index c65a1e0cbcb2..ce1458e6345c 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -6825,12 +6825,30 @@ "type": "safe" } }, + "CreateOrgGroupMemberships": { + "tag": "Org Groups", + "undo": { + "type": "unsafe" + } + }, "BulkUpdateOrgGroupMemberships": { "tag": "Org Groups", "undo": { "type": "idempotent" } }, + "BulkDeleteOrgGroupMemberships": { + "tag": "Org Groups", + "undo": { + "type": "idempotent" + } + }, + "DeleteOrgGroupMembership": { + "tag": "Org Groups", + "undo": { + "type": "idempotent" + } + }, "GetOrgGroupMembership": { "tag": "Org Groups", "undo": { diff --git a/packages/datadog-api-client-common/configuration.ts b/packages/datadog-api-client-common/configuration.ts index f1feb6eb8b24..66c4dba67296 100644 --- a/packages/datadog-api-client-common/configuration.ts +++ b/packages/datadog-api-client-common/configuration.ts @@ -721,11 +721,14 @@ export function createConfiguration( "v2.registerOAuthClient": false, "v2.upsertScopesRestriction": false, "v2.disableCustomerOrg": false, + "v2.bulkDeleteOrgGroupMemberships": false, "v2.bulkUpdateOrgGroupMemberships": false, "v2.createOrgGroup": false, + "v2.createOrgGroupMemberships": false, "v2.createOrgGroupPolicy": false, "v2.createOrgGroupPolicyOverride": false, "v2.deleteOrgGroup": false, + "v2.deleteOrgGroupMembership": false, "v2.deleteOrgGroupPolicy": false, "v2.deleteOrgGroupPolicyOverride": false, "v2.getOrgGroup": false, diff --git a/packages/datadog-api-client-v2/apis/OrgGroupsApi.ts b/packages/datadog-api-client-v2/apis/OrgGroupsApi.ts index 056475afa001..4372601fb901 100644 --- a/packages/datadog-api-client-v2/apis/OrgGroupsApi.ts +++ b/packages/datadog-api-client-v2/apis/OrgGroupsApi.ts @@ -20,7 +20,9 @@ import { APIErrorResponse } from "../models/APIErrorResponse"; import { JSONAPIErrorResponse } from "../models/JSONAPIErrorResponse"; import { OrgGroupCreateRequest } from "../models/OrgGroupCreateRequest"; import { OrgGroupListResponse } from "../models/OrgGroupListResponse"; +import { OrgGroupMembershipBulkDeleteRequest } from "../models/OrgGroupMembershipBulkDeleteRequest"; import { OrgGroupMembershipBulkUpdateRequest } from "../models/OrgGroupMembershipBulkUpdateRequest"; +import { OrgGroupMembershipCreateRequest } from "../models/OrgGroupMembershipCreateRequest"; import { OrgGroupMembershipListResponse } from "../models/OrgGroupMembershipListResponse"; import { OrgGroupMembershipResponse } from "../models/OrgGroupMembershipResponse"; import { OrgGroupMembershipSortOption } from "../models/OrgGroupMembershipSortOption"; @@ -43,6 +45,82 @@ import { OrgGroupSortOption } from "../models/OrgGroupSortOption"; import { OrgGroupUpdateRequest } from "../models/OrgGroupUpdateRequest"; export class OrgGroupsApiRequestFactory extends BaseAPIRequestFactory { + public async bulkDeleteOrgGroupMemberships( + filterOrgGroupId: string, + body: OrgGroupMembershipBulkDeleteRequest, + _options?: Configuration + ): Promise { + const _config = _options || this.configuration; + + logger.warn("Using unstable operation 'bulkDeleteOrgGroupMemberships'"); + if (!_config.unstableOperations["v2.bulkDeleteOrgGroupMemberships"]) { + throw new Error( + "Unstable operation 'bulkDeleteOrgGroupMemberships' is disabled" + ); + } + + // verify required parameter 'filterOrgGroupId' is not null or undefined + if (filterOrgGroupId === null || filterOrgGroupId === undefined) { + throw new RequiredError( + "filterOrgGroupId", + "bulkDeleteOrgGroupMemberships" + ); + } + + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError("body", "bulkDeleteOrgGroupMemberships"); + } + + // Path Params + const localVarPath = "/api/v2/org_group_memberships/bulk_delete"; + + // Make Request Context + const requestContext = _config + .getServer("v2.OrgGroupsApi.bulkDeleteOrgGroupMemberships") + .makeRequestContext(localVarPath, HttpMethod.POST); + requestContext.setHeaderParam("Accept", "*/*"); + requestContext.setHttpConfig(_config.httpConfig); + + // Set IaC header + if (_config.isIaC) { + requestContext.setHeaderParam("X-Datadog-Managed-By", "iac"); + } + + // Query Params + if (filterOrgGroupId !== undefined) { + requestContext.setQueryParam( + "filter[org_group_id]", + ObjectSerializer.serialize(filterOrgGroupId, "string", "uuid"), + "" + ); + } + + // Body Params + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json", + ]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = ObjectSerializer.stringify( + ObjectSerializer.serialize( + body, + "OrgGroupMembershipBulkDeleteRequest", + "" + ), + contentType + ); + requestContext.setBody(serializedBody); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + "AuthZ", + ]); + + return requestContext; + } + public async bulkUpdateOrgGroupMemberships( body: OrgGroupMembershipBulkUpdateRequest, _options?: Configuration @@ -153,6 +231,60 @@ export class OrgGroupsApiRequestFactory extends BaseAPIRequestFactory { return requestContext; } + public async createOrgGroupMemberships( + body: OrgGroupMembershipCreateRequest, + _options?: Configuration + ): Promise { + const _config = _options || this.configuration; + + logger.warn("Using unstable operation 'createOrgGroupMemberships'"); + if (!_config.unstableOperations["v2.createOrgGroupMemberships"]) { + throw new Error( + "Unstable operation 'createOrgGroupMemberships' is disabled" + ); + } + + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError("body", "createOrgGroupMemberships"); + } + + // Path Params + const localVarPath = "/api/v2/org_group_memberships"; + + // Make Request Context + const requestContext = _config + .getServer("v2.OrgGroupsApi.createOrgGroupMemberships") + .makeRequestContext(localVarPath, HttpMethod.POST); + requestContext.setHeaderParam("Accept", "*/*"); + requestContext.setHttpConfig(_config.httpConfig); + + // Set IaC header + if (_config.isIaC) { + requestContext.setHeaderParam("X-Datadog-Managed-By", "iac"); + } + + // Body Params + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json", + ]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = ObjectSerializer.stringify( + ObjectSerializer.serialize(body, "OrgGroupMembershipCreateRequest", ""), + contentType + ); + requestContext.setBody(serializedBody); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + "AuthZ", + ]); + + return requestContext; + } + public async createOrgGroupPolicy( body: OrgGroupPolicyCreateRequest, _options?: Configuration @@ -307,6 +439,71 @@ export class OrgGroupsApiRequestFactory extends BaseAPIRequestFactory { return requestContext; } + public async deleteOrgGroupMembership( + orgGroupMembershipId: string, + filterOrgGroupId: string, + _options?: Configuration + ): Promise { + const _config = _options || this.configuration; + + logger.warn("Using unstable operation 'deleteOrgGroupMembership'"); + if (!_config.unstableOperations["v2.deleteOrgGroupMembership"]) { + throw new Error( + "Unstable operation 'deleteOrgGroupMembership' is disabled" + ); + } + + // verify required parameter 'orgGroupMembershipId' is not null or undefined + if (orgGroupMembershipId === null || orgGroupMembershipId === undefined) { + throw new RequiredError( + "orgGroupMembershipId", + "deleteOrgGroupMembership" + ); + } + + // verify required parameter 'filterOrgGroupId' is not null or undefined + if (filterOrgGroupId === null || filterOrgGroupId === undefined) { + throw new RequiredError("filterOrgGroupId", "deleteOrgGroupMembership"); + } + + // Path Params + const localVarPath = + "/api/v2/org_group_memberships/{org_group_membership_id}".replace( + "{org_group_membership_id}", + encodeURIComponent(String(orgGroupMembershipId)) + ); + + // Make Request Context + const requestContext = _config + .getServer("v2.OrgGroupsApi.deleteOrgGroupMembership") + .makeRequestContext(localVarPath, HttpMethod.DELETE); + requestContext.setHeaderParam("Accept", "*/*"); + requestContext.setHttpConfig(_config.httpConfig); + + // Set IaC header + if (_config.isIaC) { + requestContext.setHeaderParam("X-Datadog-Managed-By", "iac"); + } + + // Query Params + if (filterOrgGroupId !== undefined) { + requestContext.setQueryParam( + "filter[org_group_id]", + ObjectSerializer.serialize(filterOrgGroupId, "string", "uuid"), + "" + ); + } + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + "AuthZ", + ]); + + return requestContext; + } + public async deleteOrgGroupPolicy( orgGroupPolicyId: string, _options?: Configuration @@ -1275,6 +1472,83 @@ export class OrgGroupsApiRequestFactory extends BaseAPIRequestFactory { } export class OrgGroupsApiResponseProcessor { + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to bulkDeleteOrgGroupMemberships + * @throws ApiException if the response code was not in [200, 299] + */ + public async bulkDeleteOrgGroupMemberships( + response: ResponseContext + ): Promise { + const contentType = ObjectSerializer.normalizeMediaType( + response.headers["content-type"] + ); + if (response.httpStatusCode === 204) { + return; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 401 || + response.httpStatusCode === 403 || + response.httpStatusCode === 404 + ) { + const bodyText = ObjectSerializer.parse( + await response.body.text(), + contentType + ); + let body: JSONAPIErrorResponse; + try { + body = ObjectSerializer.deserialize( + bodyText, + "JSONAPIErrorResponse" + ) as JSONAPIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText + ); + } + throw new ApiException( + response.httpStatusCode, + body + ); + } + if (response.httpStatusCode === 429) { + const bodyText = ObjectSerializer.parse( + await response.body.text(), + contentType + ); + let body: APIErrorResponse; + try { + body = ObjectSerializer.deserialize( + bodyText, + "APIErrorResponse" + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + return; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"' + ); + } + /** * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects @@ -1447,6 +1721,83 @@ export class OrgGroupsApiResponseProcessor { ); } + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to createOrgGroupMemberships + * @throws ApiException if the response code was not in [200, 299] + */ + public async createOrgGroupMemberships( + response: ResponseContext + ): Promise { + const contentType = ObjectSerializer.normalizeMediaType( + response.headers["content-type"] + ); + if (response.httpStatusCode === 201) { + return; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 401 || + response.httpStatusCode === 403 || + response.httpStatusCode === 404 + ) { + const bodyText = ObjectSerializer.parse( + await response.body.text(), + contentType + ); + let body: JSONAPIErrorResponse; + try { + body = ObjectSerializer.deserialize( + bodyText, + "JSONAPIErrorResponse" + ) as JSONAPIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText + ); + } + throw new ApiException( + response.httpStatusCode, + body + ); + } + if (response.httpStatusCode === 429) { + const bodyText = ObjectSerializer.parse( + await response.body.text(), + contentType + ); + let body: APIErrorResponse; + try { + body = ObjectSerializer.deserialize( + bodyText, + "APIErrorResponse" + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + return; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"' + ); + } + /** * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects @@ -1694,6 +2045,83 @@ export class OrgGroupsApiResponseProcessor { ); } + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to deleteOrgGroupMembership + * @throws ApiException if the response code was not in [200, 299] + */ + public async deleteOrgGroupMembership( + response: ResponseContext + ): Promise { + const contentType = ObjectSerializer.normalizeMediaType( + response.headers["content-type"] + ); + if (response.httpStatusCode === 204) { + return; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 401 || + response.httpStatusCode === 403 || + response.httpStatusCode === 404 + ) { + const bodyText = ObjectSerializer.parse( + await response.body.text(), + contentType + ); + let body: JSONAPIErrorResponse; + try { + body = ObjectSerializer.deserialize( + bodyText, + "JSONAPIErrorResponse" + ) as JSONAPIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText + ); + } + throw new ApiException( + response.httpStatusCode, + body + ); + } + if (response.httpStatusCode === 429) { + const bodyText = ObjectSerializer.parse( + await response.body.text(), + contentType + ); + let body: APIErrorResponse; + try { + body = ObjectSerializer.deserialize( + bodyText, + "APIErrorResponse" + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + return; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"' + ); + } + /** * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects @@ -3047,6 +3475,18 @@ export class OrgGroupsApiResponseProcessor { } } +export interface OrgGroupsApiBulkDeleteOrgGroupMembershipsRequest { + /** + * The ID of the org group the memberships belong to. + * @type string + */ + filterOrgGroupId: string; + /** + * @type OrgGroupMembershipBulkDeleteRequest + */ + body: OrgGroupMembershipBulkDeleteRequest; +} + export interface OrgGroupsApiBulkUpdateOrgGroupMembershipsRequest { /** * @type OrgGroupMembershipBulkUpdateRequest @@ -3061,6 +3501,13 @@ export interface OrgGroupsApiCreateOrgGroupRequest { body: OrgGroupCreateRequest; } +export interface OrgGroupsApiCreateOrgGroupMembershipsRequest { + /** + * @type OrgGroupMembershipCreateRequest + */ + body: OrgGroupMembershipCreateRequest; +} + export interface OrgGroupsApiCreateOrgGroupPolicyRequest { /** * @type OrgGroupPolicyCreateRequest @@ -3083,6 +3530,19 @@ export interface OrgGroupsApiDeleteOrgGroupRequest { orgGroupId: string; } +export interface OrgGroupsApiDeleteOrgGroupMembershipRequest { + /** + * The ID of the org group membership. + * @type string + */ + orgGroupMembershipId: string; + /** + * The ID of the org group the memberships belong to. + * @type string + */ + filterOrgGroupId: string; +} + export interface OrgGroupsApiDeleteOrgGroupPolicyRequest { /** * The ID of the org group policy. @@ -3312,7 +3772,32 @@ export class OrgGroupsApi { } /** - * Move a batch of organizations from one org group to another. This is an atomic operation. Maximum 100 orgs per request. + * Delete a batch of memberships from an org group. The memberships to delete are provided as membership resource identifiers, and the org group they belong to must be provided with `filter[org_group_id]`. Between 1 and 100 unique membership IDs may be provided per request, and the requesting organization must own the org group. Membership IDs that were already deleted, do not exist, or do not belong to the org group do not cause the request to fail. + * @param param The request object + */ + public bulkDeleteOrgGroupMemberships( + param: OrgGroupsApiBulkDeleteOrgGroupMembershipsRequest, + options?: Configuration + ): Promise { + const requestContextPromise = + this.requestFactory.bulkDeleteOrgGroupMemberships( + param.filterOrgGroupId, + param.body, + options + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.bulkDeleteOrgGroupMemberships( + responseContext + ); + }); + }); + } + + /** + * Move a batch of organizations from one org group to another. This is an atomic operation. Between 1 and 100 organizations may be provided per request. Each organization must be identified by a unique `org_uuid` and `org_site` pair, and must be in the same site as the requesting organization. * @param param The request object */ public bulkUpdateOrgGroupMemberships( @@ -3353,6 +3838,29 @@ export class OrgGroupsApi { }); } + /** + * Add a batch of organizations to an existing org group. This is an atomic operation: either all organizations are added or none are. Between 1 and 100 organizations may be provided per request. Each organization must be identified by a unique `org_uuid` and `org_site` pair, and must be in the same site as the requesting organization. The requesting organization must own the org group. + * @param param The request object + */ + public createOrgGroupMemberships( + param: OrgGroupsApiCreateOrgGroupMembershipsRequest, + options?: Configuration + ): Promise { + const requestContextPromise = this.requestFactory.createOrgGroupMemberships( + param.body, + options + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.createOrgGroupMemberships( + responseContext + ); + }); + }); + } + /** * Create a new policy for an organization group. * @param param The request object @@ -3416,6 +3924,30 @@ export class OrgGroupsApi { }); } + /** + * Remove an organization from an org group by deleting its membership. The org group the membership belongs to must be provided with `filter[org_group_id]`, and the requesting organization must own that org group. Returns `404` if the membership does not exist, was already removed, or does not belong to the org group. + * @param param The request object + */ + public deleteOrgGroupMembership( + param: OrgGroupsApiDeleteOrgGroupMembershipRequest, + options?: Configuration + ): Promise { + const requestContextPromise = this.requestFactory.deleteOrgGroupMembership( + param.orgGroupMembershipId, + param.filterOrgGroupId, + options + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.deleteOrgGroupMembership( + responseContext + ); + }); + }); + } + /** * Delete an organization group policy by its ID. * @param param The request object diff --git a/packages/datadog-api-client-v2/index.ts b/packages/datadog-api-client-v2/index.ts index b996e7097fea..a18b1f770acc 100644 --- a/packages/datadog-api-client-v2/index.ts +++ b/packages/datadog-api-client-v2/index.ts @@ -1260,11 +1260,14 @@ export { } from "./apis/OrgConnectionsApi"; export { + OrgGroupsApiBulkDeleteOrgGroupMembershipsRequest, OrgGroupsApiBulkUpdateOrgGroupMembershipsRequest, OrgGroupsApiCreateOrgGroupRequest, + OrgGroupsApiCreateOrgGroupMembershipsRequest, OrgGroupsApiCreateOrgGroupPolicyRequest, OrgGroupsApiCreateOrgGroupPolicyOverrideRequest, OrgGroupsApiDeleteOrgGroupRequest, + OrgGroupsApiDeleteOrgGroupMembershipRequest, OrgGroupsApiDeleteOrgGroupPolicyRequest, OrgGroupsApiDeleteOrgGroupPolicyOverrideRequest, OrgGroupsApiGetOrgGroupRequest, @@ -7287,11 +7290,17 @@ export { OrgGroupCreateRequest } from "./models/OrgGroupCreateRequest"; export { OrgGroupData } from "./models/OrgGroupData"; export { OrgGroupListResponse } from "./models/OrgGroupListResponse"; export { OrgGroupMembershipAttributes } from "./models/OrgGroupMembershipAttributes"; +export { OrgGroupMembershipBulkDeleteRequest } from "./models/OrgGroupMembershipBulkDeleteRequest"; +export { OrgGroupMembershipBulkDeleteRequestData } from "./models/OrgGroupMembershipBulkDeleteRequestData"; export { OrgGroupMembershipBulkUpdateAttributes } from "./models/OrgGroupMembershipBulkUpdateAttributes"; export { OrgGroupMembershipBulkUpdateData } from "./models/OrgGroupMembershipBulkUpdateData"; export { OrgGroupMembershipBulkUpdateRelationships } from "./models/OrgGroupMembershipBulkUpdateRelationships"; export { OrgGroupMembershipBulkUpdateRequest } from "./models/OrgGroupMembershipBulkUpdateRequest"; export { OrgGroupMembershipBulkUpdateType } from "./models/OrgGroupMembershipBulkUpdateType"; +export { OrgGroupMembershipCreateAttributes } from "./models/OrgGroupMembershipCreateAttributes"; +export { OrgGroupMembershipCreateData } from "./models/OrgGroupMembershipCreateData"; +export { OrgGroupMembershipCreateRelationships } from "./models/OrgGroupMembershipCreateRelationships"; +export { OrgGroupMembershipCreateRequest } from "./models/OrgGroupMembershipCreateRequest"; export { OrgGroupMembershipData } from "./models/OrgGroupMembershipData"; export { OrgGroupMembershipListResponse } from "./models/OrgGroupMembershipListResponse"; export { OrgGroupMembershipRelationships } from "./models/OrgGroupMembershipRelationships"; diff --git a/packages/datadog-api-client-v2/models/ObjectSerializer.ts b/packages/datadog-api-client-v2/models/ObjectSerializer.ts index c94160e100ad..f06b0bb2ca28 100644 --- a/packages/datadog-api-client-v2/models/ObjectSerializer.ts +++ b/packages/datadog-api-client-v2/models/ObjectSerializer.ts @@ -3994,10 +3994,16 @@ import { OrgGroupCreateRequest } from "./OrgGroupCreateRequest"; import { OrgGroupData } from "./OrgGroupData"; import { OrgGroupListResponse } from "./OrgGroupListResponse"; import { OrgGroupMembershipAttributes } from "./OrgGroupMembershipAttributes"; +import { OrgGroupMembershipBulkDeleteRequest } from "./OrgGroupMembershipBulkDeleteRequest"; +import { OrgGroupMembershipBulkDeleteRequestData } from "./OrgGroupMembershipBulkDeleteRequestData"; import { OrgGroupMembershipBulkUpdateAttributes } from "./OrgGroupMembershipBulkUpdateAttributes"; import { OrgGroupMembershipBulkUpdateData } from "./OrgGroupMembershipBulkUpdateData"; import { OrgGroupMembershipBulkUpdateRelationships } from "./OrgGroupMembershipBulkUpdateRelationships"; import { OrgGroupMembershipBulkUpdateRequest } from "./OrgGroupMembershipBulkUpdateRequest"; +import { OrgGroupMembershipCreateAttributes } from "./OrgGroupMembershipCreateAttributes"; +import { OrgGroupMembershipCreateData } from "./OrgGroupMembershipCreateData"; +import { OrgGroupMembershipCreateRelationships } from "./OrgGroupMembershipCreateRelationships"; +import { OrgGroupMembershipCreateRequest } from "./OrgGroupMembershipCreateRequest"; import { OrgGroupMembershipData } from "./OrgGroupMembershipData"; import { OrgGroupMembershipListResponse } from "./OrgGroupMembershipListResponse"; import { OrgGroupMembershipRelationships } from "./OrgGroupMembershipRelationships"; @@ -14982,12 +14988,19 @@ const typeMap: { [index: string]: any } = { OrgGroupData: OrgGroupData, OrgGroupListResponse: OrgGroupListResponse, OrgGroupMembershipAttributes: OrgGroupMembershipAttributes, + OrgGroupMembershipBulkDeleteRequest: OrgGroupMembershipBulkDeleteRequest, + OrgGroupMembershipBulkDeleteRequestData: + OrgGroupMembershipBulkDeleteRequestData, OrgGroupMembershipBulkUpdateAttributes: OrgGroupMembershipBulkUpdateAttributes, OrgGroupMembershipBulkUpdateData: OrgGroupMembershipBulkUpdateData, OrgGroupMembershipBulkUpdateRelationships: OrgGroupMembershipBulkUpdateRelationships, OrgGroupMembershipBulkUpdateRequest: OrgGroupMembershipBulkUpdateRequest, + OrgGroupMembershipCreateAttributes: OrgGroupMembershipCreateAttributes, + OrgGroupMembershipCreateData: OrgGroupMembershipCreateData, + OrgGroupMembershipCreateRelationships: OrgGroupMembershipCreateRelationships, + OrgGroupMembershipCreateRequest: OrgGroupMembershipCreateRequest, OrgGroupMembershipData: OrgGroupMembershipData, OrgGroupMembershipListResponse: OrgGroupMembershipListResponse, OrgGroupMembershipRelationships: OrgGroupMembershipRelationships, diff --git a/packages/datadog-api-client-v2/models/OrgGroupMembershipBulkDeleteRequest.ts b/packages/datadog-api-client-v2/models/OrgGroupMembershipBulkDeleteRequest.ts new file mode 100644 index 000000000000..ceee462505e4 --- /dev/null +++ b/packages/datadog-api-client-v2/models/OrgGroupMembershipBulkDeleteRequest.ts @@ -0,0 +1,54 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ +import { OrgGroupMembershipBulkDeleteRequestData } from "./OrgGroupMembershipBulkDeleteRequestData"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Request to delete a batch of org group memberships. + */ +export class OrgGroupMembershipBulkDeleteRequest { + /** + * The memberships to delete, as membership resource identifiers. Between 1 and 100 unique membership IDs per request. + */ + "data": Array; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "Array", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return OrgGroupMembershipBulkDeleteRequest.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/OrgGroupMembershipBulkDeleteRequestData.ts b/packages/datadog-api-client-v2/models/OrgGroupMembershipBulkDeleteRequestData.ts new file mode 100644 index 000000000000..62b55faaf224 --- /dev/null +++ b/packages/datadog-api-client-v2/models/OrgGroupMembershipBulkDeleteRequestData.ts @@ -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 2020-Present Datadog, Inc. + */ +import { OrgGroupMembershipType } from "./OrgGroupMembershipType"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * A resource identifier for an org group membership to delete. + */ +export class OrgGroupMembershipBulkDeleteRequestData { + /** + * The ID of the org group membership. + */ + "id": string; + /** + * Org group memberships resource type. + */ + "type": OrgGroupMembershipType; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + id: { + baseName: "id", + type: "string", + required: true, + format: "uuid", + }, + type: { + baseName: "type", + type: "OrgGroupMembershipType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return OrgGroupMembershipBulkDeleteRequestData.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/OrgGroupMembershipBulkUpdateAttributes.ts b/packages/datadog-api-client-v2/models/OrgGroupMembershipBulkUpdateAttributes.ts index 6d05ede3db57..3392b41c0260 100644 --- a/packages/datadog-api-client-v2/models/OrgGroupMembershipBulkUpdateAttributes.ts +++ b/packages/datadog-api-client-v2/models/OrgGroupMembershipBulkUpdateAttributes.ts @@ -12,7 +12,7 @@ import { AttributeTypeMap } from "../../datadog-api-client-common/util"; */ export class OrgGroupMembershipBulkUpdateAttributes { /** - * List of organizations to move. Maximum 100 per request. + * List of organizations to move. Between 1 and 100 per request. Each `org_uuid` and `org_site` pair must be unique. */ "orgs": Array; diff --git a/packages/datadog-api-client-v2/models/OrgGroupMembershipCreateAttributes.ts b/packages/datadog-api-client-v2/models/OrgGroupMembershipCreateAttributes.ts new file mode 100644 index 000000000000..90241824e035 --- /dev/null +++ b/packages/datadog-api-client-v2/models/OrgGroupMembershipCreateAttributes.ts @@ -0,0 +1,54 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ +import { GlobalOrgIdentifier } from "./GlobalOrgIdentifier"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Attributes for adding organizations to an org group. + */ +export class OrgGroupMembershipCreateAttributes { + /** + * List of organizations to add. Between 1 and 100 per request. Each `org_uuid` and `org_site` pair must be unique. + */ + "orgs": Array; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + orgs: { + baseName: "orgs", + type: "Array", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return OrgGroupMembershipCreateAttributes.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/OrgGroupMembershipCreateData.ts b/packages/datadog-api-client-v2/models/OrgGroupMembershipCreateData.ts new file mode 100644 index 000000000000..a6d9de6923ce --- /dev/null +++ b/packages/datadog-api-client-v2/models/OrgGroupMembershipCreateData.ts @@ -0,0 +1,74 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ +import { OrgGroupMembershipCreateAttributes } from "./OrgGroupMembershipCreateAttributes"; +import { OrgGroupMembershipCreateRelationships } from "./OrgGroupMembershipCreateRelationships"; +import { OrgGroupMembershipType } from "./OrgGroupMembershipType"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Data for adding organizations to an org group. + */ +export class OrgGroupMembershipCreateData { + /** + * Attributes for adding organizations to an org group. + */ + "attributes": OrgGroupMembershipCreateAttributes; + /** + * Relationships for adding organizations to an org group. + */ + "relationships": OrgGroupMembershipCreateRelationships; + /** + * Org group memberships resource type. + */ + "type": OrgGroupMembershipType; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + attributes: { + baseName: "attributes", + type: "OrgGroupMembershipCreateAttributes", + required: true, + }, + relationships: { + baseName: "relationships", + type: "OrgGroupMembershipCreateRelationships", + required: true, + }, + type: { + baseName: "type", + type: "OrgGroupMembershipType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return OrgGroupMembershipCreateData.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/OrgGroupMembershipCreateRelationships.ts b/packages/datadog-api-client-v2/models/OrgGroupMembershipCreateRelationships.ts new file mode 100644 index 000000000000..319eac16bad7 --- /dev/null +++ b/packages/datadog-api-client-v2/models/OrgGroupMembershipCreateRelationships.ts @@ -0,0 +1,54 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ +import { OrgGroupRelationshipToOne } from "./OrgGroupRelationshipToOne"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Relationships for adding organizations to an org group. + */ +export class OrgGroupMembershipCreateRelationships { + /** + * Relationship to a single org group. + */ + "orgGroup": OrgGroupRelationshipToOne; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + orgGroup: { + baseName: "org_group", + type: "OrgGroupRelationshipToOne", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return OrgGroupMembershipCreateRelationships.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/OrgGroupMembershipCreateRequest.ts b/packages/datadog-api-client-v2/models/OrgGroupMembershipCreateRequest.ts new file mode 100644 index 000000000000..041c27140717 --- /dev/null +++ b/packages/datadog-api-client-v2/models/OrgGroupMembershipCreateRequest.ts @@ -0,0 +1,54 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ +import { OrgGroupMembershipCreateData } from "./OrgGroupMembershipCreateData"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Request to add organizations to an org group. + */ +export class OrgGroupMembershipCreateRequest { + /** + * Data for adding organizations to an org group. + */ + "data": OrgGroupMembershipCreateData; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "OrgGroupMembershipCreateData", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return OrgGroupMembershipCreateRequest.attributeTypeMap; + } + + public constructor() {} +}