export type CloudAccountsAwsOrganisationalUnit = {child_id: string, child_name: string, parent_id?: string | undefined}; export type CloudAccountsAwsOrganisationalUnitRequest = {mgmtAccountId: string, structure: Array}; export type CreateApiV1CloudAwsControlTowerCreateOrgStructureArgs = {body: CloudAccountsAwsOrganisationalUnitRequest}; export type CreateApiV1CloudAwsControlTowerCreateOrgStructureOptions = {baseUrl?: string | undefined, BearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Create Organizational Structure * * POST /v1/cloud/aws/controlTower/createOrgStructure */ export const createApiV1CloudAwsControlTowerCreateOrgStructure = async (args: CreateApiV1CloudAwsControlTowerCreateOrgStructureArgs, options?: CreateApiV1CloudAwsControlTowerCreateOrgStructureOptions) => { const {baseUrl = "https://api.na-01.cloud.solarwinds.com", fetch: fetchFn = fetch, BearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (BearerAuth !== undefined) headers.set('authorization', `Bearer ${BearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/cloud/aws/controlTower/createOrgStructure${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 };