Skip to content

Commit

Permalink
CodeGen from PR 14406 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Merge 6002e63ec968096b0ba7c3b54242dec5f0057700 into 7d4caa5e1c9996a25300b0b23ef426667e4a7bde
  • Loading branch information
SDKAuto committed May 13, 2021
1 parent 044d139 commit c0cae71
Show file tree
Hide file tree
Showing 40 changed files with 3,596 additions and 12,726 deletions.
133 changes: 2 additions & 131 deletions sdk/cosmosdb/arm-cosmosdb/src/cosmosDBManagementClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
import * as msRest from "@azure/ms-rest-js";
import * as Models from "./models";
import * as Mappers from "./models/mappers";
import * as Parameters from "./models/parameters";
import * as operations from "./operations";
import { CosmosDBManagementClientContext } from "./cosmosDBManagementClientContext";


class CosmosDBManagementClient extends CosmosDBManagementClientContext {
// Operation groups
databaseAccounts: operations.DatabaseAccounts;
Expand All @@ -34,31 +34,17 @@ class CosmosDBManagementClient extends CosmosDBManagementClientContext {
tableResources: operations.TableResources;
cassandraResources: operations.CassandraResources;
gremlinResources: operations.GremlinResources;
restorableDatabaseAccounts: operations.RestorableDatabaseAccounts;
notebookWorkspaces: operations.NotebookWorkspaces;
restorableSqlDatabases: operations.RestorableSqlDatabases;
restorableSqlContainers: operations.RestorableSqlContainers;
restorableSqlResources: operations.RestorableSqlResources;
restorableMongodbDatabases: operations.RestorableMongodbDatabases;
restorableMongodbCollections: operations.RestorableMongodbCollections;
restorableMongodbResources: operations.RestorableMongodbResources;
cassandraClusters: operations.CassandraClusters;
cassandraDataCenters: operations.CassandraDataCenters;
privateLinkResources: operations.PrivateLinkResources;
privateEndpointConnections: operations.PrivateEndpointConnections;
service: operations.Service;

/**
* Initializes a new instance of the CosmosDBManagementClient class.
* @param credentials Credentials needed for the client to connect to Azure.
* @param subscriptionId The ID of the target subscription.
* @param [options] The parameter options
*/
constructor(
credentials: msRest.ServiceClientCredentials,
subscriptionId: string,
options?: Models.CosmosDBManagementClientOptions
) {
constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.CosmosDBManagementClientOptions) {
super(credentials, subscriptionId, options);
this.databaseAccounts = new operations.DatabaseAccounts(this);
this.operations = new operations.Operations(this);
Expand All @@ -78,128 +64,13 @@ class CosmosDBManagementClient extends CosmosDBManagementClientContext {
this.tableResources = new operations.TableResources(this);
this.cassandraResources = new operations.CassandraResources(this);
this.gremlinResources = new operations.GremlinResources(this);
this.restorableDatabaseAccounts = new operations.RestorableDatabaseAccounts(this);
this.notebookWorkspaces = new operations.NotebookWorkspaces(this);
this.restorableSqlDatabases = new operations.RestorableSqlDatabases(this);
this.restorableSqlContainers = new operations.RestorableSqlContainers(this);
this.restorableSqlResources = new operations.RestorableSqlResources(this);
this.restorableMongodbDatabases = new operations.RestorableMongodbDatabases(this);
this.restorableMongodbCollections = new operations.RestorableMongodbCollections(this);
this.restorableMongodbResources = new operations.RestorableMongodbResources(this);
this.cassandraClusters = new operations.CassandraClusters(this);
this.cassandraDataCenters = new operations.CassandraDataCenters(this);
this.privateLinkResources = new operations.PrivateLinkResources(this);
this.privateEndpointConnections = new operations.PrivateEndpointConnections(this);
this.service = new operations.Service(this);
}

/**
* List Cosmos DB locations and their properties
* @param [options] The optional parameters
* @returns Promise<Models.LocationListResponse>
*/
locationList(options?: msRest.RequestOptionsBase): Promise<Models.LocationListResponse>;
/**
* @param callback The callback
*/
locationList(callback: msRest.ServiceCallback<Models.LocationListResult>): void;
/**
* @param options The optional parameters
* @param callback The callback
*/
locationList(
options: msRest.RequestOptionsBase,
callback: msRest.ServiceCallback<Models.LocationListResult>
): void;
locationList(
options?: msRest.RequestOptionsBase | msRest.ServiceCallback<Models.LocationListResult>,
callback?: msRest.ServiceCallback<Models.LocationListResult>
): Promise<Models.LocationListResponse> {
return this.sendOperationRequest(
{
options
},
locationListOperationSpec,
callback
) as Promise<Models.LocationListResponse>;
}

/**
* Get the properties of an existing Cosmos DB location
* @param location Cosmos DB region, with spaces between words and each word capitalized.
* @param [options] The optional parameters
* @returns Promise<Models.LocationGetResponse>
*/
locationGet(
location: string,
options?: msRest.RequestOptionsBase
): Promise<Models.LocationGetResponse>;
/**
* @param location Cosmos DB region, with spaces between words and each word capitalized.
* @param callback The callback
*/
locationGet(location: string, callback: msRest.ServiceCallback<Models.LocationGetResult>): void;
/**
* @param location Cosmos DB region, with spaces between words and each word capitalized.
* @param options The optional parameters
* @param callback The callback
*/
locationGet(
location: string,
options: msRest.RequestOptionsBase,
callback: msRest.ServiceCallback<Models.LocationGetResult>
): void;
locationGet(
location: string,
options?: msRest.RequestOptionsBase | msRest.ServiceCallback<Models.LocationGetResult>,
callback?: msRest.ServiceCallback<Models.LocationGetResult>
): Promise<Models.LocationGetResponse> {
return this.sendOperationRequest(
{
location,
options
},
locationGetOperationSpec,
callback
) as Promise<Models.LocationGetResponse>;
}
}

// Operation Specifications
const serializer = new msRest.Serializer(Mappers);
const locationListOperationSpec: msRest.OperationSpec = {
httpMethod: "GET",
path: "subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations",
urlParameters: [Parameters.subscriptionId],
queryParameters: [Parameters.apiVersion],
headerParameters: [Parameters.acceptLanguage],
responses: {
200: {
bodyMapper: Mappers.LocationListResult
},
default: {
bodyMapper: Mappers.CloudError
}
},
serializer
};

const locationGetOperationSpec: msRest.OperationSpec = {
httpMethod: "GET",
path: "subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}",
urlParameters: [Parameters.subscriptionId, Parameters.location],
queryParameters: [Parameters.apiVersion],
headerParameters: [Parameters.acceptLanguage],
responses: {
200: {
bodyMapper: Mappers.LocationGetResult
},
default: {
bodyMapper: Mappers.CloudError
}
},
serializer
};

export {
CosmosDBManagementClient,
Expand Down
23 changes: 8 additions & 15 deletions sdk/cosmosdb/arm-cosmosdb/src/cosmosDBManagementClientContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,43 +25,36 @@ export class CosmosDBManagementClientContext extends msRestAzure.AzureServiceCli
* @param subscriptionId The ID of the target subscription.
* @param [options] The parameter options
*/
constructor(
credentials: msRest.ServiceClientCredentials,
subscriptionId: string,
options?: Models.CosmosDBManagementClientOptions
) {
constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.CosmosDBManagementClientOptions) {
if (credentials == undefined) {
throw new Error("'credentials' cannot be null.");
throw new Error('\'credentials\' cannot be null.');
}
if (subscriptionId == undefined) {
throw new Error("'subscriptionId' cannot be null.");
throw new Error('\'subscriptionId\' cannot be null.');
}

if (!options) {
options = {};
}
if (!options.userAgent) {
if(!options.userAgent) {
const defaultUserAgent = msRestAzure.getDefaultUserAgentValue();
options.userAgent = `${packageName}/${packageVersion} ${defaultUserAgent}`;
}

super(credentials, options);

this.apiVersion = "2021-04-01-preview";
this.acceptLanguage = "en-US";
this.apiVersion = '2021-04-15';
this.acceptLanguage = 'en-US';
this.longRunningOperationRetryTimeout = 30;
this.baseUri = options.baseUri || this.baseUri || "https://management.azure.com";
this.requestContentType = "application/json; charset=utf-8";
this.credentials = credentials;
this.subscriptionId = subscriptionId;

if (options.acceptLanguage !== null && options.acceptLanguage !== undefined) {
if(options.acceptLanguage !== null && options.acceptLanguage !== undefined) {
this.acceptLanguage = options.acceptLanguage;
}
if (
options.longRunningOperationRetryTimeout !== null &&
options.longRunningOperationRetryTimeout !== undefined
) {
if(options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) {
this.longRunningOperationRetryTimeout = options.longRunningOperationRetryTimeout;
}
}
Expand Down
157 changes: 0 additions & 157 deletions sdk/cosmosdb/arm-cosmosdb/src/models/cassandraClustersMappers.ts

This file was deleted.

Loading

0 comments on commit c0cae71

Please sign in to comment.