export type AzureConfig = {keyLocation: string, region: string}; export type RotateAzureKey = {config: AzureConfig}; export type UpdateApiV4OrganizationsOrganizationIdProjectsProjectIdCmekCmekIdArgs = {body: RotateAzureKey}; export type UpdateApiV4OrganizationsOrganizationIdProjectsProjectIdCmekCmekIdOptions = {baseUrl?: string | undefined, token?: string | undefined, fetch?: typeof fetch | undefined}; /** * Rotate Azure Key For Project * * PUT /v4/organizations/{organizationId}/projects/{projectId}/cmek/{cmekId} */ export const updateApiV4OrganizationsOrganizationIdProjectsProjectIdCmekCmekId = async (args: UpdateApiV4OrganizationsOrganizationIdProjectsProjectIdCmekCmekIdArgs, options?: UpdateApiV4OrganizationsOrganizationIdProjectsProjectIdCmekCmekIdOptions) => { 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))}/projects/${encodeURIComponent(String(args.projectId))}/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 };