/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging";
import { setContinuationToken } from "../pagingHelper";
import { SyncGroups } from "../operationsInterfaces";
import * as coreClient from "@azure/core-client";
import * as Mappers from "../models/mappers";
import * as Parameters from "../models/parameters";
import { SqlManagementClient } from "../sqlManagementClient";
import {
SimplePollerLike,
OperationState,
createHttpPoller
} from "@azure/core-lro";
import { createLroSpec } from "../lroImpl";
import {
SyncDatabaseIdProperties,
SyncGroupsListSyncDatabaseIdsNextOptionalParams,
SyncGroupsListSyncDatabaseIdsOptionalParams,
SyncGroupsListSyncDatabaseIdsResponse,
SyncFullSchemaProperties,
SyncGroupsListHubSchemasNextOptionalParams,
SyncGroupsListHubSchemasOptionalParams,
SyncGroupsListHubSchemasResponse,
SyncGroupLogProperties,
SyncGroupsListLogsNextOptionalParams,
SyncGroupsType,
SyncGroupsListLogsOptionalParams,
SyncGroupsListLogsResponse,
SyncGroup,
SyncGroupsListByDatabaseNextOptionalParams,
SyncGroupsListByDatabaseOptionalParams,
SyncGroupsListByDatabaseResponse,
SyncGroupsRefreshHubSchemaOptionalParams,
SyncGroupsCancelSyncOptionalParams,
SyncGroupsTriggerSyncOptionalParams,
SyncGroupsGetOptionalParams,
SyncGroupsGetResponse,
SyncGroupsCreateOrUpdateOptionalParams,
SyncGroupsCreateOrUpdateResponse,
SyncGroupsDeleteOptionalParams,
SyncGroupsUpdateOptionalParams,
SyncGroupsUpdateResponse,
SyncGroupsListSyncDatabaseIdsNextResponse,
SyncGroupsListHubSchemasNextResponse,
SyncGroupsListLogsNextResponse,
SyncGroupsListByDatabaseNextResponse
} from "../models";
///
/** Class containing SyncGroups operations. */
export class SyncGroupsImpl implements SyncGroups {
private readonly client: SqlManagementClient;
/**
* Initialize a new instance of the class SyncGroups class.
* @param client Reference to the service client
*/
constructor(client: SqlManagementClient) {
this.client = client;
}
/**
* Gets a collection of sync database ids.
* @param locationName The name of the region where the resource is located.
* @param options The options parameters.
*/
public listSyncDatabaseIds(
locationName: string,
options?: SyncGroupsListSyncDatabaseIdsOptionalParams
): PagedAsyncIterableIterator {
const iter = this.listSyncDatabaseIdsPagingAll(locationName, options);
return {
next() {
return iter.next();
},
[Symbol.asyncIterator]() {
return this;
},
byPage: (settings?: PageSettings) => {
if (settings?.maxPageSize) {
throw new Error("maxPageSize is not supported by this operation.");
}
return this.listSyncDatabaseIdsPagingPage(
locationName,
options,
settings
);
}
};
}
private async *listSyncDatabaseIdsPagingPage(
locationName: string,
options?: SyncGroupsListSyncDatabaseIdsOptionalParams,
settings?: PageSettings
): AsyncIterableIterator {
let result: SyncGroupsListSyncDatabaseIdsResponse;
let continuationToken = settings?.continuationToken;
if (!continuationToken) {
result = await this._listSyncDatabaseIds(locationName, options);
let page = result.value || [];
continuationToken = result.nextLink;
setContinuationToken(page, continuationToken);
yield page;
}
while (continuationToken) {
result = await this._listSyncDatabaseIdsNext(
locationName,
continuationToken,
options
);
continuationToken = result.nextLink;
let page = result.value || [];
setContinuationToken(page, continuationToken);
yield page;
}
}
private async *listSyncDatabaseIdsPagingAll(
locationName: string,
options?: SyncGroupsListSyncDatabaseIdsOptionalParams
): AsyncIterableIterator {
for await (const page of this.listSyncDatabaseIdsPagingPage(
locationName,
options
)) {
yield* page;
}
}
/**
* Gets a collection of hub database schemas.
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain
* this value from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database on which the sync group is hosted.
* @param syncGroupName The name of the sync group.
* @param options The options parameters.
*/
public listHubSchemas(
resourceGroupName: string,
serverName: string,
databaseName: string,
syncGroupName: string,
options?: SyncGroupsListHubSchemasOptionalParams
): PagedAsyncIterableIterator {
const iter = this.listHubSchemasPagingAll(
resourceGroupName,
serverName,
databaseName,
syncGroupName,
options
);
return {
next() {
return iter.next();
},
[Symbol.asyncIterator]() {
return this;
},
byPage: (settings?: PageSettings) => {
if (settings?.maxPageSize) {
throw new Error("maxPageSize is not supported by this operation.");
}
return this.listHubSchemasPagingPage(
resourceGroupName,
serverName,
databaseName,
syncGroupName,
options,
settings
);
}
};
}
private async *listHubSchemasPagingPage(
resourceGroupName: string,
serverName: string,
databaseName: string,
syncGroupName: string,
options?: SyncGroupsListHubSchemasOptionalParams,
settings?: PageSettings
): AsyncIterableIterator {
let result: SyncGroupsListHubSchemasResponse;
let continuationToken = settings?.continuationToken;
if (!continuationToken) {
result = await this._listHubSchemas(
resourceGroupName,
serverName,
databaseName,
syncGroupName,
options
);
let page = result.value || [];
continuationToken = result.nextLink;
setContinuationToken(page, continuationToken);
yield page;
}
while (continuationToken) {
result = await this._listHubSchemasNext(
resourceGroupName,
serverName,
databaseName,
syncGroupName,
continuationToken,
options
);
continuationToken = result.nextLink;
let page = result.value || [];
setContinuationToken(page, continuationToken);
yield page;
}
}
private async *listHubSchemasPagingAll(
resourceGroupName: string,
serverName: string,
databaseName: string,
syncGroupName: string,
options?: SyncGroupsListHubSchemasOptionalParams
): AsyncIterableIterator {
for await (const page of this.listHubSchemasPagingPage(
resourceGroupName,
serverName,
databaseName,
syncGroupName,
options
)) {
yield* page;
}
}
/**
* Gets a collection of sync group logs.
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain
* this value from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database on which the sync group is hosted.
* @param syncGroupName The name of the sync group.
* @param startTime Get logs generated after this time.
* @param endTime Get logs generated before this time.
* @param typeParam The types of logs to retrieve.
* @param options The options parameters.
*/
public listLogs(
resourceGroupName: string,
serverName: string,
databaseName: string,
syncGroupName: string,
startTime: string,
endTime: string,
typeParam: SyncGroupsType,
options?: SyncGroupsListLogsOptionalParams
): PagedAsyncIterableIterator {
const iter = this.listLogsPagingAll(
resourceGroupName,
serverName,
databaseName,
syncGroupName,
startTime,
endTime,
typeParam,
options
);
return {
next() {
return iter.next();
},
[Symbol.asyncIterator]() {
return this;
},
byPage: (settings?: PageSettings) => {
if (settings?.maxPageSize) {
throw new Error("maxPageSize is not supported by this operation.");
}
return this.listLogsPagingPage(
resourceGroupName,
serverName,
databaseName,
syncGroupName,
startTime,
endTime,
typeParam,
options,
settings
);
}
};
}
private async *listLogsPagingPage(
resourceGroupName: string,
serverName: string,
databaseName: string,
syncGroupName: string,
startTime: string,
endTime: string,
typeParam: SyncGroupsType,
options?: SyncGroupsListLogsOptionalParams,
settings?: PageSettings
): AsyncIterableIterator {
let result: SyncGroupsListLogsResponse;
let continuationToken = settings?.continuationToken;
if (!continuationToken) {
result = await this._listLogs(
resourceGroupName,
serverName,
databaseName,
syncGroupName,
startTime,
endTime,
typeParam,
options
);
let page = result.value || [];
continuationToken = result.nextLink;
setContinuationToken(page, continuationToken);
yield page;
}
while (continuationToken) {
result = await this._listLogsNext(
resourceGroupName,
serverName,
databaseName,
syncGroupName,
continuationToken,
options
);
continuationToken = result.nextLink;
let page = result.value || [];
setContinuationToken(page, continuationToken);
yield page;
}
}
private async *listLogsPagingAll(
resourceGroupName: string,
serverName: string,
databaseName: string,
syncGroupName: string,
startTime: string,
endTime: string,
typeParam: SyncGroupsType,
options?: SyncGroupsListLogsOptionalParams
): AsyncIterableIterator {
for await (const page of this.listLogsPagingPage(
resourceGroupName,
serverName,
databaseName,
syncGroupName,
startTime,
endTime,
typeParam,
options
)) {
yield* page;
}
}
/**
* Lists sync groups under a hub database.
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain
* this value from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database on which the sync group is hosted.
* @param options The options parameters.
*/
public listByDatabase(
resourceGroupName: string,
serverName: string,
databaseName: string,
options?: SyncGroupsListByDatabaseOptionalParams
): PagedAsyncIterableIterator {
const iter = this.listByDatabasePagingAll(
resourceGroupName,
serverName,
databaseName,
options
);
return {
next() {
return iter.next();
},
[Symbol.asyncIterator]() {
return this;
},
byPage: (settings?: PageSettings) => {
if (settings?.maxPageSize) {
throw new Error("maxPageSize is not supported by this operation.");
}
return this.listByDatabasePagingPage(
resourceGroupName,
serverName,
databaseName,
options,
settings
);
}
};
}
private async *listByDatabasePagingPage(
resourceGroupName: string,
serverName: string,
databaseName: string,
options?: SyncGroupsListByDatabaseOptionalParams,
settings?: PageSettings
): AsyncIterableIterator {
let result: SyncGroupsListByDatabaseResponse;
let continuationToken = settings?.continuationToken;
if (!continuationToken) {
result = await this._listByDatabase(
resourceGroupName,
serverName,
databaseName,
options
);
let page = result.value || [];
continuationToken = result.nextLink;
setContinuationToken(page, continuationToken);
yield page;
}
while (continuationToken) {
result = await this._listByDatabaseNext(
resourceGroupName,
serverName,
databaseName,
continuationToken,
options
);
continuationToken = result.nextLink;
let page = result.value || [];
setContinuationToken(page, continuationToken);
yield page;
}
}
private async *listByDatabasePagingAll(
resourceGroupName: string,
serverName: string,
databaseName: string,
options?: SyncGroupsListByDatabaseOptionalParams
): AsyncIterableIterator {
for await (const page of this.listByDatabasePagingPage(
resourceGroupName,
serverName,
databaseName,
options
)) {
yield* page;
}
}
/**
* Gets a collection of sync database ids.
* @param locationName The name of the region where the resource is located.
* @param options The options parameters.
*/
private _listSyncDatabaseIds(
locationName: string,
options?: SyncGroupsListSyncDatabaseIdsOptionalParams
): Promise {
return this.client.sendOperationRequest(
{ locationName, options },
listSyncDatabaseIdsOperationSpec
);
}
/**
* Refreshes a hub database schema.
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain
* this value from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database on which the sync group is hosted.
* @param syncGroupName The name of the sync group.
* @param options The options parameters.
*/
async beginRefreshHubSchema(
resourceGroupName: string,
serverName: string,
databaseName: string,
syncGroupName: string,
options?: SyncGroupsRefreshHubSchemaOptionalParams
): Promise, void>> {
const directSendOperation = async (
args: coreClient.OperationArguments,
spec: coreClient.OperationSpec
): Promise => {
return this.client.sendOperationRequest(args, spec);
};
const sendOperationFn = async (
args: coreClient.OperationArguments,
spec: coreClient.OperationSpec
) => {
let currentRawResponse:
| coreClient.FullOperationResponse
| undefined = undefined;
const providedCallback = args.options?.onResponse;
const callback: coreClient.RawResponseCallback = (
rawResponse: coreClient.FullOperationResponse,
flatResponse: unknown
) => {
currentRawResponse = rawResponse;
providedCallback?.(rawResponse, flatResponse);
};
const updatedArgs = {
...args,
options: {
...args.options,
onResponse: callback
}
};
const flatResponse = await directSendOperation(updatedArgs, spec);
return {
flatResponse,
rawResponse: {
statusCode: currentRawResponse!.status,
body: currentRawResponse!.parsedBody,
headers: currentRawResponse!.headers.toJSON()
}
};
};
const lro = createLroSpec({
sendOperationFn,
args: {
resourceGroupName,
serverName,
databaseName,
syncGroupName,
options
},
spec: refreshHubSchemaOperationSpec
});
const poller = await createHttpPoller>(lro, {
restoreFrom: options?.resumeFrom,
intervalInMs: options?.updateIntervalInMs
});
await poller.poll();
return poller;
}
/**
* Refreshes a hub database schema.
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain
* this value from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database on which the sync group is hosted.
* @param syncGroupName The name of the sync group.
* @param options The options parameters.
*/
async beginRefreshHubSchemaAndWait(
resourceGroupName: string,
serverName: string,
databaseName: string,
syncGroupName: string,
options?: SyncGroupsRefreshHubSchemaOptionalParams
): Promise {
const poller = await this.beginRefreshHubSchema(
resourceGroupName,
serverName,
databaseName,
syncGroupName,
options
);
return poller.pollUntilDone();
}
/**
* Gets a collection of hub database schemas.
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain
* this value from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database on which the sync group is hosted.
* @param syncGroupName The name of the sync group.
* @param options The options parameters.
*/
private _listHubSchemas(
resourceGroupName: string,
serverName: string,
databaseName: string,
syncGroupName: string,
options?: SyncGroupsListHubSchemasOptionalParams
): Promise {
return this.client.sendOperationRequest(
{ resourceGroupName, serverName, databaseName, syncGroupName, options },
listHubSchemasOperationSpec
);
}
/**
* Gets a collection of sync group logs.
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain
* this value from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database on which the sync group is hosted.
* @param syncGroupName The name of the sync group.
* @param startTime Get logs generated after this time.
* @param endTime Get logs generated before this time.
* @param typeParam The types of logs to retrieve.
* @param options The options parameters.
*/
private _listLogs(
resourceGroupName: string,
serverName: string,
databaseName: string,
syncGroupName: string,
startTime: string,
endTime: string,
typeParam: SyncGroupsType,
options?: SyncGroupsListLogsOptionalParams
): Promise {
return this.client.sendOperationRequest(
{
resourceGroupName,
serverName,
databaseName,
syncGroupName,
startTime,
endTime,
typeParam,
options
},
listLogsOperationSpec
);
}
/**
* Cancels a sync group synchronization.
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain
* this value from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database on which the sync group is hosted.
* @param syncGroupName The name of the sync group.
* @param options The options parameters.
*/
cancelSync(
resourceGroupName: string,
serverName: string,
databaseName: string,
syncGroupName: string,
options?: SyncGroupsCancelSyncOptionalParams
): Promise {
return this.client.sendOperationRequest(
{ resourceGroupName, serverName, databaseName, syncGroupName, options },
cancelSyncOperationSpec
);
}
/**
* Triggers a sync group synchronization.
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain
* this value from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database on which the sync group is hosted.
* @param syncGroupName The name of the sync group.
* @param options The options parameters.
*/
triggerSync(
resourceGroupName: string,
serverName: string,
databaseName: string,
syncGroupName: string,
options?: SyncGroupsTriggerSyncOptionalParams
): Promise {
return this.client.sendOperationRequest(
{ resourceGroupName, serverName, databaseName, syncGroupName, options },
triggerSyncOperationSpec
);
}
/**
* Gets a sync group.
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain
* this value from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database on which the sync group is hosted.
* @param syncGroupName The name of the sync group.
* @param options The options parameters.
*/
get(
resourceGroupName: string,
serverName: string,
databaseName: string,
syncGroupName: string,
options?: SyncGroupsGetOptionalParams
): Promise {
return this.client.sendOperationRequest(
{ resourceGroupName, serverName, databaseName, syncGroupName, options },
getOperationSpec
);
}
/**
* Creates or updates a sync group.
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain
* this value from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database on which the sync group is hosted.
* @param syncGroupName The name of the sync group.
* @param parameters The requested sync group resource state.
* @param options The options parameters.
*/
async beginCreateOrUpdate(
resourceGroupName: string,
serverName: string,
databaseName: string,
syncGroupName: string,
parameters: SyncGroup,
options?: SyncGroupsCreateOrUpdateOptionalParams
): Promise<
SimplePollerLike<
OperationState,
SyncGroupsCreateOrUpdateResponse
>
> {
const directSendOperation = async (
args: coreClient.OperationArguments,
spec: coreClient.OperationSpec
): Promise => {
return this.client.sendOperationRequest(args, spec);
};
const sendOperationFn = async (
args: coreClient.OperationArguments,
spec: coreClient.OperationSpec
) => {
let currentRawResponse:
| coreClient.FullOperationResponse
| undefined = undefined;
const providedCallback = args.options?.onResponse;
const callback: coreClient.RawResponseCallback = (
rawResponse: coreClient.FullOperationResponse,
flatResponse: unknown
) => {
currentRawResponse = rawResponse;
providedCallback?.(rawResponse, flatResponse);
};
const updatedArgs = {
...args,
options: {
...args.options,
onResponse: callback
}
};
const flatResponse = await directSendOperation(updatedArgs, spec);
return {
flatResponse,
rawResponse: {
statusCode: currentRawResponse!.status,
body: currentRawResponse!.parsedBody,
headers: currentRawResponse!.headers.toJSON()
}
};
};
const lro = createLroSpec({
sendOperationFn,
args: {
resourceGroupName,
serverName,
databaseName,
syncGroupName,
parameters,
options
},
spec: createOrUpdateOperationSpec
});
const poller = await createHttpPoller<
SyncGroupsCreateOrUpdateResponse,
OperationState
>(lro, {
restoreFrom: options?.resumeFrom,
intervalInMs: options?.updateIntervalInMs
});
await poller.poll();
return poller;
}
/**
* Creates or updates a sync group.
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain
* this value from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database on which the sync group is hosted.
* @param syncGroupName The name of the sync group.
* @param parameters The requested sync group resource state.
* @param options The options parameters.
*/
async beginCreateOrUpdateAndWait(
resourceGroupName: string,
serverName: string,
databaseName: string,
syncGroupName: string,
parameters: SyncGroup,
options?: SyncGroupsCreateOrUpdateOptionalParams
): Promise {
const poller = await this.beginCreateOrUpdate(
resourceGroupName,
serverName,
databaseName,
syncGroupName,
parameters,
options
);
return poller.pollUntilDone();
}
/**
* Deletes a sync group.
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain
* this value from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database on which the sync group is hosted.
* @param syncGroupName The name of the sync group.
* @param options The options parameters.
*/
async beginDelete(
resourceGroupName: string,
serverName: string,
databaseName: string,
syncGroupName: string,
options?: SyncGroupsDeleteOptionalParams
): Promise, void>> {
const directSendOperation = async (
args: coreClient.OperationArguments,
spec: coreClient.OperationSpec
): Promise => {
return this.client.sendOperationRequest(args, spec);
};
const sendOperationFn = async (
args: coreClient.OperationArguments,
spec: coreClient.OperationSpec
) => {
let currentRawResponse:
| coreClient.FullOperationResponse
| undefined = undefined;
const providedCallback = args.options?.onResponse;
const callback: coreClient.RawResponseCallback = (
rawResponse: coreClient.FullOperationResponse,
flatResponse: unknown
) => {
currentRawResponse = rawResponse;
providedCallback?.(rawResponse, flatResponse);
};
const updatedArgs = {
...args,
options: {
...args.options,
onResponse: callback
}
};
const flatResponse = await directSendOperation(updatedArgs, spec);
return {
flatResponse,
rawResponse: {
statusCode: currentRawResponse!.status,
body: currentRawResponse!.parsedBody,
headers: currentRawResponse!.headers.toJSON()
}
};
};
const lro = createLroSpec({
sendOperationFn,
args: {
resourceGroupName,
serverName,
databaseName,
syncGroupName,
options
},
spec: deleteOperationSpec
});
const poller = await createHttpPoller>(lro, {
restoreFrom: options?.resumeFrom,
intervalInMs: options?.updateIntervalInMs
});
await poller.poll();
return poller;
}
/**
* Deletes a sync group.
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain
* this value from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database on which the sync group is hosted.
* @param syncGroupName The name of the sync group.
* @param options The options parameters.
*/
async beginDeleteAndWait(
resourceGroupName: string,
serverName: string,
databaseName: string,
syncGroupName: string,
options?: SyncGroupsDeleteOptionalParams
): Promise {
const poller = await this.beginDelete(
resourceGroupName,
serverName,
databaseName,
syncGroupName,
options
);
return poller.pollUntilDone();
}
/**
* Updates a sync group.
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain
* this value from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database on which the sync group is hosted.
* @param syncGroupName The name of the sync group.
* @param parameters The requested sync group resource state.
* @param options The options parameters.
*/
async beginUpdate(
resourceGroupName: string,
serverName: string,
databaseName: string,
syncGroupName: string,
parameters: SyncGroup,
options?: SyncGroupsUpdateOptionalParams
): Promise<
SimplePollerLike<
OperationState,
SyncGroupsUpdateResponse
>
> {
const directSendOperation = async (
args: coreClient.OperationArguments,
spec: coreClient.OperationSpec
): Promise => {
return this.client.sendOperationRequest(args, spec);
};
const sendOperationFn = async (
args: coreClient.OperationArguments,
spec: coreClient.OperationSpec
) => {
let currentRawResponse:
| coreClient.FullOperationResponse
| undefined = undefined;
const providedCallback = args.options?.onResponse;
const callback: coreClient.RawResponseCallback = (
rawResponse: coreClient.FullOperationResponse,
flatResponse: unknown
) => {
currentRawResponse = rawResponse;
providedCallback?.(rawResponse, flatResponse);
};
const updatedArgs = {
...args,
options: {
...args.options,
onResponse: callback
}
};
const flatResponse = await directSendOperation(updatedArgs, spec);
return {
flatResponse,
rawResponse: {
statusCode: currentRawResponse!.status,
body: currentRawResponse!.parsedBody,
headers: currentRawResponse!.headers.toJSON()
}
};
};
const lro = createLroSpec({
sendOperationFn,
args: {
resourceGroupName,
serverName,
databaseName,
syncGroupName,
parameters,
options
},
spec: updateOperationSpec
});
const poller = await createHttpPoller<
SyncGroupsUpdateResponse,
OperationState
>(lro, {
restoreFrom: options?.resumeFrom,
intervalInMs: options?.updateIntervalInMs
});
await poller.poll();
return poller;
}
/**
* Updates a sync group.
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain
* this value from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database on which the sync group is hosted.
* @param syncGroupName The name of the sync group.
* @param parameters The requested sync group resource state.
* @param options The options parameters.
*/
async beginUpdateAndWait(
resourceGroupName: string,
serverName: string,
databaseName: string,
syncGroupName: string,
parameters: SyncGroup,
options?: SyncGroupsUpdateOptionalParams
): Promise {
const poller = await this.beginUpdate(
resourceGroupName,
serverName,
databaseName,
syncGroupName,
parameters,
options
);
return poller.pollUntilDone();
}
/**
* Lists sync groups under a hub database.
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain
* this value from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database on which the sync group is hosted.
* @param options The options parameters.
*/
private _listByDatabase(
resourceGroupName: string,
serverName: string,
databaseName: string,
options?: SyncGroupsListByDatabaseOptionalParams
): Promise {
return this.client.sendOperationRequest(
{ resourceGroupName, serverName, databaseName, options },
listByDatabaseOperationSpec
);
}
/**
* ListSyncDatabaseIdsNext
* @param locationName The name of the region where the resource is located.
* @param nextLink The nextLink from the previous successful call to the ListSyncDatabaseIds method.
* @param options The options parameters.
*/
private _listSyncDatabaseIdsNext(
locationName: string,
nextLink: string,
options?: SyncGroupsListSyncDatabaseIdsNextOptionalParams
): Promise {
return this.client.sendOperationRequest(
{ locationName, nextLink, options },
listSyncDatabaseIdsNextOperationSpec
);
}
/**
* ListHubSchemasNext
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain
* this value from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database on which the sync group is hosted.
* @param syncGroupName The name of the sync group.
* @param nextLink The nextLink from the previous successful call to the ListHubSchemas method.
* @param options The options parameters.
*/
private _listHubSchemasNext(
resourceGroupName: string,
serverName: string,
databaseName: string,
syncGroupName: string,
nextLink: string,
options?: SyncGroupsListHubSchemasNextOptionalParams
): Promise {
return this.client.sendOperationRequest(
{
resourceGroupName,
serverName,
databaseName,
syncGroupName,
nextLink,
options
},
listHubSchemasNextOperationSpec
);
}
/**
* ListLogsNext
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain
* this value from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database on which the sync group is hosted.
* @param syncGroupName The name of the sync group.
* @param nextLink The nextLink from the previous successful call to the ListLogs method.
* @param options The options parameters.
*/
private _listLogsNext(
resourceGroupName: string,
serverName: string,
databaseName: string,
syncGroupName: string,
nextLink: string,
options?: SyncGroupsListLogsNextOptionalParams
): Promise {
return this.client.sendOperationRequest(
{
resourceGroupName,
serverName,
databaseName,
syncGroupName,
nextLink,
options
},
listLogsNextOperationSpec
);
}
/**
* ListByDatabaseNext
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain
* this value from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param databaseName The name of the database on which the sync group is hosted.
* @param nextLink The nextLink from the previous successful call to the ListByDatabase method.
* @param options The options parameters.
*/
private _listByDatabaseNext(
resourceGroupName: string,
serverName: string,
databaseName: string,
nextLink: string,
options?: SyncGroupsListByDatabaseNextOptionalParams
): Promise {
return this.client.sendOperationRequest(
{ resourceGroupName, serverName, databaseName, nextLink, options },
listByDatabaseNextOperationSpec
);
}
}
// Operation Specifications
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
const listSyncDatabaseIdsOperationSpec: coreClient.OperationSpec = {
path:
"/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/syncDatabaseIds",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.SyncDatabaseIdListResult
},
default: {}
},
queryParameters: [Parameters.apiVersion3],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.locationName
],
headerParameters: [Parameters.accept],
serializer
};
const refreshHubSchemaOperationSpec: coreClient.OperationSpec = {
path:
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/refreshHubSchema",
httpMethod: "POST",
responses: { 200: {}, 201: {}, 202: {}, 204: {}, default: {} },
queryParameters: [Parameters.apiVersion3],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.serverName,
Parameters.databaseName,
Parameters.syncGroupName
],
serializer
};
const listHubSchemasOperationSpec: coreClient.OperationSpec = {
path:
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/hubSchemas",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.SyncFullSchemaPropertiesListResult
},
default: {}
},
queryParameters: [Parameters.apiVersion3],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.serverName,
Parameters.databaseName,
Parameters.syncGroupName
],
headerParameters: [Parameters.accept],
serializer
};
const listLogsOperationSpec: coreClient.OperationSpec = {
path:
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/logs",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.SyncGroupLogListResult
},
default: {}
},
queryParameters: [
Parameters.apiVersion3,
Parameters.startTime1,
Parameters.endTime1,
Parameters.typeParam,
Parameters.continuationToken
],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.serverName,
Parameters.databaseName,
Parameters.syncGroupName
],
headerParameters: [Parameters.accept],
serializer
};
const cancelSyncOperationSpec: coreClient.OperationSpec = {
path:
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/cancelSync",
httpMethod: "POST",
responses: { 200: {}, default: {} },
queryParameters: [Parameters.apiVersion3],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.serverName,
Parameters.databaseName,
Parameters.syncGroupName
],
serializer
};
const triggerSyncOperationSpec: coreClient.OperationSpec = {
path:
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/triggerSync",
httpMethod: "POST",
responses: { 200: {}, default: {} },
queryParameters: [Parameters.apiVersion3],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.serverName,
Parameters.databaseName,
Parameters.syncGroupName
],
serializer
};
const getOperationSpec: coreClient.OperationSpec = {
path:
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.SyncGroup
},
default: {}
},
queryParameters: [Parameters.apiVersion3],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.serverName,
Parameters.databaseName,
Parameters.syncGroupName
],
headerParameters: [Parameters.accept],
serializer
};
const createOrUpdateOperationSpec: coreClient.OperationSpec = {
path:
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}",
httpMethod: "PUT",
responses: {
200: {
bodyMapper: Mappers.SyncGroup
},
201: {
bodyMapper: Mappers.SyncGroup
},
202: {
bodyMapper: Mappers.SyncGroup
},
204: {
bodyMapper: Mappers.SyncGroup
},
default: {}
},
requestBody: Parameters.parameters57,
queryParameters: [Parameters.apiVersion3],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.serverName,
Parameters.databaseName,
Parameters.syncGroupName
],
headerParameters: [Parameters.contentType, Parameters.accept],
mediaType: "json",
serializer
};
const deleteOperationSpec: coreClient.OperationSpec = {
path:
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}",
httpMethod: "DELETE",
responses: { 200: {}, 201: {}, 202: {}, 204: {}, default: {} },
queryParameters: [Parameters.apiVersion3],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.serverName,
Parameters.databaseName,
Parameters.syncGroupName
],
serializer
};
const updateOperationSpec: coreClient.OperationSpec = {
path:
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}",
httpMethod: "PATCH",
responses: {
200: {
bodyMapper: Mappers.SyncGroup
},
201: {
bodyMapper: Mappers.SyncGroup
},
202: {
bodyMapper: Mappers.SyncGroup
},
204: {
bodyMapper: Mappers.SyncGroup
},
default: {}
},
requestBody: Parameters.parameters57,
queryParameters: [Parameters.apiVersion3],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.serverName,
Parameters.databaseName,
Parameters.syncGroupName
],
headerParameters: [Parameters.contentType, Parameters.accept],
mediaType: "json",
serializer
};
const listByDatabaseOperationSpec: coreClient.OperationSpec = {
path:
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.SyncGroupListResult
},
default: {}
},
queryParameters: [Parameters.apiVersion3],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.serverName,
Parameters.databaseName
],
headerParameters: [Parameters.accept],
serializer
};
const listSyncDatabaseIdsNextOperationSpec: coreClient.OperationSpec = {
path: "{nextLink}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.SyncDatabaseIdListResult
},
default: {}
},
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.nextLink,
Parameters.locationName
],
headerParameters: [Parameters.accept],
serializer
};
const listHubSchemasNextOperationSpec: coreClient.OperationSpec = {
path: "{nextLink}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.SyncFullSchemaPropertiesListResult
},
default: {}
},
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.serverName,
Parameters.databaseName,
Parameters.nextLink,
Parameters.syncGroupName
],
headerParameters: [Parameters.accept],
serializer
};
const listLogsNextOperationSpec: coreClient.OperationSpec = {
path: "{nextLink}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.SyncGroupLogListResult
},
default: {}
},
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.serverName,
Parameters.databaseName,
Parameters.nextLink,
Parameters.syncGroupName
],
headerParameters: [Parameters.accept],
serializer
};
const listByDatabaseNextOperationSpec: coreClient.OperationSpec = {
path: "{nextLink}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.SyncGroupListResult
},
default: {}
},
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.serverName,
Parameters.databaseName,
Parameters.nextLink
],
headerParameters: [Parameters.accept],
serializer
};