mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2024-11-25 15:06:55 +00:00
Fix enable synapse link error (#918)
* Fix enable synapse error * Default all ARM requests to JSON Co-authored-by: Steve Faulkner <southpolesteve@gmail.com>
This commit is contained in:
parent
b65456f754
commit
ee4404c439
@ -29,7 +29,13 @@ export async function update(
|
|||||||
body: Types.DatabaseAccountUpdateParameters
|
body: Types.DatabaseAccountUpdateParameters
|
||||||
): Promise<Types.DatabaseAccountGetResults> {
|
): Promise<Types.DatabaseAccountGetResults> {
|
||||||
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}`;
|
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}`;
|
||||||
return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "PATCH", apiVersion, body });
|
return armRequest({
|
||||||
|
host: configContext.ARM_ENDPOINT,
|
||||||
|
path,
|
||||||
|
method: "PATCH",
|
||||||
|
apiVersion,
|
||||||
|
body,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when performing updates on an account. */
|
/* Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when performing updates on an account. */
|
||||||
|
@ -6,6 +6,7 @@ Instead, generate ARM clients that consume this function with stricter typing.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import promiseRetry, { AbortError } from "p-retry";
|
import promiseRetry, { AbortError } from "p-retry";
|
||||||
|
import { HttpHeaders } from "../../Common/Constants";
|
||||||
import { configContext } from "../../ConfigContext";
|
import { configContext } from "../../ConfigContext";
|
||||||
import { userContext } from "../../UserContext";
|
import { userContext } from "../../UserContext";
|
||||||
|
|
||||||
@ -45,6 +46,7 @@ interface Options {
|
|||||||
method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD";
|
method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD";
|
||||||
body?: unknown;
|
body?: unknown;
|
||||||
queryParams?: ARMQueryParams;
|
queryParams?: ARMQueryParams;
|
||||||
|
contentType?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function armRequestWithoutPolling<T>({
|
export async function armRequestWithoutPolling<T>({
|
||||||
@ -54,6 +56,7 @@ export async function armRequestWithoutPolling<T>({
|
|||||||
method,
|
method,
|
||||||
body: requestBody,
|
body: requestBody,
|
||||||
queryParams,
|
queryParams,
|
||||||
|
contentType,
|
||||||
}: Options): Promise<{ result: T; operationStatusUrl: string }> {
|
}: Options): Promise<{ result: T; operationStatusUrl: string }> {
|
||||||
const url = new URL(path, host);
|
const url = new URL(path, host);
|
||||||
url.searchParams.append("api-version", configContext.armAPIVersion || apiVersion);
|
url.searchParams.append("api-version", configContext.armAPIVersion || apiVersion);
|
||||||
@ -70,6 +73,7 @@ export async function armRequestWithoutPolling<T>({
|
|||||||
method,
|
method,
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: userContext.authorizationToken,
|
Authorization: userContext.authorizationToken,
|
||||||
|
[HttpHeaders.contentType]: contentType || "application/json",
|
||||||
},
|
},
|
||||||
body: requestBody ? JSON.stringify(requestBody) : undefined,
|
body: requestBody ? JSON.stringify(requestBody) : undefined,
|
||||||
});
|
});
|
||||||
@ -104,6 +108,7 @@ export async function armRequest<T>({
|
|||||||
method,
|
method,
|
||||||
body: requestBody,
|
body: requestBody,
|
||||||
queryParams,
|
queryParams,
|
||||||
|
contentType,
|
||||||
}: Options): Promise<T> {
|
}: Options): Promise<T> {
|
||||||
const armRequestResult = await armRequestWithoutPolling<T>({
|
const armRequestResult = await armRequestWithoutPolling<T>({
|
||||||
host,
|
host,
|
||||||
@ -112,6 +117,7 @@ export async function armRequest<T>({
|
|||||||
method,
|
method,
|
||||||
body: requestBody,
|
body: requestBody,
|
||||||
queryParams,
|
queryParams,
|
||||||
|
contentType,
|
||||||
});
|
});
|
||||||
const operationStatusUrl = armRequestResult.operationStatusUrl;
|
const operationStatusUrl = armRequestResult.operationStatusUrl;
|
||||||
if (operationStatusUrl) {
|
if (operationStatusUrl) {
|
||||||
|
Loading…
Reference in New Issue
Block a user