export type GlobalOrgIdentifier = {org_site: string, org_uuid: string}; export type OrgGroupMembershipCreateAttributes = {orgs: Array}; export type OrgGroupType = 'org_groups'; export type OrgGroupRelationshipToOneData = {id: string, type: OrgGroupType}; export type OrgGroupRelationshipToOne = {data: OrgGroupRelationshipToOneData}; export type OrgGroupMembershipCreateRelationships = {org_group: OrgGroupRelationshipToOne}; export type OrgGroupMembershipType = 'org_group_memberships'; export type OrgGroupMembershipCreateData = {attributes: OrgGroupMembershipCreateAttributes, relationships: OrgGroupMembershipCreateRelationships, type: OrgGroupMembershipType}; export type OrgGroupMembershipCreateRequest = {data: OrgGroupMembershipCreateData}; export type CreateApiApiV2OrgGroupMembershipsArgs = {body: OrgGroupMembershipCreateRequest}; export type CreateApiApiV2OrgGroupMembershipsOptions = {baseUrl?: string | undefined, apiKeyAuth?: string | undefined, appKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Create org group memberships * * POST /api/v2/org_group_memberships * * Also accepts auth: AuthZ */ export const createApiApiV2OrgGroupMemberships = async (args: CreateApiApiV2OrgGroupMembershipsArgs, options?: CreateApiApiV2OrgGroupMembershipsOptions) => { const {baseUrl = "https://api.datadoghq.com", fetch: fetchFn = fetch, apiKeyAuth, appKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (apiKeyAuth !== undefined) headers.set("DD-API-KEY", apiKeyAuth) if (appKeyAuth !== undefined) headers.set("DD-APPLICATION-KEY", appKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/api/v2/org_group_memberships${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };