export type AWSConfig = {arn: string}; export type GCPConfig = {resourceName: string}; export type AzureConfig = {keyLocation: string, region: string}; export type RotateCMEKKey = {config: AWSConfig | GCPConfig | AzureConfig}; export type UpdateApiV4OrganizationsOrganizationIdCmekCmekIdArgs = {body: RotateCMEKKey}; export type UpdateApiV4OrganizationsOrganizationIdCmekCmekIdOptions = {baseUrl?: string | undefined, token?: string | undefined, fetch?: typeof fetch | undefined}; /** * Rotate Key * * PUT /v4/organizations/{organizationId}/cmek/{cmekId} */ export const updateApiV4OrganizationsOrganizationIdCmekCmekId = async (args: UpdateApiV4OrganizationsOrganizationIdCmekCmekIdArgs, options?: UpdateApiV4OrganizationsOrganizationIdCmekCmekIdOptions) => { const {baseUrl = "https://cloudapi.cloud.couchbase.com", fetch: fetchFn = fetch, token} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (token !== undefined) headers.set('authorization', `Bearer ${token}`) const url = `${baseUrl.replace(/\/+$/, '')}/v4/organizations/${encodeURIComponent(String(args.organizationId))}/cmek/${encodeURIComponent(String(args.cmekId))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", 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 };