From 6174e3c48154bd8b405b8f9bd702fabca4a0bdd7 Mon Sep 17 00:00:00 2001 From: Jose Manuel Heredia Hidalgo Date: Tue, 12 May 2020 13:22:53 -0700 Subject: [PATCH] [v6] Refactor parent and additionalProperties processing (#642) * Refactor parent and additionalProperties processing * don't destructure additionalProperties out of mapper type * Use "Any" mapper instead of object * remove not needed filter * Add CosmosDB, Monitor and Graphrbac to smoke tests --- src/generators/mappersGenerator.ts | 6 +- src/transforms/mapperTransforms.ts | 43 +- src/transforms/objectTransforms.ts | 74 +- src/transforms/transforms.ts | 6 +- src/utils/schemaHelpers.ts | 43 +- .../cosmos-db-resource-manager/LICENSE.txt | 21 + .../cosmos-db-resource-manager/README.md | 27 + .../cosmos-db-resource-manager/package.json | 58 + .../rollup.config.js | 39 + .../src/cosmosDBManagementClient.ts | 88 + .../src/cosmosDBManagementClientContext.ts | 68 + .../src/lro/azureAsyncOperationStrategy.ts | 197 + .../src/lro/bodyPollingStrategy.ts | 62 + .../src/lro/constants.ts | 9 + .../src/lro/index.ts | 23 + .../src/lro/locationStrategy.ts | 74 + .../src/lro/lroPolicy.ts | 43 + .../src/lro/lroPoller.ts | 154 + .../src/lro/models.ts | 60 + .../src/lro/operation.ts | 82 + .../src/lro/passthroughStrategy.ts | 30 + .../src/lro/requestUtils.ts | 117 + .../src/models/index.ts | 4038 +++++++++++++++++ .../src/models/mappers.ts | 3657 +++++++++++++++ .../src/models/parameters.ts | 493 ++ .../src/operations/cassandraResources.ts | 780 ++++ .../src/operations/collection.ts | 192 + .../src/operations/collectionPartition.ts | 141 + .../operations/collectionPartitionRegion.ts | 92 + .../src/operations/collectionRegion.ts | 92 + .../src/operations/database.ts | 180 + .../src/operations/databaseAccountRegion.ts | 83 + .../src/operations/databaseAccounts.ts | 902 ++++ .../src/operations/gremlinResources.ts | 775 ++++ .../src/operations/index.ts | 29 + .../src/operations/mongoDBResources.ts | 778 ++++ .../src/operations/notebookWorkspaces.ts | 418 ++ .../src/operations/operations.ts | 88 + .../src/operations/partitionKeyRangeId.ts | 91 + .../operations/partitionKeyRangeIdRegion.ts | 96 + .../src/operations/percentile.ts | 75 + .../src/operations/percentileSourceTarget.ts | 90 + .../src/operations/percentileTarget.ts | 85 + .../operations/privateEndpointConnections.ts | 268 ++ .../src/operations/privateLinkResources.ts | 114 + .../src/operations/sqlResources.ts | 1548 +++++++ .../src/operations/tableResources.ts | 385 ++ .../cosmos-db-resource-manager/tsconfig.json | 19 + .../graphrbac-data-plane/LICENSE.txt | 21 + .../generated/graphrbac-data-plane/README.md | 27 + .../graphrbac-data-plane/package.json | 57 + .../graphrbac-data-plane/rollup.config.js | 39 + .../src/graphRbacManagementClient.ts | 58 + .../src/graphRbacManagementClientContext.ts | 61 + .../graphrbac-data-plane/src/models/index.ts | 2325 ++++++++++ .../src/models/mappers.ts | 2057 +++++++++ .../src/models/parameters.ts | 530 +++ .../src/operations/applications.ts | 603 +++ .../src/operations/deletedApplications.ts | 169 + .../src/operations/domains.ts | 92 + .../src/operations/groups.ts | 574 +++ .../src/operations/index.ts | 17 + .../src/operations/oAuth2PermissionGrant.ts | 160 + .../src/operations/objects.ts | 99 + .../src/operations/servicePrincipals.ts | 454 ++ .../src/operations/signedInUser.ts | 129 + .../src/operations/users.ts | 291 ++ .../graphrbac-data-plane/tsconfig.json | 19 + .../generated/monitor-data-plane/LICENSE.txt | 21 + .../generated/monitor-data-plane/README.md | 27 + .../generated/monitor-data-plane/package.json | 57 + .../monitor-data-plane/rollup.config.js | 39 + .../monitor-data-plane/src/models/index.ts | 121 + .../monitor-data-plane/src/models/mappers.ts | 191 + .../src/models/parameters.ts | 127 + .../monitor-data-plane/src/monitorClient.ts | 40 + .../src/monitorClientContext.ts | 50 + .../src/operations/index.ts | 9 + .../src/operations/metrics.ts | 107 + .../monitor-data-plane/tsconfig.json | 19 + test/utils/smoke-test-list.ts | 12 +- test/utils/smoke-test.ts | 24 +- 82 files changed, 25391 insertions(+), 68 deletions(-) create mode 100644 test/smoke/generated/cosmos-db-resource-manager/LICENSE.txt create mode 100644 test/smoke/generated/cosmos-db-resource-manager/README.md create mode 100644 test/smoke/generated/cosmos-db-resource-manager/package.json create mode 100644 test/smoke/generated/cosmos-db-resource-manager/rollup.config.js create mode 100644 test/smoke/generated/cosmos-db-resource-manager/src/cosmosDBManagementClient.ts create mode 100644 test/smoke/generated/cosmos-db-resource-manager/src/cosmosDBManagementClientContext.ts create mode 100644 test/smoke/generated/cosmos-db-resource-manager/src/lro/azureAsyncOperationStrategy.ts create mode 100644 test/smoke/generated/cosmos-db-resource-manager/src/lro/bodyPollingStrategy.ts create mode 100644 test/smoke/generated/cosmos-db-resource-manager/src/lro/constants.ts create mode 100644 test/smoke/generated/cosmos-db-resource-manager/src/lro/index.ts create mode 100644 test/smoke/generated/cosmos-db-resource-manager/src/lro/locationStrategy.ts create mode 100644 test/smoke/generated/cosmos-db-resource-manager/src/lro/lroPolicy.ts create mode 100644 test/smoke/generated/cosmos-db-resource-manager/src/lro/lroPoller.ts create mode 100644 test/smoke/generated/cosmos-db-resource-manager/src/lro/models.ts create mode 100644 test/smoke/generated/cosmos-db-resource-manager/src/lro/operation.ts create mode 100644 test/smoke/generated/cosmos-db-resource-manager/src/lro/passthroughStrategy.ts create mode 100644 test/smoke/generated/cosmos-db-resource-manager/src/lro/requestUtils.ts create mode 100644 test/smoke/generated/cosmos-db-resource-manager/src/models/index.ts create mode 100644 test/smoke/generated/cosmos-db-resource-manager/src/models/mappers.ts create mode 100644 test/smoke/generated/cosmos-db-resource-manager/src/models/parameters.ts create mode 100644 test/smoke/generated/cosmos-db-resource-manager/src/operations/cassandraResources.ts create mode 100644 test/smoke/generated/cosmos-db-resource-manager/src/operations/collection.ts create mode 100644 test/smoke/generated/cosmos-db-resource-manager/src/operations/collectionPartition.ts create mode 100644 test/smoke/generated/cosmos-db-resource-manager/src/operations/collectionPartitionRegion.ts create mode 100644 test/smoke/generated/cosmos-db-resource-manager/src/operations/collectionRegion.ts create mode 100644 test/smoke/generated/cosmos-db-resource-manager/src/operations/database.ts create mode 100644 test/smoke/generated/cosmos-db-resource-manager/src/operations/databaseAccountRegion.ts create mode 100644 test/smoke/generated/cosmos-db-resource-manager/src/operations/databaseAccounts.ts create mode 100644 test/smoke/generated/cosmos-db-resource-manager/src/operations/gremlinResources.ts create mode 100644 test/smoke/generated/cosmos-db-resource-manager/src/operations/index.ts create mode 100644 test/smoke/generated/cosmos-db-resource-manager/src/operations/mongoDBResources.ts create mode 100644 test/smoke/generated/cosmos-db-resource-manager/src/operations/notebookWorkspaces.ts create mode 100644 test/smoke/generated/cosmos-db-resource-manager/src/operations/operations.ts create mode 100644 test/smoke/generated/cosmos-db-resource-manager/src/operations/partitionKeyRangeId.ts create mode 100644 test/smoke/generated/cosmos-db-resource-manager/src/operations/partitionKeyRangeIdRegion.ts create mode 100644 test/smoke/generated/cosmos-db-resource-manager/src/operations/percentile.ts create mode 100644 test/smoke/generated/cosmos-db-resource-manager/src/operations/percentileSourceTarget.ts create mode 100644 test/smoke/generated/cosmos-db-resource-manager/src/operations/percentileTarget.ts create mode 100644 test/smoke/generated/cosmos-db-resource-manager/src/operations/privateEndpointConnections.ts create mode 100644 test/smoke/generated/cosmos-db-resource-manager/src/operations/privateLinkResources.ts create mode 100644 test/smoke/generated/cosmos-db-resource-manager/src/operations/sqlResources.ts create mode 100644 test/smoke/generated/cosmos-db-resource-manager/src/operations/tableResources.ts create mode 100644 test/smoke/generated/cosmos-db-resource-manager/tsconfig.json create mode 100644 test/smoke/generated/graphrbac-data-plane/LICENSE.txt create mode 100644 test/smoke/generated/graphrbac-data-plane/README.md create mode 100644 test/smoke/generated/graphrbac-data-plane/package.json create mode 100644 test/smoke/generated/graphrbac-data-plane/rollup.config.js create mode 100644 test/smoke/generated/graphrbac-data-plane/src/graphRbacManagementClient.ts create mode 100644 test/smoke/generated/graphrbac-data-plane/src/graphRbacManagementClientContext.ts create mode 100644 test/smoke/generated/graphrbac-data-plane/src/models/index.ts create mode 100644 test/smoke/generated/graphrbac-data-plane/src/models/mappers.ts create mode 100644 test/smoke/generated/graphrbac-data-plane/src/models/parameters.ts create mode 100644 test/smoke/generated/graphrbac-data-plane/src/operations/applications.ts create mode 100644 test/smoke/generated/graphrbac-data-plane/src/operations/deletedApplications.ts create mode 100644 test/smoke/generated/graphrbac-data-plane/src/operations/domains.ts create mode 100644 test/smoke/generated/graphrbac-data-plane/src/operations/groups.ts create mode 100644 test/smoke/generated/graphrbac-data-plane/src/operations/index.ts create mode 100644 test/smoke/generated/graphrbac-data-plane/src/operations/oAuth2PermissionGrant.ts create mode 100644 test/smoke/generated/graphrbac-data-plane/src/operations/objects.ts create mode 100644 test/smoke/generated/graphrbac-data-plane/src/operations/servicePrincipals.ts create mode 100644 test/smoke/generated/graphrbac-data-plane/src/operations/signedInUser.ts create mode 100644 test/smoke/generated/graphrbac-data-plane/src/operations/users.ts create mode 100644 test/smoke/generated/graphrbac-data-plane/tsconfig.json create mode 100644 test/smoke/generated/monitor-data-plane/LICENSE.txt create mode 100644 test/smoke/generated/monitor-data-plane/README.md create mode 100644 test/smoke/generated/monitor-data-plane/package.json create mode 100644 test/smoke/generated/monitor-data-plane/rollup.config.js create mode 100644 test/smoke/generated/monitor-data-plane/src/models/index.ts create mode 100644 test/smoke/generated/monitor-data-plane/src/models/mappers.ts create mode 100644 test/smoke/generated/monitor-data-plane/src/models/parameters.ts create mode 100644 test/smoke/generated/monitor-data-plane/src/monitorClient.ts create mode 100644 test/smoke/generated/monitor-data-plane/src/monitorClientContext.ts create mode 100644 test/smoke/generated/monitor-data-plane/src/operations/index.ts create mode 100644 test/smoke/generated/monitor-data-plane/src/operations/metrics.ts create mode 100644 test/smoke/generated/monitor-data-plane/tsconfig.json diff --git a/src/generators/mappersGenerator.ts b/src/generators/mappersGenerator.ts index 109b2d5852..2b15e2f16a 100644 --- a/src/generators/mappersGenerator.ts +++ b/src/generators/mappersGenerator.ts @@ -169,8 +169,8 @@ export function writeMapper(writer: CodeBlockWriter, mapper: Mapper) { .block(() => { // Write all type properties that don't need special handling writeObjectProps(restType, writer); - // Write ptype roperties that need special handling - writePolymorphicDiscrimitator(writer, polymorphicDiscriminator); + // Write type properties that need special handling + writePolymorphicDiscriminator(writer, polymorphicDiscriminator); writeModelProperties(writer, parents, modelProperties); }); }); @@ -225,7 +225,7 @@ function writeModelProperties( }); } -function writePolymorphicDiscrimitator( +function writePolymorphicDiscriminator( writer: CodeBlockWriter, polymorphicDiscriminator?: PolymorphicDiscriminator ) { diff --git a/src/transforms/mapperTransforms.ts b/src/transforms/mapperTransforms.ts index 8010ebd9de..324ed03a32 100644 --- a/src/transforms/mapperTransforms.ts +++ b/src/transforms/mapperTransforms.ts @@ -30,6 +30,11 @@ import { normalizeName, NameType } from "../utils/nameUtils"; import { extractHeaders } from "../utils/extractHeaders"; import { KnownMediaType } from "@azure-tools/codegen"; import { ClientOptions } from "../models/clientDetails"; +import { + getSchemaParents, + getAdditionalProperties +} from "../utils/schemaHelpers"; +import { ObjectDetails } from "../models/modelDetails"; interface PipelineValue { schema: Schema; @@ -53,8 +58,6 @@ const pipe = ( ...fns: Array<(pipelineValue: PipelineValue) => PipelineValue> ) => (x: PipelineValue) => fns.reduce((v, f) => (!v.isHandled ? f(v) : v), x); -let uberParents: string[] = []; - export type ModelProperties = { [propertyName: string]: Mapper | string[] }; export interface EntityOptions { @@ -62,6 +65,7 @@ export interface EntityOptions { required?: boolean; readOnly?: boolean; hasXmlMetadata?: boolean; + uberParents?: string[]; } export interface MapperInput { @@ -71,6 +75,7 @@ export interface MapperInput { export async function transformMappers( codeModel: CodeModel, + uberParents: ObjectDetails[], { mediaTypes }: ClientOptions ): Promise { const clientName = getLanguageMetadata(codeModel.language).name; @@ -79,12 +84,16 @@ export async function transformMappers( return []; } + const uberParentsNames = uberParents.map(up => up.name); const hasXmlMetadata = mediaTypes?.has(KnownMediaType.Xml); return [ ...codeModel.schemas.objects, ...extractHeaders(codeModel.operationGroups, clientName) ].map(objectSchema => - transformMapper({ schema: objectSchema, options: { hasXmlMetadata } }) + transformMapper({ + schema: objectSchema, + options: { hasXmlMetadata, uberParents: uberParentsNames } + }) ); } @@ -253,8 +262,11 @@ function getXmlMetadata( }; } -function getAdditionalProperties(allParents: Schema[]): Mapper | undefined { - return allParents.some(p => p.type === SchemaType.Dictionary) +function buildAdditionalProperties( + objectSchema: ObjectSchema +): Mapper | undefined { + const additionalProperties = getAdditionalProperties(objectSchema); + return additionalProperties ? { type: { name: MapperType.Object @@ -264,10 +276,8 @@ function getAdditionalProperties(allParents: Schema[]): Mapper | undefined { } function isUberParent(objectSchema: ObjectSchema) { - const { discriminator, parents, children } = objectSchema; - return ( - discriminator && !parents && children && children.all && children.all.length - ); + const { parents, children } = objectSchema; + return !parents && children && children.all && children.all.length; } function transformObjectMapper(pipelineValue: PipelineValue) { @@ -281,21 +291,24 @@ function transformObjectMapper(pipelineValue: PipelineValue) { const { discriminator, discriminatorValue } = objectSchema; let modelProperties = processProperties(objectSchema.properties, options); - const parents = objectSchema.parents ? objectSchema.parents.all : []; - const immediateParents = objectSchema.parents - ? objectSchema.parents.immediate - : []; + const parents = getSchemaParents(objectSchema); + const immediateParents = getSchemaParents( + objectSchema, + true /** immediateOnly */ + ); const parentsRefs = immediateParents .map(p => getMapperClassName(p)) .filter(p => p !== className); - const additionalProperties = getAdditionalProperties(parents); + const additionalProperties = buildAdditionalProperties(objectSchema); modelProperties = { ...modelProperties, ...(parentsRefs && parentsRefs.length && { parentsRefs }) }; + const uberParents = options?.uberParents || []; + // If we find a new uber parent, store it if (uberParents.indexOf(className) < 0 && isUberParent(objectSchema)) { uberParents.push(className); @@ -717,6 +730,8 @@ export function getMapperTypeFromSchema(type: SchemaType, format?: string) { return MapperType.Number; case SchemaType.Object: return MapperType.Object; + case SchemaType.Any: + return "any"; default: throw new Error(`There is no known Mapper type for schema type ${type}`); } diff --git a/src/transforms/objectTransforms.ts b/src/transforms/objectTransforms.ts index 64721b9360..dcdf0b54b5 100644 --- a/src/transforms/objectTransforms.ts +++ b/src/transforms/objectTransforms.ts @@ -18,7 +18,11 @@ import { import { getLanguageMetadata } from "../utils/languageHelpers"; import { normalizeName, NameType } from "../utils/nameUtils"; import { PropertyDetails } from "../models/modelDetails"; -import { getTypeForSchema } from "../utils/schemaHelpers"; +import { + getTypeForSchema, + getSchemaParents, + getAdditionalProperties +} from "../utils/schemaHelpers"; import { extractHeaders } from "../utils/extractHeaders"; export function transformObjects( @@ -61,7 +65,7 @@ export function transformObject( : [] }; - return getAdditionalObjectDetails(objectDetails, schema, uberParents); + return getAdditionalObjectDetails(objectDetails, uberParents); } export function transformProperty({ @@ -100,7 +104,8 @@ function getObjectKind(schema: ObjectSchema): ObjectKind { return ObjectKind.Polymorphic; } - if (schema.parents && schema.parents.immediate.length) { + const immediateParents = getSchemaParents(schema, true /** immediateOnly */); + if (immediateParents.length) { return ObjectKind.Extended; } @@ -111,8 +116,10 @@ function getObjectDetailsWithHierarchy( objectsDetails: ObjectDetails[] ): ObjectDetails[] { return objectsDetails.map(current => { - const parentsSchema = - current.schema.parents && current.schema.parents.immediate; + const parentsSchema = getSchemaParents( + current.schema, + true /** immediateOnly */ + ); const childrenSchema = current.schema.children && current.schema.children.immediate; let parents: ObjectDetails[] = extractHierarchy( @@ -125,9 +132,9 @@ function getObjectDetailsWithHierarchy( objectsDetails, current ); - const hasAdditionalProperties = - !!parentsSchema && - parentsSchema.some(p => p.type === SchemaType.Dictionary); + const hasAdditionalProperties = Boolean( + getAdditionalProperties(current.schema, true /** immediateOnly */) + ); return { ...current, @@ -147,28 +154,25 @@ function extractHierarchy( return []; } - return schemas - .filter(s => s.type === SchemaType.Object) - .map(r => { - const relativeName = normalizeName( - getLanguageMetadata(r.language).name, - NameType.Interface, - true /** shouldGuard */ - ); - const relative = objectsDetails.find(o => o.name === relativeName); + return schemas.map(r => { + const relativeName = normalizeName( + getLanguageMetadata(r.language).name, + NameType.Interface, + true /** shouldGuard */ + ); + const relative = objectsDetails.find(o => o.name === relativeName); - if (!relative) { - throw new Error( - `Expected relative ${relativeName} of ${current.name} but couldn't find it in transformed objects` - ); - } - return relative; - }); + if (!relative) { + throw new Error( + `Expected relative ${relativeName} of ${current.name} but couldn't find it in transformed objects` + ); + } + return relative; + }); } function getAdditionalObjectDetails( objectDetails: ObjectDetails, - schema: ObjectSchema, uberParents: ObjectDetails[] ): ObjectDetails { switch (objectDetails.kind) { @@ -177,25 +181,27 @@ function getAdditionalObjectDetails( case ObjectKind.Polymorphic: return transformPolymorphicObject( objectDetails as PolymorphicObjectDetails, - schema, uberParents ); case ObjectKind.Extended: - return transformComposedObject(objectDetails, schema); + return transformComposedObject(objectDetails); default: throw new Error(`Unexpected ObjectKind ${objectDetails.kind}`); } } function transformComposedObject( - objectDetails: ObjectDetails, - schema: ObjectSchema + objectDetails: ObjectDetails ): ComposedObjectDetails { - if (!schema.parents) { + const immediateParents = getSchemaParents( + objectDetails.schema, + true /** immediateOnly */ + ); + if (immediateParents.length < 1) { throw new Error(`Expected object ${objectDetails.name} to have parents`); } - const parentNames = schema.parents.immediate.map(parent => { + const parentNames = immediateParents.map(parent => { const name = getLanguageMetadata(parent.language).name; return `${normalizeName( name, @@ -212,11 +218,11 @@ function transformComposedObject( function transformPolymorphicObject( objectDetails: PolymorphicObjectDetails, - schema: ObjectSchema, uberParents: ObjectDetails[] ): PolymorphicObjectDetails { - let uberParent: ObjectSchema | undefined = schema; - const allParents = schema.parents && schema.parents.all; + const schema = objectDetails.schema; + let uberParent: ObjectSchema | undefined = objectDetails.schema; + const allParents = getSchemaParents(schema); if (allParents && allParents.length) { const uberParentSchema = allParents.find(p => { // TODO: Reconsider names to reduce issues with normalization, can we switch to serialized? diff --git a/src/transforms/transforms.ts b/src/transforms/transforms.ts index bf06303ea6..803c806053 100644 --- a/src/transforms/transforms.ts +++ b/src/transforms/transforms.ts @@ -27,6 +27,7 @@ import { Host } from "@azure-tools/autorest-extension-base"; import { transformBaseUrl } from "./urlTransforms"; import { normalizeModelWithExtensions } from "./extensions"; import { transformGroups } from "./groupTransforms"; +import { getSchemaParents } from "../utils/schemaHelpers"; export async function transformChoices(codeModel: CodeModel) { const choices = [ @@ -82,7 +83,7 @@ export async function transformCodeModel( ] = await Promise.all([ transformObjects(codeModel, uberParents), transformGroups(codeModel), - transformMappers(codeModel, options), + transformMappers(codeModel, uberParents, options), transformChoices(codeModel), transformParameters(codeModel, options), transformBaseUrl(codeModel) @@ -105,6 +106,7 @@ export async function transformCodeModel( /** * This function gets all top level objects with children, aka UberParents + * An UberParent is an object schema that has no parents but is extended * @param codeModel CodeModel */ async function getUberParents(codeModel: CodeModel): Promise { @@ -118,7 +120,7 @@ async function getUberParents(codeModel: CodeModel): Promise { const name = getLanguageMetadata(object.language).name; const isPresent = uberParents.some(up => up.name === name); const hasChildren = object.children && object.children.all.length; - const hasParents = object.parents && object.parents.all.length; + const hasParents = getSchemaParents(object).length > 0; if (hasChildren && !hasParents && !isPresent) { const baseObject = transformObject(object, uberParents); diff --git a/src/utils/schemaHelpers.ts b/src/utils/schemaHelpers.ts index 6d2dae56eb..194d7e5bd8 100644 --- a/src/utils/schemaHelpers.ts +++ b/src/utils/schemaHelpers.ts @@ -10,12 +10,53 @@ import { ObjectSchema, ArraySchema, DictionarySchema, - SchemaResponse + SchemaResponse, + ComplexSchema } from "@azure-tools/codemodel"; import { getStringForValue } from "./valueHelpers"; import { getLanguageMetadata } from "./languageHelpers"; import { normalizeName, NameType, normalizeTypeName } from "./nameUtils"; +/** + * Extracts parents from an ObjectSchema + * by default it extracts all parameters unless + * immediateOnly = true is passed + */ +export function getSchemaParents( + { parents }: ObjectSchema, + immediateOnly = false +) { + if (!parents) { + return []; + } + + const allParents: ComplexSchema[] = immediateOnly + ? parents.immediate + : parents.all; + + return allParents.filter(p => p.type === SchemaType.Object); +} + +/** + * Extracts the additional properties for an object schema + * if immediateOnly is true, it will only extract additionalProperties defined directly + * in the schema, otherwise it will get it from any of its parents + */ +export function getAdditionalProperties( + { parents }: ObjectSchema, + immediateOnly = false +): ComplexSchema | undefined { + if (!parents) { + return undefined; + } + + const allParents: ComplexSchema[] = immediateOnly + ? parents.immediate + : parents.all; + + return allParents.find(p => p.type === SchemaType.Dictionary); +} + /** * Helper function which given a schema returns type information for useful for generating Typescript code * @param schema schema to extract type information from diff --git a/test/smoke/generated/cosmos-db-resource-manager/LICENSE.txt b/test/smoke/generated/cosmos-db-resource-manager/LICENSE.txt new file mode 100644 index 0000000000..4c529f375c --- /dev/null +++ b/test/smoke/generated/cosmos-db-resource-manager/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2020 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/test/smoke/generated/cosmos-db-resource-manager/README.md b/test/smoke/generated/cosmos-db-resource-manager/README.md new file mode 100644 index 0000000000..272bca07a6 --- /dev/null +++ b/test/smoke/generated/cosmos-db-resource-manager/README.md @@ -0,0 +1,27 @@ +## Azure CosmosDBManagementClient SDK for JavaScript + +This package contains an isomorphic SDK for CosmosDBManagementClient. + +### Currently supported environments + +- Node.js version 8.x.x or higher +- Browser JavaScript + +### How to Install + +```bash +npm install cosmos-db-resource-manager +``` + +### How to use + +#### Sample code + +Refer the sample code in the [azure-sdk-for-js-samples](https://github.com/Azure/azure-sdk-for-js-samples) repository. + +## Related projects + +- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js) + + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fcdn%2Farm-cdn%2FREADME.png) \ No newline at end of file diff --git a/test/smoke/generated/cosmos-db-resource-manager/package.json b/test/smoke/generated/cosmos-db-resource-manager/package.json new file mode 100644 index 0000000000..949fd6544a --- /dev/null +++ b/test/smoke/generated/cosmos-db-resource-manager/package.json @@ -0,0 +1,58 @@ +{ + "name": "cosmos-db-resource-manager", + "author": "Microsoft Corporation", + "description": "Azure Cosmos DB Database Service Resource Provider REST API", + "version": "1.0.0", + "dependencies": { + "@azure/core-lro": "^1.0.1", + "@azure/core-http": "^1.1.1", + "tslib": "^1.9.3" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], + "license": "MIT", + "main": "./dist/cosmos-db-resource-manager.js", + "module": "./esm/cosmosDBManagementClient.js", + "types": "./esm/cosmosDBManagementClient.d.ts", + "devDependencies": { + "typescript": "^3.1.1", + "rollup": "^0.66.2", + "rollup-plugin-node-resolve": "^3.4.0", + "rollup-plugin-sourcemaps": "^0.4.2", + "uglify-js": "^3.4.9" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js", + "repository": { + "type": "git", + "url": "https://github.com/Azure/azure-sdk-for-js.git" + }, + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "files": [ + "dist/**/*.js", + "dist/**/*.js.map", + "dist/**/*.d.ts", + "dist/**/*.d.ts.map", + "esm/**/*.js", + "esm/**/*.js.map", + "esm/**/*.d.ts", + "esm/**/*.d.ts.map", + "src/**/*.ts", + "README.md", + "rollup.config.js", + "tsconfig.json" + ], + "scripts": { + "build": "tsc && rollup -c rollup.config.js && npm run minify", + "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/cosmos-db-resource-manager.js.map'\" -o ./dist/cosmos-db-resource-manager.min.js ./dist/cosmos-db-resource-manager.js", + "prepack": "npm install && npm run build" + }, + "sideEffects": false, + "autoPublish": true +} diff --git a/test/smoke/generated/cosmos-db-resource-manager/rollup.config.js b/test/smoke/generated/cosmos-db-resource-manager/rollup.config.js new file mode 100644 index 0000000000..0287fd1fd8 --- /dev/null +++ b/test/smoke/generated/cosmos-db-resource-manager/rollup.config.js @@ -0,0 +1,39 @@ +/* + * 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 rollup from "rollup"; +import nodeResolve from "rollup-plugin-node-resolve"; +import sourcemaps from "rollup-plugin-sourcemaps"; + +/** + * @type {rollup.RollupFileOptions} + */ +const config = { + input: "./esm/cosmosDBManagementClient.js", + external: ["@azure/core-http", "@azure/core-arm"], + output: { + file: "./dist/cosmos-db-resource-manager.js", + format: "umd", + name: "CosmosDbResourceManager", + sourcemap: true, + globals: { + "@azure/core-http": "coreHttp", + "@azure/core-arm": "coreArm" + }, + banner: `/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ ` + }, + plugins: [nodeResolve({ module: true }), sourcemaps()] +}; + +export default config; diff --git a/test/smoke/generated/cosmos-db-resource-manager/src/cosmosDBManagementClient.ts b/test/smoke/generated/cosmos-db-resource-manager/src/cosmosDBManagementClient.ts new file mode 100644 index 0000000000..9d6e4e659c --- /dev/null +++ b/test/smoke/generated/cosmos-db-resource-manager/src/cosmosDBManagementClient.ts @@ -0,0 +1,88 @@ +/* + * 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 * as coreHttp from "@azure/core-http"; +import * as operations from "./operations"; +import * as Models from "./models"; +import * as Mappers from "./models/mappers"; +import { CosmosDBManagementClientContext } from "./cosmosDBManagementClientContext"; + +class CosmosDBManagementClient extends CosmosDBManagementClientContext { + /** + * Initializes a new instance of the CosmosDBManagementClient class. + * @param credentials Subscription credentials which uniquely identify client subscription. + * @param subscriptionId The ID of the target subscription. + * @param options The parameter options + */ + constructor( + credentials: coreHttp.TokenCredential | coreHttp.ServiceClientCredentials, + subscriptionId: string, + options?: Models.CosmosDBManagementClientOptionalParams + ) { + super(credentials, subscriptionId, options); + this.databaseAccounts = new operations.DatabaseAccounts(this); + this.operations = new operations.Operations(this); + this.database = new operations.Database(this); + this.collection = new operations.Collection(this); + this.collectionRegion = new operations.CollectionRegion(this); + this.databaseAccountRegion = new operations.DatabaseAccountRegion(this); + this.percentileSourceTarget = new operations.PercentileSourceTarget(this); + this.percentileTarget = new operations.PercentileTarget(this); + this.percentile = new operations.Percentile(this); + this.collectionPartitionRegion = new operations.CollectionPartitionRegion( + this + ); + this.collectionPartition = new operations.CollectionPartition(this); + this.partitionKeyRangeId = new operations.PartitionKeyRangeId(this); + this.partitionKeyRangeIdRegion = new operations.PartitionKeyRangeIdRegion( + this + ); + this.sqlResources = new operations.SqlResources(this); + this.mongoDBResources = new operations.MongoDBResources(this); + this.tableResources = new operations.TableResources(this); + this.cassandraResources = new operations.CassandraResources(this); + this.gremlinResources = new operations.GremlinResources(this); + this.notebookWorkspaces = new operations.NotebookWorkspaces(this); + this.privateLinkResources = new operations.PrivateLinkResources(this); + this.privateEndpointConnections = new operations.PrivateEndpointConnections( + this + ); + } + + databaseAccounts: operations.DatabaseAccounts; + operations: operations.Operations; + database: operations.Database; + collection: operations.Collection; + collectionRegion: operations.CollectionRegion; + databaseAccountRegion: operations.DatabaseAccountRegion; + percentileSourceTarget: operations.PercentileSourceTarget; + percentileTarget: operations.PercentileTarget; + percentile: operations.Percentile; + collectionPartitionRegion: operations.CollectionPartitionRegion; + collectionPartition: operations.CollectionPartition; + partitionKeyRangeId: operations.PartitionKeyRangeId; + partitionKeyRangeIdRegion: operations.PartitionKeyRangeIdRegion; + sqlResources: operations.SqlResources; + mongoDBResources: operations.MongoDBResources; + tableResources: operations.TableResources; + cassandraResources: operations.CassandraResources; + gremlinResources: operations.GremlinResources; + notebookWorkspaces: operations.NotebookWorkspaces; + privateLinkResources: operations.PrivateLinkResources; + privateEndpointConnections: operations.PrivateEndpointConnections; +} + +// Operation Specifications + +export { + CosmosDBManagementClient, + CosmosDBManagementClientContext, + Models as CosmosDBManagementModels, + Mappers as CosmosDBManagementMappers +}; +export * from "./operations"; diff --git a/test/smoke/generated/cosmos-db-resource-manager/src/cosmosDBManagementClientContext.ts b/test/smoke/generated/cosmos-db-resource-manager/src/cosmosDBManagementClientContext.ts new file mode 100644 index 0000000000..95b683095d --- /dev/null +++ b/test/smoke/generated/cosmos-db-resource-manager/src/cosmosDBManagementClientContext.ts @@ -0,0 +1,68 @@ +/* + * 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 * as coreHttp from "@azure/core-http"; +import * as Models from "./models"; +import { lroPolicy } from "./lro"; + +const packageName = "cosmos-db-resource-manager"; +const packageVersion = "1.0.0"; + +export class CosmosDBManagementClientContext extends coreHttp.ServiceClient { + $host: string; + subscriptionId: string; + + /** + * Initializes a new instance of the CosmosDBManagementClientContext class. + * @param credentials Subscription credentials which uniquely identify client subscription. + * @param subscriptionId The ID of the target subscription. + * @param options The parameter options + */ + constructor( + credentials: coreHttp.TokenCredential | coreHttp.ServiceClientCredentials, + subscriptionId: string, + options?: Models.CosmosDBManagementClientOptionalParams + ) { + if (credentials === undefined) { + throw new Error("'credentials' cannot be null"); + } + if (subscriptionId === undefined) { + throw new Error("'subscriptionId' cannot be null"); + } + + // Initializing default values for options + if (!options) { + options = {}; + } + + if (!options.userAgent) { + const defaultUserAgent = coreHttp.getDefaultUserAgentValue(); + options.userAgent = `${packageName}/${packageVersion} ${defaultUserAgent}`; + } + + const defaultPipelines = coreHttp.createPipelineFromOptions(options) + .requestPolicyFactories as coreHttp.RequestPolicyFactory[]; + + options = { + ...options, + requestPolicyFactories: [lroPolicy(), ...defaultPipelines] + }; + + super(credentials, options); + + this.requestContentType = "application/json; charset=utf-8"; + + this.baseUri = options.endpoint || "{$host}"; + + // Parameter assignments + this.subscriptionId = subscriptionId; + + // Assigning values to Constant parameters + this.$host = options.$host || "https://management.azure.com"; + } +} diff --git a/test/smoke/generated/cosmos-db-resource-manager/src/lro/azureAsyncOperationStrategy.ts b/test/smoke/generated/cosmos-db-resource-manager/src/lro/azureAsyncOperationStrategy.ts new file mode 100644 index 0000000000..ecdc300c1f --- /dev/null +++ b/test/smoke/generated/cosmos-db-resource-manager/src/lro/azureAsyncOperationStrategy.ts @@ -0,0 +1,197 @@ +/* + * 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 { + LROStrategy, + BaseResult, + LROOperationStep, + LROResponseInfo, + FinalStateVia +} from "./models"; +import { OperationSpec, OperationArguments } from "@azure/core-http"; +import { terminalStates } from "./constants"; +import { SendOperationFn } from "."; + +export function createAzureAsyncOperationStrategy( + initialOperation: LROOperationStep, + sendOperationFn: SendOperationFn, + finalStateVia?: FinalStateVia +): LROStrategy { + const lroData = initialOperation.result._lroData; + if (!lroData) { + throw new Error( + "Expected lroData to be defined for Azure-AsyncOperation strategy" + ); + } + + let currentOperation = initialOperation; + let lastKnownPollingUrl = + lroData.azureAsyncOperation || lroData.operationLocation; + + return { + isTerminal: () => { + const currentResult = currentOperation.result._lroData; + + if (!currentResult) { + throw new Error("Expected lroData to determine terminal status"); + } + + if (currentOperation === initialOperation) { + // Azure-AsyncOperations don't need to check for terminal state + // on originalOperation result, always need to poll + return false; + } + + const { status = "succeeded" } = currentResult; + return terminalStates.includes(status.toLowerCase()); + }, + sendFinalRequest: async () => { + if (!initialOperation.result._lroData) { + throw new Error("Expected lroData to determine terminal status"); + } + + if (!currentOperation.result._lroData) { + throw new Error("Expected lroData to determine terminal status"); + } + + const initialOperationResult = initialOperation.result._lroData; + const currentOperationResult = currentOperation.result._lroData; + + if ( + !shouldPerformFinalGet(initialOperationResult, currentOperationResult) + ) { + return currentOperation; + } + + if (initialOperationResult.requestMethod === "PUT") { + currentOperation = await sendFinalGet( + initialOperation, + sendOperationFn + ); + + return currentOperation; + } + + if (initialOperationResult.location) { + switch (finalStateVia) { + case "original-uri": + currentOperation = await sendFinalGet( + initialOperation, + sendOperationFn + ); + return currentOperation; + + case "azure-async-operation": + return currentOperation; + case "location": + default: + const location = + initialOperationResult.location || + currentOperationResult.location; + + if (!location) { + throw new Error("Couldn't determine final GET URL from location"); + } + + return await sendFinalGet( + initialOperation, + sendOperationFn, + location + ); + } + } + + // All other cases return the last operation + return currentOperation; + }, + poll: async () => { + if (!lastKnownPollingUrl) { + throw new Error("Unable to determine polling url"); + } + + const pollingArgs = currentOperation.args; + // Make sure we don't send any body to the get request + const { requestBody, ...restSpec } = currentOperation.spec; + const pollingSpec: OperationSpec = { + ...restSpec, + httpMethod: "GET", + path: lastKnownPollingUrl + }; + + const result = await sendOperationFn(pollingArgs, pollingSpec); + + // Update latest polling url + lastKnownPollingUrl = + result._lroData?.azureAsyncOperation || + result._lroData?.operationLocation || + lastKnownPollingUrl; + + // Update lastOperation result + currentOperation = { + args: pollingArgs, + spec: pollingSpec, + result + }; + + return currentOperation; + } + }; +} + +function shouldPerformFinalGet( + initialResult: LROResponseInfo, + currentResult: LROResponseInfo +) { + const { status } = currentResult; + const { requestMethod: initialRequestMethod, location } = initialResult; + if (status && status.toLowerCase() !== "succeeded") { + return false; + } + + if (initialRequestMethod === "DELETE") { + return false; + } + + if (initialRequestMethod !== "PUT" && !location) { + return false; + } + + return true; +} + +async function sendFinalGet( + initialOperation: LROOperationStep, + sendOperationFn: SendOperationFn, + path?: string +): Promise> { + // Make sure we don't send any body to the get request + const { requestBody, ...restSpec } = initialOperation.spec; + const finalGetSpec: OperationSpec = { + ...restSpec, + httpMethod: "GET" + }; + + // Send final GET request to the Original URL + const spec = { + ...finalGetSpec, + ...(path && { path }) + }; + + let operationArgs: OperationArguments = initialOperation.args; + if (operationArgs.options) { + operationArgs.options.shouldDeserialize = true; + } + + const finalResult = await sendOperationFn(initialOperation.args, spec); + + return { + args: initialOperation.args, + spec, + result: finalResult + }; +} diff --git a/test/smoke/generated/cosmos-db-resource-manager/src/lro/bodyPollingStrategy.ts b/test/smoke/generated/cosmos-db-resource-manager/src/lro/bodyPollingStrategy.ts new file mode 100644 index 0000000000..35cc6bac2a --- /dev/null +++ b/test/smoke/generated/cosmos-db-resource-manager/src/lro/bodyPollingStrategy.ts @@ -0,0 +1,62 @@ +/* + * 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 { LROStrategy, BaseResult, LROOperationStep } from "./models"; +import { OperationSpec } from "@azure/core-http"; +import { terminalStates } from "./constants"; +import { SendOperationFn } from "./lroPoller"; + +/** + * Creates a polling strategy based on BodyPolling which uses the provisioning state + * from the result to determine the current operation state + */ +export function createBodyPollingStrategy( + initialOperation: LROOperationStep, + sendOperation: SendOperationFn +): LROStrategy { + if (!initialOperation.result._lroData) { + throw new Error("Expected lroData to be defined for BodyPolling strategy"); + } + + let currentOperation = initialOperation; + + return { + isTerminal: () => { + const currentResult = currentOperation.result._lroData; + if (!currentResult) { + throw new Error("Expected lroData to determine terminal status"); + } + + const { provisioningState = "succeeded" } = currentResult; + // If provisioning state is missing, default to Success + + return terminalStates.includes(provisioningState.toLowerCase()); + }, + sendFinalRequest: () => { + // BodyPolling doesn't require a final get so return the lastOperation + return Promise.resolve(currentOperation); + }, + poll: async () => { + // When doing BodyPolling, we need to poll to the original url with a + // GET http method + const { requestBody, ...restSpec } = initialOperation.spec; + const pollingSpec: OperationSpec = { + // Make sure we don't send any body to the get request + ...restSpec, + httpMethod: "GET" + }; + + // Execute the polling operation + initialOperation.result = await sendOperation( + initialOperation.args, + pollingSpec + ); + return initialOperation; + } + }; +} diff --git a/test/smoke/generated/cosmos-db-resource-manager/src/lro/constants.ts b/test/smoke/generated/cosmos-db-resource-manager/src/lro/constants.ts new file mode 100644 index 0000000000..fa0ee2d994 --- /dev/null +++ b/test/smoke/generated/cosmos-db-resource-manager/src/lro/constants.ts @@ -0,0 +1,9 @@ +/* + * 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. + */ + +export const terminalStates = ["succeeded", "failed", "canceled", "cancelled"]; diff --git a/test/smoke/generated/cosmos-db-resource-manager/src/lro/index.ts b/test/smoke/generated/cosmos-db-resource-manager/src/lro/index.ts new file mode 100644 index 0000000000..f605ce7ee3 --- /dev/null +++ b/test/smoke/generated/cosmos-db-resource-manager/src/lro/index.ts @@ -0,0 +1,23 @@ +/* + * 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. + */ + +export { shouldDeserializeLRO } from "./requestUtils"; +export { createBodyPollingStrategy } from "./bodyPollingStrategy"; +export { terminalStates } from "./constants"; +export { lroPolicy } from "./lroPolicy"; +export { LROPoller, LROPollerOptions, SendOperationFn } from "./lroPoller"; +export { + LROResponseInfo, + BaseResult, + LROOperationStep, + LROOperationState, + LROStrategy, + LROOperation +} from "./models"; +export { makeOperation } from "./operation"; +export * from "./locationStrategy"; diff --git a/test/smoke/generated/cosmos-db-resource-manager/src/lro/locationStrategy.ts b/test/smoke/generated/cosmos-db-resource-manager/src/lro/locationStrategy.ts new file mode 100644 index 0000000000..1a5c8d462e --- /dev/null +++ b/test/smoke/generated/cosmos-db-resource-manager/src/lro/locationStrategy.ts @@ -0,0 +1,74 @@ +/* + * 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 { BaseResult, LROOperationStep, LROStrategy } from "./models"; +import { SendOperationFn } from "./lroPoller"; +import { OperationSpec } from "@azure/core-http"; + +export function createLocationStrategy( + initialOperation: LROOperationStep, + sendOperationFn: SendOperationFn +): LROStrategy { + const lroData = initialOperation.result._lroData; + if (!lroData) { + throw new Error( + "Expected lroData to be defined for Azure-AsyncOperation strategy" + ); + } + + let currentOperation = initialOperation; + let lastKnownPollingUrl = lroData.location; + + return { + isTerminal: () => { + const currentResult = currentOperation.result._lroData; + if (!currentResult) { + throw new Error("Expected lroData to determine terminal status"); + } + + if (currentOperation === initialOperation) { + return false; + } + + if (currentResult.statusCode === 202) { + return false; + } + + return true; + }, + sendFinalRequest: () => Promise.resolve(currentOperation), + poll: async () => { + if (!lastKnownPollingUrl) { + throw new Error("Unable to determine polling url"); + } + + const pollingArgs = currentOperation.args; + // Make sure we don't send any body to the get request + const { requestBody, ...restSpec } = currentOperation.spec; + const pollingSpec: OperationSpec = { + ...restSpec, + httpMethod: "GET", + path: lastKnownPollingUrl + }; + + const result = await sendOperationFn(pollingArgs, pollingSpec); + + // Update latest polling url + lastKnownPollingUrl = result._lroData?.location || lastKnownPollingUrl; + + // Update lastOperation result + currentOperation = { + args: pollingArgs, + spec: pollingSpec, + result + }; + + return currentOperation; + } + }; +} diff --git a/test/smoke/generated/cosmos-db-resource-manager/src/lro/lroPolicy.ts b/test/smoke/generated/cosmos-db-resource-manager/src/lro/lroPolicy.ts new file mode 100644 index 0000000000..0591f541b3 --- /dev/null +++ b/test/smoke/generated/cosmos-db-resource-manager/src/lro/lroPolicy.ts @@ -0,0 +1,43 @@ +/* + * 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 { + RequestPolicy, + RequestPolicyOptions, + BaseRequestPolicy, + HttpOperationResponse, + WebResource +} from "@azure/core-http"; +import { getLROData } from "./requestUtils"; + +export function lroPolicy() { + return { + create: (nextPolicy: RequestPolicy, options: RequestPolicyOptions) => { + return new LROPolicy(nextPolicy, options); + } + }; +} + +class LROPolicy extends BaseRequestPolicy { + constructor(nextPolicy: RequestPolicy, options: RequestPolicyOptions) { + super(nextPolicy, options); + } + + public async sendRequest( + webResource: WebResource + ): Promise { + let result = await this._nextPolicy.sendRequest(webResource); + + if (webResource.shouldDeserialize !== undefined) { + const _lroData = getLROData(result); + result.parsedBody = { ...result.parsedBody, _lroData }; + } + + return result; + } +} diff --git a/test/smoke/generated/cosmos-db-resource-manager/src/lro/lroPoller.ts b/test/smoke/generated/cosmos-db-resource-manager/src/lro/lroPoller.ts new file mode 100644 index 0000000000..bc2f2aa05a --- /dev/null +++ b/test/smoke/generated/cosmos-db-resource-manager/src/lro/lroPoller.ts @@ -0,0 +1,154 @@ +/* + * 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 { Poller } from "@azure/core-lro"; +import { + OperationSpec, + OperationArguments, + delay, + RestError +} from "@azure/core-http"; +import { + BaseResult, + LROOperationState, + LROOperationStep, + FinalStateVia +} from "./models"; +import { makeOperation } from "./operation"; +import { createBodyPollingStrategy } from "./bodyPollingStrategy"; +import { createAzureAsyncOperationStrategy } from "./azureAsyncOperationStrategy"; +import { createLocationStrategy } from "./locationStrategy"; +import { createPassthroughStrategy } from "./passthroughStrategy"; + +export type SendOperationFn = ( + args: OperationArguments, + spec: OperationSpec +) => Promise; + +export interface LROPollerOptions { + /** + * Defines how much time the poller is going to wait before making a new request to the service. + */ + intervalInMs?: number; + /** + * Arguments used to send the initial operation + */ + initialOperationArguments: OperationArguments; + /** + * Operation spec provided for the initial operation + */ + initialOperationSpec: OperationSpec; + /** + * Result from the initial operation + */ + initialOperationResult: TResult; + /** + * Function to execute an operation based on an operation spec and arguments + */ + sendOperation: SendOperationFn; + /** + * Optional information on where to poll. When not defined it defaults to "Location" + */ + finalStateVia?: FinalStateVia; +} + +export class LROPoller extends Poller< + LROOperationState, + TResult +> { + private intervalInMs: number; + + constructor({ + initialOperationArguments, + initialOperationResult, + initialOperationSpec, + sendOperation, + finalStateVia, + intervalInMs = 2000 + }: LROPollerOptions) { + const initialOperation = { + args: initialOperationArguments, + spec: initialOperationSpec, + result: initialOperationResult + }; + + const pollingStrategy = getPollingStrategy( + initialOperation, + sendOperation, + finalStateVia + ); + + const state: LROOperationState = { + // Initial operation will become the last operation + initialOperation, + lastOperation: initialOperation, + pollingStrategy, + finalStateVia + }; + + const operation = makeOperation(state); + super(operation); + + this.intervalInMs = intervalInMs; + } + + /** + * The method used by the poller to wait before attempting to update its operation. + */ + delay(): Promise { + return delay(this.intervalInMs); + } +} + +/** + * This function determines which strategy to use based on the response from + * the last operation executed, this last operation can be an initial operation + * or a polling operation. The 3 possible strategies are described below: + * + * A) Azure-AsyncOperation or Operation-Location + * B) Location + * C) BodyPolling (provisioningState) + * - This strategy is used when: + * - Response doesn't contain any of the following headers Location, Azure-AsyncOperation or Operation-Location + * - Last operation method is PUT + */ +function getPollingStrategy( + initialOperation: LROOperationStep, + sendOperationFn: SendOperationFn, + finalStateVia?: FinalStateVia +) { + const lroData = initialOperation.result._lroData; + + if (!lroData) { + const error = new RestError( + "Service response doesn't include the required LRO data to continue polling" + ); + error.statusCode = initialOperation.result._response.status; + error.response = initialOperation.result._response; + throw error; + } + + if (lroData.azureAsyncOperation || lroData.operationLocation) { + return createAzureAsyncOperationStrategy( + initialOperation, + sendOperationFn, + finalStateVia + ); + } + + if (lroData.location) { + return createLocationStrategy(initialOperation, sendOperationFn); + } + + if (["PUT", "PATCH"].includes(lroData.requestMethod || "")) { + return createBodyPollingStrategy(initialOperation, sendOperationFn); + } + + // Default strategy is just a passthrough returning the initial operation + return createPassthroughStrategy(initialOperation); +} diff --git a/test/smoke/generated/cosmos-db-resource-manager/src/lro/models.ts b/test/smoke/generated/cosmos-db-resource-manager/src/lro/models.ts new file mode 100644 index 0000000000..a90afc5b41 --- /dev/null +++ b/test/smoke/generated/cosmos-db-resource-manager/src/lro/models.ts @@ -0,0 +1,60 @@ +/* + * 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 { + OperationArguments, + OperationSpec, + RestResponse, + HttpMethods +} from "@azure/core-http"; +import { PollOperationState, PollOperation } from "@azure/core-lro"; + +export type FinalStateVia = + | "azure-async-operation" + | "location" + | "original-uri"; + +export interface LROResponseInfo { + requestMethod: HttpMethods; + statusCode: number; + isInitialRequest?: boolean; + azureAsyncOperation?: string; + operationLocation?: string; + location?: string; + provisioningState?: string; + status?: string; +} + +export interface BaseResult extends RestResponse { + _lroData?: LROResponseInfo; +} + +export interface LROOperationStep { + args: OperationArguments; + spec: OperationSpec; + result: TResult; +} + +export interface LROOperationState + extends PollOperationState { + lastOperation: LROOperationStep; + initialOperation: LROOperationStep; + pollingStrategy: LROStrategy; + finalStateVia?: FinalStateVia; +} + +export interface LROStrategy { + isTerminal: () => boolean; + sendFinalRequest: () => Promise>; + poll: () => Promise>; +} + +export type LROOperation = PollOperation< + LROOperationState, + TResult +>; diff --git a/test/smoke/generated/cosmos-db-resource-manager/src/lro/operation.ts b/test/smoke/generated/cosmos-db-resource-manager/src/lro/operation.ts new file mode 100644 index 0000000000..9cda560a02 --- /dev/null +++ b/test/smoke/generated/cosmos-db-resource-manager/src/lro/operation.ts @@ -0,0 +1,82 @@ +/* + * 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 { BaseResult, LROOperationState, LROOperation } from "./models"; + +/** + * Creates a copy of the operation from a given State + */ +export function makeOperation( + state: LROOperationState +): LROOperation { + return { + state: { ...state }, + update, + cancel, + toString: function(this: LROOperation) { + return JSON.stringify(this.state); + } + }; +} + +/** + * General update function for LROPoller, the general process is as follows + * 1. Check initial operation result to determine the strategy to use + * - Strategies: Location, Azure-AsyncOperation, Original Uri + * 2. Check if the operation result has a terminal state + * - Terminal state will be determined by each strategy + * 2.1 If it is terminal state Check if a final GET request is required, if so + * send final GET request and return result from operation. If no final GET + * is required, just return the result from operation. + * - Determining what to call for final request is responsibility of each strategy + * 2.2 If it is not terminal state, call the polling operation call it and go to step 1 + * - Determining what to call for polling is responsibility of each strategy + * - Strategies will always use the latest URI for polling if provided otherwise + * the last known one + */ +async function update( + this: LROOperation +): Promise> { + const state = { ...this.state }; + + const { sendFinalRequest, poll, isTerminal } = state.pollingStrategy; + const currentResponse = state.lastOperation; + const currentLroData = currentResponse.result._lroData; + + if (!currentLroData) { + throw new Error( + "Expected lroData to be defined for updating LRO operation" + ); + } + + if (state.result) { + state.isCompleted = true; + return makeOperation(state); + } + + // Check if last result is terminal + if (isTerminal()) { + state.lastOperation = await sendFinalRequest(); + state.result = state.lastOperation.result; + } else { + state.lastOperation = await poll(); + } + + // Return operation + return makeOperation(state); +} + +/** + * Swagger doesn't support defining a cancel operation, we'll just mark + * the operation state as cancelled + */ +async function cancel( + this: LROOperation +): Promise> { + return makeOperation({ ...this.state, isCancelled: true }); +} diff --git a/test/smoke/generated/cosmos-db-resource-manager/src/lro/passthroughStrategy.ts b/test/smoke/generated/cosmos-db-resource-manager/src/lro/passthroughStrategy.ts new file mode 100644 index 0000000000..23342c2e4e --- /dev/null +++ b/test/smoke/generated/cosmos-db-resource-manager/src/lro/passthroughStrategy.ts @@ -0,0 +1,30 @@ +/* + * 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 { LROStrategy, BaseResult, LROOperationStep } from "./models"; + +/** + * Creates a polling strategy based on BodyPolling which uses the provisioning state + * from the result to determine the current operation state + */ +export function createPassthroughStrategy( + initialOperation: LROOperationStep +): LROStrategy { + return { + isTerminal: () => { + return true; + }, + sendFinalRequest: () => { + // BodyPolling doesn't require a final get so return the lastOperation + return Promise.resolve(initialOperation); + }, + poll: async () => { + throw new Error("Passthrough strategy should never poll"); + } + }; +} diff --git a/test/smoke/generated/cosmos-db-resource-manager/src/lro/requestUtils.ts b/test/smoke/generated/cosmos-db-resource-manager/src/lro/requestUtils.ts new file mode 100644 index 0000000000..e9af4cde5e --- /dev/null +++ b/test/smoke/generated/cosmos-db-resource-manager/src/lro/requestUtils.ts @@ -0,0 +1,117 @@ +/* + * 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 { HttpOperationResponse } from "@azure/core-http"; +import { terminalStates } from "./constants"; +import { LROResponseInfo } from "./models"; + +/** + * We need to selectively deserialize our responses, only deserializing if we + * are in a final LRO response, not deserializing any polling non-terminal responses + */ +export function shouldDeserializeLRO(finalStateVia?: string) { + let initialOperationInfo: LROResponseInfo | undefined; + let isInitialRequest = true; + + return (response: HttpOperationResponse) => { + if (response.status < 200 || response.status >= 300) { + return true; + } + + if (!initialOperationInfo) { + initialOperationInfo = getLROData(response); + } else { + isInitialRequest = false; + } + + if ( + initialOperationInfo.azureAsyncOperation || + initialOperationInfo.operationLocation + ) { + return ( + !isInitialRequest && + isAsyncOperationFinalResponse( + response, + initialOperationInfo, + finalStateVia + ) + ); + } + + if (initialOperationInfo.location) { + return isLocationFinalResponse(response); + } + + if (initialOperationInfo.requestMethod === "PUT") { + return isBodyPollingFinalResponse(response); + } + + return true; + }; +} + +function isAsyncOperationFinalResponse( + response: HttpOperationResponse, + initialOperationInfo: LROResponseInfo, + finalStateVia?: string +): boolean { + const status: string = response.parsedBody?.status || "Succeeded"; + if (!terminalStates.includes(status.toLowerCase())) { + return false; + } + + if (initialOperationInfo.requestMethod === "DELETE") { + return true; + } + + if ( + initialOperationInfo.requestMethod === "PUT" && + finalStateVia && + finalStateVia.toLowerCase() === "azure-asyncoperation" + ) { + return true; + } + + if ( + initialOperationInfo.requestMethod !== "PUT" && + !initialOperationInfo.location + ) { + return true; + } + + return false; +} + +function isLocationFinalResponse(response: HttpOperationResponse): boolean { + return response.status !== 202; +} + +function isBodyPollingFinalResponse(response: HttpOperationResponse): boolean { + const provisioningState: string = + response.parsedBody?.properties?.provisioningState || "Succeeded"; + + if (terminalStates.includes(provisioningState.toLowerCase())) { + return true; + } + + return false; +} + +export function getLROData(result: HttpOperationResponse): LROResponseInfo { + const statusCode = result.status; + const { status, properties } = result.parsedBody || {}; + return { + statusCode, + azureAsyncOperation: result.headers.get("azure-asyncoperation"), + operationLocation: result.headers.get("operation-location"), + location: result.headers.get("location"), + requestMethod: result.request.method, + status, + provisioningState: properties?.provisioningState + }; +} diff --git a/test/smoke/generated/cosmos-db-resource-manager/src/models/index.ts b/test/smoke/generated/cosmos-db-resource-manager/src/models/index.ts new file mode 100644 index 0000000000..567907d462 --- /dev/null +++ b/test/smoke/generated/cosmos-db-resource-manager/src/models/index.ts @@ -0,0 +1,4038 @@ +/* + * 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 * as coreHttp from "@azure/core-http"; + +/** + * The core properties of ARM resources. + */ +export interface ARMResourceProperties { + /** + * The unique resource identifier of the ARM resource. + */ + readonly id?: string; + /** + * The name of the ARM resource. + */ + readonly name?: string; + /** + * The type of Azure resource. + */ + readonly type?: string; + /** + * The location of the resource group to which the resource belongs. + */ + location?: string; + /** + * Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + */ + tags?: { [propertyName: string]: string }; +} + +/** + * An Azure Cosmos DB database account. + */ +export type DatabaseAccountGetResults = ARMResourceProperties & { + /** + * Indicates the type of database account. This can only be set at database account creation. + */ + kind?: DatabaseAccountKind; + /** + * The status of the Cosmos DB account at the time the operation was called. The status can be one of following. 'Creating' – the Cosmos DB account is being created. When an account is in Creating state, only properties that are specified as input for the Create Cosmos DB account operation are returned. 'Succeeded' – the Cosmos DB account is active for use. 'Updating' – the Cosmos DB account is being updated. 'Deleting' – the Cosmos DB account is being deleted. 'Failed' – the Cosmos DB account failed creation. 'DeletionFailed' – the Cosmos DB account deletion failed. + */ + readonly provisioningState?: string; + /** + * The connection endpoint for the Cosmos DB database account. + */ + readonly documentEndpoint?: string; + /** + * The offer type for the Cosmos DB database account. Default value: Standard. + */ + readonly databaseAccountOfferType?: "Standard"; + /** + * Cosmos DB Firewall Support: This value specifies the set of IP addresses or IP address ranges in CIDR form to be included as the allowed list of client IPs for a given database account. IP addresses/ranges must be comma separated and must not contain any spaces. + */ + ipRangeFilter?: string; + /** + * Flag to indicate whether to enable/disable Virtual Network ACL rules. + */ + isVirtualNetworkFilterEnabled?: boolean; + /** + * Enables automatic failover of the write region in the rare event that the region is unavailable due to an outage. Automatic failover will result in a new write region for the account and is chosen based on the failover priorities configured for the account. + */ + enableAutomaticFailover?: boolean; + /** + * The consistency policy for the Cosmos DB database account. + */ + consistencyPolicy?: ConsistencyPolicy; + /** + * List of Cosmos DB capabilities for the account + */ + capabilities?: Capability[]; + /** + * An array that contains the write location for the Cosmos DB account. + */ + readonly writeLocations?: Location[]; + /** + * An array that contains of the read locations enabled for the Cosmos DB account. + */ + readonly readLocations?: Location[]; + /** + * An array that contains all of the locations enabled for the Cosmos DB account. + */ + readonly locations?: Location[]; + /** + * An array that contains the regions ordered by their failover priorities. + */ + readonly failoverPolicies?: FailoverPolicy[]; + /** + * List of Virtual Network ACL rules configured for the Cosmos DB account. + */ + virtualNetworkRules?: VirtualNetworkRule[]; + /** + * List of Private Endpoint Connections configured for the Cosmos DB account. + */ + readonly privateEndpointConnections?: PrivateEndpointConnection[]; + /** + * Enables the account to write in multiple locations + */ + enableMultipleWriteLocations?: boolean; + /** + * Enables the cassandra connector on the Cosmos DB C* account + */ + enableCassandraConnector?: boolean; + /** + * The cassandra connector offer type for the Cosmos DB database C* account. + */ + connectorOffer?: "Small"; + /** + * Disable write operations on metadata resources (databases, containers, throughput) via account keys + */ + disableKeyBasedMetadataWriteAccess?: boolean; + /** + * The URI of the key vault + */ + keyVaultKeyUri?: string; + /** + * Whether requests from Public Network are allowed + */ + readonly publicNetworkAccess?: PublicNetworkAccess; +}; + +/** + * The consistency policy for the Cosmos DB database account. + */ +export interface ConsistencyPolicy { + /** + * The default consistency level and configuration settings of the Cosmos DB account. + */ + defaultConsistencyLevel: DefaultConsistencyLevel; + /** + * When used with the Bounded Staleness consistency level, this value represents the number of stale requests tolerated. Accepted range for this value is 1 – 2,147,483,647. Required when defaultConsistencyPolicy is set to 'BoundedStaleness'. + */ + maxStalenessPrefix?: number; + /** + * When used with the Bounded Staleness consistency level, this value represents the time amount of staleness (in seconds) tolerated. Accepted range for this value is 5 - 86400. Required when defaultConsistencyPolicy is set to 'BoundedStaleness'. + */ + maxIntervalInSeconds?: number; +} + +/** + * Cosmos DB capability object + */ +export interface Capability { + /** + * Name of the Cosmos DB capability. For example, "name": "EnableCassandra". Current values also include "EnableTable" and "EnableGremlin". + */ + name?: string; +} + +/** + * A region in which the Azure Cosmos DB database account is deployed. + */ +export interface Location { + /** + * The unique identifier of the region within the database account. Example: <accountName>-<locationName>. + */ + readonly id?: string; + /** + * The name of the region. + */ + locationName?: string; + /** + * The connection endpoint for the specific region. Example: https://<accountName>-<locationName>.documents.azure.com:443/ + */ + readonly documentEndpoint?: string; + /** + * The status of the Cosmos DB account at the time the operation was called. The status can be one of following. 'Creating' – the Cosmos DB account is being created. When an account is in Creating state, only properties that are specified as input for the Create Cosmos DB account operation are returned. 'Succeeded' – the Cosmos DB account is active for use. 'Updating' – the Cosmos DB account is being updated. 'Deleting' – the Cosmos DB account is being deleted. 'Failed' – the Cosmos DB account failed creation. 'DeletionFailed' – the Cosmos DB account deletion failed. + */ + readonly provisioningState?: string; + /** + * The failover priority of the region. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. + */ + failoverPriority?: number; + /** + * Flag to indicate whether or not this region is an AvailabilityZone region + */ + isZoneRedundant?: boolean; +} + +/** + * The failover policy for a given region of a database account. + */ +export interface FailoverPolicy { + /** + * The unique identifier of the region in which the database account replicates to. Example: <accountName>-<locationName>. + */ + readonly id?: string; + /** + * The name of the region in which the database account exists. + */ + locationName?: string; + /** + * The failover priority of the region. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. + */ + failoverPriority?: number; +} + +/** + * Virtual Network ACL Rule object + */ +export interface VirtualNetworkRule { + /** + * Resource ID of a subnet, for example: /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + */ + id?: string; + /** + * Create firewall rule before the virtual network has vnet service endpoint enabled. + */ + ignoreMissingVNetServiceEndpoint?: boolean; +} + +export interface Resource { + /** + * Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + */ + readonly id?: string; + /** + * The name of the resource + */ + readonly name?: string; + /** + * The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + */ + readonly type?: string; +} + +/** + * A private endpoint connection + */ +export type PrivateEndpointConnection = Resource & { + /** + * Private endpoint which the connection belongs to. + */ + privateEndpoint?: PrivateEndpointProperty; + /** + * Connection State of the Private Endpoint Connection. + */ + privateLinkServiceConnectionState?: PrivateLinkServiceConnectionStateProperty; +}; + +/** + * Private endpoint which the connection belongs to. + */ +export interface PrivateEndpointProperty { + /** + * Resource id of the private endpoint. + */ + id?: string; +} + +/** + * Connection State of the Private Endpoint Connection. + */ +export interface PrivateLinkServiceConnectionStateProperty { + /** + * The private link service connection status. + */ + status?: string; + /** + * Any action that is required beyond basic workflow (approve/ reject/ disconnect) + */ + readonly actionsRequired?: string; +} + +/** + * Parameters for patching Azure Cosmos DB database account properties. + */ +export interface DatabaseAccountUpdateParameters { + /** + * Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + */ + tags?: { [propertyName: string]: string }; + /** + * The location of the resource group to which the resource belongs. + */ + location?: string; + /** + * The consistency policy for the Cosmos DB account. + */ + consistencyPolicy?: ConsistencyPolicy; + /** + * An array that contains the georeplication locations enabled for the Cosmos DB account. + */ + locations?: Location[]; + /** + * Cosmos DB Firewall Support: This value specifies the set of IP addresses or IP address ranges in CIDR form to be included as the allowed list of client IPs for a given database account. IP addresses/ranges must be comma separated and must not contain any spaces. + */ + ipRangeFilter?: string; + /** + * Flag to indicate whether to enable/disable Virtual Network ACL rules. + */ + isVirtualNetworkFilterEnabled?: boolean; + /** + * Enables automatic failover of the write region in the rare event that the region is unavailable due to an outage. Automatic failover will result in a new write region for the account and is chosen based on the failover priorities configured for the account. + */ + enableAutomaticFailover?: boolean; + /** + * List of Cosmos DB capabilities for the account + */ + capabilities?: Capability[]; + /** + * List of Virtual Network ACL rules configured for the Cosmos DB account. + */ + virtualNetworkRules?: VirtualNetworkRule[]; + /** + * Enables the account to write in multiple locations + */ + enableMultipleWriteLocations?: boolean; + /** + * Enables the cassandra connector on the Cosmos DB C* account + */ + enableCassandraConnector?: boolean; + /** + * The cassandra connector offer type for the Cosmos DB database C* account. + */ + connectorOffer?: "Small"; + /** + * Disable write operations on metadata resources (databases, containers, throughput) via account keys + */ + disableKeyBasedMetadataWriteAccess?: boolean; + /** + * The URI of the key vault + */ + keyVaultKeyUri?: string; + /** + * Whether requests from Public Network are allowed + */ + readonly publicNetworkAccess?: PublicNetworkAccess; +} + +/** + * Parameters to create and update Cosmos DB database accounts. + */ +export type DatabaseAccountCreateUpdateParameters = ARMResourceProperties & { + /** + * Indicates the type of database account. This can only be set at database account creation. + */ + kind?: DatabaseAccountKind; + /** + * The consistency policy for the Cosmos DB account. + */ + consistencyPolicy?: ConsistencyPolicy; + /** + * An array that contains the georeplication locations enabled for the Cosmos DB account. + */ + locations: Location[]; + /** + * The offer type for the database + */ + databaseAccountOfferType: "Standard"; + /** + * Cosmos DB Firewall Support: This value specifies the set of IP addresses or IP address ranges in CIDR form to be included as the allowed list of client IPs for a given database account. IP addresses/ranges must be comma separated and must not contain any spaces. + */ + ipRangeFilter?: string; + /** + * Flag to indicate whether to enable/disable Virtual Network ACL rules. + */ + isVirtualNetworkFilterEnabled?: boolean; + /** + * Enables automatic failover of the write region in the rare event that the region is unavailable due to an outage. Automatic failover will result in a new write region for the account and is chosen based on the failover priorities configured for the account. + */ + enableAutomaticFailover?: boolean; + /** + * List of Cosmos DB capabilities for the account + */ + capabilities?: Capability[]; + /** + * List of Virtual Network ACL rules configured for the Cosmos DB account. + */ + virtualNetworkRules?: VirtualNetworkRule[]; + /** + * Enables the account to write in multiple locations + */ + enableMultipleWriteLocations?: boolean; + /** + * Enables the cassandra connector on the Cosmos DB C* account + */ + enableCassandraConnector?: boolean; + /** + * The cassandra connector offer type for the Cosmos DB database C* account. + */ + connectorOffer?: "Small"; + /** + * Disable write operations on metadata resources (databases, containers, throughput) via account keys + */ + disableKeyBasedMetadataWriteAccess?: boolean; + /** + * The URI of the key vault + */ + keyVaultKeyUri?: string; + /** + * Whether requests from Public Network are allowed + */ + readonly publicNetworkAccess?: PublicNetworkAccess; +}; + +/** + * The list of new failover policies for the failover priority change. + */ +export interface FailoverPolicies { + /** + * List of failover policies. + */ + failoverPolicies: FailoverPolicy[]; +} + +/** + * The List operation response, that contains the database accounts and their properties. + */ +export interface DatabaseAccountsListResult { + /** + * List of database account and their properties. + */ + readonly value?: DatabaseAccountGetResults[]; +} + +/** + * The read-only access keys for the given database account. + */ +export interface DatabaseAccountListReadOnlyKeysResult { + /** + * Base 64 encoded value of the primary read-only key. + */ + readonly primaryReadonlyMasterKey?: string; + /** + * Base 64 encoded value of the secondary read-only key. + */ + readonly secondaryReadonlyMasterKey?: string; +} + +/** + * The access keys for the given database account. + */ +export type DatabaseAccountListKeysResult = DatabaseAccountListReadOnlyKeysResult & { + /** + * Base 64 encoded value of the primary read-write key. + */ + readonly primaryMasterKey?: string; + /** + * Base 64 encoded value of the secondary read-write key. + */ + readonly secondaryMasterKey?: string; +}; + +/** + * The connection strings for the given database account. + */ +export interface DatabaseAccountListConnectionStringsResult { + /** + * An array that contains the connection strings for the Cosmos DB account. + */ + connectionStrings?: DatabaseAccountConnectionString[]; +} + +/** + * Connection string for the Cosmos DB account + */ +export interface DatabaseAccountConnectionString { + /** + * Value of the connection string + */ + readonly connectionString?: string; + /** + * Description of the connection string + */ + readonly description?: string; +} + +/** + * Cosmos DB region to online or offline. + */ +export interface RegionForOnlineOffline { + /** + * Cosmos DB region, with spaces between words and each word capitalized. + */ + region: string; +} + +/** + * Error Response. + */ +export interface ErrorResponse { + /** + * Error code. + */ + code?: string; + /** + * Error message indicating why the operation failed. + */ + message?: string; +} + +/** + * Parameters to regenerate the keys within the database account. + */ +export interface DatabaseAccountRegenerateKeyParameters { + /** + * The access key to regenerate. + */ + keyKind: KeyKind; +} + +/** + * Result of the request to list Resource Provider operations. It contains a list of operations and a URL link to get the next set of results. + */ +export interface OperationListResult { + /** + * List of operations supported by the Resource Provider. + */ + value?: Operation[]; + /** + * URL to get the next set of operation list results if there are any. + */ + nextLink?: string; +} + +/** + * REST API operation + */ +export interface Operation { + /** + * Operation name: {provider}/{resource}/{operation} + */ + name?: string; + /** + * The object that represents the operation. + */ + display?: OperationDisplay; +} + +/** + * The object that represents the operation. + */ +export interface OperationDisplay { + /** + * Service provider: Microsoft.ResourceProvider + */ + provider?: string; + /** + * Resource on which the operation is performed: Profile, endpoint, etc. + */ + resource?: string; + /** + * Operation type: Read, write, delete, etc. + */ + operation?: string; + /** + * Description of operation + */ + description?: string; +} + +/** + * The response to a list metrics request. + */ +export interface MetricListResult { + /** + * The list of metrics for the account. + */ + readonly value?: Metric[]; +} + +/** + * Metric data + */ +export interface Metric { + /** + * The start time for the metric (ISO-8601 format). + */ + readonly startTime?: Date; + /** + * The end time for the metric (ISO-8601 format). + */ + readonly endTime?: Date; + /** + * The time grain to be used to summarize the metric values. + */ + readonly timeGrain?: string; + /** + * The unit of the metric. + */ + readonly unit?: UnitType; + /** + * The name information for the metric. + */ + readonly name?: MetricName; + /** + * The metric values for the specified time window and timestep. + */ + readonly metricValues?: MetricValue[]; +} + +/** + * A metric name. + */ +export interface MetricName { + /** + * The name of the metric. + */ + readonly value?: string; + /** + * The friendly name of the metric. + */ + readonly localizedValue?: string; +} + +/** + * Represents metrics values. + */ +export interface MetricValue { + /** + * The number of values for the metric. + */ + readonly count?: number; + /** + * The average value of the metric. + */ + readonly average?: number; + /** + * The max value of the metric. + */ + readonly maximum?: number; + /** + * The min value of the metric. + */ + readonly minimum?: number; + /** + * The metric timestamp (ISO-8601 format). + */ + readonly timestamp?: Date; + /** + * The total value of the metric. + */ + readonly total?: number; +} + +/** + * The response to a list percentile metrics request. + */ +export interface PercentileMetricListResult { + /** + * The list of percentile metrics for the account. + */ + readonly value?: PercentileMetric[]; +} + +/** + * Percentile Metric data + */ +export interface PercentileMetric { + /** + * The start time for the metric (ISO-8601 format). + */ + readonly startTime?: Date; + /** + * The end time for the metric (ISO-8601 format). + */ + readonly endTime?: Date; + /** + * The time grain to be used to summarize the metric values. + */ + readonly timeGrain?: string; + /** + * The unit of the metric. + */ + readonly unit?: UnitType; + /** + * The name information for the metric. + */ + readonly name?: MetricName; + /** + * The percentile metric values for the specified time window and timestep. + */ + readonly metricValues?: PercentileMetricValue[]; +} + +/** + * Represents percentile metrics values. + */ +export type PercentileMetricValue = MetricValue & { + /** + * The 10th percentile value for the metric. + */ + readonly p10?: number; + /** + * The 25th percentile value for the metric. + */ + readonly p25?: number; + /** + * The 50th percentile value for the metric. + */ + readonly p50?: number; + /** + * The 75th percentile value for the metric. + */ + readonly p75?: number; + /** + * The 90th percentile value for the metric. + */ + readonly p90?: number; + /** + * The 95th percentile value for the metric. + */ + readonly p95?: number; + /** + * The 99th percentile value for the metric. + */ + readonly p99?: number; +}; + +/** + * The response to a list partition metrics request. + */ +export interface PartitionMetricListResult { + /** + * The list of partition-level metrics for the account. + */ + readonly value?: PartitionMetric[]; +} + +/** + * The metric values for a single partition. + */ +export type PartitionMetric = Metric & { + /** + * The partition id (GUID identifier) of the metric values. + */ + readonly partitionId?: string; + /** + * The partition key range id (integer identifier) of the metric values. + */ + readonly partitionKeyRangeId?: string; +}; + +/** + * The response to a list usage request. + */ +export interface UsagesResult { + /** + * The list of usages for the database. A usage is a point in time metric + */ + readonly value?: Usage[]; +} + +/** + * The usage data for a usage request. + */ +export interface Usage { + /** + * The unit of the metric. + */ + readonly unit?: UnitType; + /** + * The name information for the metric. + */ + readonly name?: MetricName; + /** + * The quota period used to summarize the usage values. + */ + readonly quotaPeriod?: string; + /** + * Maximum value for this metric + */ + readonly limit?: number; + /** + * Current value for this metric + */ + readonly currentValue?: number; +} + +/** + * The response to a list partition level usage request. + */ +export interface PartitionUsagesResult { + /** + * The list of partition-level usages for the database. A usage is a point in time metric + */ + readonly value?: PartitionUsage[]; +} + +/** + * The partition level usage data for a usage request. + */ +export type PartitionUsage = Usage & { + /** + * The partition id (GUID identifier) of the usages. + */ + readonly partitionId?: string; + /** + * The partition key range id (integer identifier) of the usages. + */ + readonly partitionKeyRangeId?: string; +}; + +/** + * The response to a list metric definitions request. + */ +export interface MetricDefinitionsListResult { + /** + * The list of metric definitions for the account. + */ + readonly value?: MetricDefinition[]; +} + +/** + * The definition of a metric. + */ +export interface MetricDefinition { + /** + * The list of metric availabilities for the account. + */ + readonly metricAvailabilities?: MetricAvailability[]; + /** + * The primary aggregation type of the metric. + */ + readonly primaryAggregationType?: PrimaryAggregationType; + /** + * The unit of the metric. + */ + readonly unit?: UnitType; + /** + * The resource uri of the database. + */ + readonly resourceUri?: string; + /** + * The name information for the metric. + */ + readonly name?: MetricName; +} + +/** + * The availability of the metric. + */ +export interface MetricAvailability { + /** + * The time grain to be used to summarize the metric values. + */ + readonly timeGrain?: string; + /** + * The retention for the metric values. + */ + readonly retention?: string; +} + +/** + * The List operation response, that contains the SQL databases and their properties. + */ +export interface SqlDatabaseListResult { + /** + * List of SQL databases and their properties. + */ + readonly value?: SqlDatabaseGetResults[]; +} + +/** + * An Azure Cosmos DB SQL database. + */ +export type SqlDatabaseGetResults = ARMResourceProperties & { + resource?: SqlDatabaseGetPropertiesResource; + /** + * Cosmos DB options resource object + */ + options?: OptionsResource; +}; + +/** + * Cosmos DB SQL database resource object + */ +export interface SqlDatabaseResource { + /** + * Name of the Cosmos DB SQL database + */ + id: string; +} + +/** + * The system generated resource properties associated with SQL databases, SQL containers, Gremlin databases and Gremlin graphs. + */ +export interface ExtendedResourceProperties { + /** + * A system generated property. A unique identifier. + */ + readonly rid?: string; + /** + * A system generated property that denotes the last updated timestamp of the resource. + */ + readonly ts?: any; + /** + * A system generated property representing the resource etag required for optimistic concurrency control. + */ + readonly etag?: string; +} + +export type SqlDatabaseGetPropertiesResource = SqlDatabaseResource & + ExtendedResourceProperties & { + /** + * A system generated property that specified the addressable path of the collections resource. + */ + colls?: string; + /** + * A system generated property that specifies the addressable path of the users resource. + */ + users?: string; + }; + +/** + * Cosmos DB options resource object + */ +export interface OptionsResource { + /** + * Value of the Cosmos DB resource throughput. Use the ThroughputSetting resource when retrieving offer details. + */ + throughput?: number; +} + +/** + * Parameters to create and update Cosmos DB SQL database. + */ +export type SqlDatabaseCreateUpdateParameters = ARMResourceProperties & { + /** + * The standard JSON format of a SQL database + */ + resource: SqlDatabaseResource; + /** + * A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + */ + options: CreateUpdateOptions; +}; + +/** + * CreateUpdateOptions are a list of key-value pairs that describe the resource. Supported keys are "If-Match", "If-None-Match", "Session-Token" and "Throughput" + */ +export interface CreateUpdateOptions { + /** + * Describes unknown properties. The value of an unknown property can be of "any" type. + */ + [property: string]: any; + /** + * Request Units per second. For example, "throughput": "10000". + */ + throughput?: string; +} + +/** + * An Azure Cosmos DB resource throughput. + */ +export type ThroughputSettingsGetResults = ARMResourceProperties & { + resource?: ThroughputSettingsGetPropertiesResource; +}; + +/** + * Cosmos DB resource throughput object. Either throughput is required or provisionedThroughputSettings is required, but not both. + */ +export interface ThroughputSettingsResource { + /** + * Value of the Cosmos DB resource throughput. Either throughput is required or provisionedThroughputSettings is required, but not both. + */ + throughput?: number; + /** + * Cosmos DB resource for provisioned throughput settings. Either throughput is required or provisionedThroughputSettings is required, but not both. + */ + provisionedThroughputSettings?: ProvisionedThroughputSettingsResource; + /** + * The minimum throughput of the resource + */ + readonly minimumThroughput?: string; + /** + * The throughput replace is pending + */ + readonly offerReplacePending?: string; +} + +/** + * Cosmos DB provisioned throughput settings object + */ +export interface ProvisionedThroughputSettingsResource { + /** + * Represents maximum throughput container can scale up to. + */ + maxThroughput: number; + /** + * Cosmos DB resource auto-upgrade policy + */ + autoUpgradePolicy?: AutoUpgradePolicyResource; + /** + * Represents target maximum throughput container can scale up to once offer is no longer in pending state. + */ + readonly targetMaxThroughput?: number; +} + +/** + * Cosmos DB resource auto-upgrade policy + */ +export interface AutoUpgradePolicyResource { + /** + * Represents throughput policy which service must adhere to for auto-upgrade + */ + throughputPolicy?: ThroughputPolicyResource; +} + +/** + * Cosmos DB resource throughput policy + */ +export interface ThroughputPolicyResource { + /** + * Determines whether the ThroughputPolicy is active or not + */ + isEnabled?: boolean; + /** + * Represents the percentage by which throughput can increase every time throughput policy kicks in. + */ + incrementPercent?: number; +} + +export type ThroughputSettingsGetPropertiesResource = ThroughputSettingsResource & + ExtendedResourceProperties & {}; + +/** + * Parameters to update Cosmos DB resource throughput. + */ +export type ThroughputSettingsUpdateParameters = ARMResourceProperties & { + /** + * The standard JSON format of a resource throughput + */ + resource: ThroughputSettingsResource; +}; + +/** + * The List operation response, that contains the containers and their properties. + */ +export interface SqlContainerListResult { + /** + * List of containers and their properties. + */ + readonly value?: SqlContainerGetResults[]; +} + +/** + * An Azure Cosmos DB container. + */ +export type SqlContainerGetResults = ARMResourceProperties & { + resource?: SqlContainerGetPropertiesResource; + /** + * Cosmos DB options resource object + */ + options?: OptionsResource; +}; + +/** + * Cosmos DB SQL container resource object + */ +export interface SqlContainerResource { + /** + * Name of the Cosmos DB SQL container + */ + id: string; + /** + * The configuration of the indexing policy. By default, the indexing is automatic for all document paths within the container + */ + indexingPolicy?: IndexingPolicy; + /** + * The configuration of the partition key to be used for partitioning data into multiple partitions + */ + partitionKey?: ContainerPartitionKey; + /** + * Default time to live + */ + defaultTtl?: number; + /** + * The unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service. + */ + uniqueKeyPolicy?: UniqueKeyPolicy; + /** + * The conflict resolution policy for the container. + */ + conflictResolutionPolicy?: ConflictResolutionPolicy; +} + +/** + * Cosmos DB indexing policy + */ +export interface IndexingPolicy { + /** + * Indicates if the indexing policy is automatic + */ + automatic?: boolean; + /** + * Indicates the indexing mode. + */ + indexingMode?: IndexingMode; + /** + * List of paths to include in the indexing + */ + includedPaths?: IncludedPath[]; + /** + * List of paths to exclude from indexing + */ + excludedPaths?: ExcludedPath[]; + /** + * List of composite path list + */ + compositeIndexes?: CompositePath[][]; + /** + * List of spatial specifics + */ + spatialIndexes?: SpatialSpec[]; +} + +/** + * The paths that are included in indexing + */ +export interface IncludedPath { + /** + * The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*) + */ + path?: string; + /** + * List of indexes for this path + */ + indexes?: Indexes[]; +} + +/** + * The indexes for the path. + */ +export interface Indexes { + /** + * The datatype for which the indexing behavior is applied to. + */ + dataType?: DataType; + /** + * The precision of the index. -1 is maximum precision. + */ + precision?: number; + /** + * Indicates the type of index. + */ + kind?: IndexKind; +} + +export interface ExcludedPath { + /** + * The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*) + */ + path?: string; +} + +export interface CompositePath { + /** + * The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*) + */ + path?: string; + /** + * Sort order for composite paths. + */ + order?: CompositePathSortOrder; +} + +export interface SpatialSpec { + /** + * The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*) + */ + path?: string; + /** + * List of path's spatial type + */ + types?: SpatialType[]; +} + +/** + * The configuration of the partition key to be used for partitioning data into multiple partitions + */ +export interface ContainerPartitionKey { + /** + * List of paths using which data within the container can be partitioned + */ + paths?: string[]; + /** + * Indicates the kind of algorithm used for partitioning + */ + kind?: PartitionKind; + /** + * Indicates the version of the partition key definition + */ + version?: number; +} + +/** + * The unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service. + */ +export interface UniqueKeyPolicy { + /** + * List of unique keys on that enforces uniqueness constraint on documents in the collection in the Azure Cosmos DB service. + */ + uniqueKeys?: UniqueKey[]; +} + +/** + * The unique key on that enforces uniqueness constraint on documents in the collection in the Azure Cosmos DB service. + */ +export interface UniqueKey { + /** + * List of paths must be unique for each document in the Azure Cosmos DB service + */ + paths?: string[]; +} + +/** + * The conflict resolution policy for the container. + */ +export interface ConflictResolutionPolicy { + /** + * Indicates the conflict resolution mode. + */ + mode?: ConflictResolutionMode; + /** + * The conflict resolution path in the case of LastWriterWins mode. + */ + conflictResolutionPath?: string; + /** + * The procedure to resolve conflicts in the case of custom mode. + */ + conflictResolutionProcedure?: string; +} + +export type SqlContainerGetPropertiesResource = SqlContainerResource & + ExtendedResourceProperties & {}; + +/** + * Parameters to create and update Cosmos DB container. + */ +export type SqlContainerCreateUpdateParameters = ARMResourceProperties & { + /** + * The standard JSON format of a container + */ + resource: SqlContainerResource; + /** + * A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + */ + options: CreateUpdateOptions; +}; + +/** + * The List operation response, that contains the storedProcedures and their properties. + */ +export interface SqlStoredProcedureListResult { + /** + * List of storedProcedures and their properties. + */ + readonly value?: SqlStoredProcedureGetResults[]; +} + +/** + * An Azure Cosmos DB storedProcedure. + */ +export type SqlStoredProcedureGetResults = ARMResourceProperties & { + resource?: SqlStoredProcedureGetPropertiesResource; +}; + +/** + * Cosmos DB SQL storedProcedure resource object + */ +export interface SqlStoredProcedureResource { + /** + * Name of the Cosmos DB SQL storedProcedure + */ + id: string; + /** + * Body of the Stored Procedure + */ + body?: string; +} + +export type SqlStoredProcedureGetPropertiesResource = SqlStoredProcedureResource & + ExtendedResourceProperties & {}; + +/** + * Parameters to create and update Cosmos DB storedProcedure. + */ +export type SqlStoredProcedureCreateUpdateParameters = ARMResourceProperties & { + /** + * The standard JSON format of a storedProcedure + */ + resource: SqlStoredProcedureResource; + /** + * A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + */ + options: CreateUpdateOptions; +}; + +/** + * The List operation response, that contains the userDefinedFunctions and their properties. + */ +export interface SqlUserDefinedFunctionListResult { + /** + * List of userDefinedFunctions and their properties. + */ + readonly value?: SqlUserDefinedFunctionGetResults[]; +} + +/** + * An Azure Cosmos DB userDefinedFunction. + */ +export type SqlUserDefinedFunctionGetResults = ARMResourceProperties & { + resource?: SqlUserDefinedFunctionGetPropertiesResource; +}; + +/** + * Cosmos DB SQL userDefinedFunction resource object + */ +export interface SqlUserDefinedFunctionResource { + /** + * Name of the Cosmos DB SQL userDefinedFunction + */ + id: string; + /** + * Body of the User Defined Function + */ + body?: string; +} + +export type SqlUserDefinedFunctionGetPropertiesResource = SqlUserDefinedFunctionResource & + ExtendedResourceProperties & {}; + +/** + * Parameters to create and update Cosmos DB userDefinedFunction. + */ +export type SqlUserDefinedFunctionCreateUpdateParameters = ARMResourceProperties & { + /** + * The standard JSON format of a userDefinedFunction + */ + resource: SqlUserDefinedFunctionResource; + /** + * A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + */ + options: CreateUpdateOptions; +}; + +/** + * The List operation response, that contains the triggers and their properties. + */ +export interface SqlTriggerListResult { + /** + * List of triggers and their properties. + */ + readonly value?: SqlTriggerGetResults[]; +} + +/** + * An Azure Cosmos DB trigger. + */ +export type SqlTriggerGetResults = ARMResourceProperties & { + resource?: SqlTriggerGetPropertiesResource; +}; + +/** + * Cosmos DB SQL trigger resource object + */ +export interface SqlTriggerResource { + /** + * Name of the Cosmos DB SQL trigger + */ + id: string; + /** + * Body of the Trigger + */ + body?: string; + /** + * Type of the Trigger + */ + triggerType?: TriggerType; + /** + * The operation the trigger is associated with + */ + triggerOperation?: TriggerOperation; +} + +export type SqlTriggerGetPropertiesResource = SqlTriggerResource & + ExtendedResourceProperties & {}; + +/** + * Parameters to create and update Cosmos DB trigger. + */ +export type SqlTriggerCreateUpdateParameters = ARMResourceProperties & { + /** + * The standard JSON format of a trigger + */ + resource: SqlTriggerResource; + /** + * A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + */ + options: CreateUpdateOptions; +}; + +/** + * The List operation response, that contains the MongoDB databases and their properties. + */ +export interface MongoDBDatabaseListResult { + /** + * List of MongoDB databases and their properties. + */ + readonly value?: MongoDBDatabaseGetResults[]; +} + +/** + * An Azure Cosmos DB MongoDB database. + */ +export type MongoDBDatabaseGetResults = ARMResourceProperties & { + resource?: MongoDBDatabaseGetPropertiesResource; + /** + * Cosmos DB options resource object + */ + options?: OptionsResource; +}; + +/** + * Cosmos DB MongoDB database resource object + */ +export interface MongoDBDatabaseResource { + /** + * Name of the Cosmos DB MongoDB database + */ + id: string; +} + +export type MongoDBDatabaseGetPropertiesResource = MongoDBDatabaseResource & + ExtendedResourceProperties & {}; + +/** + * Parameters to create and update Cosmos DB MongoDB database. + */ +export type MongoDBDatabaseCreateUpdateParameters = ARMResourceProperties & { + /** + * The standard JSON format of a MongoDB database + */ + resource: MongoDBDatabaseResource; + /** + * A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + */ + options: CreateUpdateOptions; +}; + +/** + * The List operation response, that contains the MongoDB collections and their properties. + */ +export interface MongoDBCollectionListResult { + /** + * List of MongoDB collections and their properties. + */ + readonly value?: MongoDBCollectionGetResults[]; +} + +/** + * An Azure Cosmos DB MongoDB collection. + */ +export type MongoDBCollectionGetResults = ARMResourceProperties & { + resource?: MongoDBCollectionGetPropertiesResource; + /** + * Cosmos DB options resource object + */ + options?: OptionsResource; +}; + +/** + * Cosmos DB MongoDB collection resource object + */ +export interface MongoDBCollectionResource { + /** + * Name of the Cosmos DB MongoDB collection + */ + id: string; + /** + * A key-value pair of shard keys to be applied for the request. + */ + shardKey?: { [propertyName: string]: string }; + /** + * List of index keys + */ + indexes?: MongoIndex[]; +} + +/** + * Cosmos DB MongoDB collection index key + */ +export interface MongoIndex { + /** + * Cosmos DB MongoDB collection index keys + */ + key?: MongoIndexKeys; + /** + * Cosmos DB MongoDB collection index key options + */ + options?: MongoIndexOptions; +} + +/** + * Cosmos DB MongoDB collection resource object + */ +export interface MongoIndexKeys { + /** + * List of keys for each MongoDB collection in the Azure Cosmos DB service + */ + keys?: string[]; +} + +/** + * Cosmos DB MongoDB collection index options + */ +export interface MongoIndexOptions { + /** + * Expire after seconds + */ + expireAfterSeconds?: number; + /** + * Is unique or not + */ + unique?: boolean; +} + +export type MongoDBCollectionGetPropertiesResource = MongoDBCollectionResource & + ExtendedResourceProperties & {}; + +/** + * Parameters to create and update Cosmos DB MongoDB collection. + */ +export type MongoDBCollectionCreateUpdateParameters = ARMResourceProperties & { + /** + * The standard JSON format of a MongoDB collection + */ + resource: MongoDBCollectionResource; + /** + * A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + */ + options: CreateUpdateOptions; +}; + +/** + * The List operation response, that contains the Table and their properties. + */ +export interface TableListResult { + /** + * List of Table and their properties. + */ + readonly value?: TableGetResults[]; +} + +/** + * An Azure Cosmos DB Table. + */ +export type TableGetResults = ARMResourceProperties & { + resource?: TableGetPropertiesResource; + /** + * Cosmos DB options resource object + */ + options?: OptionsResource; +}; + +/** + * Cosmos DB table resource object + */ +export interface TableResource { + /** + * Name of the Cosmos DB table + */ + id: string; +} + +export type TableGetPropertiesResource = TableResource & + ExtendedResourceProperties & {}; + +/** + * Parameters to create and update Cosmos DB Table. + */ +export type TableCreateUpdateParameters = ARMResourceProperties & { + /** + * The standard JSON format of a Table + */ + resource: TableResource; + /** + * A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + */ + options: CreateUpdateOptions; +}; + +/** + * The List operation response, that contains the Cassandra keyspaces and their properties. + */ +export interface CassandraKeyspaceListResult { + /** + * List of Cassandra keyspaces and their properties. + */ + readonly value?: CassandraKeyspaceGetResults[]; +} + +/** + * An Azure Cosmos DB Cassandra keyspace. + */ +export type CassandraKeyspaceGetResults = ARMResourceProperties & { + resource?: CassandraKeyspaceGetPropertiesResource; + /** + * Cosmos DB options resource object + */ + options?: OptionsResource; +}; + +/** + * Cosmos DB Cassandra keyspace resource object + */ +export interface CassandraKeyspaceResource { + /** + * Name of the Cosmos DB Cassandra keyspace + */ + id: string; +} + +export type CassandraKeyspaceGetPropertiesResource = CassandraKeyspaceResource & + ExtendedResourceProperties & {}; + +/** + * Parameters to create and update Cosmos DB Cassandra keyspace. + */ +export type CassandraKeyspaceCreateUpdateParameters = ARMResourceProperties & { + /** + * The standard JSON format of a Cassandra keyspace + */ + resource: CassandraKeyspaceResource; + /** + * A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + */ + options: CreateUpdateOptions; +}; + +/** + * The List operation response, that contains the Cassandra tables and their properties. + */ +export interface CassandraTableListResult { + /** + * List of Cassandra tables and their properties. + */ + readonly value?: CassandraTableGetResults[]; +} + +/** + * An Azure Cosmos DB Cassandra table. + */ +export type CassandraTableGetResults = ARMResourceProperties & { + resource?: CassandraTableGetPropertiesResource; + /** + * Cosmos DB options resource object + */ + options?: OptionsResource; +}; + +/** + * Cosmos DB Cassandra table resource object + */ +export interface CassandraTableResource { + /** + * Name of the Cosmos DB Cassandra table + */ + id: string; + /** + * Time to live of the Cosmos DB Cassandra table + */ + defaultTtl?: number; + /** + * Schema of the Cosmos DB Cassandra table + */ + schema?: CassandraSchema; +} + +/** + * Cosmos DB Cassandra table schema + */ +export interface CassandraSchema { + /** + * List of Cassandra table columns. + */ + columns?: Column[]; + /** + * List of partition key. + */ + partitionKeys?: CassandraPartitionKey[]; + /** + * List of cluster key. + */ + clusterKeys?: ClusterKey[]; +} + +/** + * Cosmos DB Cassandra table column + */ +export interface Column { + /** + * Name of the Cosmos DB Cassandra table column + */ + name?: string; + /** + * Type of the Cosmos DB Cassandra table column + */ + type?: string; +} + +/** + * Cosmos DB Cassandra table partition key + */ +export interface CassandraPartitionKey { + /** + * Name of the Cosmos DB Cassandra table partition key + */ + name?: string; +} + +/** + * Cosmos DB Cassandra table cluster key + */ +export interface ClusterKey { + /** + * Name of the Cosmos DB Cassandra table cluster key + */ + name?: string; + /** + * Order of the Cosmos DB Cassandra table cluster key, only support "Asc" and "Desc" + */ + orderBy?: string; +} + +export type CassandraTableGetPropertiesResource = CassandraTableResource & + ExtendedResourceProperties & {}; + +/** + * Parameters to create and update Cosmos DB Cassandra table. + */ +export type CassandraTableCreateUpdateParameters = ARMResourceProperties & { + /** + * The standard JSON format of a Cassandra table + */ + resource: CassandraTableResource; + /** + * A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + */ + options: CreateUpdateOptions; +}; + +/** + * The List operation response, that contains the Gremlin databases and their properties. + */ +export interface GremlinDatabaseListResult { + /** + * List of Gremlin databases and their properties. + */ + readonly value?: GremlinDatabaseGetResults[]; +} + +/** + * An Azure Cosmos DB Gremlin database. + */ +export type GremlinDatabaseGetResults = ARMResourceProperties & { + resource?: GremlinDatabaseGetPropertiesResource; + /** + * Cosmos DB options resource object + */ + options?: OptionsResource; +}; + +/** + * Cosmos DB Gremlin database resource object + */ +export interface GremlinDatabaseResource { + /** + * Name of the Cosmos DB Gremlin database + */ + id: string; +} + +export type GremlinDatabaseGetPropertiesResource = GremlinDatabaseResource & + ExtendedResourceProperties & {}; + +/** + * Parameters to create and update Cosmos DB Gremlin database. + */ +export type GremlinDatabaseCreateUpdateParameters = ARMResourceProperties & { + /** + * The standard JSON format of a Gremlin database + */ + resource: GremlinDatabaseResource; + /** + * A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + */ + options: CreateUpdateOptions; +}; + +/** + * The List operation response, that contains the graphs and their properties. + */ +export interface GremlinGraphListResult { + /** + * List of graphs and their properties. + */ + readonly value?: GremlinGraphGetResults[]; +} + +/** + * An Azure Cosmos DB Gremlin graph. + */ +export type GremlinGraphGetResults = ARMResourceProperties & { + resource?: GremlinGraphGetPropertiesResource; + /** + * Cosmos DB options resource object + */ + options?: OptionsResource; +}; + +/** + * Cosmos DB Gremlin graph resource object + */ +export interface GremlinGraphResource { + /** + * Name of the Cosmos DB Gremlin graph + */ + id: string; + /** + * The configuration of the indexing policy. By default, the indexing is automatic for all document paths within the graph + */ + indexingPolicy?: IndexingPolicy; + /** + * The configuration of the partition key to be used for partitioning data into multiple partitions + */ + partitionKey?: ContainerPartitionKey; + /** + * Default time to live + */ + defaultTtl?: number; + /** + * The unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service. + */ + uniqueKeyPolicy?: UniqueKeyPolicy; + /** + * The conflict resolution policy for the graph. + */ + conflictResolutionPolicy?: ConflictResolutionPolicy; +} + +export type GremlinGraphGetPropertiesResource = GremlinGraphResource & + ExtendedResourceProperties & {}; + +/** + * Parameters to create and update Cosmos DB Gremlin graph. + */ +export type GremlinGraphCreateUpdateParameters = ARMResourceProperties & { + /** + * The standard JSON format of a Gremlin graph + */ + resource: GremlinGraphResource; + /** + * A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + */ + options: CreateUpdateOptions; +}; + +/** + * A list of notebook workspace resources + */ +export interface NotebookWorkspaceListResult { + /** + * Array of notebook workspace resources + */ + value?: NotebookWorkspace[]; +} + +/** + * The resource model definition for a ARM proxy resource. It will have everything other than required location and tags + */ +export interface ARMProxyResource { + /** + * The unique resource identifier of the database account. + */ + readonly id?: string; + /** + * The name of the database account. + */ + readonly name?: string; + /** + * The type of Azure resource. + */ + readonly type?: string; +} + +/** + * A notebook workspace resource + */ +export type NotebookWorkspace = ARMProxyResource & { + /** + * Specifies the endpoint of Notebook server. + */ + readonly notebookServerEndpoint?: string; + /** + * Status of the notebook workspace. Possible values are: Creating, Online, Deleting, Failed, Updating. + */ + readonly status?: string; +}; + +/** + * The connection info for the given notebook workspace + */ +export interface NotebookWorkspaceConnectionInfoResult { + /** + * Specifies auth token used for connecting to Notebook server (uses token-based auth). + */ + readonly authToken?: string; + /** + * Specifies the endpoint of Notebook server. + */ + readonly notebookServerEndpoint?: string; +} + +/** + * A list of private link resources + */ +export interface PrivateLinkResourceListResult { + /** + * Array of private link resources + */ + value?: PrivateLinkResource[]; +} + +/** + * A private link resource + */ +export type PrivateLinkResource = ARMProxyResource & { + /** + * The private link resource group id. + */ + readonly groupId?: string; + /** + * The private link resource required member names. + */ + readonly requiredMembers?: string[]; + /** + * The private link resource required zone names. + */ + readonly requiredZoneNames?: string[]; +}; + +/** + * A list of private endpoint connections + */ +export interface PrivateEndpointConnectionListResult { + /** + * Array of private endpoint connections + */ + value?: PrivateEndpointConnectionAutoGenerated[]; +} + +/** + * A private endpoint connection + */ +export type PrivateEndpointConnectionAutoGenerated = Resource & { + /** + * Private endpoint which the connection belongs to. + */ + privateEndpoint?: PrivateEndpointProperty; + /** + * Connection State of the Private Endpoint Connection. + */ + privateLinkServiceConnectionState?: PrivateLinkServiceConnectionStatePropertyAutoGenerated; + /** + * Group id of the private endpoint. + */ + groupId?: string; + /** + * Provisioning state of the private endpoint. + */ + provisioningState?: string; +}; + +/** + * Connection State of the Private Endpoint Connection. + */ +export interface PrivateLinkServiceConnectionStatePropertyAutoGenerated { + /** + * The private link service connection status. + */ + status?: string; + /** + * The private link service connection description. + */ + description?: string; + /** + * Any action that is required beyond basic workflow (approve/ reject/ disconnect) + */ + readonly actionsRequired?: string; +} + +export type SqlDatabaseGetPropertiesOptions = OptionsResource & {}; + +export type SqlContainerGetPropertiesOptions = OptionsResource & {}; + +export type MongoDBDatabaseGetPropertiesOptions = OptionsResource & {}; + +export type MongoDBCollectionGetPropertiesOptions = OptionsResource & {}; + +export type TableGetPropertiesOptions = OptionsResource & {}; + +export type CassandraKeyspaceGetPropertiesOptions = OptionsResource & {}; + +export type CassandraTableGetPropertiesOptions = OptionsResource & {}; + +export type GremlinDatabaseGetPropertiesOptions = OptionsResource & {}; + +export type GremlinGraphGetPropertiesOptions = OptionsResource & {}; + +/** + * Parameters to create a notebook workspace resource + */ +export type NotebookWorkspaceCreateUpdateParameters = ARMProxyResource & {}; + +/** + * The resource model definition for a ARM proxy resource. It will have everything other than required location and tags + */ +export type ProxyResource = Resource & {}; +/** + * Defines values for DatabaseAccountKind. + */ +export type DatabaseAccountKind = "GlobalDocumentDB" | "MongoDB" | "Parse"; +/** + * Defines values for PublicNetworkAccess. + */ +export type PublicNetworkAccess = "Enabled" | "Disabled"; +/** + * Defines values for KeyKind. + */ +export type KeyKind = + | "primary" + | "secondary" + | "primaryReadonly" + | "secondaryReadonly"; +/** + * Defines values for UnitType. + */ +export type UnitType = + | "Count" + | "Bytes" + | "Seconds" + | "Percent" + | "CountPerSecond" + | "BytesPerSecond" + | "Milliseconds"; +/** + * Defines values for PrimaryAggregationType. + */ +export type PrimaryAggregationType = + | "None" + | "Average" + | "Total" + | "Minimum" + | "Maximum" + | "Last"; +/** + * Defines values for IndexingMode. + */ +export type IndexingMode = "Consistent" | "Lazy" | "None"; +/** + * Defines values for DataType. + */ +export type DataType = + | "String" + | "Number" + | "Point" + | "Polygon" + | "LineString" + | "MultiPolygon"; +/** + * Defines values for IndexKind. + */ +export type IndexKind = "Hash" | "Range" | "Spatial"; +/** + * Defines values for CompositePathSortOrder. + */ +export type CompositePathSortOrder = "Ascending" | "Descending"; +/** + * Defines values for SpatialType. + */ +export type SpatialType = "Point" | "LineString" | "Polygon" | "MultiPolygon"; +/** + * Defines values for PartitionKind. + */ +export type PartitionKind = "Hash" | "Range"; +/** + * Defines values for ConflictResolutionMode. + */ +export type ConflictResolutionMode = "LastWriterWins" | "Custom"; +/** + * Defines values for TriggerType. + */ +export type TriggerType = "Pre" | "Post"; +/** + * Defines values for TriggerOperation. + */ +export type TriggerOperation = + | "All" + | "Create" + | "Update" + | "Delete" + | "Replace"; +/** + * Defines values for DefaultConsistencyLevel. + */ +export type DefaultConsistencyLevel = + | "Eventual" + | "Session" + | "BoundedStaleness" + | "Strong" + | "ConsistentPrefix"; + +/** + * Contains response data for the get operation. + */ +export type DatabaseAccountsGetResponse = DatabaseAccountGetResults & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: DatabaseAccountGetResults; + }; +}; + +/** + * Contains response data for the update operation. + */ +export type DatabaseAccountsUpdateResponse = DatabaseAccountGetResults & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: DatabaseAccountGetResults; + }; +}; + +/** + * Contains response data for the createOrUpdate operation. + */ +export type DatabaseAccountsCreateOrUpdateResponse = DatabaseAccountGetResults & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: DatabaseAccountGetResults; + }; +}; + +/** + * Contains response data for the list operation. + */ +export type DatabaseAccountsListResponse = DatabaseAccountsListResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: DatabaseAccountsListResult; + }; +}; + +/** + * Contains response data for the listByResourceGroup operation. + */ +export type DatabaseAccountsListByResourceGroupResponse = DatabaseAccountsListResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: DatabaseAccountsListResult; + }; +}; + +/** + * Contains response data for the listKeys operation. + */ +export type DatabaseAccountsListKeysResponse = DatabaseAccountListKeysResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: DatabaseAccountListKeysResult; + }; +}; + +/** + * Contains response data for the listConnectionStrings operation. + */ +export type DatabaseAccountsListConnectionStringsResponse = DatabaseAccountListConnectionStringsResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: DatabaseAccountListConnectionStringsResult; + }; +}; + +/** + * Contains response data for the getReadOnlyKeys operation. + */ +export type DatabaseAccountsGetReadOnlyKeysResponse = DatabaseAccountListReadOnlyKeysResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: DatabaseAccountListReadOnlyKeysResult; + }; +}; + +/** + * Contains response data for the listReadOnlyKeys operation. + */ +export type DatabaseAccountsListReadOnlyKeysResponse = DatabaseAccountListReadOnlyKeysResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: DatabaseAccountListReadOnlyKeysResult; + }; +}; + +/** + * Contains response data for the listMetrics operation. + */ +export type DatabaseAccountsListMetricsResponse = MetricListResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: MetricListResult; + }; +}; + +/** + * Optional parameters. + */ +export interface DatabaseAccountsListUsagesOptionalParams + extends coreHttp.OperationOptions { + /** + * An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of the metric, can have an or of multiple names). + */ + filter?: string; +} + +/** + * Contains response data for the listUsages operation. + */ +export type DatabaseAccountsListUsagesResponse = UsagesResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: UsagesResult; + }; +}; + +/** + * Contains response data for the listMetricDefinitions operation. + */ +export type DatabaseAccountsListMetricDefinitionsResponse = MetricDefinitionsListResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: MetricDefinitionsListResult; + }; +}; + +/** + * Contains response data for the list operation. + */ +export type OperationsListResponse = OperationListResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: OperationListResult; + }; +}; + +/** + * Contains response data for the listNext operation. + */ +export type OperationsListNextResponse = OperationListResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: OperationListResult; + }; +}; + +/** + * Contains response data for the listMetrics operation. + */ +export type DatabaseListMetricsResponse = MetricListResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: MetricListResult; + }; +}; + +/** + * Optional parameters. + */ +export interface DatabaseListUsagesOptionalParams + extends coreHttp.OperationOptions { + /** + * An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of the metric, can have an or of multiple names). + */ + filter?: string; +} + +/** + * Contains response data for the listUsages operation. + */ +export type DatabaseListUsagesResponse = UsagesResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: UsagesResult; + }; +}; + +/** + * Contains response data for the listMetricDefinitions operation. + */ +export type DatabaseListMetricDefinitionsResponse = MetricDefinitionsListResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: MetricDefinitionsListResult; + }; +}; + +/** + * Contains response data for the listMetrics operation. + */ +export type CollectionListMetricsResponse = MetricListResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: MetricListResult; + }; +}; + +/** + * Optional parameters. + */ +export interface CollectionListUsagesOptionalParams + extends coreHttp.OperationOptions { + /** + * An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of the metric, can have an or of multiple names). + */ + filter?: string; +} + +/** + * Contains response data for the listUsages operation. + */ +export type CollectionListUsagesResponse = UsagesResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: UsagesResult; + }; +}; + +/** + * Contains response data for the listMetricDefinitions operation. + */ +export type CollectionListMetricDefinitionsResponse = MetricDefinitionsListResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: MetricDefinitionsListResult; + }; +}; + +/** + * Contains response data for the listMetrics operation. + */ +export type CollectionRegionListMetricsResponse = MetricListResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: MetricListResult; + }; +}; + +/** + * Contains response data for the listMetrics operation. + */ +export type DatabaseAccountRegionListMetricsResponse = MetricListResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: MetricListResult; + }; +}; + +/** + * Contains response data for the listMetrics operation. + */ +export type PercentileSourceTargetListMetricsResponse = PercentileMetricListResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: PercentileMetricListResult; + }; +}; + +/** + * Contains response data for the listMetrics operation. + */ +export type PercentileTargetListMetricsResponse = PercentileMetricListResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: PercentileMetricListResult; + }; +}; + +/** + * Contains response data for the listMetrics operation. + */ +export type PercentileListMetricsResponse = PercentileMetricListResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: PercentileMetricListResult; + }; +}; + +/** + * Contains response data for the listMetrics operation. + */ +export type CollectionPartitionRegionListMetricsResponse = PartitionMetricListResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: PartitionMetricListResult; + }; +}; + +/** + * Contains response data for the listMetrics operation. + */ +export type CollectionPartitionListMetricsResponse = PartitionMetricListResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: PartitionMetricListResult; + }; +}; + +/** + * Optional parameters. + */ +export interface CollectionPartitionListUsagesOptionalParams + extends coreHttp.OperationOptions { + /** + * An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of the metric, can have an or of multiple names). + */ + filter?: string; +} + +/** + * Contains response data for the listUsages operation. + */ +export type CollectionPartitionListUsagesResponse = PartitionUsagesResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: PartitionUsagesResult; + }; +}; + +/** + * Contains response data for the listMetrics operation. + */ +export type PartitionKeyRangeIdListMetricsResponse = PartitionMetricListResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: PartitionMetricListResult; + }; +}; + +/** + * Contains response data for the listMetrics operation. + */ +export type PartitionKeyRangeIdRegionListMetricsResponse = PartitionMetricListResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: PartitionMetricListResult; + }; +}; + +/** + * Contains response data for the listSqlDatabases operation. + */ +export type SqlResourcesListSqlDatabasesResponse = SqlDatabaseListResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: SqlDatabaseListResult; + }; +}; + +/** + * Contains response data for the getSqlDatabase operation. + */ +export type SqlResourcesGetSqlDatabaseResponse = SqlDatabaseGetResults & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: SqlDatabaseGetResults; + }; +}; + +/** + * Contains response data for the createUpdateSqlDatabase operation. + */ +export type SqlResourcesCreateUpdateSqlDatabaseResponse = SqlDatabaseGetResults & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: SqlDatabaseGetResults; + }; +}; + +/** + * Contains response data for the getSqlDatabaseThroughput operation. + */ +export type SqlResourcesGetSqlDatabaseThroughputResponse = ThroughputSettingsGetResults & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: ThroughputSettingsGetResults; + }; +}; + +/** + * Contains response data for the updateSqlDatabaseThroughput operation. + */ +export type SqlResourcesUpdateSqlDatabaseThroughputResponse = ThroughputSettingsGetResults & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: ThroughputSettingsGetResults; + }; +}; + +/** + * Contains response data for the listSqlContainers operation. + */ +export type SqlResourcesListSqlContainersResponse = SqlContainerListResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: SqlContainerListResult; + }; +}; + +/** + * Contains response data for the getSqlContainer operation. + */ +export type SqlResourcesGetSqlContainerResponse = SqlContainerGetResults & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: SqlContainerGetResults; + }; +}; + +/** + * Contains response data for the createUpdateSqlContainer operation. + */ +export type SqlResourcesCreateUpdateSqlContainerResponse = SqlContainerGetResults & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: SqlContainerGetResults; + }; +}; + +/** + * Contains response data for the getSqlContainerThroughput operation. + */ +export type SqlResourcesGetSqlContainerThroughputResponse = ThroughputSettingsGetResults & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: ThroughputSettingsGetResults; + }; +}; + +/** + * Contains response data for the updateSqlContainerThroughput operation. + */ +export type SqlResourcesUpdateSqlContainerThroughputResponse = ThroughputSettingsGetResults & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: ThroughputSettingsGetResults; + }; +}; + +/** + * Contains response data for the listSqlStoredProcedures operation. + */ +export type SqlResourcesListSqlStoredProceduresResponse = SqlStoredProcedureListResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: SqlStoredProcedureListResult; + }; +}; + +/** + * Contains response data for the getSqlStoredProcedure operation. + */ +export type SqlResourcesGetSqlStoredProcedureResponse = SqlStoredProcedureGetResults & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: SqlStoredProcedureGetResults; + }; +}; + +/** + * Contains response data for the createUpdateSqlStoredProcedure operation. + */ +export type SqlResourcesCreateUpdateSqlStoredProcedureResponse = SqlStoredProcedureGetResults & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: SqlStoredProcedureGetResults; + }; +}; + +/** + * Contains response data for the listSqlUserDefinedFunctions operation. + */ +export type SqlResourcesListSqlUserDefinedFunctionsResponse = SqlUserDefinedFunctionListResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: SqlUserDefinedFunctionListResult; + }; +}; + +/** + * Contains response data for the getSqlUserDefinedFunction operation. + */ +export type SqlResourcesGetSqlUserDefinedFunctionResponse = SqlUserDefinedFunctionGetResults & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: SqlUserDefinedFunctionGetResults; + }; +}; + +/** + * Contains response data for the createUpdateSqlUserDefinedFunction operation. + */ +export type SqlResourcesCreateUpdateSqlUserDefinedFunctionResponse = SqlUserDefinedFunctionGetResults & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: SqlUserDefinedFunctionGetResults; + }; +}; + +/** + * Contains response data for the listSqlTriggers operation. + */ +export type SqlResourcesListSqlTriggersResponse = SqlTriggerListResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: SqlTriggerListResult; + }; +}; + +/** + * Contains response data for the getSqlTrigger operation. + */ +export type SqlResourcesGetSqlTriggerResponse = SqlTriggerGetResults & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: SqlTriggerGetResults; + }; +}; + +/** + * Contains response data for the createUpdateSqlTrigger operation. + */ +export type SqlResourcesCreateUpdateSqlTriggerResponse = SqlTriggerGetResults & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: SqlTriggerGetResults; + }; +}; + +/** + * Contains response data for the listMongoDBDatabases operation. + */ +export type MongoDBResourcesListMongoDBDatabasesResponse = MongoDBDatabaseListResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: MongoDBDatabaseListResult; + }; +}; + +/** + * Contains response data for the getMongoDBDatabase operation. + */ +export type MongoDBResourcesGetMongoDBDatabaseResponse = MongoDBDatabaseGetResults & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: MongoDBDatabaseGetResults; + }; +}; + +/** + * Contains response data for the createUpdateMongoDBDatabase operation. + */ +export type MongoDBResourcesCreateUpdateMongoDBDatabaseResponse = MongoDBDatabaseGetResults & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: MongoDBDatabaseGetResults; + }; +}; + +/** + * Contains response data for the getMongoDBDatabaseThroughput operation. + */ +export type MongoDBResourcesGetMongoDBDatabaseThroughputResponse = ThroughputSettingsGetResults & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: ThroughputSettingsGetResults; + }; +}; + +/** + * Contains response data for the updateMongoDBDatabaseThroughput operation. + */ +export type MongoDBResourcesUpdateMongoDBDatabaseThroughputResponse = ThroughputSettingsGetResults & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: ThroughputSettingsGetResults; + }; +}; + +/** + * Contains response data for the listMongoDBCollections operation. + */ +export type MongoDBResourcesListMongoDBCollectionsResponse = MongoDBCollectionListResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: MongoDBCollectionListResult; + }; +}; + +/** + * Contains response data for the getMongoDBCollection operation. + */ +export type MongoDBResourcesGetMongoDBCollectionResponse = MongoDBCollectionGetResults & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: MongoDBCollectionGetResults; + }; +}; + +/** + * Contains response data for the createUpdateMongoDBCollection operation. + */ +export type MongoDBResourcesCreateUpdateMongoDBCollectionResponse = MongoDBCollectionGetResults & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: MongoDBCollectionGetResults; + }; +}; + +/** + * Contains response data for the getMongoDBCollectionThroughput operation. + */ +export type MongoDBResourcesGetMongoDBCollectionThroughputResponse = ThroughputSettingsGetResults & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: ThroughputSettingsGetResults; + }; +}; + +/** + * Contains response data for the updateMongoDBCollectionThroughput operation. + */ +export type MongoDBResourcesUpdateMongoDBCollectionThroughputResponse = ThroughputSettingsGetResults & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: ThroughputSettingsGetResults; + }; +}; + +/** + * Contains response data for the listTables operation. + */ +export type TableResourcesListTablesResponse = TableListResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: TableListResult; + }; +}; + +/** + * Contains response data for the getTable operation. + */ +export type TableResourcesGetTableResponse = TableGetResults & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: TableGetResults; + }; +}; + +/** + * Contains response data for the createUpdateTable operation. + */ +export type TableResourcesCreateUpdateTableResponse = TableGetResults & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: TableGetResults; + }; +}; + +/** + * Contains response data for the getTableThroughput operation. + */ +export type TableResourcesGetTableThroughputResponse = ThroughputSettingsGetResults & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: ThroughputSettingsGetResults; + }; +}; + +/** + * Contains response data for the updateTableThroughput operation. + */ +export type TableResourcesUpdateTableThroughputResponse = ThroughputSettingsGetResults & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: ThroughputSettingsGetResults; + }; +}; + +/** + * Contains response data for the listCassandraKeyspaces operation. + */ +export type CassandraResourcesListCassandraKeyspacesResponse = CassandraKeyspaceListResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: CassandraKeyspaceListResult; + }; +}; + +/** + * Contains response data for the getCassandraKeyspace operation. + */ +export type CassandraResourcesGetCassandraKeyspaceResponse = CassandraKeyspaceGetResults & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: CassandraKeyspaceGetResults; + }; +}; + +/** + * Contains response data for the createUpdateCassandraKeyspace operation. + */ +export type CassandraResourcesCreateUpdateCassandraKeyspaceResponse = CassandraKeyspaceGetResults & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: CassandraKeyspaceGetResults; + }; +}; + +/** + * Contains response data for the getCassandraKeyspaceThroughput operation. + */ +export type CassandraResourcesGetCassandraKeyspaceThroughputResponse = ThroughputSettingsGetResults & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: ThroughputSettingsGetResults; + }; +}; + +/** + * Contains response data for the updateCassandraKeyspaceThroughput operation. + */ +export type CassandraResourcesUpdateCassandraKeyspaceThroughputResponse = ThroughputSettingsGetResults & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: ThroughputSettingsGetResults; + }; +}; + +/** + * Contains response data for the listCassandraTables operation. + */ +export type CassandraResourcesListCassandraTablesResponse = CassandraTableListResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: CassandraTableListResult; + }; +}; + +/** + * Contains response data for the getCassandraTable operation. + */ +export type CassandraResourcesGetCassandraTableResponse = CassandraTableGetResults & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: CassandraTableGetResults; + }; +}; + +/** + * Contains response data for the createUpdateCassandraTable operation. + */ +export type CassandraResourcesCreateUpdateCassandraTableResponse = CassandraTableGetResults & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: CassandraTableGetResults; + }; +}; + +/** + * Contains response data for the getCassandraTableThroughput operation. + */ +export type CassandraResourcesGetCassandraTableThroughputResponse = ThroughputSettingsGetResults & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: ThroughputSettingsGetResults; + }; +}; + +/** + * Contains response data for the updateCassandraTableThroughput operation. + */ +export type CassandraResourcesUpdateCassandraTableThroughputResponse = ThroughputSettingsGetResults & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: ThroughputSettingsGetResults; + }; +}; + +/** + * Contains response data for the listGremlinDatabases operation. + */ +export type GremlinResourcesListGremlinDatabasesResponse = GremlinDatabaseListResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: GremlinDatabaseListResult; + }; +}; + +/** + * Contains response data for the getGremlinDatabase operation. + */ +export type GremlinResourcesGetGremlinDatabaseResponse = GremlinDatabaseGetResults & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: GremlinDatabaseGetResults; + }; +}; + +/** + * Contains response data for the createUpdateGremlinDatabase operation. + */ +export type GremlinResourcesCreateUpdateGremlinDatabaseResponse = GremlinDatabaseGetResults & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: GremlinDatabaseGetResults; + }; +}; + +/** + * Contains response data for the getGremlinDatabaseThroughput operation. + */ +export type GremlinResourcesGetGremlinDatabaseThroughputResponse = ThroughputSettingsGetResults & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: ThroughputSettingsGetResults; + }; +}; + +/** + * Contains response data for the updateGremlinDatabaseThroughput operation. + */ +export type GremlinResourcesUpdateGremlinDatabaseThroughputResponse = ThroughputSettingsGetResults & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: ThroughputSettingsGetResults; + }; +}; + +/** + * Contains response data for the listGremlinGraphs operation. + */ +export type GremlinResourcesListGremlinGraphsResponse = GremlinGraphListResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: GremlinGraphListResult; + }; +}; + +/** + * Contains response data for the getGremlinGraph operation. + */ +export type GremlinResourcesGetGremlinGraphResponse = GremlinGraphGetResults & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: GremlinGraphGetResults; + }; +}; + +/** + * Contains response data for the createUpdateGremlinGraph operation. + */ +export type GremlinResourcesCreateUpdateGremlinGraphResponse = GremlinGraphGetResults & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: GremlinGraphGetResults; + }; +}; + +/** + * Contains response data for the getGremlinGraphThroughput operation. + */ +export type GremlinResourcesGetGremlinGraphThroughputResponse = ThroughputSettingsGetResults & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: ThroughputSettingsGetResults; + }; +}; + +/** + * Contains response data for the updateGremlinGraphThroughput operation. + */ +export type GremlinResourcesUpdateGremlinGraphThroughputResponse = ThroughputSettingsGetResults & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: ThroughputSettingsGetResults; + }; +}; + +/** + * Contains response data for the listByDatabaseAccount operation. + */ +export type NotebookWorkspacesListByDatabaseAccountResponse = NotebookWorkspaceListResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: NotebookWorkspaceListResult; + }; +}; + +/** + * Contains response data for the get operation. + */ +export type NotebookWorkspacesGetResponse = NotebookWorkspace & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: NotebookWorkspace; + }; +}; + +/** + * Contains response data for the createOrUpdate operation. + */ +export type NotebookWorkspacesCreateOrUpdateResponse = NotebookWorkspace & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: NotebookWorkspace; + }; +}; + +/** + * Contains response data for the listConnectionInfo operation. + */ +export type NotebookWorkspacesListConnectionInfoResponse = NotebookWorkspaceConnectionInfoResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: NotebookWorkspaceConnectionInfoResult; + }; +}; + +/** + * Contains response data for the listByDatabaseAccount operation. + */ +export type PrivateLinkResourcesListByDatabaseAccountResponse = PrivateLinkResourceListResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: PrivateLinkResourceListResult; + }; +}; + +/** + * Contains response data for the get operation. + */ +export type PrivateLinkResourcesGetResponse = PrivateLinkResource & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: PrivateLinkResource; + }; +}; + +/** + * Contains response data for the listByDatabaseAccount operation. + */ +export type PrivateEndpointConnectionsListByDatabaseAccountResponse = PrivateEndpointConnectionListResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: PrivateEndpointConnectionListResult; + }; +}; + +/** + * Contains response data for the get operation. + */ +export type PrivateEndpointConnectionsGetResponse = PrivateEndpointConnectionAutoGenerated & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: PrivateEndpointConnectionAutoGenerated; + }; +}; + +/** + * Contains response data for the createOrUpdate operation. + */ +export type PrivateEndpointConnectionsCreateOrUpdateResponse = PrivateEndpointConnectionAutoGenerated & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: PrivateEndpointConnectionAutoGenerated; + }; +}; + +/** + * Optional parameters. + */ +export interface CosmosDBManagementClientOptionalParams + extends coreHttp.ServiceClientOptions { + /** + * server parameter + */ + $host?: string; + /** + * Overrides client endpoint. + */ + endpoint?: string; +} diff --git a/test/smoke/generated/cosmos-db-resource-manager/src/models/mappers.ts b/test/smoke/generated/cosmos-db-resource-manager/src/models/mappers.ts new file mode 100644 index 0000000000..6b00f8e95b --- /dev/null +++ b/test/smoke/generated/cosmos-db-resource-manager/src/models/mappers.ts @@ -0,0 +1,3657 @@ +/* + * 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 * as coreHttp from "@azure/core-http"; + +export const ARMResourceProperties: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "ARMResourceProperties", + modelProperties: { + id: { + serializedName: "id", + readOnly: true, + type: { + name: "String" + } + }, + name: { + serializedName: "name", + readOnly: true, + type: { + name: "String" + } + }, + type: { + serializedName: "type", + readOnly: true, + type: { + name: "String" + } + }, + location: { + serializedName: "location", + type: { + name: "String" + } + }, + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + } + } + } +}; + +export const DatabaseAccountGetResults: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "DatabaseAccountGetResults", + modelProperties: { + ...ARMResourceProperties.type.modelProperties, + kind: { + serializedName: "kind", + type: { + name: "String" + } + }, + provisioningState: { + serializedName: "properties.provisioningState", + readOnly: true, + type: { + name: "String" + } + }, + documentEndpoint: { + serializedName: "properties.documentEndpoint", + readOnly: true, + type: { + name: "String" + } + }, + databaseAccountOfferType: { + defaultValue: "Standard", + isConstant: true, + serializedName: "properties.databaseAccountOfferType", + type: { + name: "String" + } + }, + ipRangeFilter: { + serializedName: "properties.ipRangeFilter", + type: { + name: "String" + } + }, + isVirtualNetworkFilterEnabled: { + serializedName: "properties.isVirtualNetworkFilterEnabled", + type: { + name: "Boolean" + } + }, + enableAutomaticFailover: { + serializedName: "properties.enableAutomaticFailover", + type: { + name: "Boolean" + } + }, + consistencyPolicy: { + serializedName: "consistencyPolicy", + type: { + name: "Composite", + className: "ConsistencyPolicy" + } + }, + capabilities: { + serializedName: "properties.capabilities", + type: { + name: "Sequence", + element: { type: { name: "Composite", className: "Capability" } } + } + }, + writeLocations: { + serializedName: "properties.writeLocations", + readOnly: true, + type: { + name: "Sequence", + element: { type: { name: "Composite", className: "Location" } } + } + }, + readLocations: { + serializedName: "properties.readLocations", + readOnly: true, + type: { + name: "Sequence", + element: { type: { name: "Composite", className: "Location" } } + } + }, + locations: { + serializedName: "properties.locations", + readOnly: true, + type: { + name: "Sequence", + element: { type: { name: "Composite", className: "Location" } } + } + }, + failoverPolicies: { + serializedName: "properties.failoverPolicies", + readOnly: true, + type: { + name: "Sequence", + element: { type: { name: "Composite", className: "FailoverPolicy" } } + } + }, + virtualNetworkRules: { + serializedName: "properties.virtualNetworkRules", + type: { + name: "Sequence", + element: { + type: { name: "Composite", className: "VirtualNetworkRule" } + } + } + }, + privateEndpointConnections: { + serializedName: "properties.privateEndpointConnections", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { name: "Composite", className: "PrivateEndpointConnection" } + } + } + }, + enableMultipleWriteLocations: { + serializedName: "properties.enableMultipleWriteLocations", + type: { + name: "Boolean" + } + }, + enableCassandraConnector: { + serializedName: "properties.enableCassandraConnector", + type: { + name: "Boolean" + } + }, + connectorOffer: { + defaultValue: "Small", + isConstant: true, + serializedName: "properties.connectorOffer", + type: { + name: "String" + } + }, + disableKeyBasedMetadataWriteAccess: { + serializedName: "properties.disableKeyBasedMetadataWriteAccess", + type: { + name: "Boolean" + } + }, + keyVaultKeyUri: { + serializedName: "properties.keyVaultKeyUri", + type: { + name: "String" + } + }, + publicNetworkAccess: { + serializedName: "properties.publicNetworkAccess", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const ConsistencyPolicy: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "ConsistencyPolicy", + modelProperties: { + defaultConsistencyLevel: { + serializedName: "defaultConsistencyLevel", + required: true, + type: { + name: "Enum", + allowedValues: [ + "Eventual", + "Session", + "BoundedStaleness", + "Strong", + "ConsistentPrefix" + ] + } + }, + maxStalenessPrefix: { + constraints: { + InclusiveMaximum: 2147483647, + InclusiveMinimum: 1 + }, + serializedName: "maxStalenessPrefix", + type: { + name: "Number" + } + }, + maxIntervalInSeconds: { + constraints: { + InclusiveMaximum: 86400, + InclusiveMinimum: 5 + }, + serializedName: "maxIntervalInSeconds", + type: { + name: "Number" + } + } + } + } +}; + +export const Capability: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "Capability", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + } + } + } +}; + +export const Location: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "Location", + modelProperties: { + id: { + serializedName: "id", + readOnly: true, + type: { + name: "String" + } + }, + locationName: { + serializedName: "locationName", + type: { + name: "String" + } + }, + documentEndpoint: { + serializedName: "documentEndpoint", + readOnly: true, + type: { + name: "String" + } + }, + provisioningState: { + serializedName: "provisioningState", + readOnly: true, + type: { + name: "String" + } + }, + failoverPriority: { + constraints: {}, + serializedName: "failoverPriority", + type: { + name: "Number" + } + }, + isZoneRedundant: { + serializedName: "isZoneRedundant", + type: { + name: "Boolean" + } + } + } + } +}; + +export const FailoverPolicy: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "FailoverPolicy", + modelProperties: { + id: { + serializedName: "id", + readOnly: true, + type: { + name: "String" + } + }, + locationName: { + serializedName: "locationName", + type: { + name: "String" + } + }, + failoverPriority: { + constraints: {}, + serializedName: "failoverPriority", + type: { + name: "Number" + } + } + } + } +}; + +export const VirtualNetworkRule: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "VirtualNetworkRule", + modelProperties: { + id: { + serializedName: "id", + type: { + name: "String" + } + }, + ignoreMissingVNetServiceEndpoint: { + serializedName: "ignoreMissingVNetServiceEndpoint", + type: { + name: "Boolean" + } + } + } + } +}; + +export const Resource: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "Resource", + modelProperties: { + id: { + serializedName: "id", + readOnly: true, + type: { + name: "String" + } + }, + name: { + serializedName: "name", + readOnly: true, + type: { + name: "String" + } + }, + type: { + serializedName: "type", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const PrivateEndpointConnection: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "PrivateEndpointConnection", + modelProperties: { + ...Resource.type.modelProperties, + privateEndpoint: { + serializedName: "privateEndpoint", + type: { + name: "Composite", + className: "PrivateEndpointProperty" + } + }, + privateLinkServiceConnectionState: { + serializedName: "privateLinkServiceConnectionState", + type: { + name: "Composite", + className: "PrivateLinkServiceConnectionStateProperty" + } + } + } + } +}; + +export const PrivateEndpointProperty: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "PrivateEndpointProperty", + modelProperties: { + id: { + serializedName: "id", + type: { + name: "String" + } + } + } + } +}; + +export const PrivateLinkServiceConnectionStateProperty: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "PrivateLinkServiceConnectionStateProperty", + modelProperties: { + status: { + serializedName: "status", + type: { + name: "String" + } + }, + actionsRequired: { + serializedName: "actionsRequired", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const DatabaseAccountUpdateParameters: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "DatabaseAccountUpdateParameters", + modelProperties: { + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + }, + location: { + serializedName: "location", + type: { + name: "String" + } + }, + consistencyPolicy: { + serializedName: "consistencyPolicy", + type: { + name: "Composite", + className: "ConsistencyPolicy" + } + }, + locations: { + serializedName: "properties.locations", + type: { + name: "Sequence", + element: { type: { name: "Composite", className: "Location" } } + } + }, + ipRangeFilter: { + serializedName: "properties.ipRangeFilter", + type: { + name: "String" + } + }, + isVirtualNetworkFilterEnabled: { + serializedName: "properties.isVirtualNetworkFilterEnabled", + type: { + name: "Boolean" + } + }, + enableAutomaticFailover: { + serializedName: "properties.enableAutomaticFailover", + type: { + name: "Boolean" + } + }, + capabilities: { + serializedName: "properties.capabilities", + type: { + name: "Sequence", + element: { type: { name: "Composite", className: "Capability" } } + } + }, + virtualNetworkRules: { + serializedName: "properties.virtualNetworkRules", + type: { + name: "Sequence", + element: { + type: { name: "Composite", className: "VirtualNetworkRule" } + } + } + }, + enableMultipleWriteLocations: { + serializedName: "properties.enableMultipleWriteLocations", + type: { + name: "Boolean" + } + }, + enableCassandraConnector: { + serializedName: "properties.enableCassandraConnector", + type: { + name: "Boolean" + } + }, + connectorOffer: { + defaultValue: "Small", + isConstant: true, + serializedName: "properties.connectorOffer", + type: { + name: "String" + } + }, + disableKeyBasedMetadataWriteAccess: { + serializedName: "properties.disableKeyBasedMetadataWriteAccess", + type: { + name: "Boolean" + } + }, + keyVaultKeyUri: { + serializedName: "properties.keyVaultKeyUri", + type: { + name: "String" + } + }, + publicNetworkAccess: { + serializedName: "properties.publicNetworkAccess", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const DatabaseAccountCreateUpdateParameters: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "DatabaseAccountCreateUpdateParameters", + modelProperties: { + ...ARMResourceProperties.type.modelProperties, + kind: { + serializedName: "kind", + type: { + name: "String" + } + }, + consistencyPolicy: { + serializedName: "consistencyPolicy", + type: { + name: "Composite", + className: "ConsistencyPolicy" + } + }, + locations: { + serializedName: "properties.locations", + required: true, + type: { + name: "Sequence", + element: { type: { name: "Composite", className: "Location" } } + } + }, + databaseAccountOfferType: { + defaultValue: "Standard", + isConstant: true, + serializedName: "properties.databaseAccountOfferType", + type: { + name: "String" + } + }, + ipRangeFilter: { + serializedName: "properties.ipRangeFilter", + type: { + name: "String" + } + }, + isVirtualNetworkFilterEnabled: { + serializedName: "properties.isVirtualNetworkFilterEnabled", + type: { + name: "Boolean" + } + }, + enableAutomaticFailover: { + serializedName: "properties.enableAutomaticFailover", + type: { + name: "Boolean" + } + }, + capabilities: { + serializedName: "properties.capabilities", + type: { + name: "Sequence", + element: { type: { name: "Composite", className: "Capability" } } + } + }, + virtualNetworkRules: { + serializedName: "properties.virtualNetworkRules", + type: { + name: "Sequence", + element: { + type: { name: "Composite", className: "VirtualNetworkRule" } + } + } + }, + enableMultipleWriteLocations: { + serializedName: "properties.enableMultipleWriteLocations", + type: { + name: "Boolean" + } + }, + enableCassandraConnector: { + serializedName: "properties.enableCassandraConnector", + type: { + name: "Boolean" + } + }, + connectorOffer: { + defaultValue: "Small", + isConstant: true, + serializedName: "properties.connectorOffer", + type: { + name: "String" + } + }, + disableKeyBasedMetadataWriteAccess: { + serializedName: "properties.disableKeyBasedMetadataWriteAccess", + type: { + name: "Boolean" + } + }, + keyVaultKeyUri: { + serializedName: "properties.keyVaultKeyUri", + type: { + name: "String" + } + }, + publicNetworkAccess: { + serializedName: "properties.publicNetworkAccess", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const FailoverPolicies: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "FailoverPolicies", + modelProperties: { + failoverPolicies: { + serializedName: "failoverPolicies", + required: true, + type: { + name: "Sequence", + element: { type: { name: "Composite", className: "FailoverPolicy" } } + } + } + } + } +}; + +export const DatabaseAccountsListResult: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "DatabaseAccountsListResult", + modelProperties: { + value: { + serializedName: "value", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { name: "Composite", className: "DatabaseAccountGetResults" } + } + } + } + } + } +}; + +export const DatabaseAccountListReadOnlyKeysResult: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "DatabaseAccountListReadOnlyKeysResult", + modelProperties: { + primaryReadonlyMasterKey: { + serializedName: "primaryReadonlyMasterKey", + readOnly: true, + type: { + name: "String" + } + }, + secondaryReadonlyMasterKey: { + serializedName: "secondaryReadonlyMasterKey", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const DatabaseAccountListKeysResult: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "DatabaseAccountListKeysResult", + modelProperties: { + ...DatabaseAccountListReadOnlyKeysResult.type.modelProperties, + primaryMasterKey: { + serializedName: "primaryMasterKey", + readOnly: true, + type: { + name: "String" + } + }, + secondaryMasterKey: { + serializedName: "secondaryMasterKey", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const DatabaseAccountListConnectionStringsResult: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "DatabaseAccountListConnectionStringsResult", + modelProperties: { + connectionStrings: { + serializedName: "connectionStrings", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "DatabaseAccountConnectionString" + } + } + } + } + } + } +}; + +export const DatabaseAccountConnectionString: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "DatabaseAccountConnectionString", + modelProperties: { + connectionString: { + serializedName: "connectionString", + readOnly: true, + type: { + name: "String" + } + }, + description: { + serializedName: "description", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const RegionForOnlineOffline: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "RegionForOnlineOffline", + modelProperties: { + region: { + serializedName: "region", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const ErrorResponse: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorResponse", + modelProperties: { + code: { + serializedName: "code", + type: { + name: "String" + } + }, + message: { + serializedName: "message", + type: { + name: "String" + } + } + } + } +}; + +export const DatabaseAccountRegenerateKeyParameters: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "DatabaseAccountRegenerateKeyParameters", + modelProperties: { + keyKind: { + serializedName: "keyKind", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const OperationListResult: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "OperationListResult", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { type: { name: "Composite", className: "Operation" } } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const Operation: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "Operation", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + }, + display: { + serializedName: "display", + type: { + name: "Composite", + className: "OperationDisplay" + } + } + } + } +}; + +export const OperationDisplay: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "OperationDisplay", + modelProperties: { + provider: { + serializedName: "Provider", + type: { + name: "String" + } + }, + resource: { + serializedName: "Resource", + type: { + name: "String" + } + }, + operation: { + serializedName: "Operation", + type: { + name: "String" + } + }, + description: { + serializedName: "Description", + type: { + name: "String" + } + } + } + } +}; + +export const MetricListResult: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "MetricListResult", + modelProperties: { + value: { + serializedName: "value", + readOnly: true, + type: { + name: "Sequence", + element: { type: { name: "Composite", className: "Metric" } } + } + } + } + } +}; + +export const Metric: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "Metric", + modelProperties: { + startTime: { + serializedName: "startTime", + readOnly: true, + type: { + name: "DateTime" + } + }, + endTime: { + serializedName: "endTime", + readOnly: true, + type: { + name: "DateTime" + } + }, + timeGrain: { + serializedName: "timeGrain", + readOnly: true, + type: { + name: "String" + } + }, + unit: { + serializedName: "unit", + readOnly: true, + type: { + name: "String" + } + }, + name: { + serializedName: "name", + type: { + name: "Composite", + className: "MetricName" + } + }, + metricValues: { + serializedName: "metricValues", + readOnly: true, + type: { + name: "Sequence", + element: { type: { name: "Composite", className: "MetricValue" } } + } + } + } + } +}; + +export const MetricName: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "MetricName", + modelProperties: { + value: { + serializedName: "value", + readOnly: true, + type: { + name: "String" + } + }, + localizedValue: { + serializedName: "localizedValue", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const MetricValue: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "MetricValue", + modelProperties: { + count: { + serializedName: "_count", + readOnly: true, + type: { + name: "Number" + } + }, + average: { + serializedName: "average", + readOnly: true, + type: { + name: "Number" + } + }, + maximum: { + serializedName: "maximum", + readOnly: true, + type: { + name: "Number" + } + }, + minimum: { + serializedName: "minimum", + readOnly: true, + type: { + name: "Number" + } + }, + timestamp: { + serializedName: "timestamp", + readOnly: true, + type: { + name: "DateTime" + } + }, + total: { + serializedName: "total", + readOnly: true, + type: { + name: "Number" + } + } + } + } +}; + +export const PercentileMetricListResult: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "PercentileMetricListResult", + modelProperties: { + value: { + serializedName: "value", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { name: "Composite", className: "PercentileMetric" } + } + } + } + } + } +}; + +export const PercentileMetric: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "PercentileMetric", + modelProperties: { + startTime: { + serializedName: "startTime", + readOnly: true, + type: { + name: "DateTime" + } + }, + endTime: { + serializedName: "endTime", + readOnly: true, + type: { + name: "DateTime" + } + }, + timeGrain: { + serializedName: "timeGrain", + readOnly: true, + type: { + name: "String" + } + }, + unit: { + serializedName: "unit", + readOnly: true, + type: { + name: "String" + } + }, + name: { + serializedName: "name", + type: { + name: "Composite", + className: "MetricName" + } + }, + metricValues: { + serializedName: "metricValues", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { name: "Composite", className: "PercentileMetricValue" } + } + } + } + } + } +}; + +export const PercentileMetricValue: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "PercentileMetricValue", + modelProperties: { + ...MetricValue.type.modelProperties, + p10: { + serializedName: "P10", + readOnly: true, + type: { + name: "Number" + } + }, + p25: { + serializedName: "P25", + readOnly: true, + type: { + name: "Number" + } + }, + p50: { + serializedName: "P50", + readOnly: true, + type: { + name: "Number" + } + }, + p75: { + serializedName: "P75", + readOnly: true, + type: { + name: "Number" + } + }, + p90: { + serializedName: "P90", + readOnly: true, + type: { + name: "Number" + } + }, + p95: { + serializedName: "P95", + readOnly: true, + type: { + name: "Number" + } + }, + p99: { + serializedName: "P99", + readOnly: true, + type: { + name: "Number" + } + } + } + } +}; + +export const PartitionMetricListResult: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "PartitionMetricListResult", + modelProperties: { + value: { + serializedName: "value", + readOnly: true, + type: { + name: "Sequence", + element: { type: { name: "Composite", className: "PartitionMetric" } } + } + } + } + } +}; + +export const PartitionMetric: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "PartitionMetric", + modelProperties: { + ...Metric.type.modelProperties, + partitionId: { + serializedName: "partitionId", + readOnly: true, + type: { + name: "String" + } + }, + partitionKeyRangeId: { + serializedName: "partitionKeyRangeId", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const UsagesResult: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "UsagesResult", + modelProperties: { + value: { + serializedName: "value", + readOnly: true, + type: { + name: "Sequence", + element: { type: { name: "Composite", className: "Usage" } } + } + } + } + } +}; + +export const Usage: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "Usage", + modelProperties: { + unit: { + serializedName: "unit", + readOnly: true, + type: { + name: "String" + } + }, + name: { + serializedName: "name", + type: { + name: "Composite", + className: "MetricName" + } + }, + quotaPeriod: { + serializedName: "quotaPeriod", + readOnly: true, + type: { + name: "String" + } + }, + limit: { + serializedName: "limit", + readOnly: true, + type: { + name: "Number" + } + }, + currentValue: { + serializedName: "currentValue", + readOnly: true, + type: { + name: "Number" + } + } + } + } +}; + +export const PartitionUsagesResult: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "PartitionUsagesResult", + modelProperties: { + value: { + serializedName: "value", + readOnly: true, + type: { + name: "Sequence", + element: { type: { name: "Composite", className: "PartitionUsage" } } + } + } + } + } +}; + +export const PartitionUsage: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "PartitionUsage", + modelProperties: { + ...Usage.type.modelProperties, + partitionId: { + serializedName: "partitionId", + readOnly: true, + type: { + name: "String" + } + }, + partitionKeyRangeId: { + serializedName: "partitionKeyRangeId", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const MetricDefinitionsListResult: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "MetricDefinitionsListResult", + modelProperties: { + value: { + serializedName: "value", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { name: "Composite", className: "MetricDefinition" } + } + } + } + } + } +}; + +export const MetricDefinition: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "MetricDefinition", + modelProperties: { + metricAvailabilities: { + serializedName: "metricAvailabilities", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { name: "Composite", className: "MetricAvailability" } + } + } + }, + primaryAggregationType: { + serializedName: "primaryAggregationType", + readOnly: true, + type: { + name: "String" + } + }, + unit: { + serializedName: "unit", + readOnly: true, + type: { + name: "String" + } + }, + resourceUri: { + serializedName: "resourceUri", + readOnly: true, + type: { + name: "String" + } + }, + name: { + serializedName: "name", + type: { + name: "Composite", + className: "MetricName" + } + } + } + } +}; + +export const MetricAvailability: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "MetricAvailability", + modelProperties: { + timeGrain: { + serializedName: "timeGrain", + readOnly: true, + type: { + name: "String" + } + }, + retention: { + serializedName: "retention", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const SqlDatabaseListResult: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "SqlDatabaseListResult", + modelProperties: { + value: { + serializedName: "value", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { name: "Composite", className: "SqlDatabaseGetResults" } + } + } + } + } + } +}; + +export const SqlDatabaseGetResults: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "SqlDatabaseGetResults", + modelProperties: { + ...ARMResourceProperties.type.modelProperties, + resource: { + serializedName: "resource", + type: { + name: "Composite", + className: "SqlDatabaseGetPropertiesResource" + } + }, + options: { + serializedName: "options", + type: { + name: "Composite", + className: "OptionsResource" + } + } + } + } +}; + +export const SqlDatabaseResource: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "SqlDatabaseResource", + modelProperties: { + id: { + serializedName: "id", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const ExtendedResourceProperties: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "ExtendedResourceProperties", + modelProperties: { + rid: { + serializedName: "_rid", + readOnly: true, + type: { + name: "String" + } + }, + ts: { + serializedName: "_ts", + readOnly: true, + type: { + name: "any" + } + }, + etag: { + serializedName: "_etag", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const SqlDatabaseGetPropertiesResource: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "SqlDatabaseGetPropertiesResource", + modelProperties: { + ...SqlDatabaseResource.type.modelProperties, + ...ExtendedResourceProperties.type.modelProperties, + colls: { + serializedName: "_colls", + type: { + name: "String" + } + }, + users: { + serializedName: "_users", + type: { + name: "String" + } + } + } + } +}; + +export const OptionsResource: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "OptionsResource", + modelProperties: { + throughput: { + serializedName: "throughput", + type: { + name: "Number" + } + } + } + } +}; + +export const SqlDatabaseCreateUpdateParameters: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "SqlDatabaseCreateUpdateParameters", + modelProperties: { + ...ARMResourceProperties.type.modelProperties, + resource: { + serializedName: "resource", + type: { + name: "Composite", + className: "SqlDatabaseResource" + } + }, + options: { + serializedName: "options", + type: { + name: "Composite", + className: "CreateUpdateOptions" + } + } + } + } +}; + +export const CreateUpdateOptions: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "CreateUpdateOptions", + additionalProperties: { type: { name: "Object" } }, + modelProperties: { + throughput: { + serializedName: "throughput", + type: { + name: "String" + } + } + } + } +}; + +export const ThroughputSettingsGetResults: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "ThroughputSettingsGetResults", + modelProperties: { + ...ARMResourceProperties.type.modelProperties, + resource: { + serializedName: "resource", + type: { + name: "Composite", + className: "ThroughputSettingsGetPropertiesResource" + } + } + } + } +}; + +export const ThroughputSettingsResource: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "ThroughputSettingsResource", + modelProperties: { + throughput: { + serializedName: "throughput", + type: { + name: "Number" + } + }, + provisionedThroughputSettings: { + serializedName: "provisionedThroughputSettings", + type: { + name: "Composite", + className: "ProvisionedThroughputSettingsResource" + } + }, + minimumThroughput: { + serializedName: "minimumThroughput", + readOnly: true, + type: { + name: "String" + } + }, + offerReplacePending: { + serializedName: "offerReplacePending", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const ProvisionedThroughputSettingsResource: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "ProvisionedThroughputSettingsResource", + modelProperties: { + maxThroughput: { + serializedName: "maxThroughput", + required: true, + type: { + name: "Number" + } + }, + autoUpgradePolicy: { + serializedName: "autoUpgradePolicy", + type: { + name: "Composite", + className: "AutoUpgradePolicyResource" + } + }, + targetMaxThroughput: { + serializedName: "targetMaxThroughput", + readOnly: true, + type: { + name: "Number" + } + } + } + } +}; + +export const AutoUpgradePolicyResource: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "AutoUpgradePolicyResource", + modelProperties: { + throughputPolicy: { + serializedName: "throughputPolicy", + type: { + name: "Composite", + className: "ThroughputPolicyResource" + } + } + } + } +}; + +export const ThroughputPolicyResource: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "ThroughputPolicyResource", + modelProperties: { + isEnabled: { + serializedName: "isEnabled", + type: { + name: "Boolean" + } + }, + incrementPercent: { + serializedName: "incrementPercent", + type: { + name: "Number" + } + } + } + } +}; + +export const ThroughputSettingsGetPropertiesResource: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "ThroughputSettingsGetPropertiesResource", + modelProperties: { + ...ThroughputSettingsResource.type.modelProperties, + ...ExtendedResourceProperties.type.modelProperties + } + } +}; + +export const ThroughputSettingsUpdateParameters: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "ThroughputSettingsUpdateParameters", + modelProperties: { + ...ARMResourceProperties.type.modelProperties, + resource: { + serializedName: "resource", + type: { + name: "Composite", + className: "ThroughputSettingsResource" + } + } + } + } +}; + +export const SqlContainerListResult: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "SqlContainerListResult", + modelProperties: { + value: { + serializedName: "value", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { name: "Composite", className: "SqlContainerGetResults" } + } + } + } + } + } +}; + +export const SqlContainerGetResults: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "SqlContainerGetResults", + modelProperties: { + ...ARMResourceProperties.type.modelProperties, + resource: { + serializedName: "resource", + type: { + name: "Composite", + className: "SqlContainerGetPropertiesResource" + } + }, + options: { + serializedName: "options", + type: { + name: "Composite", + className: "OptionsResource" + } + } + } + } +}; + +export const SqlContainerResource: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "SqlContainerResource", + modelProperties: { + id: { + serializedName: "id", + required: true, + type: { + name: "String" + } + }, + indexingPolicy: { + serializedName: "indexingPolicy", + type: { + name: "Composite", + className: "IndexingPolicy" + } + }, + partitionKey: { + serializedName: "partitionKey", + type: { + name: "Composite", + className: "ContainerPartitionKey" + } + }, + defaultTtl: { + serializedName: "defaultTtl", + type: { + name: "Number" + } + }, + uniqueKeyPolicy: { + serializedName: "uniqueKeyPolicy", + type: { + name: "Composite", + className: "UniqueKeyPolicy" + } + }, + conflictResolutionPolicy: { + serializedName: "conflictResolutionPolicy", + type: { + name: "Composite", + className: "ConflictResolutionPolicy" + } + } + } + } +}; + +export const IndexingPolicy: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "IndexingPolicy", + modelProperties: { + automatic: { + serializedName: "automatic", + type: { + name: "Boolean" + } + }, + indexingMode: { + defaultValue: "Consistent", + serializedName: "indexingMode", + type: { + name: "String" + } + }, + includedPaths: { + serializedName: "includedPaths", + type: { + name: "Sequence", + element: { type: { name: "Composite", className: "IncludedPath" } } + } + }, + excludedPaths: { + serializedName: "excludedPaths", + type: { + name: "Sequence", + element: { type: { name: "Composite", className: "ExcludedPath" } } + } + }, + compositeIndexes: { + serializedName: "compositeIndexes", + type: { + name: "Sequence", + element: { + type: { + name: "Sequence", + element: { + type: { name: "Composite", className: "CompositePath" } + } + } + } + } + }, + spatialIndexes: { + serializedName: "spatialIndexes", + type: { + name: "Sequence", + element: { type: { name: "Composite", className: "SpatialSpec" } } + } + } + } + } +}; + +export const IncludedPath: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "IncludedPath", + modelProperties: { + path: { + serializedName: "path", + type: { + name: "String" + } + }, + indexes: { + serializedName: "indexes", + type: { + name: "Sequence", + element: { type: { name: "Composite", className: "Indexes" } } + } + } + } + } +}; + +export const Indexes: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "Indexes", + modelProperties: { + dataType: { + defaultValue: "String", + serializedName: "dataType", + type: { + name: "String" + } + }, + precision: { + serializedName: "precision", + type: { + name: "Number" + } + }, + kind: { + defaultValue: "Hash", + serializedName: "kind", + type: { + name: "String" + } + } + } + } +}; + +export const ExcludedPath: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "ExcludedPath", + modelProperties: { + path: { + serializedName: "path", + type: { + name: "String" + } + } + } + } +}; + +export const CompositePath: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "CompositePath", + modelProperties: { + path: { + serializedName: "path", + type: { + name: "String" + } + }, + order: { + serializedName: "order", + type: { + name: "String" + } + } + } + } +}; + +export const SpatialSpec: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "SpatialSpec", + modelProperties: { + path: { + serializedName: "path", + type: { + name: "String" + } + }, + types: { + serializedName: "types", + type: { + name: "Sequence", + element: { type: { name: "String" } } + } + } + } + } +}; + +export const ContainerPartitionKey: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "ContainerPartitionKey", + modelProperties: { + paths: { + serializedName: "paths", + type: { + name: "Sequence", + element: { type: { name: "String" } } + } + }, + kind: { + defaultValue: "Hash", + serializedName: "kind", + type: { + name: "String" + } + }, + version: { + constraints: { + InclusiveMaximum: 2, + InclusiveMinimum: 1 + }, + serializedName: "version", + type: { + name: "Number" + } + } + } + } +}; + +export const UniqueKeyPolicy: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "UniqueKeyPolicy", + modelProperties: { + uniqueKeys: { + serializedName: "uniqueKeys", + type: { + name: "Sequence", + element: { type: { name: "Composite", className: "UniqueKey" } } + } + } + } + } +}; + +export const UniqueKey: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "UniqueKey", + modelProperties: { + paths: { + serializedName: "paths", + type: { + name: "Sequence", + element: { type: { name: "String" } } + } + } + } + } +}; + +export const ConflictResolutionPolicy: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "ConflictResolutionPolicy", + modelProperties: { + mode: { + defaultValue: "LastWriterWins", + serializedName: "mode", + type: { + name: "String" + } + }, + conflictResolutionPath: { + serializedName: "conflictResolutionPath", + type: { + name: "String" + } + }, + conflictResolutionProcedure: { + serializedName: "conflictResolutionProcedure", + type: { + name: "String" + } + } + } + } +}; + +export const SqlContainerGetPropertiesResource: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "SqlContainerGetPropertiesResource", + modelProperties: { + ...SqlContainerResource.type.modelProperties, + ...ExtendedResourceProperties.type.modelProperties + } + } +}; + +export const SqlContainerCreateUpdateParameters: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "SqlContainerCreateUpdateParameters", + modelProperties: { + ...ARMResourceProperties.type.modelProperties, + resource: { + serializedName: "resource", + type: { + name: "Composite", + className: "SqlContainerResource" + } + }, + options: { + serializedName: "options", + type: { + name: "Composite", + className: "CreateUpdateOptions" + } + } + } + } +}; + +export const SqlStoredProcedureListResult: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "SqlStoredProcedureListResult", + modelProperties: { + value: { + serializedName: "value", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "SqlStoredProcedureGetResults" + } + } + } + } + } + } +}; + +export const SqlStoredProcedureGetResults: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "SqlStoredProcedureGetResults", + modelProperties: { + ...ARMResourceProperties.type.modelProperties, + resource: { + serializedName: "resource", + type: { + name: "Composite", + className: "SqlStoredProcedureGetPropertiesResource" + } + } + } + } +}; + +export const SqlStoredProcedureResource: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "SqlStoredProcedureResource", + modelProperties: { + id: { + serializedName: "id", + required: true, + type: { + name: "String" + } + }, + body: { + serializedName: "body", + type: { + name: "String" + } + } + } + } +}; + +export const SqlStoredProcedureGetPropertiesResource: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "SqlStoredProcedureGetPropertiesResource", + modelProperties: { + ...SqlStoredProcedureResource.type.modelProperties, + ...ExtendedResourceProperties.type.modelProperties + } + } +}; + +export const SqlStoredProcedureCreateUpdateParameters: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "SqlStoredProcedureCreateUpdateParameters", + modelProperties: { + ...ARMResourceProperties.type.modelProperties, + resource: { + serializedName: "resource", + type: { + name: "Composite", + className: "SqlStoredProcedureResource" + } + }, + options: { + serializedName: "options", + type: { + name: "Composite", + className: "CreateUpdateOptions" + } + } + } + } +}; + +export const SqlUserDefinedFunctionListResult: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "SqlUserDefinedFunctionListResult", + modelProperties: { + value: { + serializedName: "value", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "SqlUserDefinedFunctionGetResults" + } + } + } + } + } + } +}; + +export const SqlUserDefinedFunctionGetResults: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "SqlUserDefinedFunctionGetResults", + modelProperties: { + ...ARMResourceProperties.type.modelProperties, + resource: { + serializedName: "resource", + type: { + name: "Composite", + className: "SqlUserDefinedFunctionGetPropertiesResource" + } + } + } + } +}; + +export const SqlUserDefinedFunctionResource: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "SqlUserDefinedFunctionResource", + modelProperties: { + id: { + serializedName: "id", + required: true, + type: { + name: "String" + } + }, + body: { + serializedName: "body", + type: { + name: "String" + } + } + } + } +}; + +export const SqlUserDefinedFunctionGetPropertiesResource: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "SqlUserDefinedFunctionGetPropertiesResource", + modelProperties: { + ...SqlUserDefinedFunctionResource.type.modelProperties, + ...ExtendedResourceProperties.type.modelProperties + } + } +}; + +export const SqlUserDefinedFunctionCreateUpdateParameters: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "SqlUserDefinedFunctionCreateUpdateParameters", + modelProperties: { + ...ARMResourceProperties.type.modelProperties, + resource: { + serializedName: "resource", + type: { + name: "Composite", + className: "SqlUserDefinedFunctionResource" + } + }, + options: { + serializedName: "options", + type: { + name: "Composite", + className: "CreateUpdateOptions" + } + } + } + } +}; + +export const SqlTriggerListResult: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "SqlTriggerListResult", + modelProperties: { + value: { + serializedName: "value", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { name: "Composite", className: "SqlTriggerGetResults" } + } + } + } + } + } +}; + +export const SqlTriggerGetResults: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "SqlTriggerGetResults", + modelProperties: { + ...ARMResourceProperties.type.modelProperties, + resource: { + serializedName: "resource", + type: { + name: "Composite", + className: "SqlTriggerGetPropertiesResource" + } + } + } + } +}; + +export const SqlTriggerResource: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "SqlTriggerResource", + modelProperties: { + id: { + serializedName: "id", + required: true, + type: { + name: "String" + } + }, + body: { + serializedName: "body", + type: { + name: "String" + } + }, + triggerType: { + serializedName: "triggerType", + type: { + name: "String" + } + }, + triggerOperation: { + serializedName: "triggerOperation", + type: { + name: "String" + } + } + } + } +}; + +export const SqlTriggerGetPropertiesResource: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "SqlTriggerGetPropertiesResource", + modelProperties: { + ...SqlTriggerResource.type.modelProperties, + ...ExtendedResourceProperties.type.modelProperties + } + } +}; + +export const SqlTriggerCreateUpdateParameters: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "SqlTriggerCreateUpdateParameters", + modelProperties: { + ...ARMResourceProperties.type.modelProperties, + resource: { + serializedName: "resource", + type: { + name: "Composite", + className: "SqlTriggerResource" + } + }, + options: { + serializedName: "options", + type: { + name: "Composite", + className: "CreateUpdateOptions" + } + } + } + } +}; + +export const MongoDBDatabaseListResult: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "MongoDBDatabaseListResult", + modelProperties: { + value: { + serializedName: "value", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { name: "Composite", className: "MongoDBDatabaseGetResults" } + } + } + } + } + } +}; + +export const MongoDBDatabaseGetResults: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "MongoDBDatabaseGetResults", + modelProperties: { + ...ARMResourceProperties.type.modelProperties, + resource: { + serializedName: "resource", + type: { + name: "Composite", + className: "MongoDBDatabaseGetPropertiesResource" + } + }, + options: { + serializedName: "options", + type: { + name: "Composite", + className: "OptionsResource" + } + } + } + } +}; + +export const MongoDBDatabaseResource: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "MongoDBDatabaseResource", + modelProperties: { + id: { + serializedName: "id", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const MongoDBDatabaseGetPropertiesResource: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "MongoDBDatabaseGetPropertiesResource", + modelProperties: { + ...MongoDBDatabaseResource.type.modelProperties, + ...ExtendedResourceProperties.type.modelProperties + } + } +}; + +export const MongoDBDatabaseCreateUpdateParameters: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "MongoDBDatabaseCreateUpdateParameters", + modelProperties: { + ...ARMResourceProperties.type.modelProperties, + resource: { + serializedName: "resource", + type: { + name: "Composite", + className: "MongoDBDatabaseResource" + } + }, + options: { + serializedName: "options", + type: { + name: "Composite", + className: "CreateUpdateOptions" + } + } + } + } +}; + +export const MongoDBCollectionListResult: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "MongoDBCollectionListResult", + modelProperties: { + value: { + serializedName: "value", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "MongoDBCollectionGetResults" + } + } + } + } + } + } +}; + +export const MongoDBCollectionGetResults: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "MongoDBCollectionGetResults", + modelProperties: { + ...ARMResourceProperties.type.modelProperties, + resource: { + serializedName: "resource", + type: { + name: "Composite", + className: "MongoDBCollectionGetPropertiesResource" + } + }, + options: { + serializedName: "options", + type: { + name: "Composite", + className: "OptionsResource" + } + } + } + } +}; + +export const MongoDBCollectionResource: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "MongoDBCollectionResource", + modelProperties: { + id: { + serializedName: "id", + required: true, + type: { + name: "String" + } + }, + shardKey: { + serializedName: "shardKey", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + }, + indexes: { + serializedName: "indexes", + type: { + name: "Sequence", + element: { type: { name: "Composite", className: "MongoIndex" } } + } + } + } + } +}; + +export const MongoIndex: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "MongoIndex", + modelProperties: { + key: { + serializedName: "key", + type: { + name: "Composite", + className: "MongoIndexKeys" + } + }, + options: { + serializedName: "options", + type: { + name: "Composite", + className: "MongoIndexOptions" + } + } + } + } +}; + +export const MongoIndexKeys: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "MongoIndexKeys", + modelProperties: { + keys: { + serializedName: "keys", + type: { + name: "Sequence", + element: { type: { name: "String" } } + } + } + } + } +}; + +export const MongoIndexOptions: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "MongoIndexOptions", + modelProperties: { + expireAfterSeconds: { + serializedName: "expireAfterSeconds", + type: { + name: "Number" + } + }, + unique: { + serializedName: "unique", + type: { + name: "Boolean" + } + } + } + } +}; + +export const MongoDBCollectionGetPropertiesResource: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "MongoDBCollectionGetPropertiesResource", + modelProperties: { + ...MongoDBCollectionResource.type.modelProperties, + ...ExtendedResourceProperties.type.modelProperties + } + } +}; + +export const MongoDBCollectionCreateUpdateParameters: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "MongoDBCollectionCreateUpdateParameters", + modelProperties: { + ...ARMResourceProperties.type.modelProperties, + resource: { + serializedName: "resource", + type: { + name: "Composite", + className: "MongoDBCollectionResource" + } + }, + options: { + serializedName: "options", + type: { + name: "Composite", + className: "CreateUpdateOptions" + } + } + } + } +}; + +export const TableListResult: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "TableListResult", + modelProperties: { + value: { + serializedName: "value", + readOnly: true, + type: { + name: "Sequence", + element: { type: { name: "Composite", className: "TableGetResults" } } + } + } + } + } +}; + +export const TableGetResults: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "TableGetResults", + modelProperties: { + ...ARMResourceProperties.type.modelProperties, + resource: { + serializedName: "resource", + type: { + name: "Composite", + className: "TableGetPropertiesResource" + } + }, + options: { + serializedName: "options", + type: { + name: "Composite", + className: "OptionsResource" + } + } + } + } +}; + +export const TableResource: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "TableResource", + modelProperties: { + id: { + serializedName: "id", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const TableGetPropertiesResource: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "TableGetPropertiesResource", + modelProperties: { + ...TableResource.type.modelProperties, + ...ExtendedResourceProperties.type.modelProperties + } + } +}; + +export const TableCreateUpdateParameters: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "TableCreateUpdateParameters", + modelProperties: { + ...ARMResourceProperties.type.modelProperties, + resource: { + serializedName: "resource", + type: { + name: "Composite", + className: "TableResource" + } + }, + options: { + serializedName: "options", + type: { + name: "Composite", + className: "CreateUpdateOptions" + } + } + } + } +}; + +export const CassandraKeyspaceListResult: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "CassandraKeyspaceListResult", + modelProperties: { + value: { + serializedName: "value", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "CassandraKeyspaceGetResults" + } + } + } + } + } + } +}; + +export const CassandraKeyspaceGetResults: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "CassandraKeyspaceGetResults", + modelProperties: { + ...ARMResourceProperties.type.modelProperties, + resource: { + serializedName: "resource", + type: { + name: "Composite", + className: "CassandraKeyspaceGetPropertiesResource" + } + }, + options: { + serializedName: "options", + type: { + name: "Composite", + className: "OptionsResource" + } + } + } + } +}; + +export const CassandraKeyspaceResource: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "CassandraKeyspaceResource", + modelProperties: { + id: { + serializedName: "id", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const CassandraKeyspaceGetPropertiesResource: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "CassandraKeyspaceGetPropertiesResource", + modelProperties: { + ...CassandraKeyspaceResource.type.modelProperties, + ...ExtendedResourceProperties.type.modelProperties + } + } +}; + +export const CassandraKeyspaceCreateUpdateParameters: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "CassandraKeyspaceCreateUpdateParameters", + modelProperties: { + ...ARMResourceProperties.type.modelProperties, + resource: { + serializedName: "resource", + type: { + name: "Composite", + className: "CassandraKeyspaceResource" + } + }, + options: { + serializedName: "options", + type: { + name: "Composite", + className: "CreateUpdateOptions" + } + } + } + } +}; + +export const CassandraTableListResult: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "CassandraTableListResult", + modelProperties: { + value: { + serializedName: "value", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { name: "Composite", className: "CassandraTableGetResults" } + } + } + } + } + } +}; + +export const CassandraTableGetResults: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "CassandraTableGetResults", + modelProperties: { + ...ARMResourceProperties.type.modelProperties, + resource: { + serializedName: "resource", + type: { + name: "Composite", + className: "CassandraTableGetPropertiesResource" + } + }, + options: { + serializedName: "options", + type: { + name: "Composite", + className: "OptionsResource" + } + } + } + } +}; + +export const CassandraTableResource: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "CassandraTableResource", + modelProperties: { + id: { + serializedName: "id", + required: true, + type: { + name: "String" + } + }, + defaultTtl: { + serializedName: "defaultTtl", + type: { + name: "Number" + } + }, + schema: { + serializedName: "schema", + type: { + name: "Composite", + className: "CassandraSchema" + } + } + } + } +}; + +export const CassandraSchema: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "CassandraSchema", + modelProperties: { + columns: { + serializedName: "columns", + type: { + name: "Sequence", + element: { type: { name: "Composite", className: "Column" } } + } + }, + partitionKeys: { + serializedName: "partitionKeys", + type: { + name: "Sequence", + element: { + type: { name: "Composite", className: "CassandraPartitionKey" } + } + } + }, + clusterKeys: { + serializedName: "clusterKeys", + type: { + name: "Sequence", + element: { type: { name: "Composite", className: "ClusterKey" } } + } + } + } + } +}; + +export const Column: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "Column", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + }, + type: { + serializedName: "type", + type: { + name: "String" + } + } + } + } +}; + +export const CassandraPartitionKey: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "CassandraPartitionKey", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + } + } + } +}; + +export const ClusterKey: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "ClusterKey", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + }, + orderBy: { + serializedName: "orderBy", + type: { + name: "String" + } + } + } + } +}; + +export const CassandraTableGetPropertiesResource: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "CassandraTableGetPropertiesResource", + modelProperties: { + ...CassandraTableResource.type.modelProperties, + ...ExtendedResourceProperties.type.modelProperties + } + } +}; + +export const CassandraTableCreateUpdateParameters: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "CassandraTableCreateUpdateParameters", + modelProperties: { + ...ARMResourceProperties.type.modelProperties, + resource: { + serializedName: "resource", + type: { + name: "Composite", + className: "CassandraTableResource" + } + }, + options: { + serializedName: "options", + type: { + name: "Composite", + className: "CreateUpdateOptions" + } + } + } + } +}; + +export const GremlinDatabaseListResult: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "GremlinDatabaseListResult", + modelProperties: { + value: { + serializedName: "value", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { name: "Composite", className: "GremlinDatabaseGetResults" } + } + } + } + } + } +}; + +export const GremlinDatabaseGetResults: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "GremlinDatabaseGetResults", + modelProperties: { + ...ARMResourceProperties.type.modelProperties, + resource: { + serializedName: "resource", + type: { + name: "Composite", + className: "GremlinDatabaseGetPropertiesResource" + } + }, + options: { + serializedName: "options", + type: { + name: "Composite", + className: "OptionsResource" + } + } + } + } +}; + +export const GremlinDatabaseResource: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "GremlinDatabaseResource", + modelProperties: { + id: { + serializedName: "id", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const GremlinDatabaseGetPropertiesResource: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "GremlinDatabaseGetPropertiesResource", + modelProperties: { + ...GremlinDatabaseResource.type.modelProperties, + ...ExtendedResourceProperties.type.modelProperties + } + } +}; + +export const GremlinDatabaseCreateUpdateParameters: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "GremlinDatabaseCreateUpdateParameters", + modelProperties: { + ...ARMResourceProperties.type.modelProperties, + resource: { + serializedName: "resource", + type: { + name: "Composite", + className: "GremlinDatabaseResource" + } + }, + options: { + serializedName: "options", + type: { + name: "Composite", + className: "CreateUpdateOptions" + } + } + } + } +}; + +export const GremlinGraphListResult: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "GremlinGraphListResult", + modelProperties: { + value: { + serializedName: "value", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { name: "Composite", className: "GremlinGraphGetResults" } + } + } + } + } + } +}; + +export const GremlinGraphGetResults: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "GremlinGraphGetResults", + modelProperties: { + ...ARMResourceProperties.type.modelProperties, + resource: { + serializedName: "resource", + type: { + name: "Composite", + className: "GremlinGraphGetPropertiesResource" + } + }, + options: { + serializedName: "options", + type: { + name: "Composite", + className: "OptionsResource" + } + } + } + } +}; + +export const GremlinGraphResource: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "GremlinGraphResource", + modelProperties: { + id: { + serializedName: "id", + required: true, + type: { + name: "String" + } + }, + indexingPolicy: { + serializedName: "indexingPolicy", + type: { + name: "Composite", + className: "IndexingPolicy" + } + }, + partitionKey: { + serializedName: "partitionKey", + type: { + name: "Composite", + className: "ContainerPartitionKey" + } + }, + defaultTtl: { + serializedName: "defaultTtl", + type: { + name: "Number" + } + }, + uniqueKeyPolicy: { + serializedName: "uniqueKeyPolicy", + type: { + name: "Composite", + className: "UniqueKeyPolicy" + } + }, + conflictResolutionPolicy: { + serializedName: "conflictResolutionPolicy", + type: { + name: "Composite", + className: "ConflictResolutionPolicy" + } + } + } + } +}; + +export const GremlinGraphGetPropertiesResource: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "GremlinGraphGetPropertiesResource", + modelProperties: { + ...GremlinGraphResource.type.modelProperties, + ...ExtendedResourceProperties.type.modelProperties + } + } +}; + +export const GremlinGraphCreateUpdateParameters: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "GremlinGraphCreateUpdateParameters", + modelProperties: { + ...ARMResourceProperties.type.modelProperties, + resource: { + serializedName: "resource", + type: { + name: "Composite", + className: "GremlinGraphResource" + } + }, + options: { + serializedName: "options", + type: { + name: "Composite", + className: "CreateUpdateOptions" + } + } + } + } +}; + +export const NotebookWorkspaceListResult: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "NotebookWorkspaceListResult", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { name: "Composite", className: "NotebookWorkspace" } + } + } + } + } + } +}; + +export const ARMProxyResource: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "ARMProxyResource", + modelProperties: { + id: { + serializedName: "id", + readOnly: true, + type: { + name: "String" + } + }, + name: { + serializedName: "name", + readOnly: true, + type: { + name: "String" + } + }, + type: { + serializedName: "type", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const NotebookWorkspace: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "NotebookWorkspace", + modelProperties: { + ...ARMProxyResource.type.modelProperties, + notebookServerEndpoint: { + serializedName: "properties.notebookServerEndpoint", + readOnly: true, + type: { + name: "String" + } + }, + status: { + serializedName: "properties.status", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const NotebookWorkspaceConnectionInfoResult: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "NotebookWorkspaceConnectionInfoResult", + modelProperties: { + authToken: { + serializedName: "authToken", + readOnly: true, + type: { + name: "String" + } + }, + notebookServerEndpoint: { + serializedName: "notebookServerEndpoint", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const PrivateLinkResourceListResult: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "PrivateLinkResourceListResult", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { name: "Composite", className: "PrivateLinkResource" } + } + } + } + } + } +}; + +export const PrivateLinkResource: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "PrivateLinkResource", + modelProperties: { + ...ARMProxyResource.type.modelProperties, + groupId: { + serializedName: "properties.groupId", + readOnly: true, + type: { + name: "String" + } + }, + requiredMembers: { + serializedName: "properties.requiredMembers", + readOnly: true, + type: { + name: "Sequence", + element: { type: { name: "String" } } + } + }, + requiredZoneNames: { + serializedName: "properties.requiredZoneNames", + readOnly: true, + type: { + name: "Sequence", + element: { type: { name: "String" } } + } + } + } + } +}; + +export const PrivateEndpointConnectionListResult: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "PrivateEndpointConnectionListResult", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "PrivateEndpointConnectionAutoGenerated" + } + } + } + } + } + } +}; + +export const PrivateEndpointConnectionAutoGenerated: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "PrivateEndpointConnectionAutoGenerated", + modelProperties: { + ...Resource.type.modelProperties, + privateEndpoint: { + serializedName: "privateEndpoint", + type: { + name: "Composite", + className: "PrivateEndpointProperty" + } + }, + privateLinkServiceConnectionState: { + serializedName: "privateLinkServiceConnectionState", + type: { + name: "Composite", + className: "PrivateLinkServiceConnectionStatePropertyAutoGenerated" + } + }, + groupId: { + serializedName: "properties.groupId", + type: { + name: "String" + } + }, + provisioningState: { + serializedName: "properties.provisioningState", + type: { + name: "String" + } + } + } + } +}; + +export const PrivateLinkServiceConnectionStatePropertyAutoGenerated: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "PrivateLinkServiceConnectionStatePropertyAutoGenerated", + modelProperties: { + status: { + serializedName: "status", + type: { + name: "String" + } + }, + description: { + serializedName: "description", + type: { + name: "String" + } + }, + actionsRequired: { + serializedName: "actionsRequired", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const SqlDatabaseGetPropertiesOptions: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "SqlDatabaseGetPropertiesOptions", + modelProperties: { + ...OptionsResource.type.modelProperties + } + } +}; + +export const SqlContainerGetPropertiesOptions: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "SqlContainerGetPropertiesOptions", + modelProperties: { + ...OptionsResource.type.modelProperties + } + } +}; + +export const MongoDBDatabaseGetPropertiesOptions: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "MongoDBDatabaseGetPropertiesOptions", + modelProperties: { + ...OptionsResource.type.modelProperties + } + } +}; + +export const MongoDBCollectionGetPropertiesOptions: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "MongoDBCollectionGetPropertiesOptions", + modelProperties: { + ...OptionsResource.type.modelProperties + } + } +}; + +export const TableGetPropertiesOptions: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "TableGetPropertiesOptions", + modelProperties: { + ...OptionsResource.type.modelProperties + } + } +}; + +export const CassandraKeyspaceGetPropertiesOptions: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "CassandraKeyspaceGetPropertiesOptions", + modelProperties: { + ...OptionsResource.type.modelProperties + } + } +}; + +export const CassandraTableGetPropertiesOptions: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "CassandraTableGetPropertiesOptions", + modelProperties: { + ...OptionsResource.type.modelProperties + } + } +}; + +export const GremlinDatabaseGetPropertiesOptions: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "GremlinDatabaseGetPropertiesOptions", + modelProperties: { + ...OptionsResource.type.modelProperties + } + } +}; + +export const GremlinGraphGetPropertiesOptions: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "GremlinGraphGetPropertiesOptions", + modelProperties: { + ...OptionsResource.type.modelProperties + } + } +}; + +export const NotebookWorkspaceCreateUpdateParameters: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "NotebookWorkspaceCreateUpdateParameters", + modelProperties: { + ...ARMProxyResource.type.modelProperties + } + } +}; + +export const ProxyResource: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "ProxyResource", + modelProperties: { + ...Resource.type.modelProperties + } + } +}; diff --git a/test/smoke/generated/cosmos-db-resource-manager/src/models/parameters.ts b/test/smoke/generated/cosmos-db-resource-manager/src/models/parameters.ts new file mode 100644 index 0000000000..19b1ae3353 --- /dev/null +++ b/test/smoke/generated/cosmos-db-resource-manager/src/models/parameters.ts @@ -0,0 +1,493 @@ +/* + * 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 * as coreHttp from "@azure/core-http"; +import * as Mappers from "../models/mappers"; + +export const $host: coreHttp.OperationURLParameter = { + parameterPath: "$host", + mapper: { + serializedName: "$host", + required: true, + type: { + name: "String" + } + }, + skipEncoding: true +}; + +export const subscriptionId: coreHttp.OperationURLParameter = { + parameterPath: "subscriptionId", + mapper: { + constraints: { + MinLength: 1 + }, + serializedName: "subscriptionId", + required: true, + type: { + name: "String" + } + } +}; + +export const resourceGroupName: coreHttp.OperationURLParameter = { + parameterPath: "resourceGroupName", + mapper: { + constraints: { + Pattern: new RegExp("^[-w._()]+$"), + MaxLength: 90, + MinLength: 1 + }, + serializedName: "resourceGroupName", + required: true, + type: { + name: "String" + } + } +}; + +export const accountName: coreHttp.OperationURLParameter = { + parameterPath: "accountName", + mapper: { + constraints: { + Pattern: new RegExp("^[a-z0-9]+(-[a-z0-9]+)*"), + MaxLength: 50, + MinLength: 3 + }, + serializedName: "accountName", + required: true, + type: { + name: "String" + } + } +}; + +export const apiVersion: coreHttp.OperationQueryParameter = { + parameterPath: "apiVersion", + mapper: { + defaultValue: "2020-03-01", + isConstant: true, + serializedName: "api-version", + type: { + name: "String" + } + } +}; + +export const contentType: coreHttp.OperationParameter = { + parameterPath: ["options", "contentType"], + mapper: { + defaultValue: "application/json", + isConstant: true, + serializedName: "Content-Type", + type: { + name: "String" + } + } +}; + +export const updateParameters: coreHttp.OperationParameter = { + parameterPath: "updateParameters", + mapper: Mappers.DatabaseAccountUpdateParameters +}; + +export const createUpdateParameters: coreHttp.OperationParameter = { + parameterPath: "createUpdateParameters", + mapper: Mappers.DatabaseAccountCreateUpdateParameters +}; + +export const failoverParameters: coreHttp.OperationParameter = { + parameterPath: "failoverParameters", + mapper: Mappers.FailoverPolicies +}; + +export const regionParameterForOffline: coreHttp.OperationParameter = { + parameterPath: "regionParameterForOffline", + mapper: Mappers.RegionForOnlineOffline +}; + +export const regionParameterForOnline: coreHttp.OperationParameter = { + parameterPath: "regionParameterForOnline", + mapper: Mappers.RegionForOnlineOffline +}; + +export const keyToRegenerate: coreHttp.OperationParameter = { + parameterPath: "keyToRegenerate", + mapper: Mappers.DatabaseAccountRegenerateKeyParameters +}; + +export const filter: coreHttp.OperationQueryParameter = { + parameterPath: "filter", + mapper: { + serializedName: "$filter", + required: true, + type: { + name: "String" + } + } +}; + +export const filter1: coreHttp.OperationQueryParameter = { + parameterPath: ["options", "filter"], + mapper: { + serializedName: "$filter", + type: { + name: "String" + } + } +}; + +export const nextLink: coreHttp.OperationURLParameter = { + parameterPath: "nextLink", + mapper: { + serializedName: "nextLink", + required: true, + type: { + name: "String" + } + }, + skipEncoding: true +}; + +export const databaseRid: coreHttp.OperationURLParameter = { + parameterPath: "databaseRid", + mapper: { + serializedName: "databaseRid", + required: true, + type: { + name: "String" + } + } +}; + +export const collectionRid: coreHttp.OperationURLParameter = { + parameterPath: "collectionRid", + mapper: { + serializedName: "collectionRid", + required: true, + type: { + name: "String" + } + } +}; + +export const region: coreHttp.OperationURLParameter = { + parameterPath: "region", + mapper: { + serializedName: "region", + required: true, + type: { + name: "String" + } + } +}; + +export const sourceRegion: coreHttp.OperationURLParameter = { + parameterPath: "sourceRegion", + mapper: { + serializedName: "sourceRegion", + required: true, + type: { + name: "String" + } + } +}; + +export const targetRegion: coreHttp.OperationURLParameter = { + parameterPath: "targetRegion", + mapper: { + serializedName: "targetRegion", + required: true, + type: { + name: "String" + } + } +}; + +export const partitionKeyRangeId: coreHttp.OperationURLParameter = { + parameterPath: "partitionKeyRangeId", + mapper: { + serializedName: "partitionKeyRangeId", + required: true, + type: { + name: "String" + } + } +}; + +export const databaseName: coreHttp.OperationURLParameter = { + parameterPath: "databaseName", + mapper: { + serializedName: "databaseName", + required: true, + type: { + name: "String" + } + } +}; + +export const createUpdateSqlDatabaseParameters: coreHttp.OperationParameter = { + parameterPath: "createUpdateSqlDatabaseParameters", + mapper: Mappers.SqlDatabaseCreateUpdateParameters +}; + +export const updateThroughputParameters: coreHttp.OperationParameter = { + parameterPath: "updateThroughputParameters", + mapper: Mappers.ThroughputSettingsUpdateParameters +}; + +export const containerName: coreHttp.OperationURLParameter = { + parameterPath: "containerName", + mapper: { + serializedName: "containerName", + required: true, + type: { + name: "String" + } + } +}; + +export const createUpdateSqlContainerParameters: coreHttp.OperationParameter = { + parameterPath: "createUpdateSqlContainerParameters", + mapper: Mappers.SqlContainerCreateUpdateParameters +}; + +export const updateThroughputParameters1: coreHttp.OperationParameter = { + parameterPath: "updateThroughputParameters", + mapper: Mappers.ThroughputSettingsUpdateParameters +}; + +export const storedProcedureName: coreHttp.OperationURLParameter = { + parameterPath: "storedProcedureName", + mapper: { + serializedName: "storedProcedureName", + required: true, + type: { + name: "String" + } + } +}; + +export const createUpdateSqlStoredProcedureParameters: coreHttp.OperationParameter = { + parameterPath: "createUpdateSqlStoredProcedureParameters", + mapper: Mappers.SqlStoredProcedureCreateUpdateParameters +}; + +export const userDefinedFunctionName: coreHttp.OperationURLParameter = { + parameterPath: "userDefinedFunctionName", + mapper: { + serializedName: "userDefinedFunctionName", + required: true, + type: { + name: "String" + } + } +}; + +export const createUpdateSqlUserDefinedFunctionParameters: coreHttp.OperationParameter = { + parameterPath: "createUpdateSqlUserDefinedFunctionParameters", + mapper: Mappers.SqlUserDefinedFunctionCreateUpdateParameters +}; + +export const triggerName: coreHttp.OperationURLParameter = { + parameterPath: "triggerName", + mapper: { + serializedName: "triggerName", + required: true, + type: { + name: "String" + } + } +}; + +export const createUpdateSqlTriggerParameters: coreHttp.OperationParameter = { + parameterPath: "createUpdateSqlTriggerParameters", + mapper: Mappers.SqlTriggerCreateUpdateParameters +}; + +export const createUpdateMongoDBDatabaseParameters: coreHttp.OperationParameter = { + parameterPath: "createUpdateMongoDBDatabaseParameters", + mapper: Mappers.MongoDBDatabaseCreateUpdateParameters +}; + +export const updateThroughputParameters2: coreHttp.OperationParameter = { + parameterPath: "updateThroughputParameters", + mapper: Mappers.ThroughputSettingsUpdateParameters +}; + +export const collectionName: coreHttp.OperationURLParameter = { + parameterPath: "collectionName", + mapper: { + serializedName: "collectionName", + required: true, + type: { + name: "String" + } + } +}; + +export const createUpdateMongoDBCollectionParameters: coreHttp.OperationParameter = { + parameterPath: "createUpdateMongoDBCollectionParameters", + mapper: Mappers.MongoDBCollectionCreateUpdateParameters +}; + +export const updateThroughputParameters3: coreHttp.OperationParameter = { + parameterPath: "updateThroughputParameters", + mapper: Mappers.ThroughputSettingsUpdateParameters +}; + +export const tableName: coreHttp.OperationURLParameter = { + parameterPath: "tableName", + mapper: { + serializedName: "tableName", + required: true, + type: { + name: "String" + } + } +}; + +export const createUpdateTableParameters: coreHttp.OperationParameter = { + parameterPath: "createUpdateTableParameters", + mapper: Mappers.TableCreateUpdateParameters +}; + +export const updateThroughputParameters4: coreHttp.OperationParameter = { + parameterPath: "updateThroughputParameters", + mapper: Mappers.ThroughputSettingsUpdateParameters +}; + +export const keyspaceName: coreHttp.OperationURLParameter = { + parameterPath: "keyspaceName", + mapper: { + serializedName: "keyspaceName", + required: true, + type: { + name: "String" + } + } +}; + +export const createUpdateCassandraKeyspaceParameters: coreHttp.OperationParameter = { + parameterPath: "createUpdateCassandraKeyspaceParameters", + mapper: Mappers.CassandraKeyspaceCreateUpdateParameters +}; + +export const updateThroughputParameters5: coreHttp.OperationParameter = { + parameterPath: "updateThroughputParameters", + mapper: Mappers.ThroughputSettingsUpdateParameters +}; + +export const createUpdateCassandraTableParameters: coreHttp.OperationParameter = { + parameterPath: "createUpdateCassandraTableParameters", + mapper: Mappers.CassandraTableCreateUpdateParameters +}; + +export const updateThroughputParameters6: coreHttp.OperationParameter = { + parameterPath: "updateThroughputParameters", + mapper: Mappers.ThroughputSettingsUpdateParameters +}; + +export const createUpdateGremlinDatabaseParameters: coreHttp.OperationParameter = { + parameterPath: "createUpdateGremlinDatabaseParameters", + mapper: Mappers.GremlinDatabaseCreateUpdateParameters +}; + +export const updateThroughputParameters7: coreHttp.OperationParameter = { + parameterPath: "updateThroughputParameters", + mapper: Mappers.ThroughputSettingsUpdateParameters +}; + +export const graphName: coreHttp.OperationURLParameter = { + parameterPath: "graphName", + mapper: { + serializedName: "graphName", + required: true, + type: { + name: "String" + } + } +}; + +export const createUpdateGremlinGraphParameters: coreHttp.OperationParameter = { + parameterPath: "createUpdateGremlinGraphParameters", + mapper: Mappers.GremlinGraphCreateUpdateParameters +}; + +export const updateThroughputParameters8: coreHttp.OperationParameter = { + parameterPath: "updateThroughputParameters", + mapper: Mappers.ThroughputSettingsUpdateParameters +}; + +export const apiVersion1: coreHttp.OperationQueryParameter = { + parameterPath: "apiVersion", + mapper: { + defaultValue: "2019-08-01", + isConstant: true, + serializedName: "api-version", + type: { + name: "String" + } + } +}; + +export const notebookWorkspaceName: coreHttp.OperationURLParameter = { + parameterPath: "notebookWorkspaceName", + mapper: { + defaultValue: "default", + isConstant: true, + serializedName: "notebookWorkspaceName", + type: { + name: "String" + } + } +}; + +export const notebookCreateUpdateParameters: coreHttp.OperationParameter = { + parameterPath: "notebookCreateUpdateParameters", + mapper: Mappers.ARMProxyResource +}; + +export const apiVersion2: coreHttp.OperationQueryParameter = { + parameterPath: "apiVersion", + mapper: { + defaultValue: "2019-08-01-preview", + isConstant: true, + serializedName: "api-version", + type: { + name: "String" + } + } +}; + +export const groupName: coreHttp.OperationURLParameter = { + parameterPath: "groupName", + mapper: { + serializedName: "groupName", + required: true, + type: { + name: "String" + } + } +}; + +export const privateEndpointConnectionName: coreHttp.OperationURLParameter = { + parameterPath: "privateEndpointConnectionName", + mapper: { + serializedName: "privateEndpointConnectionName", + required: true, + type: { + name: "String" + } + } +}; + +export const parameters: coreHttp.OperationParameter = { + parameterPath: "parameters", + mapper: Mappers.PrivateEndpointConnectionAutoGenerated +}; diff --git a/test/smoke/generated/cosmos-db-resource-manager/src/operations/cassandraResources.ts b/test/smoke/generated/cosmos-db-resource-manager/src/operations/cassandraResources.ts new file mode 100644 index 0000000000..b5bce562eb --- /dev/null +++ b/test/smoke/generated/cosmos-db-resource-manager/src/operations/cassandraResources.ts @@ -0,0 +1,780 @@ +/* + * 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 * as coreHttp from "@azure/core-http"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { CosmosDBManagementClient } from "../cosmosDBManagementClient"; +import { LROPoller, shouldDeserializeLRO } from "../lro"; +import { + CassandraResourcesListCassandraKeyspacesResponse, + CassandraResourcesGetCassandraKeyspaceResponse, + CassandraKeyspaceCreateUpdateParameters, + CassandraResourcesCreateUpdateCassandraKeyspaceResponse, + CassandraResourcesGetCassandraKeyspaceThroughputResponse, + ThroughputSettingsUpdateParameters, + CassandraResourcesUpdateCassandraKeyspaceThroughputResponse, + CassandraResourcesListCassandraTablesResponse, + CassandraResourcesGetCassandraTableResponse, + CassandraTableCreateUpdateParameters, + CassandraResourcesCreateUpdateCassandraTableResponse, + CassandraResourcesGetCassandraTableThroughputResponse, + CassandraResourcesUpdateCassandraTableThroughputResponse +} from "../models"; + +/** + * Class representing a CassandraResources. + */ +export class CassandraResources { + private readonly client: CosmosDBManagementClient; + + /** + * Initialize a new instance of the class CassandraResources class. + * @param client Reference to the service client + */ + constructor(client: CosmosDBManagementClient) { + this.client = client; + } + + /** + * Lists the Cassandra keyspaces under an existing Azure Cosmos DB database account. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param options The options parameters. + */ + listCassandraKeyspaces( + resourceGroupName: string, + accountName: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { resourceGroupName, accountName, options: operationOptions }, + listCassandraKeyspacesOperationSpec + ) as Promise; + } + + /** + * Gets the Cassandra keyspaces under an existing Azure Cosmos DB database account with the provided + * name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param options The options parameters. + */ + getCassandraKeyspace( + resourceGroupName: string, + accountName: string, + keyspaceName: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { + resourceGroupName, + accountName, + keyspaceName, + options: operationOptions + }, + getCassandraKeyspaceOperationSpec + ) as Promise; + } + + /** + * Create or update an Azure Cosmos DB Cassandra keyspace + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param createUpdateCassandraKeyspaceParameters The parameters to provide for the current Cassandra + * keyspace. + * @param options The options parameters. + */ + async createUpdateCassandraKeyspace( + resourceGroupName: string, + accountName: string, + keyspaceName: string, + createUpdateCassandraKeyspaceParameters: CassandraKeyspaceCreateUpdateParameters, + options?: coreHttp.OperationOptions + ): Promise< + LROPoller + > { + const operationOptions: coreHttp.RequestOptionsBase = this.getOperationOptions( + options + ); + + const args: coreHttp.OperationArguments = { + resourceGroupName, + accountName, + keyspaceName, + createUpdateCassandraKeyspaceParameters, + options: operationOptions + }; + const sendOperation = ( + args: coreHttp.OperationArguments, + spec: coreHttp.OperationSpec + ) => + this.client.sendOperationRequest(args, spec) as Promise< + CassandraResourcesCreateUpdateCassandraKeyspaceResponse + >; + const initialOperationResult = await sendOperation( + args, + createUpdateCassandraKeyspaceOperationSpec + ); + + return new LROPoller({ + initialOperationArguments: args, + initialOperationSpec: createUpdateCassandraKeyspaceOperationSpec, + initialOperationResult, + sendOperation + }); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra keyspace. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param options The options parameters. + */ + async deleteCassandraKeyspace( + resourceGroupName: string, + accountName: string, + keyspaceName: string, + options?: coreHttp.OperationOptions + ): Promise> { + const operationOptions: coreHttp.RequestOptionsBase = this.getOperationOptions( + options + ); + + const args: coreHttp.OperationArguments = { + resourceGroupName, + accountName, + keyspaceName, + options: operationOptions + }; + const sendOperation = ( + args: coreHttp.OperationArguments, + spec: coreHttp.OperationSpec + ) => + this.client.sendOperationRequest(args, spec) as Promise< + coreHttp.RestResponse + >; + const initialOperationResult = await sendOperation( + args, + deleteCassandraKeyspaceOperationSpec + ); + + return new LROPoller({ + initialOperationArguments: args, + initialOperationSpec: deleteCassandraKeyspaceOperationSpec, + initialOperationResult, + sendOperation + }); + } + + /** + * Gets the RUs per second of the Cassandra Keyspace under an existing Azure Cosmos DB database account + * with the provided name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param options The options parameters. + */ + getCassandraKeyspaceThroughput( + resourceGroupName: string, + accountName: string, + keyspaceName: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { + resourceGroupName, + accountName, + keyspaceName, + options: operationOptions + }, + getCassandraKeyspaceThroughputOperationSpec + ) as Promise; + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra Keyspace + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current + * Cassandra Keyspace. + * @param options The options parameters. + */ + async updateCassandraKeyspaceThroughput( + resourceGroupName: string, + accountName: string, + keyspaceName: string, + updateThroughputParameters: ThroughputSettingsUpdateParameters, + options?: coreHttp.OperationOptions + ): Promise< + LROPoller + > { + const operationOptions: coreHttp.RequestOptionsBase = this.getOperationOptions( + options + ); + + const args: coreHttp.OperationArguments = { + resourceGroupName, + accountName, + keyspaceName, + updateThroughputParameters, + options: operationOptions + }; + const sendOperation = ( + args: coreHttp.OperationArguments, + spec: coreHttp.OperationSpec + ) => + this.client.sendOperationRequest(args, spec) as Promise< + CassandraResourcesUpdateCassandraKeyspaceThroughputResponse + >; + const initialOperationResult = await sendOperation( + args, + updateCassandraKeyspaceThroughputOperationSpec + ); + + return new LROPoller({ + initialOperationArguments: args, + initialOperationSpec: updateCassandraKeyspaceThroughputOperationSpec, + initialOperationResult, + sendOperation + }); + } + + /** + * Lists the Cassandra table under an existing Azure Cosmos DB database account. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param options The options parameters. + */ + listCassandraTables( + resourceGroupName: string, + accountName: string, + keyspaceName: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { + resourceGroupName, + accountName, + keyspaceName, + options: operationOptions + }, + listCassandraTablesOperationSpec + ) as Promise; + } + + /** + * Gets the Cassandra table under an existing Azure Cosmos DB database account. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param keyspaceName Cosmos DB keyspace name. + * @param options The options parameters. + */ + getCassandraTable( + resourceGroupName: string, + accountName: string, + tableName: string, + keyspaceName: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { + resourceGroupName, + accountName, + tableName, + keyspaceName, + options: operationOptions + }, + getCassandraTableOperationSpec + ) as Promise; + } + + /** + * Create or update an Azure Cosmos DB Cassandra Table + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param keyspaceName Cosmos DB keyspace name. + * @param createUpdateCassandraTableParameters The parameters to provide for the current Cassandra + * Table. + * @param options The options parameters. + */ + async createUpdateCassandraTable( + resourceGroupName: string, + accountName: string, + tableName: string, + keyspaceName: string, + createUpdateCassandraTableParameters: CassandraTableCreateUpdateParameters, + options?: coreHttp.OperationOptions + ): Promise> { + const operationOptions: coreHttp.RequestOptionsBase = this.getOperationOptions( + options + ); + + const args: coreHttp.OperationArguments = { + resourceGroupName, + accountName, + tableName, + keyspaceName, + createUpdateCassandraTableParameters, + options: operationOptions + }; + const sendOperation = ( + args: coreHttp.OperationArguments, + spec: coreHttp.OperationSpec + ) => + this.client.sendOperationRequest(args, spec) as Promise< + CassandraResourcesCreateUpdateCassandraTableResponse + >; + const initialOperationResult = await sendOperation( + args, + createUpdateCassandraTableOperationSpec + ); + + return new LROPoller({ + initialOperationArguments: args, + initialOperationSpec: createUpdateCassandraTableOperationSpec, + initialOperationResult, + sendOperation + }); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra table. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param keyspaceName Cosmos DB keyspace name. + * @param options The options parameters. + */ + async deleteCassandraTable( + resourceGroupName: string, + accountName: string, + tableName: string, + keyspaceName: string, + options?: coreHttp.OperationOptions + ): Promise> { + const operationOptions: coreHttp.RequestOptionsBase = this.getOperationOptions( + options + ); + + const args: coreHttp.OperationArguments = { + resourceGroupName, + accountName, + tableName, + keyspaceName, + options: operationOptions + }; + const sendOperation = ( + args: coreHttp.OperationArguments, + spec: coreHttp.OperationSpec + ) => + this.client.sendOperationRequest(args, spec) as Promise< + coreHttp.RestResponse + >; + const initialOperationResult = await sendOperation( + args, + deleteCassandraTableOperationSpec + ); + + return new LROPoller({ + initialOperationArguments: args, + initialOperationSpec: deleteCassandraTableOperationSpec, + initialOperationResult, + sendOperation + }); + } + + /** + * Gets the RUs per second of the Cassandra table under an existing Azure Cosmos DB database account + * with the provided name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param keyspaceName Cosmos DB keyspace name. + * @param options The options parameters. + */ + getCassandraTableThroughput( + resourceGroupName: string, + accountName: string, + tableName: string, + keyspaceName: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { + resourceGroupName, + accountName, + tableName, + keyspaceName, + options: operationOptions + }, + getCassandraTableThroughputOperationSpec + ) as Promise; + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra table + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param keyspaceName Cosmos DB keyspace name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current + * Cassandra table. + * @param options The options parameters. + */ + async updateCassandraTableThroughput( + resourceGroupName: string, + accountName: string, + tableName: string, + keyspaceName: string, + updateThroughputParameters: ThroughputSettingsUpdateParameters, + options?: coreHttp.OperationOptions + ): Promise< + LROPoller + > { + const operationOptions: coreHttp.RequestOptionsBase = this.getOperationOptions( + options + ); + + const args: coreHttp.OperationArguments = { + resourceGroupName, + accountName, + tableName, + keyspaceName, + updateThroughputParameters, + options: operationOptions + }; + const sendOperation = ( + args: coreHttp.OperationArguments, + spec: coreHttp.OperationSpec + ) => + this.client.sendOperationRequest(args, spec) as Promise< + CassandraResourcesUpdateCassandraTableThroughputResponse + >; + const initialOperationResult = await sendOperation( + args, + updateCassandraTableThroughputOperationSpec + ); + + return new LROPoller({ + initialOperationArguments: args, + initialOperationSpec: updateCassandraTableThroughputOperationSpec, + initialOperationResult, + sendOperation + }); + } + + private getOperationOptions( + options: TOptions | undefined, + finalStateVia?: string + ): coreHttp.RequestOptionsBase { + const operationOptions: coreHttp.OperationOptions = options || {}; + operationOptions.requestOptions = { + ...operationOptions.requestOptions, + shouldDeserialize: shouldDeserializeLRO(finalStateVia) + }; + return coreHttp.operationOptionsToRequestOptionsBase(operationOptions); + } +} +// Operation Specifications + +const serializer = new coreHttp.Serializer(Mappers, /* isXml */ false); + +const listCassandraKeyspacesOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.CassandraKeyspaceListResult + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName + ], + serializer +}; +const getCassandraKeyspaceOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.CassandraKeyspaceGetResults + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.keyspaceName + ], + serializer +}; +const createUpdateCassandraKeyspaceOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.CassandraKeyspaceGetResults + }, + 201: { + bodyMapper: Mappers.CassandraKeyspaceGetResults + }, + 202: { + bodyMapper: Mappers.CassandraKeyspaceGetResults + }, + 204: { + bodyMapper: Mappers.CassandraKeyspaceGetResults + } + }, + requestBody: Parameters.createUpdateCassandraKeyspaceParameters, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.keyspaceName + ], + headerParameters: [Parameters.contentType], + serializer +}; +const deleteCassandraKeyspaceOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}", + httpMethod: "DELETE", + responses: { 200: {}, 201: {}, 202: {}, 204: {} }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.keyspaceName + ], + serializer +}; +const getCassandraKeyspaceThroughputOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ThroughputSettingsGetResults + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.keyspaceName + ], + serializer +}; +const updateCassandraKeyspaceThroughputOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.ThroughputSettingsGetResults + }, + 201: { + bodyMapper: Mappers.ThroughputSettingsGetResults + }, + 202: { + bodyMapper: Mappers.ThroughputSettingsGetResults + }, + 204: { + bodyMapper: Mappers.ThroughputSettingsGetResults + } + }, + requestBody: Parameters.updateThroughputParameters5, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.keyspaceName + ], + headerParameters: [Parameters.contentType], + serializer +}; +const listCassandraTablesOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.CassandraTableListResult + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.keyspaceName + ], + serializer +}; +const getCassandraTableOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.CassandraTableGetResults + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.tableName, + Parameters.keyspaceName + ], + serializer +}; +const createUpdateCassandraTableOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.CassandraTableGetResults + }, + 201: { + bodyMapper: Mappers.CassandraTableGetResults + }, + 202: { + bodyMapper: Mappers.CassandraTableGetResults + }, + 204: { + bodyMapper: Mappers.CassandraTableGetResults + } + }, + requestBody: Parameters.createUpdateCassandraTableParameters, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.tableName, + Parameters.keyspaceName + ], + headerParameters: [Parameters.contentType], + serializer +}; +const deleteCassandraTableOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}", + httpMethod: "DELETE", + responses: { 200: {}, 201: {}, 202: {}, 204: {} }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.tableName, + Parameters.keyspaceName + ], + serializer +}; +const getCassandraTableThroughputOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ThroughputSettingsGetResults + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.tableName, + Parameters.keyspaceName + ], + serializer +}; +const updateCassandraTableThroughputOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.ThroughputSettingsGetResults + }, + 201: { + bodyMapper: Mappers.ThroughputSettingsGetResults + }, + 202: { + bodyMapper: Mappers.ThroughputSettingsGetResults + }, + 204: { + bodyMapper: Mappers.ThroughputSettingsGetResults + } + }, + requestBody: Parameters.updateThroughputParameters6, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.tableName, + Parameters.keyspaceName + ], + headerParameters: [Parameters.contentType], + serializer +}; diff --git a/test/smoke/generated/cosmos-db-resource-manager/src/operations/collection.ts b/test/smoke/generated/cosmos-db-resource-manager/src/operations/collection.ts new file mode 100644 index 0000000000..8521c43de7 --- /dev/null +++ b/test/smoke/generated/cosmos-db-resource-manager/src/operations/collection.ts @@ -0,0 +1,192 @@ +/* + * 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 * as coreHttp from "@azure/core-http"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { CosmosDBManagementClient } from "../cosmosDBManagementClient"; +import { + CollectionListMetricsResponse, + CollectionListUsagesOptionalParams, + CollectionListUsagesResponse, + CollectionListMetricDefinitionsResponse +} from "../models"; + +/** + * Class representing a Collection. + */ +export class Collection { + private readonly client: CosmosDBManagementClient; + + /** + * Initialize a new instance of the class Collection class. + * @param client Reference to the service client + */ + constructor(client: CosmosDBManagementClient) { + this.client = client; + } + + /** + * Retrieves the metrics determined by the given filter for the given database account and collection. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The + * parameters that can be filtered are name.value (name of the metric, can have an or of multiple + * names), startTime, endTime, and timeGrain. The supported operator is eq. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param options The options parameters. + */ + listMetrics( + resourceGroupName: string, + accountName: string, + filter: string, + databaseRid: string, + collectionRid: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { + resourceGroupName, + accountName, + filter, + databaseRid, + collectionRid, + options: operationOptions + }, + listMetricsOperationSpec + ) as Promise; + } + + /** + * Retrieves the usages (most recent storage data) for the given collection. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param options The options parameters. + */ + listUsages( + resourceGroupName: string, + accountName: string, + databaseRid: string, + collectionRid: string, + options?: CollectionListUsagesOptionalParams + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { + resourceGroupName, + accountName, + databaseRid, + collectionRid, + options: operationOptions + }, + listUsagesOperationSpec + ) as Promise; + } + + /** + * Retrieves metric definitions for the given collection. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param options The options parameters. + */ + listMetricDefinitions( + resourceGroupName: string, + accountName: string, + databaseRid: string, + collectionRid: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { + resourceGroupName, + accountName, + databaseRid, + collectionRid, + options: operationOptions + }, + listMetricDefinitionsOperationSpec + ) as Promise; + } +} +// Operation Specifications + +const serializer = new coreHttp.Serializer(Mappers, /* isXml */ false); + +const listMetricsOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/metrics", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.MetricListResult + } + }, + queryParameters: [Parameters.apiVersion, Parameters.filter], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.databaseRid, + Parameters.collectionRid + ], + serializer +}; +const listUsagesOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/usages", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.UsagesResult + } + }, + queryParameters: [Parameters.apiVersion, Parameters.filter1], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.databaseRid, + Parameters.collectionRid + ], + serializer +}; +const listMetricDefinitionsOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/metricDefinitions", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.MetricDefinitionsListResult + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.databaseRid, + Parameters.collectionRid + ], + serializer +}; diff --git a/test/smoke/generated/cosmos-db-resource-manager/src/operations/collectionPartition.ts b/test/smoke/generated/cosmos-db-resource-manager/src/operations/collectionPartition.ts new file mode 100644 index 0000000000..ba96743c43 --- /dev/null +++ b/test/smoke/generated/cosmos-db-resource-manager/src/operations/collectionPartition.ts @@ -0,0 +1,141 @@ +/* + * 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 * as coreHttp from "@azure/core-http"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { CosmosDBManagementClient } from "../cosmosDBManagementClient"; +import { + CollectionPartitionListMetricsResponse, + CollectionPartitionListUsagesOptionalParams, + CollectionPartitionListUsagesResponse +} from "../models"; + +/** + * Class representing a CollectionPartition. + */ +export class CollectionPartition { + private readonly client: CosmosDBManagementClient; + + /** + * Initialize a new instance of the class CollectionPartition class. + * @param client Reference to the service client + */ + constructor(client: CosmosDBManagementClient) { + this.client = client; + } + + /** + * Retrieves the metrics determined by the given filter for the given collection, split by partition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The + * parameters that can be filtered are name.value (name of the metric, can have an or of multiple + * names), startTime, endTime, and timeGrain. The supported operator is eq. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param options The options parameters. + */ + listMetrics( + resourceGroupName: string, + accountName: string, + filter: string, + databaseRid: string, + collectionRid: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { + resourceGroupName, + accountName, + filter, + databaseRid, + collectionRid, + options: operationOptions + }, + listMetricsOperationSpec + ) as Promise; + } + + /** + * Retrieves the usages (most recent storage data) for the given collection, split by partition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param options The options parameters. + */ + listUsages( + resourceGroupName: string, + accountName: string, + databaseRid: string, + collectionRid: string, + options?: CollectionPartitionListUsagesOptionalParams + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { + resourceGroupName, + accountName, + databaseRid, + collectionRid, + options: operationOptions + }, + listUsagesOperationSpec + ) as Promise; + } +} +// Operation Specifications + +const serializer = new coreHttp.Serializer(Mappers, /* isXml */ false); + +const listMetricsOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/partitions/metrics", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.PartitionMetricListResult + } + }, + queryParameters: [Parameters.apiVersion, Parameters.filter], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.databaseRid, + Parameters.collectionRid + ], + serializer +}; +const listUsagesOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/partitions/usages", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.PartitionUsagesResult + } + }, + queryParameters: [Parameters.apiVersion, Parameters.filter1], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.databaseRid, + Parameters.collectionRid + ], + serializer +}; diff --git a/test/smoke/generated/cosmos-db-resource-manager/src/operations/collectionPartitionRegion.ts b/test/smoke/generated/cosmos-db-resource-manager/src/operations/collectionPartitionRegion.ts new file mode 100644 index 0000000000..be36451d9d --- /dev/null +++ b/test/smoke/generated/cosmos-db-resource-manager/src/operations/collectionPartitionRegion.ts @@ -0,0 +1,92 @@ +/* + * 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 * as coreHttp from "@azure/core-http"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { CosmosDBManagementClient } from "../cosmosDBManagementClient"; +import { CollectionPartitionRegionListMetricsResponse } from "../models"; + +/** + * Class representing a CollectionPartitionRegion. + */ +export class CollectionPartitionRegion { + private readonly client: CosmosDBManagementClient; + + /** + * Initialize a new instance of the class CollectionPartitionRegion class. + * @param client Reference to the service client + */ + constructor(client: CosmosDBManagementClient) { + this.client = client; + } + + /** + * Retrieves the metrics determined by the given filter for the given collection and region, split by + * partition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The + * parameters that can be filtered are name.value (name of the metric, can have an or of multiple + * names), startTime, endTime, and timeGrain. The supported operator is eq. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param options The options parameters. + */ + listMetrics( + resourceGroupName: string, + accountName: string, + filter: string, + databaseRid: string, + collectionRid: string, + region: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { + resourceGroupName, + accountName, + filter, + databaseRid, + collectionRid, + region, + options: operationOptions + }, + listMetricsOperationSpec + ) as Promise; + } +} +// Operation Specifications + +const serializer = new coreHttp.Serializer(Mappers, /* isXml */ false); + +const listMetricsOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/databases/{databaseRid}/collections/{collectionRid}/partitions/metrics", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.PartitionMetricListResult + } + }, + queryParameters: [Parameters.apiVersion, Parameters.filter], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.databaseRid, + Parameters.collectionRid, + Parameters.region + ], + serializer +}; diff --git a/test/smoke/generated/cosmos-db-resource-manager/src/operations/collectionRegion.ts b/test/smoke/generated/cosmos-db-resource-manager/src/operations/collectionRegion.ts new file mode 100644 index 0000000000..839f498bad --- /dev/null +++ b/test/smoke/generated/cosmos-db-resource-manager/src/operations/collectionRegion.ts @@ -0,0 +1,92 @@ +/* + * 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 * as coreHttp from "@azure/core-http"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { CosmosDBManagementClient } from "../cosmosDBManagementClient"; +import { CollectionRegionListMetricsResponse } from "../models"; + +/** + * Class representing a CollectionRegion. + */ +export class CollectionRegion { + private readonly client: CosmosDBManagementClient; + + /** + * Initialize a new instance of the class CollectionRegion class. + * @param client Reference to the service client + */ + constructor(client: CosmosDBManagementClient) { + this.client = client; + } + + /** + * Retrieves the metrics determined by the given filter for the given database account, collection and + * region. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The + * parameters that can be filtered are name.value (name of the metric, can have an or of multiple + * names), startTime, endTime, and timeGrain. The supported operator is eq. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param options The options parameters. + */ + listMetrics( + resourceGroupName: string, + accountName: string, + filter: string, + databaseRid: string, + collectionRid: string, + region: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { + resourceGroupName, + accountName, + filter, + databaseRid, + collectionRid, + region, + options: operationOptions + }, + listMetricsOperationSpec + ) as Promise; + } +} +// Operation Specifications + +const serializer = new coreHttp.Serializer(Mappers, /* isXml */ false); + +const listMetricsOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/databases/{databaseRid}/collections/{collectionRid}/metrics", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.MetricListResult + } + }, + queryParameters: [Parameters.apiVersion, Parameters.filter], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.databaseRid, + Parameters.collectionRid, + Parameters.region + ], + serializer +}; diff --git a/test/smoke/generated/cosmos-db-resource-manager/src/operations/database.ts b/test/smoke/generated/cosmos-db-resource-manager/src/operations/database.ts new file mode 100644 index 0000000000..362571873a --- /dev/null +++ b/test/smoke/generated/cosmos-db-resource-manager/src/operations/database.ts @@ -0,0 +1,180 @@ +/* + * 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 * as coreHttp from "@azure/core-http"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { CosmosDBManagementClient } from "../cosmosDBManagementClient"; +import { + DatabaseListMetricsResponse, + DatabaseListUsagesOptionalParams, + DatabaseListUsagesResponse, + DatabaseListMetricDefinitionsResponse +} from "../models"; + +/** + * Class representing a Database. + */ +export class Database { + private readonly client: CosmosDBManagementClient; + + /** + * Initialize a new instance of the class Database class. + * @param client Reference to the service client + */ + constructor(client: CosmosDBManagementClient) { + this.client = client; + } + + /** + * Retrieves the metrics determined by the given filter for the given database account and database. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The + * parameters that can be filtered are name.value (name of the metric, can have an or of multiple + * names), startTime, endTime, and timeGrain. The supported operator is eq. + * @param databaseRid Cosmos DB database rid. + * @param options The options parameters. + */ + listMetrics( + resourceGroupName: string, + accountName: string, + filter: string, + databaseRid: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { + resourceGroupName, + accountName, + filter, + databaseRid, + options: operationOptions + }, + listMetricsOperationSpec + ) as Promise; + } + + /** + * Retrieves the usages (most recent data) for the given database. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param options The options parameters. + */ + listUsages( + resourceGroupName: string, + accountName: string, + databaseRid: string, + options?: DatabaseListUsagesOptionalParams + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { + resourceGroupName, + accountName, + databaseRid, + options: operationOptions + }, + listUsagesOperationSpec + ) as Promise; + } + + /** + * Retrieves metric definitions for the given database. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param options The options parameters. + */ + listMetricDefinitions( + resourceGroupName: string, + accountName: string, + databaseRid: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { + resourceGroupName, + accountName, + databaseRid, + options: operationOptions + }, + listMetricDefinitionsOperationSpec + ) as Promise; + } +} +// Operation Specifications + +const serializer = new coreHttp.Serializer(Mappers, /* isXml */ false); + +const listMetricsOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/metrics", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.MetricListResult + } + }, + queryParameters: [Parameters.apiVersion, Parameters.filter], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.databaseRid + ], + serializer +}; +const listUsagesOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/usages", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.UsagesResult + } + }, + queryParameters: [Parameters.apiVersion, Parameters.filter1], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.databaseRid + ], + serializer +}; +const listMetricDefinitionsOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/metricDefinitions", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.MetricDefinitionsListResult + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.databaseRid + ], + serializer +}; diff --git a/test/smoke/generated/cosmos-db-resource-manager/src/operations/databaseAccountRegion.ts b/test/smoke/generated/cosmos-db-resource-manager/src/operations/databaseAccountRegion.ts new file mode 100644 index 0000000000..0f38ecf2bd --- /dev/null +++ b/test/smoke/generated/cosmos-db-resource-manager/src/operations/databaseAccountRegion.ts @@ -0,0 +1,83 @@ +/* + * 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 * as coreHttp from "@azure/core-http"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { CosmosDBManagementClient } from "../cosmosDBManagementClient"; +import { DatabaseAccountRegionListMetricsResponse } from "../models"; + +/** + * Class representing a DatabaseAccountRegion. + */ +export class DatabaseAccountRegion { + private readonly client: CosmosDBManagementClient; + + /** + * Initialize a new instance of the class DatabaseAccountRegion class. + * @param client Reference to the service client + */ + constructor(client: CosmosDBManagementClient) { + this.client = client; + } + + /** + * Retrieves the metrics determined by the given filter for the given database account and region. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The + * parameters that can be filtered are name.value (name of the metric, can have an or of multiple + * names), startTime, endTime, and timeGrain. The supported operator is eq. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param options The options parameters. + */ + listMetrics( + resourceGroupName: string, + accountName: string, + filter: string, + region: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { + resourceGroupName, + accountName, + filter, + region, + options: operationOptions + }, + listMetricsOperationSpec + ) as Promise; + } +} +// Operation Specifications + +const serializer = new coreHttp.Serializer(Mappers, /* isXml */ false); + +const listMetricsOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/metrics", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.MetricListResult + } + }, + queryParameters: [Parameters.apiVersion, Parameters.filter], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.region + ], + serializer +}; diff --git a/test/smoke/generated/cosmos-db-resource-manager/src/operations/databaseAccounts.ts b/test/smoke/generated/cosmos-db-resource-manager/src/operations/databaseAccounts.ts new file mode 100644 index 0000000000..f2678b9134 --- /dev/null +++ b/test/smoke/generated/cosmos-db-resource-manager/src/operations/databaseAccounts.ts @@ -0,0 +1,902 @@ +/* + * 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 * as coreHttp from "@azure/core-http"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { CosmosDBManagementClient } from "../cosmosDBManagementClient"; +import { LROPoller, shouldDeserializeLRO } from "../lro"; +import { + DatabaseAccountsGetResponse, + DatabaseAccountUpdateParameters, + DatabaseAccountsUpdateResponse, + DatabaseAccountCreateUpdateParameters, + DatabaseAccountsCreateOrUpdateResponse, + FailoverPolicies, + DatabaseAccountsListResponse, + DatabaseAccountsListByResourceGroupResponse, + DatabaseAccountsListKeysResponse, + DatabaseAccountsListConnectionStringsResponse, + RegionForOnlineOffline, + DatabaseAccountsGetReadOnlyKeysResponse, + DatabaseAccountsListReadOnlyKeysResponse, + DatabaseAccountRegenerateKeyParameters, + DatabaseAccountsListMetricsResponse, + DatabaseAccountsListUsagesOptionalParams, + DatabaseAccountsListUsagesResponse, + DatabaseAccountsListMetricDefinitionsResponse +} from "../models"; + +/** + * Class representing a DatabaseAccounts. + */ +export class DatabaseAccounts { + private readonly client: CosmosDBManagementClient; + + /** + * Initialize a new instance of the class DatabaseAccounts class. + * @param client Reference to the service client + */ + constructor(client: CosmosDBManagementClient) { + this.client = client; + } + + /** + * Retrieves the properties of an existing Azure Cosmos DB database account. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + accountName: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { resourceGroupName, accountName, options: operationOptions }, + getOperationSpec + ) as Promise; + } + + /** + * Updates the properties of an existing Azure Cosmos DB database account. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param updateParameters The parameters to provide for the current database account. + * @param options The options parameters. + */ + async update( + resourceGroupName: string, + accountName: string, + updateParameters: DatabaseAccountUpdateParameters, + options?: coreHttp.OperationOptions + ): Promise> { + const operationOptions: coreHttp.RequestOptionsBase = this.getOperationOptions( + options + ); + + const args: coreHttp.OperationArguments = { + resourceGroupName, + accountName, + updateParameters, + options: operationOptions + }; + const sendOperation = ( + args: coreHttp.OperationArguments, + spec: coreHttp.OperationSpec + ) => + this.client.sendOperationRequest(args, spec) as Promise< + DatabaseAccountsUpdateResponse + >; + const initialOperationResult = await sendOperation( + args, + updateOperationSpec + ); + + return new LROPoller({ + initialOperationArguments: args, + initialOperationSpec: updateOperationSpec, + initialOperationResult, + sendOperation + }); + } + + /** + * Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when + * performing updates on an account. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param createUpdateParameters The parameters to provide for the current database account. + * @param options The options parameters. + */ + async createOrUpdate( + resourceGroupName: string, + accountName: string, + createUpdateParameters: DatabaseAccountCreateUpdateParameters, + options?: coreHttp.OperationOptions + ): Promise> { + const operationOptions: coreHttp.RequestOptionsBase = this.getOperationOptions( + options + ); + + const args: coreHttp.OperationArguments = { + resourceGroupName, + accountName, + createUpdateParameters, + options: operationOptions + }; + const sendOperation = ( + args: coreHttp.OperationArguments, + spec: coreHttp.OperationSpec + ) => + this.client.sendOperationRequest(args, spec) as Promise< + DatabaseAccountsCreateOrUpdateResponse + >; + const initialOperationResult = await sendOperation( + args, + createOrUpdateOperationSpec + ); + + return new LROPoller({ + initialOperationArguments: args, + initialOperationSpec: createOrUpdateOperationSpec, + initialOperationResult, + sendOperation + }); + } + + /** + * Deletes an existing Azure Cosmos DB database account. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param options The options parameters. + */ + async delete( + resourceGroupName: string, + accountName: string, + options?: coreHttp.OperationOptions + ): Promise> { + const operationOptions: coreHttp.RequestOptionsBase = this.getOperationOptions( + options + ); + + const args: coreHttp.OperationArguments = { + resourceGroupName, + accountName, + options: operationOptions + }; + const sendOperation = ( + args: coreHttp.OperationArguments, + spec: coreHttp.OperationSpec + ) => + this.client.sendOperationRequest(args, spec) as Promise< + coreHttp.RestResponse + >; + const initialOperationResult = await sendOperation( + args, + deleteOperationSpec + ); + + return new LROPoller({ + initialOperationArguments: args, + initialOperationSpec: deleteOperationSpec, + initialOperationResult, + sendOperation + }); + } + + /** + * Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 + * indicates a write region. The maximum value for a failover priority = (total number of regions - 1). + * Failover priority values must be unique for each of the regions in which the database account + * exists. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param failoverParameters The new failover policies for the database account. + * @param options The options parameters. + */ + async failoverPriorityChange( + resourceGroupName: string, + accountName: string, + failoverParameters: FailoverPolicies, + options?: coreHttp.OperationOptions + ): Promise> { + const operationOptions: coreHttp.RequestOptionsBase = this.getOperationOptions( + options + ); + + const args: coreHttp.OperationArguments = { + resourceGroupName, + accountName, + failoverParameters, + options: operationOptions + }; + const sendOperation = ( + args: coreHttp.OperationArguments, + spec: coreHttp.OperationSpec + ) => + this.client.sendOperationRequest(args, spec) as Promise< + coreHttp.RestResponse + >; + const initialOperationResult = await sendOperation( + args, + failoverPriorityChangeOperationSpec + ); + + return new LROPoller({ + initialOperationArguments: args, + initialOperationSpec: failoverPriorityChangeOperationSpec, + initialOperationResult, + sendOperation + }); + } + + /** + * Lists all the Azure Cosmos DB database accounts available under the subscription. + * @param options The options parameters. + */ + list( + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { options: operationOptions }, + listOperationSpec + ) as Promise; + } + + /** + * Lists all the Azure Cosmos DB database accounts available under the given resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param options The options parameters. + */ + listByResourceGroup( + resourceGroupName: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { resourceGroupName, options: operationOptions }, + listByResourceGroupOperationSpec + ) as Promise; + } + + /** + * Lists the access keys for the specified Azure Cosmos DB database account. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param options The options parameters. + */ + listKeys( + resourceGroupName: string, + accountName: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { resourceGroupName, accountName, options: operationOptions }, + listKeysOperationSpec + ) as Promise; + } + + /** + * Lists the connection strings for the specified Azure Cosmos DB database account. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param options The options parameters. + */ + listConnectionStrings( + resourceGroupName: string, + accountName: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { resourceGroupName, accountName, options: operationOptions }, + listConnectionStringsOperationSpec + ) as Promise; + } + + /** + * Offline the specified region for the specified Azure Cosmos DB database account. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param regionParameterForOffline Cosmos DB region to offline for the database account. + * @param options The options parameters. + */ + async offlineRegion( + resourceGroupName: string, + accountName: string, + regionParameterForOffline: RegionForOnlineOffline, + options?: coreHttp.OperationOptions + ): Promise> { + const operationOptions: coreHttp.RequestOptionsBase = this.getOperationOptions( + options + ); + + const args: coreHttp.OperationArguments = { + resourceGroupName, + accountName, + regionParameterForOffline, + options: operationOptions + }; + const sendOperation = ( + args: coreHttp.OperationArguments, + spec: coreHttp.OperationSpec + ) => + this.client.sendOperationRequest(args, spec) as Promise< + coreHttp.RestResponse + >; + const initialOperationResult = await sendOperation( + args, + offlineRegionOperationSpec + ); + + return new LROPoller({ + initialOperationArguments: args, + initialOperationSpec: offlineRegionOperationSpec, + initialOperationResult, + sendOperation + }); + } + + /** + * Online the specified region for the specified Azure Cosmos DB database account. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param regionParameterForOnline Cosmos DB region to online for the database account. + * @param options The options parameters. + */ + async onlineRegion( + resourceGroupName: string, + accountName: string, + regionParameterForOnline: RegionForOnlineOffline, + options?: coreHttp.OperationOptions + ): Promise> { + const operationOptions: coreHttp.RequestOptionsBase = this.getOperationOptions( + options + ); + + const args: coreHttp.OperationArguments = { + resourceGroupName, + accountName, + regionParameterForOnline, + options: operationOptions + }; + const sendOperation = ( + args: coreHttp.OperationArguments, + spec: coreHttp.OperationSpec + ) => + this.client.sendOperationRequest(args, spec) as Promise< + coreHttp.RestResponse + >; + const initialOperationResult = await sendOperation( + args, + onlineRegionOperationSpec + ); + + return new LROPoller({ + initialOperationArguments: args, + initialOperationSpec: onlineRegionOperationSpec, + initialOperationResult, + sendOperation + }); + } + + /** + * Lists the read-only access keys for the specified Azure Cosmos DB database account. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param options The options parameters. + */ + getReadOnlyKeys( + resourceGroupName: string, + accountName: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { resourceGroupName, accountName, options: operationOptions }, + getReadOnlyKeysOperationSpec + ) as Promise; + } + + /** + * Lists the read-only access keys for the specified Azure Cosmos DB database account. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param options The options parameters. + */ + listReadOnlyKeys( + resourceGroupName: string, + accountName: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { resourceGroupName, accountName, options: operationOptions }, + listReadOnlyKeysOperationSpec + ) as Promise; + } + + /** + * Regenerates an access key for the specified Azure Cosmos DB database account. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param keyToRegenerate The name of the key to regenerate. + * @param options The options parameters. + */ + async regenerateKey( + resourceGroupName: string, + accountName: string, + keyToRegenerate: DatabaseAccountRegenerateKeyParameters, + options?: coreHttp.OperationOptions + ): Promise> { + const operationOptions: coreHttp.RequestOptionsBase = this.getOperationOptions( + options + ); + + const args: coreHttp.OperationArguments = { + resourceGroupName, + accountName, + keyToRegenerate, + options: operationOptions + }; + const sendOperation = ( + args: coreHttp.OperationArguments, + spec: coreHttp.OperationSpec + ) => + this.client.sendOperationRequest(args, spec) as Promise< + coreHttp.RestResponse + >; + const initialOperationResult = await sendOperation( + args, + regenerateKeyOperationSpec + ); + + return new LROPoller({ + initialOperationArguments: args, + initialOperationSpec: regenerateKeyOperationSpec, + initialOperationResult, + sendOperation + }); + } + + /** + * Checks that the Azure Cosmos DB account name already exists. A valid account name may contain only + * lowercase letters, numbers, and the '-' character, and must be between 3 and 50 characters. + * @param accountName Cosmos DB database account name. + * @param options The options parameters. + */ + checkNameExists( + accountName: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { accountName, options: operationOptions }, + checkNameExistsOperationSpec + ) as Promise; + } + + /** + * Retrieves the metrics determined by the given filter for the given database account. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The + * parameters that can be filtered are name.value (name of the metric, can have an or of multiple + * names), startTime, endTime, and timeGrain. The supported operator is eq. + * @param options The options parameters. + */ + listMetrics( + resourceGroupName: string, + accountName: string, + filter: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { resourceGroupName, accountName, filter, options: operationOptions }, + listMetricsOperationSpec + ) as Promise; + } + + /** + * Retrieves the usages (most recent data) for the given database account. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param options The options parameters. + */ + listUsages( + resourceGroupName: string, + accountName: string, + options?: DatabaseAccountsListUsagesOptionalParams + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { resourceGroupName, accountName, options: operationOptions }, + listUsagesOperationSpec + ) as Promise; + } + + /** + * Retrieves metric definitions for the given database account. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param options The options parameters. + */ + listMetricDefinitions( + resourceGroupName: string, + accountName: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { resourceGroupName, accountName, options: operationOptions }, + listMetricDefinitionsOperationSpec + ) as Promise; + } + + private getOperationOptions( + options: TOptions | undefined, + finalStateVia?: string + ): coreHttp.RequestOptionsBase { + const operationOptions: coreHttp.OperationOptions = options || {}; + operationOptions.requestOptions = { + ...operationOptions.requestOptions, + shouldDeserialize: shouldDeserializeLRO(finalStateVia) + }; + return coreHttp.operationOptionsToRequestOptionsBase(operationOptions); + } +} +// Operation Specifications + +const serializer = new coreHttp.Serializer(Mappers, /* isXml */ false); + +const getOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DatabaseAccountGetResults + }, + 404: {} + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName + ], + serializer +}; +const updateOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}", + httpMethod: "PATCH", + responses: { + 200: { + bodyMapper: Mappers.DatabaseAccountGetResults + }, + 201: { + bodyMapper: Mappers.DatabaseAccountGetResults + }, + 202: { + bodyMapper: Mappers.DatabaseAccountGetResults + }, + 204: { + bodyMapper: Mappers.DatabaseAccountGetResults + } + }, + requestBody: Parameters.updateParameters, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName + ], + headerParameters: [Parameters.contentType], + serializer +}; +const createOrUpdateOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.DatabaseAccountGetResults + }, + 201: { + bodyMapper: Mappers.DatabaseAccountGetResults + }, + 202: { + bodyMapper: Mappers.DatabaseAccountGetResults + }, + 204: { + bodyMapper: Mappers.DatabaseAccountGetResults + } + }, + requestBody: Parameters.createUpdateParameters, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName + ], + headerParameters: [Parameters.contentType], + serializer +}; +const deleteOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}", + httpMethod: "DELETE", + responses: { 200: {}, 201: {}, 202: {}, 204: {} }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName + ], + serializer +}; +const failoverPriorityChangeOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/failoverPriorityChange", + httpMethod: "POST", + responses: { 200: {}, 201: {}, 202: {}, 204: {} }, + requestBody: Parameters.failoverParameters, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName + ], + headerParameters: [Parameters.contentType], + serializer +}; +const listOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/databaseAccounts", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DatabaseAccountsListResult + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.subscriptionId], + serializer +}; +const listByResourceGroupOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DatabaseAccountsListResult + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName + ], + serializer +}; +const listKeysOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/listKeys", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.DatabaseAccountListKeysResult + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName + ], + serializer +}; +const listConnectionStringsOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/listConnectionStrings", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.DatabaseAccountListConnectionStringsResult + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName + ], + serializer +}; +const offlineRegionOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/offlineRegion", + httpMethod: "POST", + responses: { 200: {}, 201: {}, 202: {}, 204: {} }, + requestBody: Parameters.regionParameterForOffline, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName + ], + headerParameters: [Parameters.contentType], + serializer +}; +const onlineRegionOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/onlineRegion", + httpMethod: "POST", + responses: { 200: {}, 201: {}, 202: {}, 204: {} }, + requestBody: Parameters.regionParameterForOnline, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName + ], + headerParameters: [Parameters.contentType], + serializer +}; +const getReadOnlyKeysOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/readonlykeys", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DatabaseAccountListReadOnlyKeysResult + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName + ], + serializer +}; +const listReadOnlyKeysOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/readonlykeys", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.DatabaseAccountListReadOnlyKeysResult + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName + ], + serializer +}; +const regenerateKeyOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/regenerateKey", + httpMethod: "POST", + responses: { 200: {}, 201: {}, 202: {}, 204: {} }, + requestBody: Parameters.keyToRegenerate, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName + ], + headerParameters: [Parameters.contentType], + serializer +}; +const checkNameExistsOperationSpec: coreHttp.OperationSpec = { + path: "/providers/Microsoft.DocumentDB/databaseAccountNames/{accountName}", + httpMethod: "HEAD", + responses: { 200: {}, 404: {} }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.accountName], + serializer +}; +const listMetricsOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/metrics", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.MetricListResult + } + }, + queryParameters: [Parameters.apiVersion, Parameters.filter], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName + ], + serializer +}; +const listUsagesOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/usages", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.UsagesResult + } + }, + queryParameters: [Parameters.apiVersion, Parameters.filter1], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName + ], + serializer +}; +const listMetricDefinitionsOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/metricDefinitions", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.MetricDefinitionsListResult + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName + ], + serializer +}; diff --git a/test/smoke/generated/cosmos-db-resource-manager/src/operations/gremlinResources.ts b/test/smoke/generated/cosmos-db-resource-manager/src/operations/gremlinResources.ts new file mode 100644 index 0000000000..2acffc83de --- /dev/null +++ b/test/smoke/generated/cosmos-db-resource-manager/src/operations/gremlinResources.ts @@ -0,0 +1,775 @@ +/* + * 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 * as coreHttp from "@azure/core-http"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { CosmosDBManagementClient } from "../cosmosDBManagementClient"; +import { LROPoller, shouldDeserializeLRO } from "../lro"; +import { + GremlinResourcesListGremlinDatabasesResponse, + GremlinResourcesGetGremlinDatabaseResponse, + GremlinDatabaseCreateUpdateParameters, + GremlinResourcesCreateUpdateGremlinDatabaseResponse, + GremlinResourcesGetGremlinDatabaseThroughputResponse, + ThroughputSettingsUpdateParameters, + GremlinResourcesUpdateGremlinDatabaseThroughputResponse, + GremlinResourcesListGremlinGraphsResponse, + GremlinResourcesGetGremlinGraphResponse, + GremlinGraphCreateUpdateParameters, + GremlinResourcesCreateUpdateGremlinGraphResponse, + GremlinResourcesGetGremlinGraphThroughputResponse, + GremlinResourcesUpdateGremlinGraphThroughputResponse +} from "../models"; + +/** + * Class representing a GremlinResources. + */ +export class GremlinResources { + private readonly client: CosmosDBManagementClient; + + /** + * Initialize a new instance of the class GremlinResources class. + * @param client Reference to the service client + */ + constructor(client: CosmosDBManagementClient) { + this.client = client; + } + + /** + * Lists the Gremlin databases under an existing Azure Cosmos DB database account. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param options The options parameters. + */ + listGremlinDatabases( + resourceGroupName: string, + accountName: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { resourceGroupName, accountName, options: operationOptions }, + listGremlinDatabasesOperationSpec + ) as Promise; + } + + /** + * Gets the Gremlin databases under an existing Azure Cosmos DB database account with the provided + * name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param options The options parameters. + */ + getGremlinDatabase( + resourceGroupName: string, + accountName: string, + databaseName: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { + resourceGroupName, + accountName, + databaseName, + options: operationOptions + }, + getGremlinDatabaseOperationSpec + ) as Promise; + } + + /** + * Create or update an Azure Cosmos DB Gremlin database + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateGremlinDatabaseParameters The parameters to provide for the current Gremlin + * database. + * @param options The options parameters. + */ + async createUpdateGremlinDatabase( + resourceGroupName: string, + accountName: string, + databaseName: string, + createUpdateGremlinDatabaseParameters: GremlinDatabaseCreateUpdateParameters, + options?: coreHttp.OperationOptions + ): Promise> { + const operationOptions: coreHttp.RequestOptionsBase = this.getOperationOptions( + options + ); + + const args: coreHttp.OperationArguments = { + resourceGroupName, + accountName, + databaseName, + createUpdateGremlinDatabaseParameters, + options: operationOptions + }; + const sendOperation = ( + args: coreHttp.OperationArguments, + spec: coreHttp.OperationSpec + ) => + this.client.sendOperationRequest(args, spec) as Promise< + GremlinResourcesCreateUpdateGremlinDatabaseResponse + >; + const initialOperationResult = await sendOperation( + args, + createUpdateGremlinDatabaseOperationSpec + ); + + return new LROPoller({ + initialOperationArguments: args, + initialOperationSpec: createUpdateGremlinDatabaseOperationSpec, + initialOperationResult, + sendOperation + }); + } + + /** + * Deletes an existing Azure Cosmos DB Gremlin database. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param options The options parameters. + */ + async deleteGremlinDatabase( + resourceGroupName: string, + accountName: string, + databaseName: string, + options?: coreHttp.OperationOptions + ): Promise> { + const operationOptions: coreHttp.RequestOptionsBase = this.getOperationOptions( + options + ); + + const args: coreHttp.OperationArguments = { + resourceGroupName, + accountName, + databaseName, + options: operationOptions + }; + const sendOperation = ( + args: coreHttp.OperationArguments, + spec: coreHttp.OperationSpec + ) => + this.client.sendOperationRequest(args, spec) as Promise< + coreHttp.RestResponse + >; + const initialOperationResult = await sendOperation( + args, + deleteGremlinDatabaseOperationSpec + ); + + return new LROPoller({ + initialOperationArguments: args, + initialOperationSpec: deleteGremlinDatabaseOperationSpec, + initialOperationResult, + sendOperation + }); + } + + /** + * Gets the RUs per second of the Gremlin database under an existing Azure Cosmos DB database account + * with the provided name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param options The options parameters. + */ + getGremlinDatabaseThroughput( + resourceGroupName: string, + accountName: string, + databaseName: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { + resourceGroupName, + accountName, + databaseName, + options: operationOptions + }, + getGremlinDatabaseThroughputOperationSpec + ) as Promise; + } + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin database + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current + * Gremlin database. + * @param options The options parameters. + */ + async updateGremlinDatabaseThroughput( + resourceGroupName: string, + accountName: string, + databaseName: string, + updateThroughputParameters: ThroughputSettingsUpdateParameters, + options?: coreHttp.OperationOptions + ): Promise< + LROPoller + > { + const operationOptions: coreHttp.RequestOptionsBase = this.getOperationOptions( + options + ); + + const args: coreHttp.OperationArguments = { + resourceGroupName, + accountName, + databaseName, + updateThroughputParameters, + options: operationOptions + }; + const sendOperation = ( + args: coreHttp.OperationArguments, + spec: coreHttp.OperationSpec + ) => + this.client.sendOperationRequest(args, spec) as Promise< + GremlinResourcesUpdateGremlinDatabaseThroughputResponse + >; + const initialOperationResult = await sendOperation( + args, + updateGremlinDatabaseThroughputOperationSpec + ); + + return new LROPoller({ + initialOperationArguments: args, + initialOperationSpec: updateGremlinDatabaseThroughputOperationSpec, + initialOperationResult, + sendOperation + }); + } + + /** + * Lists the Gremlin graph under an existing Azure Cosmos DB database account. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param options The options parameters. + */ + listGremlinGraphs( + resourceGroupName: string, + accountName: string, + databaseName: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { + resourceGroupName, + accountName, + databaseName, + options: operationOptions + }, + listGremlinGraphsOperationSpec + ) as Promise; + } + + /** + * Gets the Gremlin graph under an existing Azure Cosmos DB database account. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param options The options parameters. + */ + getGremlinGraph( + resourceGroupName: string, + accountName: string, + databaseName: string, + graphName: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { + resourceGroupName, + accountName, + databaseName, + graphName, + options: operationOptions + }, + getGremlinGraphOperationSpec + ) as Promise; + } + + /** + * Create or update an Azure Cosmos DB Gremlin graph + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param createUpdateGremlinGraphParameters The parameters to provide for the current Gremlin graph. + * @param options The options parameters. + */ + async createUpdateGremlinGraph( + resourceGroupName: string, + accountName: string, + databaseName: string, + graphName: string, + createUpdateGremlinGraphParameters: GremlinGraphCreateUpdateParameters, + options?: coreHttp.OperationOptions + ): Promise> { + const operationOptions: coreHttp.RequestOptionsBase = this.getOperationOptions( + options + ); + + const args: coreHttp.OperationArguments = { + resourceGroupName, + accountName, + databaseName, + graphName, + createUpdateGremlinGraphParameters, + options: operationOptions + }; + const sendOperation = ( + args: coreHttp.OperationArguments, + spec: coreHttp.OperationSpec + ) => + this.client.sendOperationRequest(args, spec) as Promise< + GremlinResourcesCreateUpdateGremlinGraphResponse + >; + const initialOperationResult = await sendOperation( + args, + createUpdateGremlinGraphOperationSpec + ); + + return new LROPoller({ + initialOperationArguments: args, + initialOperationSpec: createUpdateGremlinGraphOperationSpec, + initialOperationResult, + sendOperation + }); + } + + /** + * Deletes an existing Azure Cosmos DB Gremlin graph. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param options The options parameters. + */ + async deleteGremlinGraph( + resourceGroupName: string, + accountName: string, + databaseName: string, + graphName: string, + options?: coreHttp.OperationOptions + ): Promise> { + const operationOptions: coreHttp.RequestOptionsBase = this.getOperationOptions( + options + ); + + const args: coreHttp.OperationArguments = { + resourceGroupName, + accountName, + databaseName, + graphName, + options: operationOptions + }; + const sendOperation = ( + args: coreHttp.OperationArguments, + spec: coreHttp.OperationSpec + ) => + this.client.sendOperationRequest(args, spec) as Promise< + coreHttp.RestResponse + >; + const initialOperationResult = await sendOperation( + args, + deleteGremlinGraphOperationSpec + ); + + return new LROPoller({ + initialOperationArguments: args, + initialOperationSpec: deleteGremlinGraphOperationSpec, + initialOperationResult, + sendOperation + }); + } + + /** + * Gets the Gremlin graph throughput under an existing Azure Cosmos DB database account with the + * provided name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param options The options parameters. + */ + getGremlinGraphThroughput( + resourceGroupName: string, + accountName: string, + databaseName: string, + graphName: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { + resourceGroupName, + accountName, + databaseName, + graphName, + options: operationOptions + }, + getGremlinGraphThroughputOperationSpec + ) as Promise; + } + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin graph + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current + * Gremlin graph. + * @param options The options parameters. + */ + async updateGremlinGraphThroughput( + resourceGroupName: string, + accountName: string, + databaseName: string, + graphName: string, + updateThroughputParameters: ThroughputSettingsUpdateParameters, + options?: coreHttp.OperationOptions + ): Promise> { + const operationOptions: coreHttp.RequestOptionsBase = this.getOperationOptions( + options + ); + + const args: coreHttp.OperationArguments = { + resourceGroupName, + accountName, + databaseName, + graphName, + updateThroughputParameters, + options: operationOptions + }; + const sendOperation = ( + args: coreHttp.OperationArguments, + spec: coreHttp.OperationSpec + ) => + this.client.sendOperationRequest(args, spec) as Promise< + GremlinResourcesUpdateGremlinGraphThroughputResponse + >; + const initialOperationResult = await sendOperation( + args, + updateGremlinGraphThroughputOperationSpec + ); + + return new LROPoller({ + initialOperationArguments: args, + initialOperationSpec: updateGremlinGraphThroughputOperationSpec, + initialOperationResult, + sendOperation + }); + } + + private getOperationOptions( + options: TOptions | undefined, + finalStateVia?: string + ): coreHttp.RequestOptionsBase { + const operationOptions: coreHttp.OperationOptions = options || {}; + operationOptions.requestOptions = { + ...operationOptions.requestOptions, + shouldDeserialize: shouldDeserializeLRO(finalStateVia) + }; + return coreHttp.operationOptionsToRequestOptionsBase(operationOptions); + } +} +// Operation Specifications + +const serializer = new coreHttp.Serializer(Mappers, /* isXml */ false); + +const listGremlinDatabasesOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.GremlinDatabaseListResult + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName + ], + serializer +}; +const getGremlinDatabaseOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.GremlinDatabaseGetResults + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.databaseName + ], + serializer +}; +const createUpdateGremlinDatabaseOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.GremlinDatabaseGetResults + }, + 201: { + bodyMapper: Mappers.GremlinDatabaseGetResults + }, + 202: { + bodyMapper: Mappers.GremlinDatabaseGetResults + }, + 204: { + bodyMapper: Mappers.GremlinDatabaseGetResults + } + }, + requestBody: Parameters.createUpdateGremlinDatabaseParameters, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.databaseName + ], + headerParameters: [Parameters.contentType], + serializer +}; +const deleteGremlinDatabaseOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}", + httpMethod: "DELETE", + responses: { 200: {}, 201: {}, 202: {}, 204: {} }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.databaseName + ], + serializer +}; +const getGremlinDatabaseThroughputOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ThroughputSettingsGetResults + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.databaseName + ], + serializer +}; +const updateGremlinDatabaseThroughputOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.ThroughputSettingsGetResults + }, + 201: { + bodyMapper: Mappers.ThroughputSettingsGetResults + }, + 202: { + bodyMapper: Mappers.ThroughputSettingsGetResults + }, + 204: { + bodyMapper: Mappers.ThroughputSettingsGetResults + } + }, + requestBody: Parameters.updateThroughputParameters7, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.databaseName + ], + headerParameters: [Parameters.contentType], + serializer +}; +const listGremlinGraphsOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.GremlinGraphListResult + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.databaseName + ], + serializer +}; +const getGremlinGraphOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.GremlinGraphGetResults + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.databaseName, + Parameters.graphName + ], + serializer +}; +const createUpdateGremlinGraphOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.GremlinGraphGetResults + }, + 201: { + bodyMapper: Mappers.GremlinGraphGetResults + }, + 202: { + bodyMapper: Mappers.GremlinGraphGetResults + }, + 204: { + bodyMapper: Mappers.GremlinGraphGetResults + } + }, + requestBody: Parameters.createUpdateGremlinGraphParameters, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.databaseName, + Parameters.graphName + ], + headerParameters: [Parameters.contentType], + serializer +}; +const deleteGremlinGraphOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}", + httpMethod: "DELETE", + responses: { 200: {}, 201: {}, 202: {}, 204: {} }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.databaseName, + Parameters.graphName + ], + serializer +}; +const getGremlinGraphThroughputOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ThroughputSettingsGetResults + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.databaseName, + Parameters.graphName + ], + serializer +}; +const updateGremlinGraphThroughputOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.ThroughputSettingsGetResults + }, + 201: { + bodyMapper: Mappers.ThroughputSettingsGetResults + }, + 202: { + bodyMapper: Mappers.ThroughputSettingsGetResults + }, + 204: { + bodyMapper: Mappers.ThroughputSettingsGetResults + } + }, + requestBody: Parameters.updateThroughputParameters8, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.databaseName, + Parameters.graphName + ], + headerParameters: [Parameters.contentType], + serializer +}; diff --git a/test/smoke/generated/cosmos-db-resource-manager/src/operations/index.ts b/test/smoke/generated/cosmos-db-resource-manager/src/operations/index.ts new file mode 100644 index 0000000000..9a723dfdbd --- /dev/null +++ b/test/smoke/generated/cosmos-db-resource-manager/src/operations/index.ts @@ -0,0 +1,29 @@ +/* + * 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. + */ + +export * from "./databaseAccounts"; +export * from "./operations"; +export * from "./database"; +export * from "./collection"; +export * from "./collectionRegion"; +export * from "./databaseAccountRegion"; +export * from "./percentileSourceTarget"; +export * from "./percentileTarget"; +export * from "./percentile"; +export * from "./collectionPartitionRegion"; +export * from "./collectionPartition"; +export * from "./partitionKeyRangeId"; +export * from "./partitionKeyRangeIdRegion"; +export * from "./sqlResources"; +export * from "./mongoDBResources"; +export * from "./tableResources"; +export * from "./cassandraResources"; +export * from "./gremlinResources"; +export * from "./notebookWorkspaces"; +export * from "./privateLinkResources"; +export * from "./privateEndpointConnections"; diff --git a/test/smoke/generated/cosmos-db-resource-manager/src/operations/mongoDBResources.ts b/test/smoke/generated/cosmos-db-resource-manager/src/operations/mongoDBResources.ts new file mode 100644 index 0000000000..0cda4be762 --- /dev/null +++ b/test/smoke/generated/cosmos-db-resource-manager/src/operations/mongoDBResources.ts @@ -0,0 +1,778 @@ +/* + * 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 * as coreHttp from "@azure/core-http"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { CosmosDBManagementClient } from "../cosmosDBManagementClient"; +import { LROPoller, shouldDeserializeLRO } from "../lro"; +import { + MongoDBResourcesListMongoDBDatabasesResponse, + MongoDBResourcesGetMongoDBDatabaseResponse, + MongoDBDatabaseCreateUpdateParameters, + MongoDBResourcesCreateUpdateMongoDBDatabaseResponse, + MongoDBResourcesGetMongoDBDatabaseThroughputResponse, + ThroughputSettingsUpdateParameters, + MongoDBResourcesUpdateMongoDBDatabaseThroughputResponse, + MongoDBResourcesListMongoDBCollectionsResponse, + MongoDBResourcesGetMongoDBCollectionResponse, + MongoDBCollectionCreateUpdateParameters, + MongoDBResourcesCreateUpdateMongoDBCollectionResponse, + MongoDBResourcesGetMongoDBCollectionThroughputResponse, + MongoDBResourcesUpdateMongoDBCollectionThroughputResponse +} from "../models"; + +/** + * Class representing a MongoDBResources. + */ +export class MongoDBResources { + private readonly client: CosmosDBManagementClient; + + /** + * Initialize a new instance of the class MongoDBResources class. + * @param client Reference to the service client + */ + constructor(client: CosmosDBManagementClient) { + this.client = client; + } + + /** + * Lists the MongoDB databases under an existing Azure Cosmos DB database account. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param options The options parameters. + */ + listMongoDBDatabases( + resourceGroupName: string, + accountName: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { resourceGroupName, accountName, options: operationOptions }, + listMongoDBDatabasesOperationSpec + ) as Promise; + } + + /** + * Gets the MongoDB databases under an existing Azure Cosmos DB database account with the provided + * name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param options The options parameters. + */ + getMongoDBDatabase( + resourceGroupName: string, + accountName: string, + databaseName: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { + resourceGroupName, + accountName, + databaseName, + options: operationOptions + }, + getMongoDBDatabaseOperationSpec + ) as Promise; + } + + /** + * Create or updates Azure Cosmos DB MongoDB database + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateMongoDBDatabaseParameters The parameters to provide for the current MongoDB + * database. + * @param options The options parameters. + */ + async createUpdateMongoDBDatabase( + resourceGroupName: string, + accountName: string, + databaseName: string, + createUpdateMongoDBDatabaseParameters: MongoDBDatabaseCreateUpdateParameters, + options?: coreHttp.OperationOptions + ): Promise> { + const operationOptions: coreHttp.RequestOptionsBase = this.getOperationOptions( + options + ); + + const args: coreHttp.OperationArguments = { + resourceGroupName, + accountName, + databaseName, + createUpdateMongoDBDatabaseParameters, + options: operationOptions + }; + const sendOperation = ( + args: coreHttp.OperationArguments, + spec: coreHttp.OperationSpec + ) => + this.client.sendOperationRequest(args, spec) as Promise< + MongoDBResourcesCreateUpdateMongoDBDatabaseResponse + >; + const initialOperationResult = await sendOperation( + args, + createUpdateMongoDBDatabaseOperationSpec + ); + + return new LROPoller({ + initialOperationArguments: args, + initialOperationSpec: createUpdateMongoDBDatabaseOperationSpec, + initialOperationResult, + sendOperation + }); + } + + /** + * Deletes an existing Azure Cosmos DB MongoDB database. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param options The options parameters. + */ + async deleteMongoDBDatabase( + resourceGroupName: string, + accountName: string, + databaseName: string, + options?: coreHttp.OperationOptions + ): Promise> { + const operationOptions: coreHttp.RequestOptionsBase = this.getOperationOptions( + options + ); + + const args: coreHttp.OperationArguments = { + resourceGroupName, + accountName, + databaseName, + options: operationOptions + }; + const sendOperation = ( + args: coreHttp.OperationArguments, + spec: coreHttp.OperationSpec + ) => + this.client.sendOperationRequest(args, spec) as Promise< + coreHttp.RestResponse + >; + const initialOperationResult = await sendOperation( + args, + deleteMongoDBDatabaseOperationSpec + ); + + return new LROPoller({ + initialOperationArguments: args, + initialOperationSpec: deleteMongoDBDatabaseOperationSpec, + initialOperationResult, + sendOperation + }); + } + + /** + * Gets the RUs per second of the MongoDB database under an existing Azure Cosmos DB database account + * with the provided name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param options The options parameters. + */ + getMongoDBDatabaseThroughput( + resourceGroupName: string, + accountName: string, + databaseName: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { + resourceGroupName, + accountName, + databaseName, + options: operationOptions + }, + getMongoDBDatabaseThroughputOperationSpec + ) as Promise; + } + + /** + * Update RUs per second of the an Azure Cosmos DB MongoDB database + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current + * MongoDB database. + * @param options The options parameters. + */ + async updateMongoDBDatabaseThroughput( + resourceGroupName: string, + accountName: string, + databaseName: string, + updateThroughputParameters: ThroughputSettingsUpdateParameters, + options?: coreHttp.OperationOptions + ): Promise< + LROPoller + > { + const operationOptions: coreHttp.RequestOptionsBase = this.getOperationOptions( + options + ); + + const args: coreHttp.OperationArguments = { + resourceGroupName, + accountName, + databaseName, + updateThroughputParameters, + options: operationOptions + }; + const sendOperation = ( + args: coreHttp.OperationArguments, + spec: coreHttp.OperationSpec + ) => + this.client.sendOperationRequest(args, spec) as Promise< + MongoDBResourcesUpdateMongoDBDatabaseThroughputResponse + >; + const initialOperationResult = await sendOperation( + args, + updateMongoDBDatabaseThroughputOperationSpec + ); + + return new LROPoller({ + initialOperationArguments: args, + initialOperationSpec: updateMongoDBDatabaseThroughputOperationSpec, + initialOperationResult, + sendOperation + }); + } + + /** + * Lists the MongoDB collection under an existing Azure Cosmos DB database account. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param options The options parameters. + */ + listMongoDBCollections( + resourceGroupName: string, + accountName: string, + databaseName: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { + resourceGroupName, + accountName, + databaseName, + options: operationOptions + }, + listMongoDBCollectionsOperationSpec + ) as Promise; + } + + /** + * Gets the MongoDB collection under an existing Azure Cosmos DB database account. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param options The options parameters. + */ + getMongoDBCollection( + resourceGroupName: string, + accountName: string, + databaseName: string, + collectionName: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { + resourceGroupName, + accountName, + databaseName, + collectionName, + options: operationOptions + }, + getMongoDBCollectionOperationSpec + ) as Promise; + } + + /** + * Create or update an Azure Cosmos DB MongoDB Collection + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param createUpdateMongoDBCollectionParameters The parameters to provide for the current MongoDB + * Collection. + * @param options The options parameters. + */ + async createUpdateMongoDBCollection( + resourceGroupName: string, + accountName: string, + databaseName: string, + collectionName: string, + createUpdateMongoDBCollectionParameters: MongoDBCollectionCreateUpdateParameters, + options?: coreHttp.OperationOptions + ): Promise> { + const operationOptions: coreHttp.RequestOptionsBase = this.getOperationOptions( + options + ); + + const args: coreHttp.OperationArguments = { + resourceGroupName, + accountName, + databaseName, + collectionName, + createUpdateMongoDBCollectionParameters, + options: operationOptions + }; + const sendOperation = ( + args: coreHttp.OperationArguments, + spec: coreHttp.OperationSpec + ) => + this.client.sendOperationRequest(args, spec) as Promise< + MongoDBResourcesCreateUpdateMongoDBCollectionResponse + >; + const initialOperationResult = await sendOperation( + args, + createUpdateMongoDBCollectionOperationSpec + ); + + return new LROPoller({ + initialOperationArguments: args, + initialOperationSpec: createUpdateMongoDBCollectionOperationSpec, + initialOperationResult, + sendOperation + }); + } + + /** + * Deletes an existing Azure Cosmos DB MongoDB Collection. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param options The options parameters. + */ + async deleteMongoDBCollection( + resourceGroupName: string, + accountName: string, + databaseName: string, + collectionName: string, + options?: coreHttp.OperationOptions + ): Promise> { + const operationOptions: coreHttp.RequestOptionsBase = this.getOperationOptions( + options + ); + + const args: coreHttp.OperationArguments = { + resourceGroupName, + accountName, + databaseName, + collectionName, + options: operationOptions + }; + const sendOperation = ( + args: coreHttp.OperationArguments, + spec: coreHttp.OperationSpec + ) => + this.client.sendOperationRequest(args, spec) as Promise< + coreHttp.RestResponse + >; + const initialOperationResult = await sendOperation( + args, + deleteMongoDBCollectionOperationSpec + ); + + return new LROPoller({ + initialOperationArguments: args, + initialOperationSpec: deleteMongoDBCollectionOperationSpec, + initialOperationResult, + sendOperation + }); + } + + /** + * Gets the RUs per second of the MongoDB collection under an existing Azure Cosmos DB database account + * with the provided name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param options The options parameters. + */ + getMongoDBCollectionThroughput( + resourceGroupName: string, + accountName: string, + databaseName: string, + collectionName: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { + resourceGroupName, + accountName, + databaseName, + collectionName, + options: operationOptions + }, + getMongoDBCollectionThroughputOperationSpec + ) as Promise; + } + + /** + * Update the RUs per second of an Azure Cosmos DB MongoDB collection + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current + * MongoDB collection. + * @param options The options parameters. + */ + async updateMongoDBCollectionThroughput( + resourceGroupName: string, + accountName: string, + databaseName: string, + collectionName: string, + updateThroughputParameters: ThroughputSettingsUpdateParameters, + options?: coreHttp.OperationOptions + ): Promise< + LROPoller + > { + const operationOptions: coreHttp.RequestOptionsBase = this.getOperationOptions( + options + ); + + const args: coreHttp.OperationArguments = { + resourceGroupName, + accountName, + databaseName, + collectionName, + updateThroughputParameters, + options: operationOptions + }; + const sendOperation = ( + args: coreHttp.OperationArguments, + spec: coreHttp.OperationSpec + ) => + this.client.sendOperationRequest(args, spec) as Promise< + MongoDBResourcesUpdateMongoDBCollectionThroughputResponse + >; + const initialOperationResult = await sendOperation( + args, + updateMongoDBCollectionThroughputOperationSpec + ); + + return new LROPoller({ + initialOperationArguments: args, + initialOperationSpec: updateMongoDBCollectionThroughputOperationSpec, + initialOperationResult, + sendOperation + }); + } + + private getOperationOptions( + options: TOptions | undefined, + finalStateVia?: string + ): coreHttp.RequestOptionsBase { + const operationOptions: coreHttp.OperationOptions = options || {}; + operationOptions.requestOptions = { + ...operationOptions.requestOptions, + shouldDeserialize: shouldDeserializeLRO(finalStateVia) + }; + return coreHttp.operationOptionsToRequestOptionsBase(operationOptions); + } +} +// Operation Specifications + +const serializer = new coreHttp.Serializer(Mappers, /* isXml */ false); + +const listMongoDBDatabasesOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.MongoDBDatabaseListResult + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName + ], + serializer +}; +const getMongoDBDatabaseOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.MongoDBDatabaseGetResults + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.databaseName + ], + serializer +}; +const createUpdateMongoDBDatabaseOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.MongoDBDatabaseGetResults + }, + 201: { + bodyMapper: Mappers.MongoDBDatabaseGetResults + }, + 202: { + bodyMapper: Mappers.MongoDBDatabaseGetResults + }, + 204: { + bodyMapper: Mappers.MongoDBDatabaseGetResults + } + }, + requestBody: Parameters.createUpdateMongoDBDatabaseParameters, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.databaseName + ], + headerParameters: [Parameters.contentType], + serializer +}; +const deleteMongoDBDatabaseOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}", + httpMethod: "DELETE", + responses: { 200: {}, 201: {}, 202: {}, 204: {} }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.databaseName + ], + serializer +}; +const getMongoDBDatabaseThroughputOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ThroughputSettingsGetResults + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.databaseName + ], + serializer +}; +const updateMongoDBDatabaseThroughputOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.ThroughputSettingsGetResults + }, + 201: { + bodyMapper: Mappers.ThroughputSettingsGetResults + }, + 202: { + bodyMapper: Mappers.ThroughputSettingsGetResults + }, + 204: { + bodyMapper: Mappers.ThroughputSettingsGetResults + } + }, + requestBody: Parameters.updateThroughputParameters2, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.databaseName + ], + headerParameters: [Parameters.contentType], + serializer +}; +const listMongoDBCollectionsOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.MongoDBCollectionListResult + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.databaseName + ], + serializer +}; +const getMongoDBCollectionOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.MongoDBCollectionGetResults + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.databaseName, + Parameters.collectionName + ], + serializer +}; +const createUpdateMongoDBCollectionOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.MongoDBCollectionGetResults + }, + 201: { + bodyMapper: Mappers.MongoDBCollectionGetResults + }, + 202: { + bodyMapper: Mappers.MongoDBCollectionGetResults + }, + 204: { + bodyMapper: Mappers.MongoDBCollectionGetResults + } + }, + requestBody: Parameters.createUpdateMongoDBCollectionParameters, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.databaseName, + Parameters.collectionName + ], + headerParameters: [Parameters.contentType], + serializer +}; +const deleteMongoDBCollectionOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}", + httpMethod: "DELETE", + responses: { 200: {}, 201: {}, 202: {}, 204: {} }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.databaseName, + Parameters.collectionName + ], + serializer +}; +const getMongoDBCollectionThroughputOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ThroughputSettingsGetResults + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.databaseName, + Parameters.collectionName + ], + serializer +}; +const updateMongoDBCollectionThroughputOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.ThroughputSettingsGetResults + }, + 201: { + bodyMapper: Mappers.ThroughputSettingsGetResults + }, + 202: { + bodyMapper: Mappers.ThroughputSettingsGetResults + }, + 204: { + bodyMapper: Mappers.ThroughputSettingsGetResults + } + }, + requestBody: Parameters.updateThroughputParameters3, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.databaseName, + Parameters.collectionName + ], + headerParameters: [Parameters.contentType], + serializer +}; diff --git a/test/smoke/generated/cosmos-db-resource-manager/src/operations/notebookWorkspaces.ts b/test/smoke/generated/cosmos-db-resource-manager/src/operations/notebookWorkspaces.ts new file mode 100644 index 0000000000..cc6321ff7f --- /dev/null +++ b/test/smoke/generated/cosmos-db-resource-manager/src/operations/notebookWorkspaces.ts @@ -0,0 +1,418 @@ +/* + * 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 * as coreHttp from "@azure/core-http"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { CosmosDBManagementClient } from "../cosmosDBManagementClient"; +import { LROPoller, shouldDeserializeLRO } from "../lro"; +import { + NotebookWorkspacesListByDatabaseAccountResponse, + NotebookWorkspacesGetResponse, + ARMProxyResource, + NotebookWorkspacesCreateOrUpdateResponse, + NotebookWorkspacesListConnectionInfoResponse +} from "../models"; + +/** + * Class representing a NotebookWorkspaces. + */ +export class NotebookWorkspaces { + private readonly client: CosmosDBManagementClient; + + /** + * Initialize a new instance of the class NotebookWorkspaces class. + * @param client Reference to the service client + */ + constructor(client: CosmosDBManagementClient) { + this.client = client; + } + + /** + * Gets the notebook workspace resources of an existing Cosmos DB account. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param options The options parameters. + */ + listByDatabaseAccount( + resourceGroupName: string, + accountName: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { resourceGroupName, accountName, options: operationOptions }, + listByDatabaseAccountOperationSpec + ) as Promise; + } + + /** + * Gets the notebook workspace for a Cosmos DB account. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + accountName: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { resourceGroupName, accountName, options: operationOptions }, + getOperationSpec + ) as Promise; + } + + /** + * Creates the notebook workspace for a Cosmos DB account. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param notebookCreateUpdateParameters The notebook workspace to create for the current database + * account. + * @param options The options parameters. + */ + async createOrUpdate( + resourceGroupName: string, + accountName: string, + notebookCreateUpdateParameters: ARMProxyResource, + options?: coreHttp.OperationOptions + ): Promise> { + const operationOptions: coreHttp.RequestOptionsBase = this.getOperationOptions( + options + ); + + const args: coreHttp.OperationArguments = { + resourceGroupName, + accountName, + notebookCreateUpdateParameters, + options: operationOptions + }; + const sendOperation = ( + args: coreHttp.OperationArguments, + spec: coreHttp.OperationSpec + ) => + this.client.sendOperationRequest(args, spec) as Promise< + NotebookWorkspacesCreateOrUpdateResponse + >; + const initialOperationResult = await sendOperation( + args, + createOrUpdateOperationSpec + ); + + return new LROPoller({ + initialOperationArguments: args, + initialOperationSpec: createOrUpdateOperationSpec, + initialOperationResult, + sendOperation + }); + } + + /** + * Deletes the notebook workspace for a Cosmos DB account. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param options The options parameters. + */ + async delete( + resourceGroupName: string, + accountName: string, + options?: coreHttp.OperationOptions + ): Promise> { + const operationOptions: coreHttp.RequestOptionsBase = this.getOperationOptions( + options + ); + + const args: coreHttp.OperationArguments = { + resourceGroupName, + accountName, + options: operationOptions + }; + const sendOperation = ( + args: coreHttp.OperationArguments, + spec: coreHttp.OperationSpec + ) => + this.client.sendOperationRequest(args, spec) as Promise< + coreHttp.RestResponse + >; + const initialOperationResult = await sendOperation( + args, + deleteOperationSpec + ); + + return new LROPoller({ + initialOperationArguments: args, + initialOperationSpec: deleteOperationSpec, + initialOperationResult, + sendOperation + }); + } + + /** + * Retrieves the connection info for the notebook workspace + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param options The options parameters. + */ + listConnectionInfo( + resourceGroupName: string, + accountName: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { resourceGroupName, accountName, options: operationOptions }, + listConnectionInfoOperationSpec + ) as Promise; + } + + /** + * Regenerates the auth token for the notebook workspace + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param options The options parameters. + */ + async regenerateAuthToken( + resourceGroupName: string, + accountName: string, + options?: coreHttp.OperationOptions + ): Promise> { + const operationOptions: coreHttp.RequestOptionsBase = this.getOperationOptions( + options + ); + + const args: coreHttp.OperationArguments = { + resourceGroupName, + accountName, + options: operationOptions + }; + const sendOperation = ( + args: coreHttp.OperationArguments, + spec: coreHttp.OperationSpec + ) => + this.client.sendOperationRequest(args, spec) as Promise< + coreHttp.RestResponse + >; + const initialOperationResult = await sendOperation( + args, + regenerateAuthTokenOperationSpec + ); + + return new LROPoller({ + initialOperationArguments: args, + initialOperationSpec: regenerateAuthTokenOperationSpec, + initialOperationResult, + sendOperation + }); + } + + /** + * Starts the notebook workspace + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param options The options parameters. + */ + async start( + resourceGroupName: string, + accountName: string, + options?: coreHttp.OperationOptions + ): Promise> { + const operationOptions: coreHttp.RequestOptionsBase = this.getOperationOptions( + options + ); + + const args: coreHttp.OperationArguments = { + resourceGroupName, + accountName, + options: operationOptions + }; + const sendOperation = ( + args: coreHttp.OperationArguments, + spec: coreHttp.OperationSpec + ) => + this.client.sendOperationRequest(args, spec) as Promise< + coreHttp.RestResponse + >; + const initialOperationResult = await sendOperation( + args, + startOperationSpec + ); + + return new LROPoller({ + initialOperationArguments: args, + initialOperationSpec: startOperationSpec, + initialOperationResult, + sendOperation + }); + } + + private getOperationOptions( + options: TOptions | undefined, + finalStateVia?: string + ): coreHttp.RequestOptionsBase { + const operationOptions: coreHttp.OperationOptions = options || {}; + operationOptions.requestOptions = { + ...operationOptions.requestOptions, + shouldDeserialize: shouldDeserializeLRO(finalStateVia) + }; + return coreHttp.operationOptionsToRequestOptionsBase(operationOptions); + } +} +// Operation Specifications + +const serializer = new coreHttp.Serializer(Mappers, /* isXml */ false); + +const listByDatabaseAccountOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.NotebookWorkspaceListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion1], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName + ], + serializer +}; +const getOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.NotebookWorkspace + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion1], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.notebookWorkspaceName + ], + serializer +}; +const createOrUpdateOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.NotebookWorkspace + }, + 201: { + bodyMapper: Mappers.NotebookWorkspace + }, + 202: { + bodyMapper: Mappers.NotebookWorkspace + }, + 204: { + bodyMapper: Mappers.NotebookWorkspace + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.notebookCreateUpdateParameters, + queryParameters: [Parameters.apiVersion1], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.notebookWorkspaceName + ], + headerParameters: [Parameters.contentType], + serializer +}; +const deleteOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}", + httpMethod: "DELETE", + responses: { 200: {}, 201: {}, 202: {}, 204: {} }, + queryParameters: [Parameters.apiVersion1], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.notebookWorkspaceName + ], + serializer +}; +const listConnectionInfoOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/listConnectionInfo", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.NotebookWorkspaceConnectionInfoResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion1], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.notebookWorkspaceName + ], + serializer +}; +const regenerateAuthTokenOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/regenerateAuthToken", + httpMethod: "POST", + responses: { 200: {}, 201: {}, 202: {}, 204: {} }, + queryParameters: [Parameters.apiVersion1], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.notebookWorkspaceName + ], + serializer +}; +const startOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/start", + httpMethod: "POST", + responses: { 200: {}, 201: {}, 202: {}, 204: {} }, + queryParameters: [Parameters.apiVersion1], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.notebookWorkspaceName + ], + serializer +}; diff --git a/test/smoke/generated/cosmos-db-resource-manager/src/operations/operations.ts b/test/smoke/generated/cosmos-db-resource-manager/src/operations/operations.ts new file mode 100644 index 0000000000..8312cb130b --- /dev/null +++ b/test/smoke/generated/cosmos-db-resource-manager/src/operations/operations.ts @@ -0,0 +1,88 @@ +/* + * 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 * as coreHttp from "@azure/core-http"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { CosmosDBManagementClient } from "../cosmosDBManagementClient"; +import { OperationsListResponse, OperationsListNextResponse } from "../models"; + +/** + * Class representing a Operations. + */ +export class Operations { + private readonly client: CosmosDBManagementClient; + + /** + * Initialize a new instance of the class Operations class. + * @param client Reference to the service client + */ + constructor(client: CosmosDBManagementClient) { + this.client = client; + } + + /** + * Lists all of the available Cosmos DB Resource Provider operations. + * @param options The options parameters. + */ + list(options?: coreHttp.OperationOptions): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { options: operationOptions }, + listOperationSpec + ) as Promise; + } + + /** + * ListNext + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + listNext( + nextLink: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { nextLink, options: operationOptions }, + listNextOperationSpec + ) as Promise; + } +} +// Operation Specifications + +const serializer = new coreHttp.Serializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreHttp.OperationSpec = { + path: "/providers/Microsoft.DocumentDB/operations", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.OperationListResult + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host], + serializer +}; +const listNextOperationSpec: coreHttp.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.OperationListResult + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.nextLink], + serializer +}; diff --git a/test/smoke/generated/cosmos-db-resource-manager/src/operations/partitionKeyRangeId.ts b/test/smoke/generated/cosmos-db-resource-manager/src/operations/partitionKeyRangeId.ts new file mode 100644 index 0000000000..4c372e9cba --- /dev/null +++ b/test/smoke/generated/cosmos-db-resource-manager/src/operations/partitionKeyRangeId.ts @@ -0,0 +1,91 @@ +/* + * 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 * as coreHttp from "@azure/core-http"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { CosmosDBManagementClient } from "../cosmosDBManagementClient"; +import { PartitionKeyRangeIdListMetricsResponse } from "../models"; + +/** + * Class representing a PartitionKeyRangeId. + */ +export class PartitionKeyRangeId { + private readonly client: CosmosDBManagementClient; + + /** + * Initialize a new instance of the class PartitionKeyRangeId class. + * @param client Reference to the service client + */ + constructor(client: CosmosDBManagementClient) { + this.client = client; + } + + /** + * Retrieves the metrics determined by the given filter for the given partition key range id. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The + * parameters that can be filtered are name.value (name of the metric, can have an or of multiple + * names), startTime, endTime, and timeGrain. The supported operator is eq. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param partitionKeyRangeId Partition Key Range Id for which to get data. + * @param options The options parameters. + */ + listMetrics( + resourceGroupName: string, + accountName: string, + filter: string, + databaseRid: string, + collectionRid: string, + partitionKeyRangeId: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { + resourceGroupName, + accountName, + filter, + databaseRid, + collectionRid, + partitionKeyRangeId, + options: operationOptions + }, + listMetricsOperationSpec + ) as Promise; + } +} +// Operation Specifications + +const serializer = new coreHttp.Serializer(Mappers, /* isXml */ false); + +const listMetricsOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/partitionKeyRangeId/{partitionKeyRangeId}/metrics", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.PartitionMetricListResult + } + }, + queryParameters: [Parameters.apiVersion, Parameters.filter], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.databaseRid, + Parameters.collectionRid, + Parameters.partitionKeyRangeId + ], + serializer +}; diff --git a/test/smoke/generated/cosmos-db-resource-manager/src/operations/partitionKeyRangeIdRegion.ts b/test/smoke/generated/cosmos-db-resource-manager/src/operations/partitionKeyRangeIdRegion.ts new file mode 100644 index 0000000000..dd463f3709 --- /dev/null +++ b/test/smoke/generated/cosmos-db-resource-manager/src/operations/partitionKeyRangeIdRegion.ts @@ -0,0 +1,96 @@ +/* + * 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 * as coreHttp from "@azure/core-http"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { CosmosDBManagementClient } from "../cosmosDBManagementClient"; +import { PartitionKeyRangeIdRegionListMetricsResponse } from "../models"; + +/** + * Class representing a PartitionKeyRangeIdRegion. + */ +export class PartitionKeyRangeIdRegion { + private readonly client: CosmosDBManagementClient; + + /** + * Initialize a new instance of the class PartitionKeyRangeIdRegion class. + * @param client Reference to the service client + */ + constructor(client: CosmosDBManagementClient) { + this.client = client; + } + + /** + * Retrieves the metrics determined by the given filter for the given partition key range id and + * region. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The + * parameters that can be filtered are name.value (name of the metric, can have an or of multiple + * names), startTime, endTime, and timeGrain. The supported operator is eq. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param partitionKeyRangeId Partition Key Range Id for which to get data. + * @param options The options parameters. + */ + listMetrics( + resourceGroupName: string, + accountName: string, + filter: string, + databaseRid: string, + collectionRid: string, + region: string, + partitionKeyRangeId: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { + resourceGroupName, + accountName, + filter, + databaseRid, + collectionRid, + region, + partitionKeyRangeId, + options: operationOptions + }, + listMetricsOperationSpec + ) as Promise; + } +} +// Operation Specifications + +const serializer = new coreHttp.Serializer(Mappers, /* isXml */ false); + +const listMetricsOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/databases/{databaseRid}/collections/{collectionRid}/partitionKeyRangeId/{partitionKeyRangeId}/metrics", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.PartitionMetricListResult + } + }, + queryParameters: [Parameters.apiVersion, Parameters.filter], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.databaseRid, + Parameters.collectionRid, + Parameters.region, + Parameters.partitionKeyRangeId + ], + serializer +}; diff --git a/test/smoke/generated/cosmos-db-resource-manager/src/operations/percentile.ts b/test/smoke/generated/cosmos-db-resource-manager/src/operations/percentile.ts new file mode 100644 index 0000000000..55af02ec3e --- /dev/null +++ b/test/smoke/generated/cosmos-db-resource-manager/src/operations/percentile.ts @@ -0,0 +1,75 @@ +/* + * 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 * as coreHttp from "@azure/core-http"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { CosmosDBManagementClient } from "../cosmosDBManagementClient"; +import { PercentileListMetricsResponse } from "../models"; + +/** + * Class representing a Percentile. + */ +export class Percentile { + private readonly client: CosmosDBManagementClient; + + /** + * Initialize a new instance of the class Percentile class. + * @param client Reference to the service client + */ + constructor(client: CosmosDBManagementClient) { + this.client = client; + } + + /** + * Retrieves the metrics determined by the given filter for the given database account. This url is + * only for PBS and Replication Latency data + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The + * parameters that can be filtered are name.value (name of the metric, can have an or of multiple + * names), startTime, endTime, and timeGrain. The supported operator is eq. + * @param options The options parameters. + */ + listMetrics( + resourceGroupName: string, + accountName: string, + filter: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { resourceGroupName, accountName, filter, options: operationOptions }, + listMetricsOperationSpec + ) as Promise; + } +} +// Operation Specifications + +const serializer = new coreHttp.Serializer(Mappers, /* isXml */ false); + +const listMetricsOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/percentile/metrics", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.PercentileMetricListResult + } + }, + queryParameters: [Parameters.apiVersion, Parameters.filter], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName + ], + serializer +}; diff --git a/test/smoke/generated/cosmos-db-resource-manager/src/operations/percentileSourceTarget.ts b/test/smoke/generated/cosmos-db-resource-manager/src/operations/percentileSourceTarget.ts new file mode 100644 index 0000000000..79bf237a9d --- /dev/null +++ b/test/smoke/generated/cosmos-db-resource-manager/src/operations/percentileSourceTarget.ts @@ -0,0 +1,90 @@ +/* + * 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 * as coreHttp from "@azure/core-http"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { CosmosDBManagementClient } from "../cosmosDBManagementClient"; +import { PercentileSourceTargetListMetricsResponse } from "../models"; + +/** + * Class representing a PercentileSourceTarget. + */ +export class PercentileSourceTarget { + private readonly client: CosmosDBManagementClient; + + /** + * Initialize a new instance of the class PercentileSourceTarget class. + * @param client Reference to the service client + */ + constructor(client: CosmosDBManagementClient) { + this.client = client; + } + + /** + * Retrieves the metrics determined by the given filter for the given account, source and target + * region. This url is only for PBS and Replication Latency data + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The + * parameters that can be filtered are name.value (name of the metric, can have an or of multiple + * names), startTime, endTime, and timeGrain. The supported operator is eq. + * @param sourceRegion Source region from which data is written. Cosmos DB region, with spaces between + * words and each word capitalized. + * @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between + * words and each word capitalized. + * @param options The options parameters. + */ + listMetrics( + resourceGroupName: string, + accountName: string, + filter: string, + sourceRegion: string, + targetRegion: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { + resourceGroupName, + accountName, + filter, + sourceRegion, + targetRegion, + options: operationOptions + }, + listMetricsOperationSpec + ) as Promise; + } +} +// Operation Specifications + +const serializer = new coreHttp.Serializer(Mappers, /* isXml */ false); + +const listMetricsOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sourceRegion/{sourceRegion}/targetRegion/{targetRegion}/percentile/metrics", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.PercentileMetricListResult + } + }, + queryParameters: [Parameters.apiVersion, Parameters.filter], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.sourceRegion, + Parameters.targetRegion + ], + serializer +}; diff --git a/test/smoke/generated/cosmos-db-resource-manager/src/operations/percentileTarget.ts b/test/smoke/generated/cosmos-db-resource-manager/src/operations/percentileTarget.ts new file mode 100644 index 0000000000..46c5499e23 --- /dev/null +++ b/test/smoke/generated/cosmos-db-resource-manager/src/operations/percentileTarget.ts @@ -0,0 +1,85 @@ +/* + * 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 * as coreHttp from "@azure/core-http"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { CosmosDBManagementClient } from "../cosmosDBManagementClient"; +import { PercentileTargetListMetricsResponse } from "../models"; + +/** + * Class representing a PercentileTarget. + */ +export class PercentileTarget { + private readonly client: CosmosDBManagementClient; + + /** + * Initialize a new instance of the class PercentileTarget class. + * @param client Reference to the service client + */ + constructor(client: CosmosDBManagementClient) { + this.client = client; + } + + /** + * Retrieves the metrics determined by the given filter for the given account target region. This url + * is only for PBS and Replication Latency data + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The + * parameters that can be filtered are name.value (name of the metric, can have an or of multiple + * names), startTime, endTime, and timeGrain. The supported operator is eq. + * @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between + * words and each word capitalized. + * @param options The options parameters. + */ + listMetrics( + resourceGroupName: string, + accountName: string, + filter: string, + targetRegion: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { + resourceGroupName, + accountName, + filter, + targetRegion, + options: operationOptions + }, + listMetricsOperationSpec + ) as Promise; + } +} +// Operation Specifications + +const serializer = new coreHttp.Serializer(Mappers, /* isXml */ false); + +const listMetricsOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/targetRegion/{targetRegion}/percentile/metrics", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.PercentileMetricListResult + } + }, + queryParameters: [Parameters.apiVersion, Parameters.filter], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.targetRegion + ], + serializer +}; diff --git a/test/smoke/generated/cosmos-db-resource-manager/src/operations/privateEndpointConnections.ts b/test/smoke/generated/cosmos-db-resource-manager/src/operations/privateEndpointConnections.ts new file mode 100644 index 0000000000..2a1c6f2dce --- /dev/null +++ b/test/smoke/generated/cosmos-db-resource-manager/src/operations/privateEndpointConnections.ts @@ -0,0 +1,268 @@ +/* + * 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 * as coreHttp from "@azure/core-http"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { CosmosDBManagementClient } from "../cosmosDBManagementClient"; +import { LROPoller, shouldDeserializeLRO } from "../lro"; +import { + PrivateEndpointConnectionsListByDatabaseAccountResponse, + PrivateEndpointConnectionsGetResponse, + PrivateEndpointConnectionAutoGenerated, + PrivateEndpointConnectionsCreateOrUpdateResponse +} from "../models"; + +/** + * Class representing a PrivateEndpointConnections. + */ +export class PrivateEndpointConnections { + private readonly client: CosmosDBManagementClient; + + /** + * Initialize a new instance of the class PrivateEndpointConnections class. + * @param client Reference to the service client + */ + constructor(client: CosmosDBManagementClient) { + this.client = client; + } + + /** + * List all private endpoint connections on a Cosmos DB account. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param options The options parameters. + */ + listByDatabaseAccount( + resourceGroupName: string, + accountName: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { resourceGroupName, accountName, options: operationOptions }, + listByDatabaseAccountOperationSpec + ) as Promise; + } + + /** + * Gets a private endpoint connection. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + accountName: string, + privateEndpointConnectionName: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { + resourceGroupName, + accountName, + privateEndpointConnectionName, + options: operationOptions + }, + getOperationSpec + ) as Promise; + } + + /** + * Approve or reject a private endpoint connection with a given name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters A private endpoint connection + * @param options The options parameters. + */ + async createOrUpdate( + resourceGroupName: string, + accountName: string, + privateEndpointConnectionName: string, + parameters: PrivateEndpointConnectionAutoGenerated, + options?: coreHttp.OperationOptions + ): Promise> { + const operationOptions: coreHttp.RequestOptionsBase = this.getOperationOptions( + options + ); + + const args: coreHttp.OperationArguments = { + resourceGroupName, + accountName, + privateEndpointConnectionName, + parameters, + options: operationOptions + }; + const sendOperation = ( + args: coreHttp.OperationArguments, + spec: coreHttp.OperationSpec + ) => + this.client.sendOperationRequest(args, spec) as Promise< + PrivateEndpointConnectionsCreateOrUpdateResponse + >; + const initialOperationResult = await sendOperation( + args, + createOrUpdateOperationSpec + ); + + return new LROPoller({ + initialOperationArguments: args, + initialOperationSpec: createOrUpdateOperationSpec, + initialOperationResult, + sendOperation + }); + } + + /** + * Deletes a private endpoint connection with a given name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param options The options parameters. + */ + async delete( + resourceGroupName: string, + accountName: string, + privateEndpointConnectionName: string, + options?: coreHttp.OperationOptions + ): Promise> { + const operationOptions: coreHttp.RequestOptionsBase = this.getOperationOptions( + options + ); + + const args: coreHttp.OperationArguments = { + resourceGroupName, + accountName, + privateEndpointConnectionName, + options: operationOptions + }; + const sendOperation = ( + args: coreHttp.OperationArguments, + spec: coreHttp.OperationSpec + ) => + this.client.sendOperationRequest(args, spec) as Promise< + coreHttp.RestResponse + >; + const initialOperationResult = await sendOperation( + args, + deleteOperationSpec + ); + + return new LROPoller({ + initialOperationArguments: args, + initialOperationSpec: deleteOperationSpec, + initialOperationResult, + sendOperation + }); + } + + private getOperationOptions( + options: TOptions | undefined, + finalStateVia?: string + ): coreHttp.RequestOptionsBase { + const operationOptions: coreHttp.OperationOptions = options || {}; + operationOptions.requestOptions = { + ...operationOptions.requestOptions, + shouldDeserialize: shouldDeserializeLRO(finalStateVia) + }; + return coreHttp.operationOptionsToRequestOptionsBase(operationOptions); + } +} +// Operation Specifications + +const serializer = new coreHttp.Serializer(Mappers, /* isXml */ false); + +const listByDatabaseAccountOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.PrivateEndpointConnectionListResult + } + }, + queryParameters: [Parameters.apiVersion2], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName + ], + serializer +}; +const getOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.PrivateEndpointConnectionAutoGenerated + } + }, + queryParameters: [Parameters.apiVersion2], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.privateEndpointConnectionName + ], + serializer +}; +const createOrUpdateOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.PrivateEndpointConnectionAutoGenerated + }, + 201: { + bodyMapper: Mappers.PrivateEndpointConnectionAutoGenerated + }, + 202: { + bodyMapper: Mappers.PrivateEndpointConnectionAutoGenerated + }, + 204: { + bodyMapper: Mappers.PrivateEndpointConnectionAutoGenerated + } + }, + requestBody: Parameters.parameters, + queryParameters: [Parameters.apiVersion2], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.privateEndpointConnectionName + ], + headerParameters: [Parameters.contentType], + serializer +}; +const deleteOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}", + httpMethod: "DELETE", + responses: { 200: {}, 201: {}, 202: {}, 204: {} }, + queryParameters: [Parameters.apiVersion2], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.privateEndpointConnectionName + ], + serializer +}; diff --git a/test/smoke/generated/cosmos-db-resource-manager/src/operations/privateLinkResources.ts b/test/smoke/generated/cosmos-db-resource-manager/src/operations/privateLinkResources.ts new file mode 100644 index 0000000000..f13c449e81 --- /dev/null +++ b/test/smoke/generated/cosmos-db-resource-manager/src/operations/privateLinkResources.ts @@ -0,0 +1,114 @@ +/* + * 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 * as coreHttp from "@azure/core-http"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { CosmosDBManagementClient } from "../cosmosDBManagementClient"; +import { + PrivateLinkResourcesListByDatabaseAccountResponse, + PrivateLinkResourcesGetResponse +} from "../models"; + +/** + * Class representing a PrivateLinkResources. + */ +export class PrivateLinkResources { + private readonly client: CosmosDBManagementClient; + + /** + * Initialize a new instance of the class PrivateLinkResources class. + * @param client Reference to the service client + */ + constructor(client: CosmosDBManagementClient) { + this.client = client; + } + + /** + * Gets the private link resources that need to be created for a Cosmos DB account. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param options The options parameters. + */ + listByDatabaseAccount( + resourceGroupName: string, + accountName: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { resourceGroupName, accountName, options: operationOptions }, + listByDatabaseAccountOperationSpec + ) as Promise; + } + + /** + * Gets the private link resources that need to be created for a Cosmos DB account. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param groupName The name of the private link resource. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + accountName: string, + groupName: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { resourceGroupName, accountName, groupName, options: operationOptions }, + getOperationSpec + ) as Promise; + } +} +// Operation Specifications + +const serializer = new coreHttp.Serializer(Mappers, /* isXml */ false); + +const listByDatabaseAccountOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateLinkResources", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.PrivateLinkResourceListResult + } + }, + queryParameters: [Parameters.apiVersion2], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName + ], + serializer +}; +const getOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateLinkResources/{groupName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.PrivateLinkResource + } + }, + queryParameters: [Parameters.apiVersion2], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.groupName + ], + serializer +}; diff --git a/test/smoke/generated/cosmos-db-resource-manager/src/operations/sqlResources.ts b/test/smoke/generated/cosmos-db-resource-manager/src/operations/sqlResources.ts new file mode 100644 index 0000000000..59c879469c --- /dev/null +++ b/test/smoke/generated/cosmos-db-resource-manager/src/operations/sqlResources.ts @@ -0,0 +1,1548 @@ +/* + * 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 * as coreHttp from "@azure/core-http"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { CosmosDBManagementClient } from "../cosmosDBManagementClient"; +import { LROPoller, shouldDeserializeLRO } from "../lro"; +import { + SqlResourcesListSqlDatabasesResponse, + SqlResourcesGetSqlDatabaseResponse, + SqlDatabaseCreateUpdateParameters, + SqlResourcesCreateUpdateSqlDatabaseResponse, + SqlResourcesGetSqlDatabaseThroughputResponse, + ThroughputSettingsUpdateParameters, + SqlResourcesUpdateSqlDatabaseThroughputResponse, + SqlResourcesListSqlContainersResponse, + SqlResourcesGetSqlContainerResponse, + SqlContainerCreateUpdateParameters, + SqlResourcesCreateUpdateSqlContainerResponse, + SqlResourcesGetSqlContainerThroughputResponse, + SqlResourcesUpdateSqlContainerThroughputResponse, + SqlResourcesListSqlStoredProceduresResponse, + SqlResourcesGetSqlStoredProcedureResponse, + SqlStoredProcedureCreateUpdateParameters, + SqlResourcesCreateUpdateSqlStoredProcedureResponse, + SqlResourcesListSqlUserDefinedFunctionsResponse, + SqlResourcesGetSqlUserDefinedFunctionResponse, + SqlUserDefinedFunctionCreateUpdateParameters, + SqlResourcesCreateUpdateSqlUserDefinedFunctionResponse, + SqlResourcesListSqlTriggersResponse, + SqlResourcesGetSqlTriggerResponse, + SqlTriggerCreateUpdateParameters, + SqlResourcesCreateUpdateSqlTriggerResponse +} from "../models"; + +/** + * Class representing a SqlResources. + */ +export class SqlResources { + private readonly client: CosmosDBManagementClient; + + /** + * Initialize a new instance of the class SqlResources class. + * @param client Reference to the service client + */ + constructor(client: CosmosDBManagementClient) { + this.client = client; + } + + /** + * Lists the SQL databases under an existing Azure Cosmos DB database account. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param options The options parameters. + */ + listSqlDatabases( + resourceGroupName: string, + accountName: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { resourceGroupName, accountName, options: operationOptions }, + listSqlDatabasesOperationSpec + ) as Promise; + } + + /** + * Gets the SQL database under an existing Azure Cosmos DB database account with the provided name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param options The options parameters. + */ + getSqlDatabase( + resourceGroupName: string, + accountName: string, + databaseName: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { + resourceGroupName, + accountName, + databaseName, + options: operationOptions + }, + getSqlDatabaseOperationSpec + ) as Promise; + } + + /** + * Create or update an Azure Cosmos DB SQL database + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateSqlDatabaseParameters The parameters to provide for the current SQL database. + * @param options The options parameters. + */ + async createUpdateSqlDatabase( + resourceGroupName: string, + accountName: string, + databaseName: string, + createUpdateSqlDatabaseParameters: SqlDatabaseCreateUpdateParameters, + options?: coreHttp.OperationOptions + ): Promise> { + const operationOptions: coreHttp.RequestOptionsBase = this.getOperationOptions( + options + ); + + const args: coreHttp.OperationArguments = { + resourceGroupName, + accountName, + databaseName, + createUpdateSqlDatabaseParameters, + options: operationOptions + }; + const sendOperation = ( + args: coreHttp.OperationArguments, + spec: coreHttp.OperationSpec + ) => + this.client.sendOperationRequest(args, spec) as Promise< + SqlResourcesCreateUpdateSqlDatabaseResponse + >; + const initialOperationResult = await sendOperation( + args, + createUpdateSqlDatabaseOperationSpec + ); + + return new LROPoller({ + initialOperationArguments: args, + initialOperationSpec: createUpdateSqlDatabaseOperationSpec, + initialOperationResult, + sendOperation + }); + } + + /** + * Deletes an existing Azure Cosmos DB SQL database. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param options The options parameters. + */ + async deleteSqlDatabase( + resourceGroupName: string, + accountName: string, + databaseName: string, + options?: coreHttp.OperationOptions + ): Promise> { + const operationOptions: coreHttp.RequestOptionsBase = this.getOperationOptions( + options + ); + + const args: coreHttp.OperationArguments = { + resourceGroupName, + accountName, + databaseName, + options: operationOptions + }; + const sendOperation = ( + args: coreHttp.OperationArguments, + spec: coreHttp.OperationSpec + ) => + this.client.sendOperationRequest(args, spec) as Promise< + coreHttp.RestResponse + >; + const initialOperationResult = await sendOperation( + args, + deleteSqlDatabaseOperationSpec + ); + + return new LROPoller({ + initialOperationArguments: args, + initialOperationSpec: deleteSqlDatabaseOperationSpec, + initialOperationResult, + sendOperation + }); + } + + /** + * Gets the RUs per second of the SQL database under an existing Azure Cosmos DB database account with + * the provided name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param options The options parameters. + */ + getSqlDatabaseThroughput( + resourceGroupName: string, + accountName: string, + databaseName: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { + resourceGroupName, + accountName, + databaseName, + options: operationOptions + }, + getSqlDatabaseThroughputOperationSpec + ) as Promise; + } + + /** + * Update RUs per second of an Azure Cosmos DB SQL database + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current + * SQL database. + * @param options The options parameters. + */ + async updateSqlDatabaseThroughput( + resourceGroupName: string, + accountName: string, + databaseName: string, + updateThroughputParameters: ThroughputSettingsUpdateParameters, + options?: coreHttp.OperationOptions + ): Promise> { + const operationOptions: coreHttp.RequestOptionsBase = this.getOperationOptions( + options + ); + + const args: coreHttp.OperationArguments = { + resourceGroupName, + accountName, + databaseName, + updateThroughputParameters, + options: operationOptions + }; + const sendOperation = ( + args: coreHttp.OperationArguments, + spec: coreHttp.OperationSpec + ) => + this.client.sendOperationRequest(args, spec) as Promise< + SqlResourcesUpdateSqlDatabaseThroughputResponse + >; + const initialOperationResult = await sendOperation( + args, + updateSqlDatabaseThroughputOperationSpec + ); + + return new LROPoller({ + initialOperationArguments: args, + initialOperationSpec: updateSqlDatabaseThroughputOperationSpec, + initialOperationResult, + sendOperation + }); + } + + /** + * Lists the SQL container under an existing Azure Cosmos DB database account. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param options The options parameters. + */ + listSqlContainers( + resourceGroupName: string, + accountName: string, + databaseName: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { + resourceGroupName, + accountName, + databaseName, + options: operationOptions + }, + listSqlContainersOperationSpec + ) as Promise; + } + + /** + * Gets the SQL container under an existing Azure Cosmos DB database account. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param options The options parameters. + */ + getSqlContainer( + resourceGroupName: string, + accountName: string, + databaseName: string, + containerName: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { + resourceGroupName, + accountName, + databaseName, + containerName, + options: operationOptions + }, + getSqlContainerOperationSpec + ) as Promise; + } + + /** + * Create or update an Azure Cosmos DB SQL container + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param createUpdateSqlContainerParameters The parameters to provide for the current SQL container. + * @param options The options parameters. + */ + async createUpdateSqlContainer( + resourceGroupName: string, + accountName: string, + databaseName: string, + containerName: string, + createUpdateSqlContainerParameters: SqlContainerCreateUpdateParameters, + options?: coreHttp.OperationOptions + ): Promise> { + const operationOptions: coreHttp.RequestOptionsBase = this.getOperationOptions( + options + ); + + const args: coreHttp.OperationArguments = { + resourceGroupName, + accountName, + databaseName, + containerName, + createUpdateSqlContainerParameters, + options: operationOptions + }; + const sendOperation = ( + args: coreHttp.OperationArguments, + spec: coreHttp.OperationSpec + ) => + this.client.sendOperationRequest(args, spec) as Promise< + SqlResourcesCreateUpdateSqlContainerResponse + >; + const initialOperationResult = await sendOperation( + args, + createUpdateSqlContainerOperationSpec + ); + + return new LROPoller({ + initialOperationArguments: args, + initialOperationSpec: createUpdateSqlContainerOperationSpec, + initialOperationResult, + sendOperation + }); + } + + /** + * Deletes an existing Azure Cosmos DB SQL container. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param options The options parameters. + */ + async deleteSqlContainer( + resourceGroupName: string, + accountName: string, + databaseName: string, + containerName: string, + options?: coreHttp.OperationOptions + ): Promise> { + const operationOptions: coreHttp.RequestOptionsBase = this.getOperationOptions( + options + ); + + const args: coreHttp.OperationArguments = { + resourceGroupName, + accountName, + databaseName, + containerName, + options: operationOptions + }; + const sendOperation = ( + args: coreHttp.OperationArguments, + spec: coreHttp.OperationSpec + ) => + this.client.sendOperationRequest(args, spec) as Promise< + coreHttp.RestResponse + >; + const initialOperationResult = await sendOperation( + args, + deleteSqlContainerOperationSpec + ); + + return new LROPoller({ + initialOperationArguments: args, + initialOperationSpec: deleteSqlContainerOperationSpec, + initialOperationResult, + sendOperation + }); + } + + /** + * Gets the RUs per second of the SQL container under an existing Azure Cosmos DB database account. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param options The options parameters. + */ + getSqlContainerThroughput( + resourceGroupName: string, + accountName: string, + databaseName: string, + containerName: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { + resourceGroupName, + accountName, + databaseName, + containerName, + options: operationOptions + }, + getSqlContainerThroughputOperationSpec + ) as Promise; + } + + /** + * Update RUs per second of an Azure Cosmos DB SQL container + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current + * SQL container. + * @param options The options parameters. + */ + async updateSqlContainerThroughput( + resourceGroupName: string, + accountName: string, + databaseName: string, + containerName: string, + updateThroughputParameters: ThroughputSettingsUpdateParameters, + options?: coreHttp.OperationOptions + ): Promise> { + const operationOptions: coreHttp.RequestOptionsBase = this.getOperationOptions( + options + ); + + const args: coreHttp.OperationArguments = { + resourceGroupName, + accountName, + databaseName, + containerName, + updateThroughputParameters, + options: operationOptions + }; + const sendOperation = ( + args: coreHttp.OperationArguments, + spec: coreHttp.OperationSpec + ) => + this.client.sendOperationRequest(args, spec) as Promise< + SqlResourcesUpdateSqlContainerThroughputResponse + >; + const initialOperationResult = await sendOperation( + args, + updateSqlContainerThroughputOperationSpec + ); + + return new LROPoller({ + initialOperationArguments: args, + initialOperationSpec: updateSqlContainerThroughputOperationSpec, + initialOperationResult, + sendOperation + }); + } + + /** + * Lists the SQL storedProcedure under an existing Azure Cosmos DB database account. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param options The options parameters. + */ + listSqlStoredProcedures( + resourceGroupName: string, + accountName: string, + databaseName: string, + containerName: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { + resourceGroupName, + accountName, + databaseName, + containerName, + options: operationOptions + }, + listSqlStoredProceduresOperationSpec + ) as Promise; + } + + /** + * Gets the SQL storedProcedure under an existing Azure Cosmos DB database account. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure name. + * @param options The options parameters. + */ + getSqlStoredProcedure( + resourceGroupName: string, + accountName: string, + databaseName: string, + containerName: string, + storedProcedureName: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { + resourceGroupName, + accountName, + databaseName, + containerName, + storedProcedureName, + options: operationOptions + }, + getSqlStoredProcedureOperationSpec + ) as Promise; + } + + /** + * Create or update an Azure Cosmos DB SQL storedProcedure + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure name. + * @param createUpdateSqlStoredProcedureParameters The parameters to provide for the current SQL + * storedProcedure. + * @param options The options parameters. + */ + async createUpdateSqlStoredProcedure( + resourceGroupName: string, + accountName: string, + databaseName: string, + containerName: string, + storedProcedureName: string, + createUpdateSqlStoredProcedureParameters: SqlStoredProcedureCreateUpdateParameters, + options?: coreHttp.OperationOptions + ): Promise> { + const operationOptions: coreHttp.RequestOptionsBase = this.getOperationOptions( + options + ); + + const args: coreHttp.OperationArguments = { + resourceGroupName, + accountName, + databaseName, + containerName, + storedProcedureName, + createUpdateSqlStoredProcedureParameters, + options: operationOptions + }; + const sendOperation = ( + args: coreHttp.OperationArguments, + spec: coreHttp.OperationSpec + ) => + this.client.sendOperationRequest(args, spec) as Promise< + SqlResourcesCreateUpdateSqlStoredProcedureResponse + >; + const initialOperationResult = await sendOperation( + args, + createUpdateSqlStoredProcedureOperationSpec + ); + + return new LROPoller({ + initialOperationArguments: args, + initialOperationSpec: createUpdateSqlStoredProcedureOperationSpec, + initialOperationResult, + sendOperation + }); + } + + /** + * Deletes an existing Azure Cosmos DB SQL storedProcedure. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure name. + * @param options The options parameters. + */ + async deleteSqlStoredProcedure( + resourceGroupName: string, + accountName: string, + databaseName: string, + containerName: string, + storedProcedureName: string, + options?: coreHttp.OperationOptions + ): Promise> { + const operationOptions: coreHttp.RequestOptionsBase = this.getOperationOptions( + options + ); + + const args: coreHttp.OperationArguments = { + resourceGroupName, + accountName, + databaseName, + containerName, + storedProcedureName, + options: operationOptions + }; + const sendOperation = ( + args: coreHttp.OperationArguments, + spec: coreHttp.OperationSpec + ) => + this.client.sendOperationRequest(args, spec) as Promise< + coreHttp.RestResponse + >; + const initialOperationResult = await sendOperation( + args, + deleteSqlStoredProcedureOperationSpec + ); + + return new LROPoller({ + initialOperationArguments: args, + initialOperationSpec: deleteSqlStoredProcedureOperationSpec, + initialOperationResult, + sendOperation + }); + } + + /** + * Lists the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param options The options parameters. + */ + listSqlUserDefinedFunctions( + resourceGroupName: string, + accountName: string, + databaseName: string, + containerName: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { + resourceGroupName, + accountName, + databaseName, + containerName, + options: operationOptions + }, + listSqlUserDefinedFunctionsOperationSpec + ) as Promise; + } + + /** + * Gets the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param options The options parameters. + */ + getSqlUserDefinedFunction( + resourceGroupName: string, + accountName: string, + databaseName: string, + containerName: string, + userDefinedFunctionName: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { + resourceGroupName, + accountName, + databaseName, + containerName, + userDefinedFunctionName, + options: operationOptions + }, + getSqlUserDefinedFunctionOperationSpec + ) as Promise; + } + + /** + * Create or update an Azure Cosmos DB SQL userDefinedFunction + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param createUpdateSqlUserDefinedFunctionParameters The parameters to provide for the current SQL + * userDefinedFunction. + * @param options The options parameters. + */ + async createUpdateSqlUserDefinedFunction( + resourceGroupName: string, + accountName: string, + databaseName: string, + containerName: string, + userDefinedFunctionName: string, + createUpdateSqlUserDefinedFunctionParameters: SqlUserDefinedFunctionCreateUpdateParameters, + options?: coreHttp.OperationOptions + ): Promise< + LROPoller + > { + const operationOptions: coreHttp.RequestOptionsBase = this.getOperationOptions( + options + ); + + const args: coreHttp.OperationArguments = { + resourceGroupName, + accountName, + databaseName, + containerName, + userDefinedFunctionName, + createUpdateSqlUserDefinedFunctionParameters, + options: operationOptions + }; + const sendOperation = ( + args: coreHttp.OperationArguments, + spec: coreHttp.OperationSpec + ) => + this.client.sendOperationRequest(args, spec) as Promise< + SqlResourcesCreateUpdateSqlUserDefinedFunctionResponse + >; + const initialOperationResult = await sendOperation( + args, + createUpdateSqlUserDefinedFunctionOperationSpec + ); + + return new LROPoller({ + initialOperationArguments: args, + initialOperationSpec: createUpdateSqlUserDefinedFunctionOperationSpec, + initialOperationResult, + sendOperation + }); + } + + /** + * Deletes an existing Azure Cosmos DB SQL userDefinedFunction. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param options The options parameters. + */ + async deleteSqlUserDefinedFunction( + resourceGroupName: string, + accountName: string, + databaseName: string, + containerName: string, + userDefinedFunctionName: string, + options?: coreHttp.OperationOptions + ): Promise> { + const operationOptions: coreHttp.RequestOptionsBase = this.getOperationOptions( + options + ); + + const args: coreHttp.OperationArguments = { + resourceGroupName, + accountName, + databaseName, + containerName, + userDefinedFunctionName, + options: operationOptions + }; + const sendOperation = ( + args: coreHttp.OperationArguments, + spec: coreHttp.OperationSpec + ) => + this.client.sendOperationRequest(args, spec) as Promise< + coreHttp.RestResponse + >; + const initialOperationResult = await sendOperation( + args, + deleteSqlUserDefinedFunctionOperationSpec + ); + + return new LROPoller({ + initialOperationArguments: args, + initialOperationSpec: deleteSqlUserDefinedFunctionOperationSpec, + initialOperationResult, + sendOperation + }); + } + + /** + * Lists the SQL trigger under an existing Azure Cosmos DB database account. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param options The options parameters. + */ + listSqlTriggers( + resourceGroupName: string, + accountName: string, + databaseName: string, + containerName: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { + resourceGroupName, + accountName, + databaseName, + containerName, + options: operationOptions + }, + listSqlTriggersOperationSpec + ) as Promise; + } + + /** + * Gets the SQL trigger under an existing Azure Cosmos DB database account. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger name. + * @param options The options parameters. + */ + getSqlTrigger( + resourceGroupName: string, + accountName: string, + databaseName: string, + containerName: string, + triggerName: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { + resourceGroupName, + accountName, + databaseName, + containerName, + triggerName, + options: operationOptions + }, + getSqlTriggerOperationSpec + ) as Promise; + } + + /** + * Create or update an Azure Cosmos DB SQL trigger + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger name. + * @param createUpdateSqlTriggerParameters The parameters to provide for the current SQL trigger. + * @param options The options parameters. + */ + async createUpdateSqlTrigger( + resourceGroupName: string, + accountName: string, + databaseName: string, + containerName: string, + triggerName: string, + createUpdateSqlTriggerParameters: SqlTriggerCreateUpdateParameters, + options?: coreHttp.OperationOptions + ): Promise> { + const operationOptions: coreHttp.RequestOptionsBase = this.getOperationOptions( + options + ); + + const args: coreHttp.OperationArguments = { + resourceGroupName, + accountName, + databaseName, + containerName, + triggerName, + createUpdateSqlTriggerParameters, + options: operationOptions + }; + const sendOperation = ( + args: coreHttp.OperationArguments, + spec: coreHttp.OperationSpec + ) => + this.client.sendOperationRequest(args, spec) as Promise< + SqlResourcesCreateUpdateSqlTriggerResponse + >; + const initialOperationResult = await sendOperation( + args, + createUpdateSqlTriggerOperationSpec + ); + + return new LROPoller({ + initialOperationArguments: args, + initialOperationSpec: createUpdateSqlTriggerOperationSpec, + initialOperationResult, + sendOperation + }); + } + + /** + * Deletes an existing Azure Cosmos DB SQL trigger. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger name. + * @param options The options parameters. + */ + async deleteSqlTrigger( + resourceGroupName: string, + accountName: string, + databaseName: string, + containerName: string, + triggerName: string, + options?: coreHttp.OperationOptions + ): Promise> { + const operationOptions: coreHttp.RequestOptionsBase = this.getOperationOptions( + options + ); + + const args: coreHttp.OperationArguments = { + resourceGroupName, + accountName, + databaseName, + containerName, + triggerName, + options: operationOptions + }; + const sendOperation = ( + args: coreHttp.OperationArguments, + spec: coreHttp.OperationSpec + ) => + this.client.sendOperationRequest(args, spec) as Promise< + coreHttp.RestResponse + >; + const initialOperationResult = await sendOperation( + args, + deleteSqlTriggerOperationSpec + ); + + return new LROPoller({ + initialOperationArguments: args, + initialOperationSpec: deleteSqlTriggerOperationSpec, + initialOperationResult, + sendOperation + }); + } + + private getOperationOptions( + options: TOptions | undefined, + finalStateVia?: string + ): coreHttp.RequestOptionsBase { + const operationOptions: coreHttp.OperationOptions = options || {}; + operationOptions.requestOptions = { + ...operationOptions.requestOptions, + shouldDeserialize: shouldDeserializeLRO(finalStateVia) + }; + return coreHttp.operationOptionsToRequestOptionsBase(operationOptions); + } +} +// Operation Specifications + +const serializer = new coreHttp.Serializer(Mappers, /* isXml */ false); + +const listSqlDatabasesOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.SqlDatabaseListResult + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName + ], + serializer +}; +const getSqlDatabaseOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.SqlDatabaseGetResults + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.databaseName + ], + serializer +}; +const createUpdateSqlDatabaseOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.SqlDatabaseGetResults + }, + 201: { + bodyMapper: Mappers.SqlDatabaseGetResults + }, + 202: { + bodyMapper: Mappers.SqlDatabaseGetResults + }, + 204: { + bodyMapper: Mappers.SqlDatabaseGetResults + } + }, + requestBody: Parameters.createUpdateSqlDatabaseParameters, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.databaseName + ], + headerParameters: [Parameters.contentType], + serializer +}; +const deleteSqlDatabaseOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}", + httpMethod: "DELETE", + responses: { 200: {}, 201: {}, 202: {}, 204: {} }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.databaseName + ], + serializer +}; +const getSqlDatabaseThroughputOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ThroughputSettingsGetResults + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.databaseName + ], + serializer +}; +const updateSqlDatabaseThroughputOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.ThroughputSettingsGetResults + }, + 201: { + bodyMapper: Mappers.ThroughputSettingsGetResults + }, + 202: { + bodyMapper: Mappers.ThroughputSettingsGetResults + }, + 204: { + bodyMapper: Mappers.ThroughputSettingsGetResults + } + }, + requestBody: Parameters.updateThroughputParameters, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.databaseName + ], + headerParameters: [Parameters.contentType], + serializer +}; +const listSqlContainersOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.SqlContainerListResult + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.databaseName + ], + serializer +}; +const getSqlContainerOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.SqlContainerGetResults + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.databaseName, + Parameters.containerName + ], + serializer +}; +const createUpdateSqlContainerOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.SqlContainerGetResults + }, + 201: { + bodyMapper: Mappers.SqlContainerGetResults + }, + 202: { + bodyMapper: Mappers.SqlContainerGetResults + }, + 204: { + bodyMapper: Mappers.SqlContainerGetResults + } + }, + requestBody: Parameters.createUpdateSqlContainerParameters, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.databaseName, + Parameters.containerName + ], + headerParameters: [Parameters.contentType], + serializer +}; +const deleteSqlContainerOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}", + httpMethod: "DELETE", + responses: { 200: {}, 201: {}, 202: {}, 204: {} }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.databaseName, + Parameters.containerName + ], + serializer +}; +const getSqlContainerThroughputOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ThroughputSettingsGetResults + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.databaseName, + Parameters.containerName + ], + serializer +}; +const updateSqlContainerThroughputOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.ThroughputSettingsGetResults + }, + 201: { + bodyMapper: Mappers.ThroughputSettingsGetResults + }, + 202: { + bodyMapper: Mappers.ThroughputSettingsGetResults + }, + 204: { + bodyMapper: Mappers.ThroughputSettingsGetResults + } + }, + requestBody: Parameters.updateThroughputParameters1, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.databaseName, + Parameters.containerName + ], + headerParameters: [Parameters.contentType], + serializer +}; +const listSqlStoredProceduresOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.SqlStoredProcedureListResult + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.databaseName, + Parameters.containerName + ], + serializer +}; +const getSqlStoredProcedureOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.SqlStoredProcedureGetResults + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.databaseName, + Parameters.containerName, + Parameters.storedProcedureName + ], + serializer +}; +const createUpdateSqlStoredProcedureOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.SqlStoredProcedureGetResults + }, + 201: { + bodyMapper: Mappers.SqlStoredProcedureGetResults + }, + 202: { + bodyMapper: Mappers.SqlStoredProcedureGetResults + }, + 204: { + bodyMapper: Mappers.SqlStoredProcedureGetResults + } + }, + requestBody: Parameters.createUpdateSqlStoredProcedureParameters, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.databaseName, + Parameters.containerName, + Parameters.storedProcedureName + ], + headerParameters: [Parameters.contentType], + serializer +}; +const deleteSqlStoredProcedureOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}", + httpMethod: "DELETE", + responses: { 200: {}, 201: {}, 202: {}, 204: {} }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.databaseName, + Parameters.containerName, + Parameters.storedProcedureName + ], + serializer +}; +const listSqlUserDefinedFunctionsOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.SqlUserDefinedFunctionListResult + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.databaseName, + Parameters.containerName + ], + serializer +}; +const getSqlUserDefinedFunctionOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.SqlUserDefinedFunctionGetResults + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.databaseName, + Parameters.containerName, + Parameters.userDefinedFunctionName + ], + serializer +}; +const createUpdateSqlUserDefinedFunctionOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.SqlUserDefinedFunctionGetResults + }, + 201: { + bodyMapper: Mappers.SqlUserDefinedFunctionGetResults + }, + 202: { + bodyMapper: Mappers.SqlUserDefinedFunctionGetResults + }, + 204: { + bodyMapper: Mappers.SqlUserDefinedFunctionGetResults + } + }, + requestBody: Parameters.createUpdateSqlUserDefinedFunctionParameters, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.databaseName, + Parameters.containerName, + Parameters.userDefinedFunctionName + ], + headerParameters: [Parameters.contentType], + serializer +}; +const deleteSqlUserDefinedFunctionOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}", + httpMethod: "DELETE", + responses: { 200: {}, 201: {}, 202: {}, 204: {} }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.databaseName, + Parameters.containerName, + Parameters.userDefinedFunctionName + ], + serializer +}; +const listSqlTriggersOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.SqlTriggerListResult + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.databaseName, + Parameters.containerName + ], + serializer +}; +const getSqlTriggerOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.SqlTriggerGetResults + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.databaseName, + Parameters.containerName, + Parameters.triggerName + ], + serializer +}; +const createUpdateSqlTriggerOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.SqlTriggerGetResults + }, + 201: { + bodyMapper: Mappers.SqlTriggerGetResults + }, + 202: { + bodyMapper: Mappers.SqlTriggerGetResults + }, + 204: { + bodyMapper: Mappers.SqlTriggerGetResults + } + }, + requestBody: Parameters.createUpdateSqlTriggerParameters, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.databaseName, + Parameters.containerName, + Parameters.triggerName + ], + headerParameters: [Parameters.contentType], + serializer +}; +const deleteSqlTriggerOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}", + httpMethod: "DELETE", + responses: { 200: {}, 201: {}, 202: {}, 204: {} }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.databaseName, + Parameters.containerName, + Parameters.triggerName + ], + serializer +}; diff --git a/test/smoke/generated/cosmos-db-resource-manager/src/operations/tableResources.ts b/test/smoke/generated/cosmos-db-resource-manager/src/operations/tableResources.ts new file mode 100644 index 0000000000..dc3682dddb --- /dev/null +++ b/test/smoke/generated/cosmos-db-resource-manager/src/operations/tableResources.ts @@ -0,0 +1,385 @@ +/* + * 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 * as coreHttp from "@azure/core-http"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { CosmosDBManagementClient } from "../cosmosDBManagementClient"; +import { LROPoller, shouldDeserializeLRO } from "../lro"; +import { + TableResourcesListTablesResponse, + TableResourcesGetTableResponse, + TableCreateUpdateParameters, + TableResourcesCreateUpdateTableResponse, + TableResourcesGetTableThroughputResponse, + ThroughputSettingsUpdateParameters, + TableResourcesUpdateTableThroughputResponse +} from "../models"; + +/** + * Class representing a TableResources. + */ +export class TableResources { + private readonly client: CosmosDBManagementClient; + + /** + * Initialize a new instance of the class TableResources class. + * @param client Reference to the service client + */ + constructor(client: CosmosDBManagementClient) { + this.client = client; + } + + /** + * Lists the Tables under an existing Azure Cosmos DB database account. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param options The options parameters. + */ + listTables( + resourceGroupName: string, + accountName: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { resourceGroupName, accountName, options: operationOptions }, + listTablesOperationSpec + ) as Promise; + } + + /** + * Gets the Tables under an existing Azure Cosmos DB database account with the provided name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param options The options parameters. + */ + getTable( + resourceGroupName: string, + accountName: string, + tableName: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { resourceGroupName, accountName, tableName, options: operationOptions }, + getTableOperationSpec + ) as Promise; + } + + /** + * Create or update an Azure Cosmos DB Table + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param createUpdateTableParameters The parameters to provide for the current Table. + * @param options The options parameters. + */ + async createUpdateTable( + resourceGroupName: string, + accountName: string, + tableName: string, + createUpdateTableParameters: TableCreateUpdateParameters, + options?: coreHttp.OperationOptions + ): Promise> { + const operationOptions: coreHttp.RequestOptionsBase = this.getOperationOptions( + options + ); + + const args: coreHttp.OperationArguments = { + resourceGroupName, + accountName, + tableName, + createUpdateTableParameters, + options: operationOptions + }; + const sendOperation = ( + args: coreHttp.OperationArguments, + spec: coreHttp.OperationSpec + ) => + this.client.sendOperationRequest(args, spec) as Promise< + TableResourcesCreateUpdateTableResponse + >; + const initialOperationResult = await sendOperation( + args, + createUpdateTableOperationSpec + ); + + return new LROPoller({ + initialOperationArguments: args, + initialOperationSpec: createUpdateTableOperationSpec, + initialOperationResult, + sendOperation + }); + } + + /** + * Deletes an existing Azure Cosmos DB Table. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param options The options parameters. + */ + async deleteTable( + resourceGroupName: string, + accountName: string, + tableName: string, + options?: coreHttp.OperationOptions + ): Promise> { + const operationOptions: coreHttp.RequestOptionsBase = this.getOperationOptions( + options + ); + + const args: coreHttp.OperationArguments = { + resourceGroupName, + accountName, + tableName, + options: operationOptions + }; + const sendOperation = ( + args: coreHttp.OperationArguments, + spec: coreHttp.OperationSpec + ) => + this.client.sendOperationRequest(args, spec) as Promise< + coreHttp.RestResponse + >; + const initialOperationResult = await sendOperation( + args, + deleteTableOperationSpec + ); + + return new LROPoller({ + initialOperationArguments: args, + initialOperationSpec: deleteTableOperationSpec, + initialOperationResult, + sendOperation + }); + } + + /** + * Gets the RUs per second of the Table under an existing Azure Cosmos DB database account with the + * provided name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param options The options parameters. + */ + getTableThroughput( + resourceGroupName: string, + accountName: string, + tableName: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { resourceGroupName, accountName, tableName, options: operationOptions }, + getTableThroughputOperationSpec + ) as Promise; + } + + /** + * Update RUs per second of an Azure Cosmos DB Table + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current + * Table. + * @param options The options parameters. + */ + async updateTableThroughput( + resourceGroupName: string, + accountName: string, + tableName: string, + updateThroughputParameters: ThroughputSettingsUpdateParameters, + options?: coreHttp.OperationOptions + ): Promise> { + const operationOptions: coreHttp.RequestOptionsBase = this.getOperationOptions( + options + ); + + const args: coreHttp.OperationArguments = { + resourceGroupName, + accountName, + tableName, + updateThroughputParameters, + options: operationOptions + }; + const sendOperation = ( + args: coreHttp.OperationArguments, + spec: coreHttp.OperationSpec + ) => + this.client.sendOperationRequest(args, spec) as Promise< + TableResourcesUpdateTableThroughputResponse + >; + const initialOperationResult = await sendOperation( + args, + updateTableThroughputOperationSpec + ); + + return new LROPoller({ + initialOperationArguments: args, + initialOperationSpec: updateTableThroughputOperationSpec, + initialOperationResult, + sendOperation + }); + } + + private getOperationOptions( + options: TOptions | undefined, + finalStateVia?: string + ): coreHttp.RequestOptionsBase { + const operationOptions: coreHttp.OperationOptions = options || {}; + operationOptions.requestOptions = { + ...operationOptions.requestOptions, + shouldDeserialize: shouldDeserializeLRO(finalStateVia) + }; + return coreHttp.operationOptionsToRequestOptionsBase(operationOptions); + } +} +// Operation Specifications + +const serializer = new coreHttp.Serializer(Mappers, /* isXml */ false); + +const listTablesOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.TableListResult + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName + ], + serializer +}; +const getTableOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.TableGetResults + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.tableName + ], + serializer +}; +const createUpdateTableOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.TableGetResults + }, + 201: { + bodyMapper: Mappers.TableGetResults + }, + 202: { + bodyMapper: Mappers.TableGetResults + }, + 204: { + bodyMapper: Mappers.TableGetResults + } + }, + requestBody: Parameters.createUpdateTableParameters, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.tableName + ], + headerParameters: [Parameters.contentType], + serializer +}; +const deleteTableOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}", + httpMethod: "DELETE", + responses: { 200: {}, 201: {}, 202: {}, 204: {} }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.tableName + ], + serializer +}; +const getTableThroughputOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ThroughputSettingsGetResults + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.tableName + ], + serializer +}; +const updateTableThroughputOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.ThroughputSettingsGetResults + }, + 201: { + bodyMapper: Mappers.ThroughputSettingsGetResults + }, + 202: { + bodyMapper: Mappers.ThroughputSettingsGetResults + }, + 204: { + bodyMapper: Mappers.ThroughputSettingsGetResults + } + }, + requestBody: Parameters.updateThroughputParameters4, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.tableName + ], + headerParameters: [Parameters.contentType], + serializer +}; diff --git a/test/smoke/generated/cosmos-db-resource-manager/tsconfig.json b/test/smoke/generated/cosmos-db-resource-manager/tsconfig.json new file mode 100644 index 0000000000..422b584abd --- /dev/null +++ b/test/smoke/generated/cosmos-db-resource-manager/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "es6", + "moduleResolution": "node", + "strict": true, + "target": "es5", + "sourceMap": true, + "declarationMap": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "forceConsistentCasingInFileNames": true, + "lib": ["es6", "dom"], + "declaration": true, + "outDir": "./esm", + "importHelpers": true + }, + "include": ["./src/**/*.ts"], + "exclude": ["node_modules"] +} diff --git a/test/smoke/generated/graphrbac-data-plane/LICENSE.txt b/test/smoke/generated/graphrbac-data-plane/LICENSE.txt new file mode 100644 index 0000000000..4c529f375c --- /dev/null +++ b/test/smoke/generated/graphrbac-data-plane/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2020 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/test/smoke/generated/graphrbac-data-plane/README.md b/test/smoke/generated/graphrbac-data-plane/README.md new file mode 100644 index 0000000000..52b8c8718c --- /dev/null +++ b/test/smoke/generated/graphrbac-data-plane/README.md @@ -0,0 +1,27 @@ +## Azure GraphRbacManagementClient SDK for JavaScript + +This package contains an isomorphic SDK for GraphRbacManagementClient. + +### Currently supported environments + +- Node.js version 8.x.x or higher +- Browser JavaScript + +### How to Install + +```bash +npm install graphrbac-data-plane +``` + +### How to use + +#### Sample code + +Refer the sample code in the [azure-sdk-for-js-samples](https://github.com/Azure/azure-sdk-for-js-samples) repository. + +## Related projects + +- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js) + + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fcdn%2Farm-cdn%2FREADME.png) \ No newline at end of file diff --git a/test/smoke/generated/graphrbac-data-plane/package.json b/test/smoke/generated/graphrbac-data-plane/package.json new file mode 100644 index 0000000000..39988059f9 --- /dev/null +++ b/test/smoke/generated/graphrbac-data-plane/package.json @@ -0,0 +1,57 @@ +{ + "name": "graphrbac-data-plane", + "author": "Microsoft Corporation", + "description": "The Graph RBAC Management Client", + "version": "1.0.0", + "dependencies": { + "@azure/core-http": "^1.1.1", + "tslib": "^1.9.3" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], + "license": "MIT", + "main": "./dist/graphrbac-data-plane.js", + "module": "./esm/graphRbacManagementClient.js", + "types": "./esm/graphRbacManagementClient.d.ts", + "devDependencies": { + "typescript": "^3.1.1", + "rollup": "^0.66.2", + "rollup-plugin-node-resolve": "^3.4.0", + "rollup-plugin-sourcemaps": "^0.4.2", + "uglify-js": "^3.4.9" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js", + "repository": { + "type": "git", + "url": "https://github.com/Azure/azure-sdk-for-js.git" + }, + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "files": [ + "dist/**/*.js", + "dist/**/*.js.map", + "dist/**/*.d.ts", + "dist/**/*.d.ts.map", + "esm/**/*.js", + "esm/**/*.js.map", + "esm/**/*.d.ts", + "esm/**/*.d.ts.map", + "src/**/*.ts", + "README.md", + "rollup.config.js", + "tsconfig.json" + ], + "scripts": { + "build": "tsc && rollup -c rollup.config.js && npm run minify", + "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/graphrbac-data-plane.js.map'\" -o ./dist/graphrbac-data-plane.min.js ./dist/graphrbac-data-plane.js", + "prepack": "npm install && npm run build" + }, + "sideEffects": false, + "autoPublish": true +} diff --git a/test/smoke/generated/graphrbac-data-plane/rollup.config.js b/test/smoke/generated/graphrbac-data-plane/rollup.config.js new file mode 100644 index 0000000000..ef47b21a27 --- /dev/null +++ b/test/smoke/generated/graphrbac-data-plane/rollup.config.js @@ -0,0 +1,39 @@ +/* + * 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 rollup from "rollup"; +import nodeResolve from "rollup-plugin-node-resolve"; +import sourcemaps from "rollup-plugin-sourcemaps"; + +/** + * @type {rollup.RollupFileOptions} + */ +const config = { + input: "./esm/graphRbacManagementClient.js", + external: ["@azure/core-http", "@azure/core-arm"], + output: { + file: "./dist/graphrbac-data-plane.js", + format: "umd", + name: "GraphrbacDataPlane", + sourcemap: true, + globals: { + "@azure/core-http": "coreHttp", + "@azure/core-arm": "coreArm" + }, + banner: `/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ ` + }, + plugins: [nodeResolve({ module: true }), sourcemaps()] +}; + +export default config; diff --git a/test/smoke/generated/graphrbac-data-plane/src/graphRbacManagementClient.ts b/test/smoke/generated/graphrbac-data-plane/src/graphRbacManagementClient.ts new file mode 100644 index 0000000000..4da61887d5 --- /dev/null +++ b/test/smoke/generated/graphrbac-data-plane/src/graphRbacManagementClient.ts @@ -0,0 +1,58 @@ +/* + * 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 * as coreHttp from "@azure/core-http"; +import * as operations from "./operations"; +import * as Models from "./models"; +import * as Mappers from "./models/mappers"; +import { GraphRbacManagementClientContext } from "./graphRbacManagementClientContext"; + +class GraphRbacManagementClient extends GraphRbacManagementClientContext { + /** + * Initializes a new instance of the GraphRbacManagementClient class. + * @param credentials Subscription credentials which uniquely identify client subscription. + * @param tenantID The tenant ID. + * @param options The parameter options + */ + constructor( + credentials: coreHttp.TokenCredential | coreHttp.ServiceClientCredentials, + tenantID: string, + options?: Models.GraphRbacManagementClientOptionalParams + ) { + super(credentials, tenantID, options); + this.signedInUser = new operations.SignedInUser(this); + this.applications = new operations.Applications(this); + this.deletedApplications = new operations.DeletedApplications(this); + this.groups = new operations.Groups(this); + this.servicePrincipals = new operations.ServicePrincipals(this); + this.users = new operations.Users(this); + this.objects = new operations.Objects(this); + this.domains = new operations.Domains(this); + this.oAuth2PermissionGrant = new operations.OAuth2PermissionGrant(this); + } + + signedInUser: operations.SignedInUser; + applications: operations.Applications; + deletedApplications: operations.DeletedApplications; + groups: operations.Groups; + servicePrincipals: operations.ServicePrincipals; + users: operations.Users; + objects: operations.Objects; + domains: operations.Domains; + oAuth2PermissionGrant: operations.OAuth2PermissionGrant; +} + +// Operation Specifications + +export { + GraphRbacManagementClient, + GraphRbacManagementClientContext, + Models as GraphRbacManagementModels, + Mappers as GraphRbacManagementMappers +}; +export * from "./operations"; diff --git a/test/smoke/generated/graphrbac-data-plane/src/graphRbacManagementClientContext.ts b/test/smoke/generated/graphrbac-data-plane/src/graphRbacManagementClientContext.ts new file mode 100644 index 0000000000..fb646e49a5 --- /dev/null +++ b/test/smoke/generated/graphrbac-data-plane/src/graphRbacManagementClientContext.ts @@ -0,0 +1,61 @@ +/* + * 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 * as coreHttp from "@azure/core-http"; +import * as Models from "./models"; + +const packageName = "graphrbac-data-plane"; +const packageVersion = "1.0.0"; + +export class GraphRbacManagementClientContext extends coreHttp.ServiceClient { + $host: string; + apiVersion: string; + tenantID: string; + + /** + * Initializes a new instance of the GraphRbacManagementClientContext class. + * @param credentials Subscription credentials which uniquely identify client subscription. + * @param tenantID The tenant ID. + * @param options The parameter options + */ + constructor( + credentials: coreHttp.TokenCredential | coreHttp.ServiceClientCredentials, + tenantID: string, + options?: Models.GraphRbacManagementClientOptionalParams + ) { + if (credentials === undefined) { + throw new Error("'credentials' cannot be null"); + } + if (tenantID === undefined) { + throw new Error("'tenantID' cannot be null"); + } + + // Initializing default values for options + if (!options) { + options = {}; + } + + if (!options.userAgent) { + const defaultUserAgent = coreHttp.getDefaultUserAgentValue(); + options.userAgent = `${packageName}/${packageVersion} ${defaultUserAgent}`; + } + + super(credentials, options); + + this.requestContentType = "application/json; charset=utf-8"; + + this.baseUri = options.endpoint || "{$host}"; + + // Parameter assignments + this.tenantID = tenantID; + + // Assigning values to Constant parameters + this.$host = options.$host || "https://graph.windows.net"; + this.apiVersion = options.apiVersion || "1.6"; + } +} diff --git a/test/smoke/generated/graphrbac-data-plane/src/models/index.ts b/test/smoke/generated/graphrbac-data-plane/src/models/index.ts new file mode 100644 index 0000000000..d3bb77bfb2 --- /dev/null +++ b/test/smoke/generated/graphrbac-data-plane/src/models/index.ts @@ -0,0 +1,2325 @@ +/* + * 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 * as coreHttp from "@azure/core-http"; + +export type DirectoryObjectUnion = + | DirectoryObject + | User + | Application + | ADGroup + | ServicePrincipal; + +/** + * Represents an Azure Active Directory object. + */ +export interface DirectoryObject { + /** + * Polymorphic discriminator, which specifies the different types this object can be + */ + objectType: "User" | "Application" | "Group" | "ServicePrincipal"; + /** + * Describes unknown properties. The value of an unknown property can be of "any" type. + */ + [property: string]: any; + /** + * The object ID. + */ + readonly objectId?: string; + /** + * The time at which the directory object was deleted. + */ + readonly deletionTimestamp?: Date; +} + +/** + * Active Directory user information. + */ +export type User = DirectoryObject & { + /** + * This must be specified if you are using a federated domain for the user's userPrincipalName (UPN) property when creating a new user account. It is used to associate an on-premises Active Directory user account with their Azure AD user object. + */ + immutableId?: string; + /** + * A two letter country code (ISO standard 3166). Required for users that will be assigned licenses due to legal requirement to check for availability of services in countries. Examples include: "US", "JP", and "GB". + */ + usageLocation?: string; + /** + * The given name for the user. + */ + givenName?: string; + /** + * The user's surname (family name or last name). + */ + surname?: string; + /** + * A string value that can be used to classify user types in your directory, such as 'Member' and 'Guest'. + */ + userType?: UserType; + /** + * Whether the account is enabled. + */ + accountEnabled?: boolean; + /** + * The display name of the user. + */ + displayName?: string; + /** + * The principal name of the user. + */ + userPrincipalName?: string; + /** + * The mail alias for the user. + */ + mailNickname?: string; + /** + * The primary email address of the user. + */ + mail?: string; + /** + * The sign-in names of the user. + */ + signInNames?: SignInName[]; +}; + +/** + * Contains information about a sign-in name of a local account user in an Azure Active Directory B2C tenant. + */ +export interface SignInName { + /** + * Describes unknown properties. The value of an unknown property can be of "any" type. + */ + [property: string]: any; + /** + * A string value that can be used to classify user sign-in types in your directory, such as 'emailAddress' or 'userName'. + */ + type?: string; + /** + * The sign-in used by the local account. Must be unique across the company/tenant. For example, 'johnc@example.com'. + */ + value?: string; +} + +/** + * Active Directory error information. + */ +export interface GraphError { + /** + * Error code. + */ + code?: string; + /** + * Error message value. + */ + message?: string; +} + +/** + * DirectoryObject list operation result. + */ +export interface DirectoryObjectListResult { + /** + * A collection of DirectoryObject. + */ + value?: DirectoryObjectUnion[]; + /** + * The URL to get the next set of results. + */ + odataNextLink?: string; +} + +/** + * Active Directive Application common properties shared among GET, POST and PATCH + */ +export interface ApplicationBase { + /** + * A property on the application to indicate if the application accepts other IDPs or not or partially accepts. + */ + allowGuestsSignIn?: boolean; + /** + * Indicates that the application supports pass through users who have no presence in the resource tenant. + */ + allowPassthroughUsers?: boolean; + /** + * The url for the application logo image stored in a CDN. + */ + appLogoUrl?: string; + /** + * The collection of application roles that an application may declare. These roles can be assigned to users, groups or service principals. + */ + appRoles?: AppRole[]; + /** + * The application permissions. + */ + appPermissions?: string[]; + /** + * Whether the application is available to other tenants. + */ + availableToOtherTenants?: boolean; + /** + * A URL provided by the author of the application to report errors when using the application. + */ + errorUrl?: string; + /** + * Configures the groups claim issued in a user or OAuth 2.0 access token that the app expects. + */ + groupMembershipClaims?: GroupMembershipClaimTypes; + /** + * The home page of the application. + */ + homepage?: string; + /** + * URLs with more information about the application. + */ + informationalUrls?: InformationalUrl; + /** + * Specifies whether this application supports device authentication without a user. The default is false. + */ + isDeviceOnlyAuthSupported?: boolean; + /** + * A collection of KeyCredential objects. + */ + keyCredentials?: KeyCredential[]; + /** + * Client applications that are tied to this resource application. Consent to any of the known client applications will result in implicit consent to the resource application through a combined consent dialog (showing the OAuth permission scopes required by the client and the resource). + */ + knownClientApplications?: string[]; + /** + * the url of the logout page + */ + logoutUrl?: string; + /** + * Whether to allow implicit grant flow for OAuth2 + */ + oauth2AllowImplicitFlow?: boolean; + /** + * Specifies whether during a token Request Azure AD will allow path matching of the redirect URI against the applications collection of replyURLs. The default is false. + */ + oauth2AllowUrlPathMatching?: boolean; + /** + * The collection of OAuth 2.0 permission scopes that the web API (resource) application exposes to client applications. These permission scopes may be granted to client applications during consent. + */ + oauth2Permissions?: OAuth2Permission[]; + /** + * Specifies whether, as part of OAuth 2.0 token requests, Azure AD will allow POST requests, as opposed to GET requests. The default is false, which specifies that only GET requests will be allowed. + */ + oauth2RequirePostResponse?: boolean; + /** + * A list of tenants allowed to access application. + */ + orgRestrictions?: string[]; + /** + * Specifying the claims to be included in the token. + */ + optionalClaims?: OptionalClaims; + /** + * A collection of PasswordCredential objects + */ + passwordCredentials?: PasswordCredential[]; + /** + * list of pre-authorized applications. + */ + preAuthorizedApplications?: PreAuthorizedApplication[]; + /** + * Specifies whether this application is a public client (such as an installed application running on a mobile device). Default is false. + */ + publicClient?: boolean; + /** + * Reliable domain which can be used to identify an application. + */ + publisherDomain?: string; + /** + * A collection of reply URLs for the application. + */ + replyUrls?: string[]; + /** + * Specifies resources that this application requires access to and the set of OAuth permission scopes and application roles that it needs under each of those resources. This pre-configuration of required resource access drives the consent experience. + */ + requiredResourceAccess?: RequiredResourceAccess[]; + /** + * The URL to the SAML metadata for the application. + */ + samlMetadataUrl?: string; + /** + * Audience for signing in to the application (AzureADMyOrganization, AzureADAllOrganizations, AzureADAndMicrosoftAccounts). + */ + signInAudience?: string; + /** + * The primary Web page. + */ + wwwHomepage?: string; +} + +export interface AppRole { + /** + * Unique role identifier inside the appRoles collection. + */ + id?: string; + /** + * Specifies whether this app role definition can be assigned to users and groups by setting to 'User', or to other applications (that are accessing this application in daemon service scenarios) by setting to 'Application', or to both. + */ + allowedMemberTypes?: string[]; + /** + * Permission help text that appears in the admin app assignment and consent experiences. + */ + description?: string; + /** + * Display name for the permission that appears in the admin consent and app assignment experiences. + */ + displayName?: string; + /** + * When creating or updating a role definition, this must be set to true (which is the default). To delete a role, this must first be set to false. At that point, in a subsequent call, this role may be removed. + */ + isEnabled?: boolean; + /** + * Specifies the value of the roles claim that the application should expect in the authentication and access tokens. + */ + value?: string; +} + +/** + * Represents a group of URIs that provide terms of service, marketing, support and privacy policy information about an application. The default value for each string is null. + */ +export interface InformationalUrl { + /** + * The terms of service URI + */ + termsOfService?: string; + /** + * The marketing URI + */ + marketing?: string; + /** + * The privacy policy URI + */ + privacy?: string; + /** + * The support URI + */ + support?: string; +} + +/** + * Active Directory Key Credential information. + */ +export interface KeyCredential { + /** + * Describes unknown properties. The value of an unknown property can be of "any" type. + */ + [property: string]: any; + /** + * Start date. + */ + startDate?: Date; + /** + * End date. + */ + endDate?: Date; + /** + * Key value. + */ + value?: string; + /** + * Key ID. + */ + keyId?: string; + /** + * Usage. Acceptable values are 'Verify' and 'Sign'. + */ + usage?: string; + /** + * Type. Acceptable values are 'AsymmetricX509Cert' and 'Symmetric'. + */ + type?: string; + /** + * Custom Key Identifier + */ + customKeyIdentifier?: string; +} + +/** + * Represents an OAuth 2.0 delegated permission scope. The specified OAuth 2.0 delegated permission scopes may be requested by client applications (through the requiredResourceAccess collection on the Application object) when calling a resource application. The oauth2Permissions property of the ServicePrincipal entity and of the Application entity is a collection of OAuth2Permission. + */ +export interface OAuth2Permission { + /** + * Permission help text that appears in the admin consent and app assignment experiences. + */ + adminConsentDescription?: string; + /** + * Display name for the permission that appears in the admin consent and app assignment experiences. + */ + adminConsentDisplayName?: string; + /** + * Unique scope permission identifier inside the oauth2Permissions collection. + */ + id?: string; + /** + * When creating or updating a permission, this property must be set to true (which is the default). To delete a permission, this property must first be set to false. At that point, in a subsequent call, the permission may be removed. + */ + isEnabled?: boolean; + /** + * Specifies whether this scope permission can be consented to by an end user, or whether it is a tenant-wide permission that must be consented to by a Company Administrator. Possible values are "User" or "Admin". + */ + type?: string; + /** + * Permission help text that appears in the end user consent experience. + */ + userConsentDescription?: string; + /** + * Display name for the permission that appears in the end user consent experience. + */ + userConsentDisplayName?: string; + /** + * The value of the scope claim that the resource application should expect in the OAuth 2.0 access token. + */ + value?: string; +} + +/** + * Specifying the claims to be included in the token. + */ +export interface OptionalClaims { + /** + * Optional claims requested to be included in the id token. + */ + idToken?: OptionalClaim[]; + /** + * Optional claims requested to be included in the access token. + */ + accessToken?: OptionalClaim[]; + /** + * Optional claims requested to be included in the saml token. + */ + samlToken?: OptionalClaim[]; +} + +/** + * Specifying the claims to be included in a token. + */ +export interface OptionalClaim { + /** + * Claim name. + */ + name?: string; + /** + * Claim source. + */ + source?: string; + /** + * Is this a required claim. + */ + essential?: boolean; + /** + * Any object + */ + additionalProperties?: any; +} + +/** + * Active Directory Password Credential information. + */ +export interface PasswordCredential { + /** + * Describes unknown properties. The value of an unknown property can be of "any" type. + */ + [property: string]: any; + /** + * Start date. + */ + startDate?: Date; + /** + * End date. + */ + endDate?: Date; + /** + * Key ID. + */ + keyId?: string; + /** + * Key value. + */ + value?: string; + /** + * Custom Key Identifier + */ + customKeyIdentifier?: Uint8Array; +} + +/** + * Contains information about pre authorized client application. + */ +export interface PreAuthorizedApplication { + /** + * Represents the application id. + */ + appId?: string; + /** + * Collection of required app permissions/entitlements from the resource application. + */ + permissions?: PreAuthorizedApplicationPermission[]; + /** + * Collection of extensions from the resource application. + */ + extensions?: PreAuthorizedApplicationExtension[]; +} + +/** + * Contains information about the pre-authorized permissions. + */ +export interface PreAuthorizedApplicationPermission { + /** + * Indicates whether the permission set is DirectAccess or impersonation. + */ + directAccessGrant?: boolean; + /** + * The list of permissions. + */ + accessGrants?: string[]; +} + +/** + * Representation of an app PreAuthorizedApplicationExtension required by a pre authorized client app. + */ +export interface PreAuthorizedApplicationExtension { + /** + * The extension's conditions. + */ + conditions?: string[]; +} + +/** + * Specifies the set of OAuth 2.0 permission scopes and app roles under the specified resource that an application requires access to. The specified OAuth 2.0 permission scopes may be requested by client applications (through the requiredResourceAccess collection) when calling a resource application. The requiredResourceAccess property of the Application entity is a collection of RequiredResourceAccess. + */ +export interface RequiredResourceAccess { + /** + * Describes unknown properties. The value of an unknown property can be of "any" type. + */ + [property: string]: any; + /** + * The list of OAuth2.0 permission scopes and app roles that the application requires from the specified resource. + */ + resourceAccess: ResourceAccess[]; + /** + * The unique identifier for the resource that the application requires access to. This should be equal to the appId declared on the target resource application. + */ + resourceAppId?: string; +} + +/** + * Specifies an OAuth 2.0 permission scope or an app role that an application requires. The resourceAccess property of the RequiredResourceAccess type is a collection of ResourceAccess. + */ +export interface ResourceAccess { + /** + * Describes unknown properties. The value of an unknown property can be of "any" type. + */ + [property: string]: any; + /** + * The unique identifier for one of the OAuth2Permission or AppRole instances that the resource application exposes. + */ + id: string; + /** + * Specifies whether the id property references an OAuth2Permission or an AppRole. Possible values are "scope" or "role". + */ + type?: string; +} + +/** + * Request parameters for creating a new application. + */ +export type ApplicationCreateParameters = ApplicationBase & { + /** + * The display name of the application. + */ + displayName: string; + /** + * A collection of URIs for the application. + */ + identifierUris?: string[]; +}; + +/** + * Active Directory application information. + */ +export type Application = DirectoryObject & { + /** + * The application ID. + */ + appId?: string; + /** + * A property on the application to indicate if the application accepts other IDPs or not or partially accepts. + */ + allowGuestsSignIn?: boolean; + /** + * Indicates that the application supports pass through users who have no presence in the resource tenant. + */ + allowPassthroughUsers?: boolean; + /** + * The url for the application logo image stored in a CDN. + */ + appLogoUrl?: string; + /** + * The collection of application roles that an application may declare. These roles can be assigned to users, groups or service principals. + */ + appRoles?: AppRole[]; + /** + * The application permissions. + */ + appPermissions?: string[]; + /** + * Whether the application is available to other tenants. + */ + availableToOtherTenants?: boolean; + /** + * The display name of the application. + */ + displayName?: string; + /** + * A URL provided by the author of the application to report errors when using the application. + */ + errorUrl?: string; + /** + * Configures the groups claim issued in a user or OAuth 2.0 access token that the app expects. + */ + groupMembershipClaims?: GroupMembershipClaimTypes; + /** + * The home page of the application. + */ + homepage?: string; + /** + * A collection of URIs for the application. + */ + identifierUris?: string[]; + /** + * URLs with more information about the application. + */ + informationalUrls?: InformationalUrl; + /** + * Specifies whether this application supports device authentication without a user. The default is false. + */ + isDeviceOnlyAuthSupported?: boolean; + /** + * A collection of KeyCredential objects. + */ + keyCredentials?: KeyCredential[]; + /** + * Client applications that are tied to this resource application. Consent to any of the known client applications will result in implicit consent to the resource application through a combined consent dialog (showing the OAuth permission scopes required by the client and the resource). + */ + knownClientApplications?: string[]; + /** + * the url of the logout page + */ + logoutUrl?: string; + /** + * Whether to allow implicit grant flow for OAuth2 + */ + oauth2AllowImplicitFlow?: boolean; + /** + * Specifies whether during a token Request Azure AD will allow path matching of the redirect URI against the applications collection of replyURLs. The default is false. + */ + oauth2AllowUrlPathMatching?: boolean; + /** + * The collection of OAuth 2.0 permission scopes that the web API (resource) application exposes to client applications. These permission scopes may be granted to client applications during consent. + */ + oauth2Permissions?: OAuth2Permission[]; + /** + * Specifies whether, as part of OAuth 2.0 token requests, Azure AD will allow POST requests, as opposed to GET requests. The default is false, which specifies that only GET requests will be allowed. + */ + oauth2RequirePostResponse?: boolean; + /** + * A list of tenants allowed to access application. + */ + orgRestrictions?: string[]; + /** + * Specifying the claims to be included in the token. + */ + optionalClaims?: OptionalClaims; + /** + * A collection of PasswordCredential objects + */ + passwordCredentials?: PasswordCredential[]; + /** + * list of pre-authorized applications. + */ + preAuthorizedApplications?: PreAuthorizedApplication[]; + /** + * Specifies whether this application is a public client (such as an installed application running on a mobile device). Default is false. + */ + publicClient?: boolean; + /** + * Reliable domain which can be used to identify an application. + */ + publisherDomain?: string; + /** + * A collection of reply URLs for the application. + */ + replyUrls?: string[]; + /** + * Specifies resources that this application requires access to and the set of OAuth permission scopes and application roles that it needs under each of those resources. This pre-configuration of required resource access drives the consent experience. + */ + requiredResourceAccess?: RequiredResourceAccess[]; + /** + * The URL to the SAML metadata for the application. + */ + samlMetadataUrl?: string; + /** + * Audience for signing in to the application (AzureADMyOrganization, AzureADAllOrganizations, AzureADAndMicrosoftAccounts). + */ + signInAudience?: string; + /** + * The primary Web page. + */ + wwwHomepage?: string; +}; + +/** + * Application list operation result. + */ +export interface ApplicationListResult { + /** + * A collection of applications. + */ + value?: Application[]; + /** + * The URL to get the next set of results. + */ + odataNextLink?: string; +} + +/** + * Request parameters for updating a new application. + */ +export type ApplicationUpdateParameters = ApplicationBase & { + /** + * The display name of the application. + */ + displayName?: string; + /** + * A collection of URIs for the application. + */ + identifierUris?: string[]; +}; + +/** + * Request parameters for adding a owner to an application. + */ +export interface AddOwnerParameters { + /** + * Describes unknown properties. The value of an unknown property can be of "any" type. + */ + [property: string]: any; + /** + * A owner object URL, such as "https://graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd", where "0b1f9851-1bf0-433f-aec3-cb9272f093dc" is the tenantId and "f260bbc4-c254-447b-94cf-293b5ec434dd" is the objectId of the owner (user, application, servicePrincipal, group) to be added. + */ + url: string; +} + +/** + * KeyCredential list operation result. + */ +export interface KeyCredentialListResult { + /** + * A collection of KeyCredentials. + */ + value?: KeyCredential[]; +} + +/** + * Request parameters for a KeyCredentials update operation + */ +export interface KeyCredentialsUpdateParameters { + /** + * A collection of KeyCredentials. + */ + value: KeyCredential[]; +} + +/** + * PasswordCredential list operation result. + */ +export interface PasswordCredentialListResult { + /** + * A collection of PasswordCredentials. + */ + value?: PasswordCredential[]; +} + +/** + * Request parameters for a PasswordCredentials update operation. + */ +export interface PasswordCredentialsUpdateParameters { + /** + * A collection of PasswordCredentials. + */ + value: PasswordCredential[]; +} + +/** + * Request parameters for IsMemberOf API call. + */ +export interface CheckGroupMembershipParameters { + /** + * Describes unknown properties. The value of an unknown property can be of "any" type. + */ + [property: string]: any; + /** + * The object ID of the group to check. + */ + groupId: string; + /** + * The object ID of the contact, group, user, or service principal to check for membership in the specified group. + */ + memberId: string; +} + +/** + * Server response for IsMemberOf API call + */ +export interface CheckGroupMembershipResult { + /** + * Describes unknown properties. The value of an unknown property can be of "any" type. + */ + [property: string]: any; + /** + * True if the specified user, group, contact, or service principal has either direct or transitive membership in the specified group; otherwise, false. + */ + value?: boolean; +} + +/** + * Request parameters for adding a member to a group. + */ +export interface GroupAddMemberParameters { + /** + * Describes unknown properties. The value of an unknown property can be of "any" type. + */ + [property: string]: any; + /** + * A member object URL, such as "https://graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd", where "0b1f9851-1bf0-433f-aec3-cb9272f093dc" is the tenantId and "f260bbc4-c254-447b-94cf-293b5ec434dd" is the objectId of the member (user, application, servicePrincipal, group) to be added. + */ + url: string; +} + +/** + * Request parameters for creating a new group. + */ +export interface GroupCreateParameters { + /** + * Describes unknown properties. The value of an unknown property can be of "any" type. + */ + [property: string]: any; + /** + * Group display name + */ + displayName: string; + /** + * Whether the group is mail-enabled. Must be false. This is because only pure security groups can be created using the Graph API. + */ + mailEnabled: "undefined"; + /** + * Mail nickname + */ + mailNickname: string; + /** + * Whether the group is a security group. Must be true. This is because only pure security groups can be created using the Graph API. + */ + securityEnabled: "true"; +} + +/** + * Active Directory group information. + */ +export type ADGroup = DirectoryObject & { + /** + * The display name of the group. + */ + displayName?: string; + /** + * Whether the group is mail-enabled. Must be false. This is because only pure security groups can be created using the Graph API. + */ + mailEnabled?: boolean; + /** + * The mail alias for the group. + */ + mailNickname?: string; + /** + * Whether the group is security-enable. + */ + securityEnabled?: boolean; + /** + * The primary email address of the group. + */ + mail?: string; +}; + +/** + * Server response for Get tenant groups API call + */ +export interface GroupListResult { + /** + * A collection of Active Directory groups. + */ + value?: ADGroup[]; + /** + * The URL to get the next set of results. + */ + odataNextLink?: string; +} + +/** + * Request parameters for GetMemberGroups API call. + */ +export interface GroupGetMemberGroupsParameters { + /** + * Describes unknown properties. The value of an unknown property can be of "any" type. + */ + [property: string]: any; + /** + * If true, only membership in security-enabled groups should be checked. Otherwise, membership in all groups should be checked. + */ + securityEnabledOnly: boolean; +} + +/** + * Server response for GetMemberGroups API call. + */ +export interface GroupGetMemberGroupsResult { + /** + * A collection of group IDs of which the group is a member. + */ + value?: string[]; +} + +/** + * Active Directory service principal common properties shared among GET, POST and PATCH + */ +export interface ServicePrincipalBase { + /** + * whether or not the service principal account is enabled + */ + accountEnabled?: boolean; + /** + * Specifies whether an AppRoleAssignment to a user or group is required before Azure AD will issue a user or access token to the application. + */ + appRoleAssignmentRequired?: boolean; + /** + * The collection of key credentials associated with the service principal. + */ + keyCredentials?: KeyCredential[]; + /** + * The collection of password credentials associated with the service principal. + */ + passwordCredentials?: PasswordCredential[]; + /** + * the type of the service principal + */ + servicePrincipalType?: string; + /** + * Optional list of tags that you can apply to your service principals. Not nullable. + */ + tags?: string[]; +} + +/** + * Request parameters for creating a new service principal. + */ +export type ServicePrincipalCreateParameters = ServicePrincipalBase & { + /** + * The application ID. + */ + appId: string; +}; + +/** + * Active Directory service principal information. + */ +export type ServicePrincipal = DirectoryObject & { + /** + * whether or not the service principal account is enabled + */ + accountEnabled?: boolean; + /** + * alternative names + */ + alternativeNames?: string[]; + /** + * The display name exposed by the associated application. + */ + readonly appDisplayName?: string; + /** + * The application ID. + */ + appId?: string; + readonly appOwnerTenantId?: string; + /** + * Specifies whether an AppRoleAssignment to a user or group is required before Azure AD will issue a user or access token to the application. + */ + appRoleAssignmentRequired?: boolean; + /** + * The collection of application roles that an application may declare. These roles can be assigned to users, groups or service principals. + */ + appRoles?: AppRole[]; + /** + * The display name of the service principal. + */ + displayName?: string; + /** + * A URL provided by the author of the associated application to report errors when using the application. + */ + errorUrl?: string; + /** + * The URL to the homepage of the associated application. + */ + homepage?: string; + /** + * The collection of key credentials associated with the service principal. + */ + keyCredentials?: KeyCredential[]; + /** + * A URL provided by the author of the associated application to logout + */ + logoutUrl?: string; + /** + * The OAuth 2.0 permissions exposed by the associated application. + */ + readonly oauth2Permissions?: OAuth2Permission[]; + /** + * The collection of password credentials associated with the service principal. + */ + passwordCredentials?: PasswordCredential[]; + /** + * The thumbprint of preferred certificate to sign the token + */ + preferredTokenSigningKeyThumbprint?: string; + /** + * The publisher's name of the associated application + */ + publisherName?: string; + /** + * The URLs that user tokens are sent to for sign in with the associated application. The redirect URIs that the oAuth 2.0 authorization code and access tokens are sent to for the associated application. + */ + replyUrls?: string[]; + /** + * The URL to the SAML metadata of the associated application + */ + samlMetadataUrl?: string; + /** + * A collection of service principal names. + */ + servicePrincipalNames?: string[]; + /** + * the type of the service principal + */ + servicePrincipalType?: string; + /** + * Optional list of tags that you can apply to your service principals. Not nullable. + */ + tags?: string[]; +}; + +/** + * Server response for get tenant service principals API call. + */ +export interface ServicePrincipalListResult { + /** + * the list of service principals. + */ + value?: ServicePrincipal[]; + /** + * the URL to get the next set of results. + */ + odataNextLink?: string; +} + +/** + * Service Principal Object Result. + */ +export interface ServicePrincipalObjectResult { + /** + * The Object ID of the service principal with the specified application ID. + */ + value?: string; + /** + * The URL representing edm equivalent. + */ + odataMetadata?: string; +} + +export interface UserBase { + /** + * Describes unknown properties. The value of an unknown property can be of "any" type. + */ + [property: string]: any; + /** + * This must be specified if you are using a federated domain for the user's userPrincipalName (UPN) property when creating a new user account. It is used to associate an on-premises Active Directory user account with their Azure AD user object. + */ + immutableId?: string; + /** + * A two letter country code (ISO standard 3166). Required for users that will be assigned licenses due to legal requirement to check for availability of services in countries. Examples include: "US", "JP", and "GB". + */ + usageLocation?: string; + /** + * The given name for the user. + */ + givenName?: string; + /** + * The user's surname (family name or last name). + */ + surname?: string; + /** + * A string value that can be used to classify user types in your directory, such as 'Member' and 'Guest'. + */ + userType?: UserType; +} + +/** + * Request parameters for creating a new work or school account user. + */ +export type UserCreateParameters = UserBase & { + /** + * Whether the account is enabled. + */ + accountEnabled: boolean; + /** + * The display name of the user. + */ + displayName: string; + /** + * Password Profile + */ + passwordProfile: PasswordProfile; + /** + * The user principal name (someuser@contoso.com). It must contain one of the verified domains for the tenant. + */ + userPrincipalName: string; + /** + * The mail alias for the user. + */ + mailNickname: string; + /** + * The primary email address of the user. + */ + mail?: string; +}; + +/** + * The password profile associated with a user. + */ +export interface PasswordProfile { + /** + * Describes unknown properties. The value of an unknown property can be of "any" type. + */ + [property: string]: any; + /** + * Password + */ + password: string; + /** + * Whether to force a password change on next login. + */ + forceChangePasswordNextLogin?: boolean; +} + +/** + * Server response for Get tenant users API call. + */ +export interface UserListResult { + /** + * the list of users. + */ + value?: User[]; + /** + * The URL to get the next set of results. + */ + odataNextLink?: string; +} + +/** + * Request parameters for updating an existing work or school account user. + */ +export type UserUpdateParameters = UserBase & { + /** + * Whether the account is enabled. + */ + accountEnabled?: boolean; + /** + * The display name of the user. + */ + displayName?: string; + /** + * The password profile of the user. + */ + passwordProfile?: PasswordProfile; + /** + * The user principal name (someuser@contoso.com). It must contain one of the verified domains for the tenant. + */ + userPrincipalName?: string; + /** + * The mail alias for the user. + */ + mailNickname?: string; +}; + +/** + * Request parameters for GetMemberGroups API call. + */ +export interface UserGetMemberGroupsParameters { + /** + * Describes unknown properties. The value of an unknown property can be of "any" type. + */ + [property: string]: any; + /** + * If true, only membership in security-enabled groups should be checked. Otherwise, membership in all groups should be checked. + */ + securityEnabledOnly: boolean; +} + +/** + * Server response for GetMemberGroups API call. + */ +export interface UserGetMemberGroupsResult { + /** + * A collection of group IDs of which the user is a member. + */ + value?: string[]; +} + +/** + * Request parameters for the GetObjectsByObjectIds API. + */ +export interface GetObjectsParameters { + /** + * Describes unknown properties. The value of an unknown property can be of "any" type. + */ + [property: string]: any; + /** + * The requested object IDs. + */ + objectIds?: string[]; + /** + * The requested object types. + */ + types?: string[]; + /** + * If true, also searches for object IDs in the partner tenant. + */ + includeDirectoryObjectReferences?: boolean; +} + +/** + * Server response for Get tenant domains API call. + */ +export interface DomainListResult { + /** + * the list of domains. + */ + value?: Domain[]; +} + +/** + * Active Directory Domain information. + */ +export interface Domain { + /** + * Describes unknown properties. The value of an unknown property can be of "any" type. + */ + [property: string]: any; + /** + * the type of the authentication into the domain. + */ + readonly authenticationType?: string; + /** + * if this is the default domain in the tenant. + */ + readonly isDefault?: boolean; + /** + * if this domain's ownership is verified. + */ + readonly isVerified?: boolean; + /** + * the domain name. + */ + name: string; +} + +/** + * Server response for get oauth2 permissions grants + */ +export interface OAuth2PermissionGrantListResult { + /** + * the list of oauth2 permissions grants + */ + value?: OAuth2PermissionGrant[]; + /** + * the URL to get the next set of results. + */ + odataNextLink?: string; +} + +export interface OAuth2PermissionGrant { + /** + * Microsoft.DirectoryServices.OAuth2PermissionGrant + */ + odataType?: string; + /** + * The id of the resource's service principal granted consent to impersonate the user when accessing the resource (represented by the resourceId property). + */ + clientId?: string; + /** + * The id of the permission grant + */ + objectId?: string; + /** + * Indicates if consent was provided by the administrator (on behalf of the organization) or by an individual. + */ + consentType?: ConsentType; + /** + * When consent type is Principal, this property specifies the id of the user that granted consent and applies only for that user. + */ + principalId?: string; + /** + * Object Id of the resource you want to grant + */ + resourceId?: string; + /** + * Specifies the value of the scope claim that the resource application should expect in the OAuth 2.0 access token. For example, User.Read + */ + scope?: string; + /** + * Start time for TTL + */ + startTime?: string; + /** + * Expiry time for TTL + */ + expiryTime?: string; +} + +/** + * Request parameters for update an existing service principal. + */ +export type ServicePrincipalUpdateParameters = ServicePrincipalBase & {}; +/** + * Defines values for UserType. + */ +export type UserType = "Member" | "Guest"; +/** + * Defines values for GroupMembershipClaimTypes. + */ +export type GroupMembershipClaimTypes = "None" | "SecurityGroup" | "All"; +/** + * Defines values for ConsentType. + */ +export type ConsentType = "AllPrincipals" | "Principal"; + +/** + * Contains response data for the get operation. + */ +export type SignedInUserGetResponse = User & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: User; + }; +}; + +/** + * Contains response data for the listOwnedObjects operation. + */ +export type SignedInUserListOwnedObjectsResponse = DirectoryObjectListResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: DirectoryObjectListResult; + }; +}; + +/** + * Contains response data for the listOwnedObjectsNext operation. + */ +export type SignedInUserListOwnedObjectsNextResponse = DirectoryObjectListResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: DirectoryObjectListResult; + }; +}; + +/** + * Contains response data for the create operation. + */ +export type ApplicationsCreateResponse = Application & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: Application; + }; +}; + +/** + * Optional parameters. + */ +export interface ApplicationsListOptionalParams + extends coreHttp.OperationOptions { + /** + * The filters to apply to the operation. + */ + filter?: string; +} + +/** + * Contains response data for the list operation. + */ +export type ApplicationsListResponse = ApplicationListResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: ApplicationListResult; + }; +}; + +/** + * Contains response data for the get operation. + */ +export type ApplicationsGetResponse = Application & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: Application; + }; +}; + +/** + * Contains response data for the listOwners operation. + */ +export type ApplicationsListOwnersResponse = DirectoryObjectListResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: DirectoryObjectListResult; + }; +}; + +/** + * Contains response data for the listKeyCredentials operation. + */ +export type ApplicationsListKeyCredentialsResponse = KeyCredentialListResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: KeyCredentialListResult; + }; +}; + +/** + * Contains response data for the listPasswordCredentials operation. + */ +export type ApplicationsListPasswordCredentialsResponse = PasswordCredentialListResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: PasswordCredentialListResult; + }; +}; + +/** + * Contains response data for the getServicePrincipalsIdByAppId operation. + */ +export type ApplicationsGetServicePrincipalsIdByAppIdResponse = ServicePrincipalObjectResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: ServicePrincipalObjectResult; + }; +}; + +/** + * Contains response data for the listNext operation. + */ +export type ApplicationsListNextResponse = ApplicationListResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: ApplicationListResult; + }; +}; + +/** + * Contains response data for the listOwnersNext operation. + */ +export type ApplicationsListOwnersNextResponse = DirectoryObjectListResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: DirectoryObjectListResult; + }; +}; + +/** + * Contains response data for the restore operation. + */ +export type DeletedApplicationsRestoreResponse = Application & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: Application; + }; +}; + +/** + * Optional parameters. + */ +export interface DeletedApplicationsListOptionalParams + extends coreHttp.OperationOptions { + /** + * The filter to apply to the operation. + */ + filter?: string; +} + +/** + * Contains response data for the list operation. + */ +export type DeletedApplicationsListResponse = ApplicationListResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: ApplicationListResult; + }; +}; + +/** + * Contains response data for the listNext operation. + */ +export type DeletedApplicationsListNextResponse = ApplicationListResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: ApplicationListResult; + }; +}; + +/** + * Contains response data for the isMemberOf operation. + */ +export type GroupsIsMemberOfResponse = CheckGroupMembershipResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: CheckGroupMembershipResult; + }; +}; + +/** + * Contains response data for the create operation. + */ +export type GroupsCreateResponse = ADGroup & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: ADGroup; + }; +}; + +/** + * Optional parameters. + */ +export interface GroupsListOptionalParams extends coreHttp.OperationOptions { + /** + * The filter to apply to the operation. + */ + filter?: string; +} + +/** + * Contains response data for the list operation. + */ +export type GroupsListResponse = GroupListResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: GroupListResult; + }; +}; + +/** + * Contains response data for the getGroupMembers operation. + */ +export type GroupsGetGroupMembersResponse = DirectoryObjectListResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: DirectoryObjectListResult; + }; +}; + +/** + * Contains response data for the get operation. + */ +export type GroupsGetResponse = ADGroup & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: ADGroup; + }; +}; + +/** + * Contains response data for the getMemberGroups operation. + */ +export type GroupsGetMemberGroupsResponse = GroupGetMemberGroupsResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: GroupGetMemberGroupsResult; + }; +}; + +/** + * Contains response data for the listOwners operation. + */ +export type GroupsListOwnersResponse = DirectoryObjectListResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: DirectoryObjectListResult; + }; +}; + +/** + * Contains response data for the listNext operation. + */ +export type GroupsListNextResponse = GroupListResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: GroupListResult; + }; +}; + +/** + * Contains response data for the getGroupMembersNext operation. + */ +export type GroupsGetGroupMembersNextResponse = DirectoryObjectListResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: DirectoryObjectListResult; + }; +}; + +/** + * Contains response data for the listOwnersNext operation. + */ +export type GroupsListOwnersNextResponse = DirectoryObjectListResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: DirectoryObjectListResult; + }; +}; + +/** + * Contains response data for the create operation. + */ +export type ServicePrincipalsCreateResponse = ServicePrincipal & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: ServicePrincipal; + }; +}; + +/** + * Optional parameters. + */ +export interface ServicePrincipalsListOptionalParams + extends coreHttp.OperationOptions { + /** + * The filter to apply to the operation. + */ + filter?: string; +} + +/** + * Contains response data for the list operation. + */ +export type ServicePrincipalsListResponse = ServicePrincipalListResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: ServicePrincipalListResult; + }; +}; + +/** + * Contains response data for the get operation. + */ +export type ServicePrincipalsGetResponse = ServicePrincipal & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: ServicePrincipal; + }; +}; + +/** + * Contains response data for the listOwners operation. + */ +export type ServicePrincipalsListOwnersResponse = DirectoryObjectListResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: DirectoryObjectListResult; + }; +}; + +/** + * Contains response data for the listKeyCredentials operation. + */ +export type ServicePrincipalsListKeyCredentialsResponse = KeyCredentialListResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: KeyCredentialListResult; + }; +}; + +/** + * Contains response data for the listPasswordCredentials operation. + */ +export type ServicePrincipalsListPasswordCredentialsResponse = PasswordCredentialListResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: PasswordCredentialListResult; + }; +}; + +/** + * Contains response data for the listNext operation. + */ +export type ServicePrincipalsListNextResponse = ServicePrincipalListResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: ServicePrincipalListResult; + }; +}; + +/** + * Contains response data for the listOwnersNext operation. + */ +export type ServicePrincipalsListOwnersNextResponse = DirectoryObjectListResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: DirectoryObjectListResult; + }; +}; + +/** + * Contains response data for the create operation. + */ +export type UsersCreateResponse = User & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: User; + }; +}; + +/** + * Optional parameters. + */ +export interface UsersListOptionalParams extends coreHttp.OperationOptions { + /** + * The filter to apply to the operation. + */ + filter?: string; + /** + * The expand value for the operation result. + */ + expand?: string; +} + +/** + * Contains response data for the list operation. + */ +export type UsersListResponse = UserListResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: UserListResult; + }; +}; + +/** + * Contains response data for the get operation. + */ +export type UsersGetResponse = User & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: User; + }; +}; + +/** + * Contains response data for the getMemberGroups operation. + */ +export type UsersGetMemberGroupsResponse = UserGetMemberGroupsResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: UserGetMemberGroupsResult; + }; +}; + +/** + * Contains response data for the listNext operation. + */ +export type UsersListNextResponse = UserListResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: UserListResult; + }; +}; + +/** + * Contains response data for the getObjectsByObjectIds operation. + */ +export type ObjectsGetObjectsByObjectIdsResponse = DirectoryObjectListResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: DirectoryObjectListResult; + }; +}; + +/** + * Contains response data for the getObjectsByObjectIdsNext operation. + */ +export type ObjectsGetObjectsByObjectIdsNextResponse = DirectoryObjectListResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: DirectoryObjectListResult; + }; +}; + +/** + * Optional parameters. + */ +export interface DomainsListOptionalParams extends coreHttp.OperationOptions { + /** + * The filter to apply to the operation. + */ + filter?: string; +} + +/** + * Contains response data for the list operation. + */ +export type DomainsListResponse = DomainListResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: DomainListResult; + }; +}; + +/** + * Contains response data for the get operation. + */ +export type DomainsGetResponse = Domain & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: Domain; + }; +}; + +/** + * Optional parameters. + */ +export interface OAuth2PermissionGrantListOptionalParams + extends coreHttp.OperationOptions { + /** + * This is the Service Principal ObjectId associated with the app + */ + filter?: string; +} + +/** + * Contains response data for the list operation. + */ +export type OAuth2PermissionGrantListResponse = OAuth2PermissionGrantListResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: OAuth2PermissionGrantListResult; + }; +}; + +/** + * Optional parameters. + */ +export interface OAuth2PermissionGrantCreateOptionalParams + extends coreHttp.OperationOptions { + /** + * The relevant app Service Principal Object Id and the Service Principal Object Id you want to grant. + */ + body?: OAuth2PermissionGrant; +} + +/** + * Contains response data for the create operation. + */ +export type OAuth2PermissionGrantCreateResponse = OAuth2PermissionGrant & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: OAuth2PermissionGrant; + }; +}; + +/** + * Contains response data for the listNext operation. + */ +export type OAuth2PermissionGrantListNextResponse = OAuth2PermissionGrantListResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: OAuth2PermissionGrantListResult; + }; +}; + +/** + * Optional parameters. + */ +export interface GraphRbacManagementClientOptionalParams + extends coreHttp.ServiceClientOptions { + /** + * server parameter + */ + $host?: string; + /** + * Api Version + */ + apiVersion?: string; + /** + * Overrides client endpoint. + */ + endpoint?: string; +} diff --git a/test/smoke/generated/graphrbac-data-plane/src/models/mappers.ts b/test/smoke/generated/graphrbac-data-plane/src/models/mappers.ts new file mode 100644 index 0000000000..c7cadef7cd --- /dev/null +++ b/test/smoke/generated/graphrbac-data-plane/src/models/mappers.ts @@ -0,0 +1,2057 @@ +/* + * 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 * as coreHttp from "@azure/core-http"; + +export const DirectoryObject: coreHttp.CompositeMapper = { + serializedName: "DirectoryObject", + type: { + name: "Composite", + className: "DirectoryObject", + uberParent: "DirectoryObject", + additionalProperties: { type: { name: "Object" } }, + polymorphicDiscriminator: { + serializedName: "objectType", + clientName: "objectType" + }, + modelProperties: { + objectId: { + serializedName: "objectId", + readOnly: true, + type: { + name: "String" + } + }, + objectType: { + serializedName: "objectType", + required: true, + type: { + name: "String" + } + }, + deletionTimestamp: { + serializedName: "deletionTimestamp", + readOnly: true, + type: { + name: "DateTime" + } + } + } + } +}; + +export const User: coreHttp.CompositeMapper = { + serializedName: "User", + type: { + name: "Composite", + className: "User", + uberParent: "DirectoryObject", + additionalProperties: { type: { name: "Object" } }, + polymorphicDiscriminator: DirectoryObject.type.polymorphicDiscriminator, + modelProperties: { + ...DirectoryObject.type.modelProperties, + immutableId: { + serializedName: "immutableId", + type: { + name: "String" + } + }, + usageLocation: { + serializedName: "usageLocation", + type: { + name: "String" + } + }, + givenName: { + serializedName: "givenName", + type: { + name: "String" + } + }, + surname: { + serializedName: "surname", + type: { + name: "String" + } + }, + userType: { + serializedName: "userType", + type: { + name: "String" + } + }, + accountEnabled: { + serializedName: "accountEnabled", + type: { + name: "Boolean" + } + }, + displayName: { + serializedName: "displayName", + type: { + name: "String" + } + }, + userPrincipalName: { + serializedName: "userPrincipalName", + type: { + name: "String" + } + }, + mailNickname: { + serializedName: "mailNickname", + type: { + name: "String" + } + }, + mail: { + serializedName: "mail", + type: { + name: "String" + } + }, + signInNames: { + serializedName: "signInNames", + type: { + name: "Sequence", + element: { type: { name: "Composite", className: "SignInName" } } + } + } + } + } +}; + +export const SignInName: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "SignInName", + additionalProperties: { type: { name: "Object" } }, + modelProperties: { + type: { + serializedName: "type", + type: { + name: "String" + } + }, + value: { + serializedName: "value", + type: { + name: "String" + } + } + } + } +}; + +export const GraphError: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "GraphError", + modelProperties: { + code: { + serializedName: "odata\\.error.code", + type: { + name: "String" + } + }, + message: { + serializedName: "odata\\.error.message.value", + type: { + name: "String" + } + } + } + } +}; + +export const DirectoryObjectListResult: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "DirectoryObjectListResult", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { type: { name: "Composite", className: "DirectoryObject" } } + } + }, + odataNextLink: { + serializedName: "odata\\.nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const ApplicationBase: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "ApplicationBase", + modelProperties: { + allowGuestsSignIn: { + serializedName: "allowGuestsSignIn", + type: { + name: "Boolean" + } + }, + allowPassthroughUsers: { + serializedName: "allowPassthroughUsers", + type: { + name: "Boolean" + } + }, + appLogoUrl: { + serializedName: "appLogoUrl", + type: { + name: "String" + } + }, + appRoles: { + serializedName: "appRoles", + type: { + name: "Sequence", + element: { type: { name: "Composite", className: "AppRole" } } + } + }, + appPermissions: { + serializedName: "appPermissions", + type: { + name: "Sequence", + element: { type: { name: "String" } } + } + }, + availableToOtherTenants: { + serializedName: "availableToOtherTenants", + type: { + name: "Boolean" + } + }, + errorUrl: { + serializedName: "errorUrl", + type: { + name: "String" + } + }, + groupMembershipClaims: { + serializedName: "groupMembershipClaims", + type: { + name: "String" + } + }, + homepage: { + serializedName: "homepage", + type: { + name: "String" + } + }, + informationalUrls: { + serializedName: "informationalUrls", + type: { + name: "Composite", + className: "InformationalUrl" + } + }, + isDeviceOnlyAuthSupported: { + serializedName: "isDeviceOnlyAuthSupported", + type: { + name: "Boolean" + } + }, + keyCredentials: { + serializedName: "keyCredentials", + type: { + name: "Sequence", + element: { type: { name: "Composite", className: "KeyCredential" } } + } + }, + knownClientApplications: { + serializedName: "knownClientApplications", + type: { + name: "Sequence", + element: { type: { name: "String" } } + } + }, + logoutUrl: { + serializedName: "logoutUrl", + type: { + name: "String" + } + }, + oauth2AllowImplicitFlow: { + serializedName: "oauth2AllowImplicitFlow", + type: { + name: "Boolean" + } + }, + oauth2AllowUrlPathMatching: { + serializedName: "oauth2AllowUrlPathMatching", + type: { + name: "Boolean" + } + }, + oauth2Permissions: { + serializedName: "oauth2Permissions", + type: { + name: "Sequence", + element: { + type: { name: "Composite", className: "OAuth2Permission" } + } + } + }, + oauth2RequirePostResponse: { + serializedName: "oauth2RequirePostResponse", + type: { + name: "Boolean" + } + }, + orgRestrictions: { + serializedName: "orgRestrictions", + type: { + name: "Sequence", + element: { type: { name: "String" } } + } + }, + optionalClaims: { + serializedName: "optionalClaims", + type: { + name: "Composite", + className: "OptionalClaims" + } + }, + passwordCredentials: { + serializedName: "passwordCredentials", + type: { + name: "Sequence", + element: { + type: { name: "Composite", className: "PasswordCredential" } + } + } + }, + preAuthorizedApplications: { + serializedName: "preAuthorizedApplications", + type: { + name: "Sequence", + element: { + type: { name: "Composite", className: "PreAuthorizedApplication" } + } + } + }, + publicClient: { + serializedName: "publicClient", + type: { + name: "Boolean" + } + }, + publisherDomain: { + serializedName: "publisherDomain", + type: { + name: "String" + } + }, + replyUrls: { + serializedName: "replyUrls", + type: { + name: "Sequence", + element: { type: { name: "String" } } + } + }, + requiredResourceAccess: { + serializedName: "requiredResourceAccess", + type: { + name: "Sequence", + element: { + type: { name: "Composite", className: "RequiredResourceAccess" } + } + } + }, + samlMetadataUrl: { + serializedName: "samlMetadataUrl", + type: { + name: "String" + } + }, + signInAudience: { + serializedName: "signInAudience", + type: { + name: "String" + } + }, + wwwHomepage: { + serializedName: "wwwHomepage", + type: { + name: "String" + } + } + } + } +}; + +export const AppRole: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "AppRole", + modelProperties: { + id: { + serializedName: "id", + type: { + name: "String" + } + }, + allowedMemberTypes: { + serializedName: "allowedMemberTypes", + type: { + name: "Sequence", + element: { type: { name: "String" } } + } + }, + description: { + serializedName: "description", + type: { + name: "String" + } + }, + displayName: { + serializedName: "displayName", + type: { + name: "String" + } + }, + isEnabled: { + serializedName: "isEnabled", + type: { + name: "Boolean" + } + }, + value: { + serializedName: "value", + type: { + name: "String" + } + } + } + } +}; + +export const InformationalUrl: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "InformationalUrl", + modelProperties: { + termsOfService: { + serializedName: "termsOfService", + type: { + name: "String" + } + }, + marketing: { + serializedName: "marketing", + type: { + name: "String" + } + }, + privacy: { + serializedName: "privacy", + type: { + name: "String" + } + }, + support: { + serializedName: "support", + type: { + name: "String" + } + } + } + } +}; + +export const KeyCredential: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "KeyCredential", + additionalProperties: { type: { name: "Object" } }, + modelProperties: { + startDate: { + serializedName: "startDate", + type: { + name: "DateTime" + } + }, + endDate: { + serializedName: "endDate", + type: { + name: "DateTime" + } + }, + value: { + serializedName: "value", + type: { + name: "String" + } + }, + keyId: { + serializedName: "keyId", + type: { + name: "String" + } + }, + usage: { + serializedName: "usage", + type: { + name: "String" + } + }, + type: { + serializedName: "type", + type: { + name: "String" + } + }, + customKeyIdentifier: { + serializedName: "customKeyIdentifier", + type: { + name: "String" + } + } + } + } +}; + +export const OAuth2Permission: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "OAuth2Permission", + modelProperties: { + adminConsentDescription: { + serializedName: "adminConsentDescription", + type: { + name: "String" + } + }, + adminConsentDisplayName: { + serializedName: "adminConsentDisplayName", + type: { + name: "String" + } + }, + id: { + serializedName: "id", + type: { + name: "String" + } + }, + isEnabled: { + serializedName: "isEnabled", + type: { + name: "Boolean" + } + }, + type: { + serializedName: "type", + type: { + name: "String" + } + }, + userConsentDescription: { + serializedName: "userConsentDescription", + type: { + name: "String" + } + }, + userConsentDisplayName: { + serializedName: "userConsentDisplayName", + type: { + name: "String" + } + }, + value: { + serializedName: "value", + type: { + name: "String" + } + } + } + } +}; + +export const OptionalClaims: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "OptionalClaims", + modelProperties: { + idToken: { + serializedName: "idToken", + type: { + name: "Sequence", + element: { type: { name: "Composite", className: "OptionalClaim" } } + } + }, + accessToken: { + serializedName: "accessToken", + type: { + name: "Sequence", + element: { type: { name: "Composite", className: "OptionalClaim" } } + } + }, + samlToken: { + serializedName: "samlToken", + type: { + name: "Sequence", + element: { type: { name: "Composite", className: "OptionalClaim" } } + } + } + } + } +}; + +export const OptionalClaim: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "OptionalClaim", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + }, + source: { + serializedName: "source", + type: { + name: "String" + } + }, + essential: { + serializedName: "essential", + type: { + name: "Boolean" + } + }, + additionalProperties: { + serializedName: "additionalProperties", + type: { + name: "any" + } + } + } + } +}; + +export const PasswordCredential: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "PasswordCredential", + additionalProperties: { type: { name: "Object" } }, + modelProperties: { + startDate: { + serializedName: "startDate", + type: { + name: "DateTime" + } + }, + endDate: { + serializedName: "endDate", + type: { + name: "DateTime" + } + }, + keyId: { + serializedName: "keyId", + type: { + name: "String" + } + }, + value: { + serializedName: "value", + type: { + name: "String" + } + }, + customKeyIdentifier: { + serializedName: "customKeyIdentifier", + type: { + name: "ByteArray" + } + } + } + } +}; + +export const PreAuthorizedApplication: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "PreAuthorizedApplication", + modelProperties: { + appId: { + serializedName: "appId", + type: { + name: "String" + } + }, + permissions: { + serializedName: "permissions", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "PreAuthorizedApplicationPermission" + } + } + } + }, + extensions: { + serializedName: "extensions", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "PreAuthorizedApplicationExtension" + } + } + } + } + } + } +}; + +export const PreAuthorizedApplicationPermission: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "PreAuthorizedApplicationPermission", + modelProperties: { + directAccessGrant: { + serializedName: "directAccessGrant", + type: { + name: "Boolean" + } + }, + accessGrants: { + serializedName: "accessGrants", + type: { + name: "Sequence", + element: { type: { name: "String" } } + } + } + } + } +}; + +export const PreAuthorizedApplicationExtension: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "PreAuthorizedApplicationExtension", + modelProperties: { + conditions: { + serializedName: "conditions", + type: { + name: "Sequence", + element: { type: { name: "String" } } + } + } + } + } +}; + +export const RequiredResourceAccess: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "RequiredResourceAccess", + additionalProperties: { type: { name: "Object" } }, + modelProperties: { + resourceAccess: { + serializedName: "resourceAccess", + required: true, + type: { + name: "Sequence", + element: { type: { name: "Composite", className: "ResourceAccess" } } + } + }, + resourceAppId: { + serializedName: "resourceAppId", + type: { + name: "String" + } + } + } + } +}; + +export const ResourceAccess: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "ResourceAccess", + additionalProperties: { type: { name: "Object" } }, + modelProperties: { + id: { + serializedName: "id", + required: true, + type: { + name: "String" + } + }, + type: { + serializedName: "type", + type: { + name: "String" + } + } + } + } +}; + +export const ApplicationCreateParameters: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "ApplicationCreateParameters", + modelProperties: { + ...ApplicationBase.type.modelProperties, + displayName: { + serializedName: "displayName", + required: true, + type: { + name: "String" + } + }, + identifierUris: { + serializedName: "identifierUris", + type: { + name: "Sequence", + element: { type: { name: "String" } } + } + } + } + } +}; + +export const Application: coreHttp.CompositeMapper = { + serializedName: "Application", + type: { + name: "Composite", + className: "Application", + uberParent: "DirectoryObject", + additionalProperties: { type: { name: "Object" } }, + polymorphicDiscriminator: DirectoryObject.type.polymorphicDiscriminator, + modelProperties: { + ...DirectoryObject.type.modelProperties, + appId: { + serializedName: "appId", + type: { + name: "String" + } + }, + allowGuestsSignIn: { + serializedName: "allowGuestsSignIn", + type: { + name: "Boolean" + } + }, + allowPassthroughUsers: { + serializedName: "allowPassthroughUsers", + type: { + name: "Boolean" + } + }, + appLogoUrl: { + serializedName: "appLogoUrl", + type: { + name: "String" + } + }, + appRoles: { + serializedName: "appRoles", + type: { + name: "Sequence", + element: { type: { name: "Composite", className: "AppRole" } } + } + }, + appPermissions: { + serializedName: "appPermissions", + type: { + name: "Sequence", + element: { type: { name: "String" } } + } + }, + availableToOtherTenants: { + serializedName: "availableToOtherTenants", + type: { + name: "Boolean" + } + }, + displayName: { + serializedName: "displayName", + type: { + name: "String" + } + }, + errorUrl: { + serializedName: "errorUrl", + type: { + name: "String" + } + }, + groupMembershipClaims: { + serializedName: "groupMembershipClaims", + type: { + name: "String" + } + }, + homepage: { + serializedName: "homepage", + type: { + name: "String" + } + }, + identifierUris: { + serializedName: "identifierUris", + type: { + name: "Sequence", + element: { type: { name: "String" } } + } + }, + informationalUrls: { + serializedName: "informationalUrls", + type: { + name: "Composite", + className: "InformationalUrl" + } + }, + isDeviceOnlyAuthSupported: { + serializedName: "isDeviceOnlyAuthSupported", + type: { + name: "Boolean" + } + }, + keyCredentials: { + serializedName: "keyCredentials", + type: { + name: "Sequence", + element: { type: { name: "Composite", className: "KeyCredential" } } + } + }, + knownClientApplications: { + serializedName: "knownClientApplications", + type: { + name: "Sequence", + element: { type: { name: "String" } } + } + }, + logoutUrl: { + serializedName: "logoutUrl", + type: { + name: "String" + } + }, + oauth2AllowImplicitFlow: { + serializedName: "oauth2AllowImplicitFlow", + type: { + name: "Boolean" + } + }, + oauth2AllowUrlPathMatching: { + serializedName: "oauth2AllowUrlPathMatching", + type: { + name: "Boolean" + } + }, + oauth2Permissions: { + serializedName: "oauth2Permissions", + type: { + name: "Sequence", + element: { + type: { name: "Composite", className: "OAuth2Permission" } + } + } + }, + oauth2RequirePostResponse: { + serializedName: "oauth2RequirePostResponse", + type: { + name: "Boolean" + } + }, + orgRestrictions: { + serializedName: "orgRestrictions", + type: { + name: "Sequence", + element: { type: { name: "String" } } + } + }, + optionalClaims: { + serializedName: "optionalClaims", + type: { + name: "Composite", + className: "OptionalClaims" + } + }, + passwordCredentials: { + serializedName: "passwordCredentials", + type: { + name: "Sequence", + element: { + type: { name: "Composite", className: "PasswordCredential" } + } + } + }, + preAuthorizedApplications: { + serializedName: "preAuthorizedApplications", + type: { + name: "Sequence", + element: { + type: { name: "Composite", className: "PreAuthorizedApplication" } + } + } + }, + publicClient: { + serializedName: "publicClient", + type: { + name: "Boolean" + } + }, + publisherDomain: { + serializedName: "publisherDomain", + type: { + name: "String" + } + }, + replyUrls: { + serializedName: "replyUrls", + type: { + name: "Sequence", + element: { type: { name: "String" } } + } + }, + requiredResourceAccess: { + serializedName: "requiredResourceAccess", + type: { + name: "Sequence", + element: { + type: { name: "Composite", className: "RequiredResourceAccess" } + } + } + }, + samlMetadataUrl: { + serializedName: "samlMetadataUrl", + type: { + name: "String" + } + }, + signInAudience: { + serializedName: "signInAudience", + type: { + name: "String" + } + }, + wwwHomepage: { + serializedName: "wwwHomepage", + type: { + name: "String" + } + } + } + } +}; + +export const ApplicationListResult: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "ApplicationListResult", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { type: { name: "Composite", className: "Application" } } + } + }, + odataNextLink: { + serializedName: "odata\\.nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const ApplicationUpdateParameters: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "ApplicationUpdateParameters", + modelProperties: { + ...ApplicationBase.type.modelProperties, + displayName: { + serializedName: "displayName", + type: { + name: "String" + } + }, + identifierUris: { + serializedName: "identifierUris", + type: { + name: "Sequence", + element: { type: { name: "String" } } + } + } + } + } +}; + +export const AddOwnerParameters: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "AddOwnerParameters", + additionalProperties: { type: { name: "Object" } }, + modelProperties: { + url: { + serializedName: "url", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const KeyCredentialListResult: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "KeyCredentialListResult", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { type: { name: "Composite", className: "KeyCredential" } } + } + } + } + } +}; + +export const KeyCredentialsUpdateParameters: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "KeyCredentialsUpdateParameters", + modelProperties: { + value: { + serializedName: "value", + required: true, + type: { + name: "Sequence", + element: { type: { name: "Composite", className: "KeyCredential" } } + } + } + } + } +}; + +export const PasswordCredentialListResult: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "PasswordCredentialListResult", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { name: "Composite", className: "PasswordCredential" } + } + } + } + } + } +}; + +export const PasswordCredentialsUpdateParameters: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "PasswordCredentialsUpdateParameters", + modelProperties: { + value: { + serializedName: "value", + required: true, + type: { + name: "Sequence", + element: { + type: { name: "Composite", className: "PasswordCredential" } + } + } + } + } + } +}; + +export const CheckGroupMembershipParameters: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "CheckGroupMembershipParameters", + additionalProperties: { type: { name: "Object" } }, + modelProperties: { + groupId: { + serializedName: "groupId", + required: true, + type: { + name: "String" + } + }, + memberId: { + serializedName: "memberId", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const CheckGroupMembershipResult: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "CheckGroupMembershipResult", + additionalProperties: { type: { name: "Object" } }, + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Boolean" + } + } + } + } +}; + +export const GroupAddMemberParameters: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "GroupAddMemberParameters", + additionalProperties: { type: { name: "Object" } }, + modelProperties: { + url: { + serializedName: "url", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const GroupCreateParameters: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "GroupCreateParameters", + additionalProperties: { type: { name: "Object" } }, + modelProperties: { + displayName: { + serializedName: "displayName", + required: true, + type: { + name: "String" + } + }, + mailEnabled: { + defaultValue: false, + isConstant: true, + serializedName: "mailEnabled", + type: { + name: "Boolean" + } + }, + mailNickname: { + serializedName: "mailNickname", + required: true, + type: { + name: "String" + } + }, + securityEnabled: { + defaultValue: true, + isConstant: true, + serializedName: "securityEnabled", + type: { + name: "Boolean" + } + } + } + } +}; + +export const ADGroup: coreHttp.CompositeMapper = { + serializedName: "Group", + type: { + name: "Composite", + className: "ADGroup", + uberParent: "DirectoryObject", + additionalProperties: { type: { name: "Object" } }, + polymorphicDiscriminator: DirectoryObject.type.polymorphicDiscriminator, + modelProperties: { + ...DirectoryObject.type.modelProperties, + displayName: { + serializedName: "displayName", + type: { + name: "String" + } + }, + mailEnabled: { + serializedName: "mailEnabled", + type: { + name: "Boolean" + } + }, + mailNickname: { + serializedName: "mailNickname", + type: { + name: "String" + } + }, + securityEnabled: { + serializedName: "securityEnabled", + type: { + name: "Boolean" + } + }, + mail: { + serializedName: "mail", + type: { + name: "String" + } + } + } + } +}; + +export const GroupListResult: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "GroupListResult", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { type: { name: "Composite", className: "ADGroup" } } + } + }, + odataNextLink: { + serializedName: "odata\\.nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const GroupGetMemberGroupsParameters: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "GroupGetMemberGroupsParameters", + additionalProperties: { type: { name: "Object" } }, + modelProperties: { + securityEnabledOnly: { + serializedName: "securityEnabledOnly", + required: true, + type: { + name: "Boolean" + } + } + } + } +}; + +export const GroupGetMemberGroupsResult: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "GroupGetMemberGroupsResult", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { type: { name: "String" } } + } + } + } + } +}; + +export const ServicePrincipalBase: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "ServicePrincipalBase", + modelProperties: { + accountEnabled: { + serializedName: "accountEnabled", + type: { + name: "Boolean" + } + }, + appRoleAssignmentRequired: { + serializedName: "appRoleAssignmentRequired", + type: { + name: "Boolean" + } + }, + keyCredentials: { + serializedName: "keyCredentials", + type: { + name: "Sequence", + element: { type: { name: "Composite", className: "KeyCredential" } } + } + }, + passwordCredentials: { + serializedName: "passwordCredentials", + type: { + name: "Sequence", + element: { + type: { name: "Composite", className: "PasswordCredential" } + } + } + }, + servicePrincipalType: { + serializedName: "servicePrincipalType", + type: { + name: "String" + } + }, + tags: { + serializedName: "tags", + type: { + name: "Sequence", + element: { type: { name: "String" } } + } + } + } + } +}; + +export const ServicePrincipalCreateParameters: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "ServicePrincipalCreateParameters", + modelProperties: { + ...ServicePrincipalBase.type.modelProperties, + appId: { + serializedName: "appId", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const ServicePrincipal: coreHttp.CompositeMapper = { + serializedName: "ServicePrincipal", + type: { + name: "Composite", + className: "ServicePrincipal", + uberParent: "DirectoryObject", + additionalProperties: { type: { name: "Object" } }, + polymorphicDiscriminator: DirectoryObject.type.polymorphicDiscriminator, + modelProperties: { + ...DirectoryObject.type.modelProperties, + accountEnabled: { + serializedName: "accountEnabled", + type: { + name: "Boolean" + } + }, + alternativeNames: { + serializedName: "alternativeNames", + type: { + name: "Sequence", + element: { type: { name: "String" } } + } + }, + appDisplayName: { + serializedName: "appDisplayName", + readOnly: true, + type: { + name: "String" + } + }, + appId: { + serializedName: "appId", + type: { + name: "String" + } + }, + appOwnerTenantId: { + serializedName: "appOwnerTenantId", + readOnly: true, + type: { + name: "String" + } + }, + appRoleAssignmentRequired: { + serializedName: "appRoleAssignmentRequired", + type: { + name: "Boolean" + } + }, + appRoles: { + serializedName: "appRoles", + type: { + name: "Sequence", + element: { type: { name: "Composite", className: "AppRole" } } + } + }, + displayName: { + serializedName: "displayName", + type: { + name: "String" + } + }, + errorUrl: { + serializedName: "errorUrl", + type: { + name: "String" + } + }, + homepage: { + serializedName: "homepage", + type: { + name: "String" + } + }, + keyCredentials: { + serializedName: "keyCredentials", + type: { + name: "Sequence", + element: { type: { name: "Composite", className: "KeyCredential" } } + } + }, + logoutUrl: { + serializedName: "logoutUrl", + type: { + name: "String" + } + }, + oauth2Permissions: { + serializedName: "oauth2Permissions", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { name: "Composite", className: "OAuth2Permission" } + } + } + }, + passwordCredentials: { + serializedName: "passwordCredentials", + type: { + name: "Sequence", + element: { + type: { name: "Composite", className: "PasswordCredential" } + } + } + }, + preferredTokenSigningKeyThumbprint: { + serializedName: "preferredTokenSigningKeyThumbprint", + type: { + name: "String" + } + }, + publisherName: { + serializedName: "publisherName", + type: { + name: "String" + } + }, + replyUrls: { + serializedName: "replyUrls", + type: { + name: "Sequence", + element: { type: { name: "String" } } + } + }, + samlMetadataUrl: { + serializedName: "samlMetadataUrl", + type: { + name: "String" + } + }, + servicePrincipalNames: { + serializedName: "servicePrincipalNames", + type: { + name: "Sequence", + element: { type: { name: "String" } } + } + }, + servicePrincipalType: { + serializedName: "servicePrincipalType", + type: { + name: "String" + } + }, + tags: { + serializedName: "tags", + type: { + name: "Sequence", + element: { type: { name: "String" } } + } + } + } + } +}; + +export const ServicePrincipalListResult: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "ServicePrincipalListResult", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { name: "Composite", className: "ServicePrincipal" } + } + } + }, + odataNextLink: { + serializedName: "odata\\.nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const ServicePrincipalObjectResult: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "ServicePrincipalObjectResult", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "String" + } + }, + odataMetadata: { + serializedName: "odata\\.metadata", + type: { + name: "String" + } + } + } + } +}; + +export const UserBase: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "UserBase", + additionalProperties: { type: { name: "Object" } }, + modelProperties: { + immutableId: { + serializedName: "immutableId", + type: { + name: "String" + } + }, + usageLocation: { + serializedName: "usageLocation", + type: { + name: "String" + } + }, + givenName: { + serializedName: "givenName", + type: { + name: "String" + } + }, + surname: { + serializedName: "surname", + type: { + name: "String" + } + }, + userType: { + serializedName: "userType", + type: { + name: "String" + } + } + } + } +}; + +export const UserCreateParameters: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "UserCreateParameters", + additionalProperties: { type: { name: "Object" } }, + modelProperties: { + ...UserBase.type.modelProperties, + accountEnabled: { + serializedName: "accountEnabled", + required: true, + type: { + name: "Boolean" + } + }, + displayName: { + serializedName: "displayName", + required: true, + type: { + name: "String" + } + }, + passwordProfile: { + serializedName: "passwordProfile", + type: { + name: "Composite", + className: "PasswordProfile" + } + }, + userPrincipalName: { + serializedName: "userPrincipalName", + required: true, + type: { + name: "String" + } + }, + mailNickname: { + serializedName: "mailNickname", + required: true, + type: { + name: "String" + } + }, + mail: { + serializedName: "mail", + type: { + name: "String" + } + } + } + } +}; + +export const PasswordProfile: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "PasswordProfile", + additionalProperties: { type: { name: "Object" } }, + modelProperties: { + password: { + serializedName: "password", + required: true, + type: { + name: "String" + } + }, + forceChangePasswordNextLogin: { + serializedName: "forceChangePasswordNextLogin", + type: { + name: "Boolean" + } + } + } + } +}; + +export const UserListResult: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "UserListResult", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { type: { name: "Composite", className: "User" } } + } + }, + odataNextLink: { + serializedName: "odata\\.nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const UserUpdateParameters: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "UserUpdateParameters", + additionalProperties: { type: { name: "Object" } }, + modelProperties: { + ...UserBase.type.modelProperties, + accountEnabled: { + serializedName: "accountEnabled", + type: { + name: "Boolean" + } + }, + displayName: { + serializedName: "displayName", + type: { + name: "String" + } + }, + passwordProfile: { + serializedName: "passwordProfile", + type: { + name: "Composite", + className: "PasswordProfile" + } + }, + userPrincipalName: { + serializedName: "userPrincipalName", + type: { + name: "String" + } + }, + mailNickname: { + serializedName: "mailNickname", + type: { + name: "String" + } + } + } + } +}; + +export const UserGetMemberGroupsParameters: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "UserGetMemberGroupsParameters", + additionalProperties: { type: { name: "Object" } }, + modelProperties: { + securityEnabledOnly: { + serializedName: "securityEnabledOnly", + required: true, + type: { + name: "Boolean" + } + } + } + } +}; + +export const UserGetMemberGroupsResult: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "UserGetMemberGroupsResult", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { type: { name: "String" } } + } + } + } + } +}; + +export const GetObjectsParameters: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "GetObjectsParameters", + additionalProperties: { type: { name: "Object" } }, + modelProperties: { + objectIds: { + serializedName: "objectIds", + type: { + name: "Sequence", + element: { type: { name: "String" } } + } + }, + types: { + serializedName: "types", + type: { + name: "Sequence", + element: { type: { name: "String" } } + } + }, + includeDirectoryObjectReferences: { + serializedName: "includeDirectoryObjectReferences", + type: { + name: "Boolean" + } + } + } + } +}; + +export const DomainListResult: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "DomainListResult", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { type: { name: "Composite", className: "Domain" } } + } + } + } + } +}; + +export const Domain: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "Domain", + additionalProperties: { type: { name: "Object" } }, + modelProperties: { + authenticationType: { + serializedName: "authenticationType", + readOnly: true, + type: { + name: "String" + } + }, + isDefault: { + serializedName: "isDefault", + readOnly: true, + type: { + name: "Boolean" + } + }, + isVerified: { + serializedName: "isVerified", + readOnly: true, + type: { + name: "Boolean" + } + }, + name: { + serializedName: "name", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const OAuth2PermissionGrantListResult: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "OAuth2PermissionGrantListResult", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { name: "Composite", className: "OAuth2PermissionGrant" } + } + } + }, + odataNextLink: { + serializedName: "odata\\.nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const OAuth2PermissionGrant: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "OAuth2PermissionGrant", + modelProperties: { + odataType: { + serializedName: "odata\\.type", + type: { + name: "String" + } + }, + clientId: { + serializedName: "clientId", + type: { + name: "String" + } + }, + objectId: { + serializedName: "objectId", + type: { + name: "String" + } + }, + consentType: { + serializedName: "consentType", + type: { + name: "String" + } + }, + principalId: { + serializedName: "principalId", + type: { + name: "String" + } + }, + resourceId: { + serializedName: "resourceId", + type: { + name: "String" + } + }, + scope: { + serializedName: "scope", + type: { + name: "String" + } + }, + startTime: { + serializedName: "startTime", + type: { + name: "String" + } + }, + expiryTime: { + serializedName: "expiryTime", + type: { + name: "String" + } + } + } + } +}; + +export const ServicePrincipalUpdateParameters: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "ServicePrincipalUpdateParameters", + modelProperties: { + ...ServicePrincipalBase.type.modelProperties + } + } +}; + +export let discriminators = { + DirectoryObject: DirectoryObject, + "DirectoryObject.User": User, + "DirectoryObject.Application": Application, + "DirectoryObject.Group": ADGroup, + "DirectoryObject.ServicePrincipal": ServicePrincipal +}; diff --git a/test/smoke/generated/graphrbac-data-plane/src/models/parameters.ts b/test/smoke/generated/graphrbac-data-plane/src/models/parameters.ts new file mode 100644 index 0000000000..e16cb5748f --- /dev/null +++ b/test/smoke/generated/graphrbac-data-plane/src/models/parameters.ts @@ -0,0 +1,530 @@ +/* + * 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 * as coreHttp from "@azure/core-http"; +import * as Mappers from "../models/mappers"; + +export const $host: coreHttp.OperationURLParameter = { + parameterPath: "$host", + mapper: { + serializedName: "$host", + required: true, + type: { + name: "String" + } + }, + skipEncoding: true +}; + +export const apiVersion: coreHttp.OperationQueryParameter = { + parameterPath: "apiVersion", + mapper: { + defaultValue: "1.6", + isConstant: true, + serializedName: "api-version", + type: { + name: "String" + } + } +}; + +export const tenantID: coreHttp.OperationURLParameter = { + parameterPath: "tenantID", + mapper: { + serializedName: "tenantID", + required: true, + type: { + name: "String" + } + } +}; + +export const nextLink: coreHttp.OperationURLParameter = { + parameterPath: "nextLink", + mapper: { + serializedName: "nextLink", + required: true, + type: { + name: "String" + } + }, + skipEncoding: true +}; + +export const contentType: coreHttp.OperationParameter = { + parameterPath: ["options", "contentType"], + mapper: { + defaultValue: "application/json", + isConstant: true, + serializedName: "Content-Type", + type: { + name: "String" + } + } +}; + +export const parameters: coreHttp.OperationParameter = { + parameterPath: "parameters", + mapper: Mappers.ApplicationCreateParameters +}; + +export const filter: coreHttp.OperationQueryParameter = { + parameterPath: ["options", "filter"], + mapper: { + serializedName: "$filter", + type: { + name: "String" + } + } +}; + +export const applicationObjectId: coreHttp.OperationURLParameter = { + parameterPath: "applicationObjectId", + mapper: { + serializedName: "applicationObjectId", + required: true, + type: { + name: "String" + } + } +}; + +export const parameters1: coreHttp.OperationParameter = { + parameterPath: "parameters", + mapper: Mappers.ApplicationUpdateParameters +}; + +export const applicationObjectId1: coreHttp.OperationURLParameter = { + parameterPath: "applicationObjectId", + mapper: { + serializedName: "applicationObjectId", + required: true, + type: { + name: "String" + } + } +}; + +export const parameters2: coreHttp.OperationParameter = { + parameterPath: "parameters", + mapper: Mappers.AddOwnerParameters +}; + +export const applicationObjectId2: coreHttp.OperationURLParameter = { + parameterPath: "applicationObjectId", + mapper: { + serializedName: "applicationObjectId", + required: true, + type: { + name: "String" + } + } +}; + +export const applicationObjectId3: coreHttp.OperationURLParameter = { + parameterPath: "applicationObjectId", + mapper: { + serializedName: "applicationObjectId", + required: true, + type: { + name: "String" + } + } +}; + +export const ownerObjectId: coreHttp.OperationURLParameter = { + parameterPath: "ownerObjectId", + mapper: { + serializedName: "ownerObjectId", + required: true, + type: { + name: "String" + } + } +}; + +export const parameters3: coreHttp.OperationParameter = { + parameterPath: "parameters", + mapper: Mappers.KeyCredentialsUpdateParameters +}; + +export const parameters4: coreHttp.OperationParameter = { + parameterPath: "parameters", + mapper: Mappers.PasswordCredentialsUpdateParameters +}; + +export const applicationID: coreHttp.OperationURLParameter = { + parameterPath: "applicationID", + mapper: { + serializedName: "applicationID", + required: true, + type: { + name: "String" + } + } +}; + +export const nextLink1: coreHttp.OperationURLParameter = { + parameterPath: "nextLink", + mapper: { + serializedName: "nextLink", + required: true, + type: { + name: "String" + } + }, + skipEncoding: true +}; + +export const objectId: coreHttp.OperationURLParameter = { + parameterPath: "objectId", + mapper: { + serializedName: "objectId", + required: true, + type: { + name: "String" + } + } +}; + +export const filter1: coreHttp.OperationQueryParameter = { + parameterPath: ["options", "filter"], + mapper: { + serializedName: "$filter", + type: { + name: "String" + } + } +}; + +export const parameters5: coreHttp.OperationParameter = { + parameterPath: "parameters", + mapper: Mappers.CheckGroupMembershipParameters +}; + +export const groupObjectId: coreHttp.OperationURLParameter = { + parameterPath: "groupObjectId", + mapper: { + serializedName: "groupObjectId", + required: true, + type: { + name: "String" + } + } +}; + +export const memberObjectId: coreHttp.OperationURLParameter = { + parameterPath: "memberObjectId", + mapper: { + serializedName: "memberObjectId", + required: true, + type: { + name: "String" + } + } +}; + +export const parameters6: coreHttp.OperationParameter = { + parameterPath: "parameters", + mapper: Mappers.GroupAddMemberParameters +}; + +export const groupObjectId1: coreHttp.OperationURLParameter = { + parameterPath: "groupObjectId", + mapper: { + serializedName: "groupObjectId", + required: true, + type: { + name: "String" + } + } +}; + +export const parameters7: coreHttp.OperationParameter = { + parameterPath: "parameters", + mapper: Mappers.GroupCreateParameters +}; + +export const objectId1: coreHttp.OperationURLParameter = { + parameterPath: "objectId", + mapper: { + serializedName: "objectId", + required: true, + type: { + name: "String" + } + } +}; + +export const objectId2: coreHttp.OperationURLParameter = { + parameterPath: "objectId", + mapper: { + serializedName: "objectId", + required: true, + type: { + name: "String" + } + } +}; + +export const objectId3: coreHttp.OperationURLParameter = { + parameterPath: "objectId", + mapper: { + serializedName: "objectId", + required: true, + type: { + name: "String" + } + } +}; + +export const parameters8: coreHttp.OperationParameter = { + parameterPath: "parameters", + mapper: Mappers.GroupGetMemberGroupsParameters +}; + +export const objectId4: coreHttp.OperationURLParameter = { + parameterPath: "objectId", + mapper: { + serializedName: "objectId", + required: true, + type: { + name: "String" + } + } +}; + +export const objectId5: coreHttp.OperationURLParameter = { + parameterPath: "objectId", + mapper: { + serializedName: "objectId", + required: true, + type: { + name: "String" + } + } +}; + +export const objectId6: coreHttp.OperationURLParameter = { + parameterPath: "objectId", + mapper: { + serializedName: "objectId", + required: true, + type: { + name: "String" + } + } +}; + +export const objectId7: coreHttp.OperationURLParameter = { + parameterPath: "objectId", + mapper: { + serializedName: "objectId", + required: true, + type: { + name: "String" + } + } +}; + +export const parameters9: coreHttp.OperationParameter = { + parameterPath: "parameters", + mapper: Mappers.ServicePrincipalCreateParameters +}; + +export const parameters10: coreHttp.OperationParameter = { + parameterPath: "parameters", + mapper: Mappers.ServicePrincipalBase +}; + +export const objectId8: coreHttp.OperationURLParameter = { + parameterPath: "objectId", + mapper: { + serializedName: "objectId", + required: true, + type: { + name: "String" + } + } +}; + +export const objectId9: coreHttp.OperationURLParameter = { + parameterPath: "objectId", + mapper: { + serializedName: "objectId", + required: true, + type: { + name: "String" + } + } +}; + +export const objectId10: coreHttp.OperationURLParameter = { + parameterPath: "objectId", + mapper: { + serializedName: "objectId", + required: true, + type: { + name: "String" + } + } +}; + +export const objectId11: coreHttp.OperationURLParameter = { + parameterPath: "objectId", + mapper: { + serializedName: "objectId", + required: true, + type: { + name: "String" + } + } +}; + +export const parameters11: coreHttp.OperationParameter = { + parameterPath: "parameters", + mapper: Mappers.KeyCredentialsUpdateParameters +}; + +export const objectId12: coreHttp.OperationURLParameter = { + parameterPath: "objectId", + mapper: { + serializedName: "objectId", + required: true, + type: { + name: "String" + } + } +}; + +export const objectId13: coreHttp.OperationURLParameter = { + parameterPath: "objectId", + mapper: { + serializedName: "objectId", + required: true, + type: { + name: "String" + } + } +}; + +export const parameters12: coreHttp.OperationParameter = { + parameterPath: "parameters", + mapper: Mappers.PasswordCredentialsUpdateParameters +}; + +export const parameters13: coreHttp.OperationParameter = { + parameterPath: "parameters", + mapper: Mappers.UserCreateParameters +}; + +export const expand: coreHttp.OperationQueryParameter = { + parameterPath: ["options", "expand"], + mapper: { + serializedName: "$expand", + type: { + name: "String" + } + } +}; + +export const upnOrObjectId: coreHttp.OperationURLParameter = { + parameterPath: "upnOrObjectId", + mapper: { + serializedName: "upnOrObjectId", + required: true, + type: { + name: "String" + } + } +}; + +export const parameters14: coreHttp.OperationParameter = { + parameterPath: "parameters", + mapper: Mappers.UserUpdateParameters +}; + +export const upnOrObjectId1: coreHttp.OperationURLParameter = { + parameterPath: "upnOrObjectId", + mapper: { + serializedName: "upnOrObjectId", + required: true, + type: { + name: "String" + } + } +}; + +export const upnOrObjectId2: coreHttp.OperationURLParameter = { + parameterPath: "upnOrObjectId", + mapper: { + serializedName: "upnOrObjectId", + required: true, + type: { + name: "String" + } + } +}; + +export const parameters15: coreHttp.OperationParameter = { + parameterPath: "parameters", + mapper: Mappers.UserGetMemberGroupsParameters +}; + +export const objectId14: coreHttp.OperationURLParameter = { + parameterPath: "objectId", + mapper: { + serializedName: "objectId", + required: true, + type: { + name: "String" + } + } +}; + +export const parameters16: coreHttp.OperationParameter = { + parameterPath: "parameters", + mapper: Mappers.GetObjectsParameters +}; + +export const domainName: coreHttp.OperationURLParameter = { + parameterPath: "domainName", + mapper: { + serializedName: "domainName", + required: true, + type: { + name: "String" + } + } +}; + +export const filter2: coreHttp.OperationQueryParameter = { + parameterPath: ["options", "filter"], + mapper: { + serializedName: "$filter", + type: { + name: "String" + } + } +}; + +export const body: coreHttp.OperationParameter = { + parameterPath: ["options", "body"], + mapper: Mappers.OAuth2PermissionGrant +}; + +export const objectId15: coreHttp.OperationURLParameter = { + parameterPath: "objectId", + mapper: { + serializedName: "objectId", + required: true, + type: { + name: "String" + } + } +}; diff --git a/test/smoke/generated/graphrbac-data-plane/src/operations/applications.ts b/test/smoke/generated/graphrbac-data-plane/src/operations/applications.ts new file mode 100644 index 0000000000..f04f6f62d8 --- /dev/null +++ b/test/smoke/generated/graphrbac-data-plane/src/operations/applications.ts @@ -0,0 +1,603 @@ +/* + * 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 * as coreHttp from "@azure/core-http"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { GraphRbacManagementClient } from "../graphRbacManagementClient"; +import { + ApplicationCreateParameters, + ApplicationsCreateResponse, + ApplicationsListOptionalParams, + ApplicationsListResponse, + ApplicationsGetResponse, + ApplicationUpdateParameters, + ApplicationsListOwnersResponse, + AddOwnerParameters, + ApplicationsListKeyCredentialsResponse, + KeyCredentialsUpdateParameters, + ApplicationsListPasswordCredentialsResponse, + PasswordCredentialsUpdateParameters, + ApplicationsGetServicePrincipalsIdByAppIdResponse, + ApplicationsListNextResponse, + ApplicationsListOwnersNextResponse +} from "../models"; + +/** + * Class representing a Applications. + */ +export class Applications { + private readonly client: GraphRbacManagementClient; + + /** + * Initialize a new instance of the class Applications class. + * @param client Reference to the service client + */ + constructor(client: GraphRbacManagementClient) { + this.client = client; + } + + /** + * Create a new application. + * @param parameters The parameters for creating an application. + * @param options The options parameters. + */ + create( + parameters: ApplicationCreateParameters, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { parameters, options: operationOptions }, + createOperationSpec + ) as Promise; + } + + /** + * Lists applications by filter parameters. + * @param options The options parameters. + */ + list( + options?: ApplicationsListOptionalParams + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { options: operationOptions }, + listOperationSpec + ) as Promise; + } + + /** + * Delete an application. + * @param applicationObjectId Application object ID. + * @param options The options parameters. + */ + delete( + applicationObjectId: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { applicationObjectId, options: operationOptions }, + deleteOperationSpec + ) as Promise; + } + + /** + * Get an application by object ID. + * @param applicationObjectId Application object ID. + * @param options The options parameters. + */ + get( + applicationObjectId: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { applicationObjectId, options: operationOptions }, + getOperationSpec + ) as Promise; + } + + /** + * Update an existing application. + * @param applicationObjectId Application object ID. + * @param parameters Parameters to update an existing application. + * @param options The options parameters. + */ + patch( + applicationObjectId: string, + parameters: ApplicationUpdateParameters, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { applicationObjectId, parameters, options: operationOptions }, + patchOperationSpec + ) as Promise; + } + + /** + * The owners are a set of non-admin users who are allowed to modify this object. + * @param applicationObjectId The object ID of the application for which to get owners. + * @param options The options parameters. + */ + listOwners( + applicationObjectId: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { applicationObjectId, options: operationOptions }, + listOwnersOperationSpec + ) as Promise; + } + + /** + * Add an owner to an application. + * @param parameters The URL of the owner object, such as + * https://graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd. + * @param applicationObjectId The object ID of the application to which to add the owner. + * @param options The options parameters. + */ + addOwner( + parameters: AddOwnerParameters, + applicationObjectId: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { parameters, applicationObjectId, options: operationOptions }, + addOwnerOperationSpec + ) as Promise; + } + + /** + * Remove a member from owners. + * @param applicationObjectId The object ID of the application from which to remove the owner. + * @param ownerObjectId Owner object id + * @param options The options parameters. + */ + removeOwner( + applicationObjectId: string, + ownerObjectId: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { applicationObjectId, ownerObjectId, options: operationOptions }, + removeOwnerOperationSpec + ) as Promise; + } + + /** + * Get the keyCredentials associated with an application. + * @param applicationObjectId Application object ID. + * @param options The options parameters. + */ + listKeyCredentials( + applicationObjectId: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { applicationObjectId, options: operationOptions }, + listKeyCredentialsOperationSpec + ) as Promise; + } + + /** + * Update the keyCredentials associated with an application. + * @param applicationObjectId Application object ID. + * @param parameters Parameters to update the keyCredentials of an existing application. + * @param options The options parameters. + */ + updateKeyCredentials( + applicationObjectId: string, + parameters: KeyCredentialsUpdateParameters, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { applicationObjectId, parameters, options: operationOptions }, + updateKeyCredentialsOperationSpec + ) as Promise; + } + + /** + * Get the passwordCredentials associated with an application. + * @param applicationObjectId Application object ID. + * @param options The options parameters. + */ + listPasswordCredentials( + applicationObjectId: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { applicationObjectId, options: operationOptions }, + listPasswordCredentialsOperationSpec + ) as Promise; + } + + /** + * Update passwordCredentials associated with an application. + * @param applicationObjectId Application object ID. + * @param parameters Parameters to update passwordCredentials of an existing application. + * @param options The options parameters. + */ + updatePasswordCredentials( + applicationObjectId: string, + parameters: PasswordCredentialsUpdateParameters, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { applicationObjectId, parameters, options: operationOptions }, + updatePasswordCredentialsOperationSpec + ) as Promise; + } + + /** + * Gets an object id for a given application id from the current tenant. + * @param applicationID The application ID. + * @param options The options parameters. + */ + getServicePrincipalsIdByAppId( + applicationID: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { applicationID, options: operationOptions }, + getServicePrincipalsIdByAppIdOperationSpec + ) as Promise; + } + + /** + * Gets a list of applications from the current tenant. + * @param nextLink Next link for the list operation. + * @param options The options parameters. + */ + listNext( + nextLink: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { nextLink, options: operationOptions }, + listNextOperationSpec + ) as Promise; + } + + /** + * ListOwnersNext + * @param applicationObjectId The object ID of the application for which to get owners. + * @param nextLink The nextLink from the previous successful call to the ListOwners method. + * @param options The options parameters. + */ + listOwnersNext( + applicationObjectId: string, + nextLink: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { applicationObjectId, nextLink, options: operationOptions }, + listOwnersNextOperationSpec + ) as Promise; + } +} +// Operation Specifications + +const serializer = new coreHttp.Serializer(Mappers, /* isXml */ false); + +const createOperationSpec: coreHttp.OperationSpec = { + path: "/{tenantID}/applications", + httpMethod: "POST", + responses: { + 201: { + bodyMapper: Mappers.Application + }, + default: { + bodyMapper: Mappers.GraphError + } + }, + requestBody: Parameters.parameters, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.tenantID], + headerParameters: [Parameters.contentType], + serializer +}; +const listOperationSpec: coreHttp.OperationSpec = { + path: "/{tenantID}/applications", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ApplicationListResult + }, + default: { + bodyMapper: Mappers.GraphError + } + }, + queryParameters: [Parameters.apiVersion, Parameters.filter], + urlParameters: [Parameters.$host, Parameters.tenantID], + serializer +}; +const deleteOperationSpec: coreHttp.OperationSpec = { + path: "/{tenantID}/applications/{applicationObjectId}", + httpMethod: "DELETE", + responses: { + 204: {}, + default: { + bodyMapper: Mappers.GraphError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.tenantID, + Parameters.applicationObjectId + ], + serializer +}; +const getOperationSpec: coreHttp.OperationSpec = { + path: "/{tenantID}/applications/{applicationObjectId}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.Application + }, + default: { + bodyMapper: Mappers.GraphError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.tenantID, + Parameters.applicationObjectId + ], + serializer +}; +const patchOperationSpec: coreHttp.OperationSpec = { + path: "/{tenantID}/applications/{applicationObjectId}", + httpMethod: "PATCH", + responses: { + 204: {}, + default: { + bodyMapper: Mappers.GraphError + } + }, + requestBody: Parameters.parameters1, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.tenantID, + Parameters.applicationObjectId + ], + headerParameters: [Parameters.contentType], + serializer +}; +const listOwnersOperationSpec: coreHttp.OperationSpec = { + path: "/{tenantID}/applications/{applicationObjectId}/owners", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DirectoryObjectListResult + }, + default: { + bodyMapper: Mappers.GraphError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.tenantID, + Parameters.applicationObjectId1 + ], + serializer +}; +const addOwnerOperationSpec: coreHttp.OperationSpec = { + path: "/{tenantID}/applications/{applicationObjectId}/$links/owners", + httpMethod: "POST", + responses: { + 204: {}, + default: { + bodyMapper: Mappers.GraphError + } + }, + requestBody: Parameters.parameters2, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.tenantID, + Parameters.applicationObjectId2 + ], + headerParameters: [Parameters.contentType], + serializer +}; +const removeOwnerOperationSpec: coreHttp.OperationSpec = { + path: + "/{tenantID}/applications/{applicationObjectId}/$links/owners/{ownerObjectId}", + httpMethod: "DELETE", + responses: { + 204: {}, + default: { + bodyMapper: Mappers.GraphError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.tenantID, + Parameters.applicationObjectId3, + Parameters.ownerObjectId + ], + serializer +}; +const listKeyCredentialsOperationSpec: coreHttp.OperationSpec = { + path: "/{tenantID}/applications/{applicationObjectId}/keyCredentials", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.KeyCredentialListResult + }, + default: { + bodyMapper: Mappers.GraphError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.tenantID, + Parameters.applicationObjectId + ], + serializer +}; +const updateKeyCredentialsOperationSpec: coreHttp.OperationSpec = { + path: "/{tenantID}/applications/{applicationObjectId}/keyCredentials", + httpMethod: "PATCH", + responses: { + 204: {}, + default: { + bodyMapper: Mappers.GraphError + } + }, + requestBody: Parameters.parameters3, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.tenantID, + Parameters.applicationObjectId + ], + headerParameters: [Parameters.contentType], + serializer +}; +const listPasswordCredentialsOperationSpec: coreHttp.OperationSpec = { + path: "/{tenantID}/applications/{applicationObjectId}/passwordCredentials", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.PasswordCredentialListResult + }, + default: { + bodyMapper: Mappers.GraphError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.tenantID, + Parameters.applicationObjectId + ], + serializer +}; +const updatePasswordCredentialsOperationSpec: coreHttp.OperationSpec = { + path: "/{tenantID}/applications/{applicationObjectId}/passwordCredentials", + httpMethod: "PATCH", + responses: { + 204: {}, + default: { + bodyMapper: Mappers.GraphError + } + }, + requestBody: Parameters.parameters4, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.tenantID, + Parameters.applicationObjectId + ], + headerParameters: [Parameters.contentType], + serializer +}; +const getServicePrincipalsIdByAppIdOperationSpec: coreHttp.OperationSpec = { + path: "/{tenantID}/servicePrincipalsByAppId/{applicationID}/objectId", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ServicePrincipalObjectResult + }, + default: { + bodyMapper: Mappers.GraphError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.tenantID, + Parameters.applicationID + ], + serializer +}; +const listNextOperationSpec: coreHttp.OperationSpec = { + path: "/{tenantID}/{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ApplicationListResult + }, + default: { + bodyMapper: Mappers.GraphError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.tenantID, Parameters.nextLink], + serializer +}; +const listOwnersNextOperationSpec: coreHttp.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DirectoryObjectListResult + }, + default: { + bodyMapper: Mappers.GraphError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.tenantID, + Parameters.applicationObjectId1, + Parameters.nextLink1 + ], + serializer +}; diff --git a/test/smoke/generated/graphrbac-data-plane/src/operations/deletedApplications.ts b/test/smoke/generated/graphrbac-data-plane/src/operations/deletedApplications.ts new file mode 100644 index 0000000000..092adb537b --- /dev/null +++ b/test/smoke/generated/graphrbac-data-plane/src/operations/deletedApplications.ts @@ -0,0 +1,169 @@ +/* + * 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 * as coreHttp from "@azure/core-http"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { GraphRbacManagementClient } from "../graphRbacManagementClient"; +import { + DeletedApplicationsRestoreResponse, + DeletedApplicationsListOptionalParams, + DeletedApplicationsListResponse, + DeletedApplicationsListNextResponse +} from "../models"; + +/** + * Class representing a DeletedApplications. + */ +export class DeletedApplications { + private readonly client: GraphRbacManagementClient; + + /** + * Initialize a new instance of the class DeletedApplications class. + * @param client Reference to the service client + */ + constructor(client: GraphRbacManagementClient) { + this.client = client; + } + + /** + * Restores the deleted application in the directory. + * @param objectId Application object ID. + * @param options The options parameters. + */ + restore( + objectId: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { objectId, options: operationOptions }, + restoreOperationSpec + ) as Promise; + } + + /** + * Gets a list of deleted applications in the directory. + * @param options The options parameters. + */ + list( + options?: DeletedApplicationsListOptionalParams + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { options: operationOptions }, + listOperationSpec + ) as Promise; + } + + /** + * Hard-delete an application. + * @param applicationObjectId Application object ID. + * @param options The options parameters. + */ + hardDelete( + applicationObjectId: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { applicationObjectId, options: operationOptions }, + hardDeleteOperationSpec + ) as Promise; + } + + /** + * Gets a list of deleted applications in the directory. + * @param nextLink Next link for the list operation. + * @param options The options parameters. + */ + listNext( + nextLink: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { nextLink, options: operationOptions }, + listNextOperationSpec + ) as Promise; + } +} +// Operation Specifications + +const serializer = new coreHttp.Serializer(Mappers, /* isXml */ false); + +const restoreOperationSpec: coreHttp.OperationSpec = { + path: "/{tenantID}/deletedApplications/{objectId}/restore", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.Application + }, + default: { + bodyMapper: Mappers.GraphError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.tenantID, Parameters.objectId], + serializer +}; +const listOperationSpec: coreHttp.OperationSpec = { + path: "/{tenantID}/deletedApplications", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ApplicationListResult + }, + default: { + bodyMapper: Mappers.GraphError + } + }, + queryParameters: [Parameters.apiVersion, Parameters.filter1], + urlParameters: [Parameters.$host, Parameters.tenantID], + serializer +}; +const hardDeleteOperationSpec: coreHttp.OperationSpec = { + path: "/{tenantID}/deletedApplications/{applicationObjectId}", + httpMethod: "DELETE", + responses: { + 204: {}, + default: { + bodyMapper: Mappers.GraphError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.tenantID, + Parameters.applicationObjectId + ], + serializer +}; +const listNextOperationSpec: coreHttp.OperationSpec = { + path: "/{tenantID}/{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ApplicationListResult + }, + default: { + bodyMapper: Mappers.GraphError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.tenantID, Parameters.nextLink], + serializer +}; diff --git a/test/smoke/generated/graphrbac-data-plane/src/operations/domains.ts b/test/smoke/generated/graphrbac-data-plane/src/operations/domains.ts new file mode 100644 index 0000000000..501ce11c18 --- /dev/null +++ b/test/smoke/generated/graphrbac-data-plane/src/operations/domains.ts @@ -0,0 +1,92 @@ +/* + * 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 * as coreHttp from "@azure/core-http"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { GraphRbacManagementClient } from "../graphRbacManagementClient"; +import { + DomainsListOptionalParams, + DomainsListResponse, + DomainsGetResponse +} from "../models"; + +/** + * Class representing a Domains. + */ +export class Domains { + private readonly client: GraphRbacManagementClient; + + /** + * Initialize a new instance of the class Domains class. + * @param client Reference to the service client + */ + constructor(client: GraphRbacManagementClient) { + this.client = client; + } + + /** + * Gets a list of domains for the current tenant. + * @param options The options parameters. + */ + list(options?: DomainsListOptionalParams): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { options: operationOptions }, + listOperationSpec + ) as Promise; + } + + /** + * Gets a specific domain in the current tenant. + * @param domainName name of the domain. + * @param options The options parameters. + */ + get( + domainName: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { domainName, options: operationOptions }, + getOperationSpec + ) as Promise; + } +} +// Operation Specifications + +const serializer = new coreHttp.Serializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreHttp.OperationSpec = { + path: "/{tenantID}/domains", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DomainListResult + } + }, + queryParameters: [Parameters.apiVersion, Parameters.filter1], + urlParameters: [Parameters.$host, Parameters.tenantID], + serializer +}; +const getOperationSpec: coreHttp.OperationSpec = { + path: "/{tenantID}/domains/{domainName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.Domain + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.tenantID, Parameters.domainName], + serializer +}; diff --git a/test/smoke/generated/graphrbac-data-plane/src/operations/groups.ts b/test/smoke/generated/graphrbac-data-plane/src/operations/groups.ts new file mode 100644 index 0000000000..acb154f564 --- /dev/null +++ b/test/smoke/generated/graphrbac-data-plane/src/operations/groups.ts @@ -0,0 +1,574 @@ +/* + * 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 * as coreHttp from "@azure/core-http"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { GraphRbacManagementClient } from "../graphRbacManagementClient"; +import { + CheckGroupMembershipParameters, + GroupsIsMemberOfResponse, + GroupAddMemberParameters, + GroupCreateParameters, + GroupsCreateResponse, + GroupsListOptionalParams, + GroupsListResponse, + GroupsGetGroupMembersResponse, + GroupsGetResponse, + GroupGetMemberGroupsParameters, + GroupsGetMemberGroupsResponse, + GroupsListOwnersResponse, + AddOwnerParameters, + GroupsListNextResponse, + GroupsGetGroupMembersNextResponse, + GroupsListOwnersNextResponse +} from "../models"; + +/** + * Class representing a Groups. + */ +export class Groups { + private readonly client: GraphRbacManagementClient; + + /** + * Initialize a new instance of the class Groups class. + * @param client Reference to the service client + */ + constructor(client: GraphRbacManagementClient) { + this.client = client; + } + + /** + * Checks whether the specified user, group, contact, or service principal is a direct or transitive + * member of the specified group. + * @param parameters The check group membership parameters. + * @param options The options parameters. + */ + isMemberOf( + parameters: CheckGroupMembershipParameters, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { parameters, options: operationOptions }, + isMemberOfOperationSpec + ) as Promise; + } + + /** + * Remove a member from a group. + * @param groupObjectId The object ID of the group from which to remove the member. + * @param memberObjectId Member object id + * @param options The options parameters. + */ + removeMember( + groupObjectId: string, + memberObjectId: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { groupObjectId, memberObjectId, options: operationOptions }, + removeMemberOperationSpec + ) as Promise; + } + + /** + * Add a member to a group. + * @param parameters The URL of the member object, such as + * https://graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd. + * @param groupObjectId The object ID of the group to which to add the member. + * @param options The options parameters. + */ + addMember( + parameters: GroupAddMemberParameters, + groupObjectId: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { parameters, groupObjectId, options: operationOptions }, + addMemberOperationSpec + ) as Promise; + } + + /** + * Create a group in the directory. + * @param parameters The parameters for the group to create. + * @param options The options parameters. + */ + create( + parameters: GroupCreateParameters, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { parameters, options: operationOptions }, + createOperationSpec + ) as Promise; + } + + /** + * Gets list of groups for the current tenant. + * @param options The options parameters. + */ + list(options?: GroupsListOptionalParams): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { options: operationOptions }, + listOperationSpec + ) as Promise; + } + + /** + * Gets the members of a group. + * @param objectId The object ID of the group whose members should be retrieved. + * @param options The options parameters. + */ + getGroupMembers( + objectId: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { objectId, options: operationOptions }, + getGroupMembersOperationSpec + ) as Promise; + } + + /** + * Gets group information from the directory. + * @param objectId The object ID of the user for which to get group information. + * @param options The options parameters. + */ + get( + objectId: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { objectId, options: operationOptions }, + getOperationSpec + ) as Promise; + } + + /** + * Delete a group from the directory. + * @param objectId The object ID of the group to delete. + * @param options The options parameters. + */ + delete( + objectId: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { objectId, options: operationOptions }, + deleteOperationSpec + ) as Promise; + } + + /** + * Gets a collection of object IDs of groups of which the specified group is a member. + * @param parameters Group filtering parameters. + * @param objectId The object ID of the group for which to get group membership. + * @param options The options parameters. + */ + getMemberGroups( + parameters: GroupGetMemberGroupsParameters, + objectId: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { parameters, objectId, options: operationOptions }, + getMemberGroupsOperationSpec + ) as Promise; + } + + /** + * The owners are a set of non-admin users who are allowed to modify this object. + * @param objectId The object ID of the group for which to get owners. + * @param options The options parameters. + */ + listOwners( + objectId: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { objectId, options: operationOptions }, + listOwnersOperationSpec + ) as Promise; + } + + /** + * Add an owner to a group. + * @param parameters The URL of the owner object, such as + * https://graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd. + * @param objectId The object ID of the application to which to add the owner. + * @param options The options parameters. + */ + addOwner( + parameters: AddOwnerParameters, + objectId: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { parameters, objectId, options: operationOptions }, + addOwnerOperationSpec + ) as Promise; + } + + /** + * Remove a member from owners. + * @param ownerObjectId Owner object id + * @param objectId The object ID of the group from which to remove the owner. + * @param options The options parameters. + */ + removeOwner( + ownerObjectId: string, + objectId: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { ownerObjectId, objectId, options: operationOptions }, + removeOwnerOperationSpec + ) as Promise; + } + + /** + * Gets a list of groups for the current tenant. + * @param nextLink Next link for the list operation. + * @param options The options parameters. + */ + listNext( + nextLink: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { nextLink, options: operationOptions }, + listNextOperationSpec + ) as Promise; + } + + /** + * Gets the members of a group. + * @param nextLink Next link for the list operation. + * @param options The options parameters. + */ + getGroupMembersNext( + nextLink: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { nextLink, options: operationOptions }, + getGroupMembersNextOperationSpec + ) as Promise; + } + + /** + * ListOwnersNext + * @param nextLink The nextLink from the previous successful call to the ListOwners method. + * @param objectId The object ID of the group for which to get owners. + * @param options The options parameters. + */ + listOwnersNext( + nextLink: string, + objectId: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { nextLink, objectId, options: operationOptions }, + listOwnersNextOperationSpec + ) as Promise; + } +} +// Operation Specifications + +const serializer = new coreHttp.Serializer(Mappers, /* isXml */ false); + +const isMemberOfOperationSpec: coreHttp.OperationSpec = { + path: "/{tenantID}/isMemberOf", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.CheckGroupMembershipResult + }, + default: { + bodyMapper: Mappers.GraphError + } + }, + requestBody: Parameters.parameters5, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.tenantID], + headerParameters: [Parameters.contentType], + serializer +}; +const removeMemberOperationSpec: coreHttp.OperationSpec = { + path: "/{tenantID}/groups/{groupObjectId}/$links/members/{memberObjectId}", + httpMethod: "DELETE", + responses: { + 204: {}, + default: { + bodyMapper: Mappers.GraphError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.tenantID, + Parameters.groupObjectId, + Parameters.memberObjectId + ], + serializer +}; +const addMemberOperationSpec: coreHttp.OperationSpec = { + path: "/{tenantID}/groups/{groupObjectId}/$links/members", + httpMethod: "POST", + responses: { + 204: {}, + default: { + bodyMapper: Mappers.GraphError + } + }, + requestBody: Parameters.parameters6, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.tenantID, + Parameters.groupObjectId1 + ], + headerParameters: [Parameters.contentType], + serializer +}; +const createOperationSpec: coreHttp.OperationSpec = { + path: "/{tenantID}/groups", + httpMethod: "POST", + responses: { + 201: { + bodyMapper: Mappers.ADGroup + }, + default: { + bodyMapper: Mappers.GraphError + } + }, + requestBody: Parameters.parameters7, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.tenantID], + headerParameters: [Parameters.contentType], + serializer +}; +const listOperationSpec: coreHttp.OperationSpec = { + path: "/{tenantID}/groups", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.GroupListResult + }, + default: { + bodyMapper: Mappers.GraphError + } + }, + queryParameters: [Parameters.apiVersion, Parameters.filter1], + urlParameters: [Parameters.$host, Parameters.tenantID], + serializer +}; +const getGroupMembersOperationSpec: coreHttp.OperationSpec = { + path: "/{tenantID}/groups/{objectId}/members", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DirectoryObjectListResult + }, + default: { + bodyMapper: Mappers.GraphError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.tenantID, Parameters.objectId1], + serializer +}; +const getOperationSpec: coreHttp.OperationSpec = { + path: "/{tenantID}/groups/{objectId}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ADGroup + }, + default: { + bodyMapper: Mappers.GraphError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.tenantID, Parameters.objectId2], + serializer +}; +const deleteOperationSpec: coreHttp.OperationSpec = { + path: "/{tenantID}/groups/{objectId}", + httpMethod: "DELETE", + responses: { + 204: {}, + default: { + bodyMapper: Mappers.GraphError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.tenantID, Parameters.objectId3], + serializer +}; +const getMemberGroupsOperationSpec: coreHttp.OperationSpec = { + path: "/{tenantID}/groups/{objectId}/getMemberGroups", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.GroupGetMemberGroupsResult + }, + default: { + bodyMapper: Mappers.GraphError + } + }, + requestBody: Parameters.parameters8, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.tenantID, Parameters.objectId4], + headerParameters: [Parameters.contentType], + serializer +}; +const listOwnersOperationSpec: coreHttp.OperationSpec = { + path: "/{tenantID}/groups/{objectId}/owners", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DirectoryObjectListResult + }, + default: { + bodyMapper: Mappers.GraphError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.tenantID, Parameters.objectId5], + serializer +}; +const addOwnerOperationSpec: coreHttp.OperationSpec = { + path: "/{tenantID}/groups/{objectId}/$links/owners", + httpMethod: "POST", + responses: { + 204: {}, + default: { + bodyMapper: Mappers.GraphError + } + }, + requestBody: Parameters.parameters2, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.tenantID, Parameters.objectId6], + headerParameters: [Parameters.contentType], + serializer +}; +const removeOwnerOperationSpec: coreHttp.OperationSpec = { + path: "/{tenantID}/groups/{objectId}/$links/owners/{ownerObjectId}", + httpMethod: "DELETE", + responses: { + 204: {}, + default: { + bodyMapper: Mappers.GraphError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.tenantID, + Parameters.ownerObjectId, + Parameters.objectId7 + ], + serializer +}; +const listNextOperationSpec: coreHttp.OperationSpec = { + path: "/{tenantID}/{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.GroupListResult + }, + default: { + bodyMapper: Mappers.GraphError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.tenantID, Parameters.nextLink], + serializer +}; +const getGroupMembersNextOperationSpec: coreHttp.OperationSpec = { + path: "/{tenantID}/{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DirectoryObjectListResult + }, + default: { + bodyMapper: Mappers.GraphError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.tenantID, Parameters.nextLink], + serializer +}; +const listOwnersNextOperationSpec: coreHttp.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DirectoryObjectListResult + }, + default: { + bodyMapper: Mappers.GraphError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.tenantID, + Parameters.nextLink1, + Parameters.objectId5 + ], + serializer +}; diff --git a/test/smoke/generated/graphrbac-data-plane/src/operations/index.ts b/test/smoke/generated/graphrbac-data-plane/src/operations/index.ts new file mode 100644 index 0000000000..5c9833feb4 --- /dev/null +++ b/test/smoke/generated/graphrbac-data-plane/src/operations/index.ts @@ -0,0 +1,17 @@ +/* + * 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. + */ + +export * from "./signedInUser"; +export * from "./applications"; +export * from "./deletedApplications"; +export * from "./groups"; +export * from "./servicePrincipals"; +export * from "./users"; +export * from "./objects"; +export * from "./domains"; +export * from "./oAuth2PermissionGrant"; diff --git a/test/smoke/generated/graphrbac-data-plane/src/operations/oAuth2PermissionGrant.ts b/test/smoke/generated/graphrbac-data-plane/src/operations/oAuth2PermissionGrant.ts new file mode 100644 index 0000000000..b330dcf2ea --- /dev/null +++ b/test/smoke/generated/graphrbac-data-plane/src/operations/oAuth2PermissionGrant.ts @@ -0,0 +1,160 @@ +/* + * 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 * as coreHttp from "@azure/core-http"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { GraphRbacManagementClient } from "../graphRbacManagementClient"; +import { + OAuth2PermissionGrantListOptionalParams, + OAuth2PermissionGrantListResponse, + OAuth2PermissionGrantCreateOptionalParams, + OAuth2PermissionGrantCreateResponse, + OAuth2PermissionGrantListNextResponse +} from "../models"; + +/** + * Class representing a OAuth2PermissionGrant. + */ +export class OAuth2PermissionGrant { + private readonly client: GraphRbacManagementClient; + + /** + * Initialize a new instance of the class OAuth2PermissionGrant class. + * @param client Reference to the service client + */ + constructor(client: GraphRbacManagementClient) { + this.client = client; + } + + /** + * Queries OAuth2 permissions grants for the relevant SP ObjectId of an app. + * @param options The options parameters. + */ + list( + options?: OAuth2PermissionGrantListOptionalParams + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { options: operationOptions }, + listOperationSpec + ) as Promise; + } + + /** + * Grants OAuth2 permissions for the relevant resource Ids of an app. + * @param options The options parameters. + */ + create( + options?: OAuth2PermissionGrantCreateOptionalParams + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { options: operationOptions }, + createOperationSpec + ) as Promise; + } + + /** + * Delete a OAuth2 permission grant for the relevant resource Ids of an app. + * @param objectId The object ID of a permission grant. + * @param options The options parameters. + */ + delete( + objectId: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { objectId, options: operationOptions }, + deleteOperationSpec + ) as Promise; + } + + /** + * Gets the next page of OAuth2 permission grants + * @param nextLink Next link for the list operation. + * @param options The options parameters. + */ + listNext( + nextLink: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { nextLink, options: operationOptions }, + listNextOperationSpec + ) as Promise; + } +} +// Operation Specifications + +const serializer = new coreHttp.Serializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreHttp.OperationSpec = { + path: "/{tenantID}/oauth2PermissionGrants", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.OAuth2PermissionGrantListResult + } + }, + queryParameters: [Parameters.apiVersion, Parameters.filter2], + urlParameters: [Parameters.$host, Parameters.tenantID], + serializer +}; +const createOperationSpec: coreHttp.OperationSpec = { + path: "/{tenantID}/oauth2PermissionGrants", + httpMethod: "POST", + responses: { + 201: { + bodyMapper: Mappers.OAuth2PermissionGrant + } + }, + requestBody: Parameters.body, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.tenantID], + headerParameters: [Parameters.contentType], + serializer +}; +const deleteOperationSpec: coreHttp.OperationSpec = { + path: "/{tenantID}/oauth2PermissionGrants/{objectId}", + httpMethod: "DELETE", + responses: { + 204: {}, + default: { + bodyMapper: Mappers.GraphError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.tenantID, Parameters.objectId15], + serializer +}; +const listNextOperationSpec: coreHttp.OperationSpec = { + path: "/{tenantID}/{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.OAuth2PermissionGrantListResult + }, + default: { + bodyMapper: Mappers.GraphError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.tenantID, Parameters.nextLink], + serializer +}; diff --git a/test/smoke/generated/graphrbac-data-plane/src/operations/objects.ts b/test/smoke/generated/graphrbac-data-plane/src/operations/objects.ts new file mode 100644 index 0000000000..4a660553fa --- /dev/null +++ b/test/smoke/generated/graphrbac-data-plane/src/operations/objects.ts @@ -0,0 +1,99 @@ +/* + * 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 * as coreHttp from "@azure/core-http"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { GraphRbacManagementClient } from "../graphRbacManagementClient"; +import { + GetObjectsParameters, + ObjectsGetObjectsByObjectIdsResponse, + ObjectsGetObjectsByObjectIdsNextResponse +} from "../models"; + +/** + * Class representing a Objects. + */ +export class Objects { + private readonly client: GraphRbacManagementClient; + + /** + * Initialize a new instance of the class Objects class. + * @param client Reference to the service client + */ + constructor(client: GraphRbacManagementClient) { + this.client = client; + } + + /** + * Gets the directory objects specified in a list of object IDs. You can also specify which resource + * collections (users, groups, etc.) should be searched by specifying the optional types parameter. + * @param parameters Objects filtering parameters. + * @param options The options parameters. + */ + getObjectsByObjectIds( + parameters: GetObjectsParameters, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { parameters, options: operationOptions }, + getObjectsByObjectIdsOperationSpec + ) as Promise; + } + + /** + * Gets AD group membership for the specified AD object IDs. + * @param nextLink Next link for the list operation. + * @param options The options parameters. + */ + getObjectsByObjectIdsNext( + nextLink: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { nextLink, options: operationOptions }, + getObjectsByObjectIdsNextOperationSpec + ) as Promise; + } +} +// Operation Specifications + +const serializer = new coreHttp.Serializer(Mappers, /* isXml */ false); + +const getObjectsByObjectIdsOperationSpec: coreHttp.OperationSpec = { + path: "/{tenantID}/getObjectsByObjectIds", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.DirectoryObjectListResult + } + }, + requestBody: Parameters.parameters16, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.tenantID], + headerParameters: [Parameters.contentType], + serializer +}; +const getObjectsByObjectIdsNextOperationSpec: coreHttp.OperationSpec = { + path: "/{tenantID}/{nextLink}", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.DirectoryObjectListResult + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.tenantID, Parameters.nextLink], + serializer +}; diff --git a/test/smoke/generated/graphrbac-data-plane/src/operations/servicePrincipals.ts b/test/smoke/generated/graphrbac-data-plane/src/operations/servicePrincipals.ts new file mode 100644 index 0000000000..f1c38a6d56 --- /dev/null +++ b/test/smoke/generated/graphrbac-data-plane/src/operations/servicePrincipals.ts @@ -0,0 +1,454 @@ +/* + * 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 * as coreHttp from "@azure/core-http"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { GraphRbacManagementClient } from "../graphRbacManagementClient"; +import { + ServicePrincipalCreateParameters, + ServicePrincipalsCreateResponse, + ServicePrincipalsListOptionalParams, + ServicePrincipalsListResponse, + ServicePrincipalBase, + ServicePrincipalsGetResponse, + ServicePrincipalsListOwnersResponse, + ServicePrincipalsListKeyCredentialsResponse, + KeyCredentialsUpdateParameters, + ServicePrincipalsListPasswordCredentialsResponse, + PasswordCredentialsUpdateParameters, + ServicePrincipalsListNextResponse, + ServicePrincipalsListOwnersNextResponse +} from "../models"; + +/** + * Class representing a ServicePrincipals. + */ +export class ServicePrincipals { + private readonly client: GraphRbacManagementClient; + + /** + * Initialize a new instance of the class ServicePrincipals class. + * @param client Reference to the service client + */ + constructor(client: GraphRbacManagementClient) { + this.client = client; + } + + /** + * Creates a service principal in the directory. + * @param parameters Parameters to create a service principal. + * @param options The options parameters. + */ + create( + parameters: ServicePrincipalCreateParameters, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { parameters, options: operationOptions }, + createOperationSpec + ) as Promise; + } + + /** + * Gets a list of service principals from the current tenant. + * @param options The options parameters. + */ + list( + options?: ServicePrincipalsListOptionalParams + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { options: operationOptions }, + listOperationSpec + ) as Promise; + } + + /** + * Updates a service principal in the directory. + * @param parameters Parameters to update a service principal. + * @param objectId The object ID of the service principal to delete. + * @param options The options parameters. + */ + update( + parameters: ServicePrincipalBase, + objectId: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { parameters, objectId, options: operationOptions }, + updateOperationSpec + ) as Promise; + } + + /** + * Deletes a service principal from the directory. + * @param objectId The object ID of the service principal to delete. + * @param options The options parameters. + */ + delete( + objectId: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { objectId, options: operationOptions }, + deleteOperationSpec + ) as Promise; + } + + /** + * Gets service principal information from the directory. Query by objectId or pass a filter to query + * by appId + * @param objectId The object ID of the service principal to get. + * @param options The options parameters. + */ + get( + objectId: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { objectId, options: operationOptions }, + getOperationSpec + ) as Promise; + } + + /** + * The owners are a set of non-admin users who are allowed to modify this object. + * @param objectId The object ID of the service principal for which to get owners. + * @param options The options parameters. + */ + listOwners( + objectId: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { objectId, options: operationOptions }, + listOwnersOperationSpec + ) as Promise; + } + + /** + * Get the keyCredentials associated with the specified service principal. + * @param objectId The object ID of the service principal for which to get keyCredentials. + * @param options The options parameters. + */ + listKeyCredentials( + objectId: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { objectId, options: operationOptions }, + listKeyCredentialsOperationSpec + ) as Promise; + } + + /** + * Update the keyCredentials associated with a service principal. + * @param parameters Parameters to update the keyCredentials of an existing service principal. + * @param objectId The object ID for which to get service principal information. + * @param options The options parameters. + */ + updateKeyCredentials( + parameters: KeyCredentialsUpdateParameters, + objectId: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { parameters, objectId, options: operationOptions }, + updateKeyCredentialsOperationSpec + ) as Promise; + } + + /** + * Gets the passwordCredentials associated with a service principal. + * @param objectId The object ID of the service principal. + * @param options The options parameters. + */ + listPasswordCredentials( + objectId: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { objectId, options: operationOptions }, + listPasswordCredentialsOperationSpec + ) as Promise; + } + + /** + * Updates the passwordCredentials associated with a service principal. + * @param objectId The object ID of the service principal. + * @param parameters Parameters to update the passwordCredentials of an existing service principal. + * @param options The options parameters. + */ + updatePasswordCredentials( + objectId: string, + parameters: PasswordCredentialsUpdateParameters, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { objectId, parameters, options: operationOptions }, + updatePasswordCredentialsOperationSpec + ) as Promise; + } + + /** + * Gets a list of service principals from the current tenant. + * @param nextLink Next link for the list operation. + * @param options The options parameters. + */ + listNext( + nextLink: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { nextLink, options: operationOptions }, + listNextOperationSpec + ) as Promise; + } + + /** + * ListOwnersNext + * @param nextLink The nextLink from the previous successful call to the ListOwners method. + * @param objectId The object ID of the service principal for which to get owners. + * @param options The options parameters. + */ + listOwnersNext( + nextLink: string, + objectId: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { nextLink, objectId, options: operationOptions }, + listOwnersNextOperationSpec + ) as Promise; + } +} +// Operation Specifications + +const serializer = new coreHttp.Serializer(Mappers, /* isXml */ false); + +const createOperationSpec: coreHttp.OperationSpec = { + path: "/{tenantID}/servicePrincipals", + httpMethod: "POST", + responses: { + 201: { + bodyMapper: Mappers.ServicePrincipal + }, + default: { + bodyMapper: Mappers.GraphError + } + }, + requestBody: Parameters.parameters9, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.tenantID], + headerParameters: [Parameters.contentType], + serializer +}; +const listOperationSpec: coreHttp.OperationSpec = { + path: "/{tenantID}/servicePrincipals", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ServicePrincipalListResult + }, + default: { + bodyMapper: Mappers.GraphError + } + }, + queryParameters: [Parameters.apiVersion, Parameters.filter1], + urlParameters: [Parameters.$host, Parameters.tenantID], + serializer +}; +const updateOperationSpec: coreHttp.OperationSpec = { + path: "/{tenantID}/servicePrincipals/{objectId}", + httpMethod: "PATCH", + responses: { + 204: {}, + default: { + bodyMapper: Mappers.GraphError + } + }, + requestBody: Parameters.parameters10, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.tenantID, Parameters.objectId8], + headerParameters: [Parameters.contentType], + serializer +}; +const deleteOperationSpec: coreHttp.OperationSpec = { + path: "/{tenantID}/servicePrincipals/{objectId}", + httpMethod: "DELETE", + responses: { + 204: {}, + default: { + bodyMapper: Mappers.GraphError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.tenantID, Parameters.objectId8], + serializer +}; +const getOperationSpec: coreHttp.OperationSpec = { + path: "/{tenantID}/servicePrincipals/{objectId}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ServicePrincipal + }, + default: { + bodyMapper: Mappers.GraphError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.tenantID, Parameters.objectId9], + serializer +}; +const listOwnersOperationSpec: coreHttp.OperationSpec = { + path: "/{tenantID}/servicePrincipals/{objectId}/owners", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DirectoryObjectListResult + }, + default: { + bodyMapper: Mappers.GraphError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.tenantID, Parameters.objectId10], + serializer +}; +const listKeyCredentialsOperationSpec: coreHttp.OperationSpec = { + path: "/{tenantID}/servicePrincipals/{objectId}/keyCredentials", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.KeyCredentialListResult + }, + default: { + bodyMapper: Mappers.GraphError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.tenantID, Parameters.objectId11], + serializer +}; +const updateKeyCredentialsOperationSpec: coreHttp.OperationSpec = { + path: "/{tenantID}/servicePrincipals/{objectId}/keyCredentials", + httpMethod: "PATCH", + responses: { + 204: {}, + default: { + bodyMapper: Mappers.GraphError + } + }, + requestBody: Parameters.parameters11, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.tenantID, Parameters.objectId12], + headerParameters: [Parameters.contentType], + serializer +}; +const listPasswordCredentialsOperationSpec: coreHttp.OperationSpec = { + path: "/{tenantID}/servicePrincipals/{objectId}/passwordCredentials", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.PasswordCredentialListResult + }, + default: { + bodyMapper: Mappers.GraphError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.tenantID, Parameters.objectId13], + serializer +}; +const updatePasswordCredentialsOperationSpec: coreHttp.OperationSpec = { + path: "/{tenantID}/servicePrincipals/{objectId}/passwordCredentials", + httpMethod: "PATCH", + responses: { + 204: {}, + default: { + bodyMapper: Mappers.GraphError + } + }, + requestBody: Parameters.parameters12, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.tenantID, Parameters.objectId13], + headerParameters: [Parameters.contentType], + serializer +}; +const listNextOperationSpec: coreHttp.OperationSpec = { + path: "/{tenantID}/{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ServicePrincipalListResult + }, + default: { + bodyMapper: Mappers.GraphError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.tenantID, Parameters.nextLink], + serializer +}; +const listOwnersNextOperationSpec: coreHttp.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DirectoryObjectListResult + }, + default: { + bodyMapper: Mappers.GraphError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.tenantID, + Parameters.nextLink1, + Parameters.objectId10 + ], + serializer +}; diff --git a/test/smoke/generated/graphrbac-data-plane/src/operations/signedInUser.ts b/test/smoke/generated/graphrbac-data-plane/src/operations/signedInUser.ts new file mode 100644 index 0000000000..75b3436c61 --- /dev/null +++ b/test/smoke/generated/graphrbac-data-plane/src/operations/signedInUser.ts @@ -0,0 +1,129 @@ +/* + * 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 * as coreHttp from "@azure/core-http"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { GraphRbacManagementClient } from "../graphRbacManagementClient"; +import { + SignedInUserGetResponse, + SignedInUserListOwnedObjectsResponse, + SignedInUserListOwnedObjectsNextResponse +} from "../models"; + +/** + * Class representing a SignedInUser. + */ +export class SignedInUser { + private readonly client: GraphRbacManagementClient; + + /** + * Initialize a new instance of the class SignedInUser class. + * @param client Reference to the service client + */ + constructor(client: GraphRbacManagementClient) { + this.client = client; + } + + /** + * Gets the details for the currently logged-in user. + * @param options The options parameters. + */ + get(options?: coreHttp.OperationOptions): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { options: operationOptions }, + getOperationSpec + ) as Promise; + } + + /** + * Get the list of directory objects that are owned by the user. + * @param options The options parameters. + */ + listOwnedObjects( + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { options: operationOptions }, + listOwnedObjectsOperationSpec + ) as Promise; + } + + /** + * Get the list of directory objects that are owned by the user. + * @param nextLink Next link for the list operation. + * @param options The options parameters. + */ + listOwnedObjectsNext( + nextLink: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { nextLink, options: operationOptions }, + listOwnedObjectsNextOperationSpec + ) as Promise; + } +} +// Operation Specifications + +const serializer = new coreHttp.Serializer(Mappers, /* isXml */ false); + +const getOperationSpec: coreHttp.OperationSpec = { + path: "/{tenantID}/me", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.User + }, + default: { + bodyMapper: Mappers.GraphError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.tenantID], + serializer +}; +const listOwnedObjectsOperationSpec: coreHttp.OperationSpec = { + path: "/{tenantID}/me/ownedObjects", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DirectoryObjectListResult + }, + default: { + bodyMapper: Mappers.GraphError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.tenantID], + serializer +}; +const listOwnedObjectsNextOperationSpec: coreHttp.OperationSpec = { + path: "/{tenantID}/{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DirectoryObjectListResult + }, + default: { + bodyMapper: Mappers.GraphError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.tenantID, Parameters.nextLink], + serializer +}; diff --git a/test/smoke/generated/graphrbac-data-plane/src/operations/users.ts b/test/smoke/generated/graphrbac-data-plane/src/operations/users.ts new file mode 100644 index 0000000000..6d4f07a45b --- /dev/null +++ b/test/smoke/generated/graphrbac-data-plane/src/operations/users.ts @@ -0,0 +1,291 @@ +/* + * 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 * as coreHttp from "@azure/core-http"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { GraphRbacManagementClient } from "../graphRbacManagementClient"; +import { + UserCreateParameters, + UsersCreateResponse, + UsersListOptionalParams, + UsersListResponse, + UsersGetResponse, + UserUpdateParameters, + UserGetMemberGroupsParameters, + UsersGetMemberGroupsResponse, + UsersListNextResponse +} from "../models"; + +/** + * Class representing a Users. + */ +export class Users { + private readonly client: GraphRbacManagementClient; + + /** + * Initialize a new instance of the class Users class. + * @param client Reference to the service client + */ + constructor(client: GraphRbacManagementClient) { + this.client = client; + } + + /** + * Create a new user. + * @param parameters Parameters to create a user. + * @param options The options parameters. + */ + create( + parameters: UserCreateParameters, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { parameters, options: operationOptions }, + createOperationSpec + ) as Promise; + } + + /** + * Gets list of users for the current tenant. + * @param options The options parameters. + */ + list(options?: UsersListOptionalParams): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { options: operationOptions }, + listOperationSpec + ) as Promise; + } + + /** + * Gets user information from the directory. + * @param upnOrObjectId The object ID or principal name of the user for which to get information. + * @param options The options parameters. + */ + get( + upnOrObjectId: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { upnOrObjectId, options: operationOptions }, + getOperationSpec + ) as Promise; + } + + /** + * Updates a user. + * @param parameters Parameters to update an existing user. + * @param upnOrObjectId The object ID or principal name of the user to update. + * @param options The options parameters. + */ + update( + parameters: UserUpdateParameters, + upnOrObjectId: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { parameters, upnOrObjectId, options: operationOptions }, + updateOperationSpec + ) as Promise; + } + + /** + * Delete a user. + * @param upnOrObjectId The object ID or principal name of the user to delete. + * @param options The options parameters. + */ + delete( + upnOrObjectId: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { upnOrObjectId, options: operationOptions }, + deleteOperationSpec + ) as Promise; + } + + /** + * Gets a collection that contains the object IDs of the groups of which the user is a member. + * @param parameters User filtering parameters. + * @param objectId The object ID of the user for which to get group membership. + * @param options The options parameters. + */ + getMemberGroups( + parameters: UserGetMemberGroupsParameters, + objectId: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { parameters, objectId, options: operationOptions }, + getMemberGroupsOperationSpec + ) as Promise; + } + + /** + * Gets a list of users for the current tenant. + * @param nextLink Next link for the list operation. + * @param options The options parameters. + */ + listNext( + nextLink: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { nextLink, options: operationOptions }, + listNextOperationSpec + ) as Promise; + } +} +// Operation Specifications + +const serializer = new coreHttp.Serializer(Mappers, /* isXml */ false); + +const createOperationSpec: coreHttp.OperationSpec = { + path: "/{tenantID}/users", + httpMethod: "POST", + responses: { + 201: { + bodyMapper: Mappers.User + }, + default: { + bodyMapper: Mappers.GraphError + } + }, + requestBody: Parameters.parameters13, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.tenantID], + headerParameters: [Parameters.contentType], + serializer +}; +const listOperationSpec: coreHttp.OperationSpec = { + path: "/{tenantID}/users", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.UserListResult + }, + default: { + bodyMapper: Mappers.GraphError + } + }, + queryParameters: [ + Parameters.apiVersion, + Parameters.filter1, + Parameters.expand + ], + urlParameters: [Parameters.$host, Parameters.tenantID], + serializer +}; +const getOperationSpec: coreHttp.OperationSpec = { + path: "/{tenantID}/users/{upnOrObjectId}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.User + }, + default: { + bodyMapper: Mappers.GraphError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.tenantID, + Parameters.upnOrObjectId + ], + serializer +}; +const updateOperationSpec: coreHttp.OperationSpec = { + path: "/{tenantID}/users/{upnOrObjectId}", + httpMethod: "PATCH", + responses: { + 204: {}, + default: { + bodyMapper: Mappers.GraphError + } + }, + requestBody: Parameters.parameters14, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.tenantID, + Parameters.upnOrObjectId1 + ], + headerParameters: [Parameters.contentType], + serializer +}; +const deleteOperationSpec: coreHttp.OperationSpec = { + path: "/{tenantID}/users/{upnOrObjectId}", + httpMethod: "DELETE", + responses: { + 204: {}, + default: { + bodyMapper: Mappers.GraphError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.tenantID, + Parameters.upnOrObjectId2 + ], + serializer +}; +const getMemberGroupsOperationSpec: coreHttp.OperationSpec = { + path: "/{tenantID}/users/{objectId}/getMemberGroups", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.UserGetMemberGroupsResult + }, + default: { + bodyMapper: Mappers.GraphError + } + }, + requestBody: Parameters.parameters15, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.tenantID, Parameters.objectId14], + headerParameters: [Parameters.contentType], + serializer +}; +const listNextOperationSpec: coreHttp.OperationSpec = { + path: "/{tenantID}/{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.UserListResult + }, + default: { + bodyMapper: Mappers.GraphError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.tenantID, Parameters.nextLink], + serializer +}; diff --git a/test/smoke/generated/graphrbac-data-plane/tsconfig.json b/test/smoke/generated/graphrbac-data-plane/tsconfig.json new file mode 100644 index 0000000000..422b584abd --- /dev/null +++ b/test/smoke/generated/graphrbac-data-plane/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "es6", + "moduleResolution": "node", + "strict": true, + "target": "es5", + "sourceMap": true, + "declarationMap": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "forceConsistentCasingInFileNames": true, + "lib": ["es6", "dom"], + "declaration": true, + "outDir": "./esm", + "importHelpers": true + }, + "include": ["./src/**/*.ts"], + "exclude": ["node_modules"] +} diff --git a/test/smoke/generated/monitor-data-plane/LICENSE.txt b/test/smoke/generated/monitor-data-plane/LICENSE.txt new file mode 100644 index 0000000000..4c529f375c --- /dev/null +++ b/test/smoke/generated/monitor-data-plane/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2020 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/test/smoke/generated/monitor-data-plane/README.md b/test/smoke/generated/monitor-data-plane/README.md new file mode 100644 index 0000000000..0220028bd8 --- /dev/null +++ b/test/smoke/generated/monitor-data-plane/README.md @@ -0,0 +1,27 @@ +## Azure MonitorClient SDK for JavaScript + +This package contains an isomorphic SDK for MonitorClient. + +### Currently supported environments + +- Node.js version 8.x.x or higher +- Browser JavaScript + +### How to Install + +```bash +npm install monitor-data-plane +``` + +### How to use + +#### Sample code + +Refer the sample code in the [azure-sdk-for-js-samples](https://github.com/Azure/azure-sdk-for-js-samples) repository. + +## Related projects + +- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js) + + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fcdn%2Farm-cdn%2FREADME.png) \ No newline at end of file diff --git a/test/smoke/generated/monitor-data-plane/package.json b/test/smoke/generated/monitor-data-plane/package.json new file mode 100644 index 0000000000..53ae2064aa --- /dev/null +++ b/test/smoke/generated/monitor-data-plane/package.json @@ -0,0 +1,57 @@ +{ + "name": "monitor-data-plane", + "author": "Microsoft Corporation", + "description": "Monitor Management Client", + "version": "1.0.0", + "dependencies": { + "@azure/core-http": "^1.1.1", + "tslib": "^1.9.3" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], + "license": "MIT", + "main": "./dist/monitor-data-plane.js", + "module": "./esm/monitorClient.js", + "types": "./esm/monitorClient.d.ts", + "devDependencies": { + "typescript": "^3.1.1", + "rollup": "^0.66.2", + "rollup-plugin-node-resolve": "^3.4.0", + "rollup-plugin-sourcemaps": "^0.4.2", + "uglify-js": "^3.4.9" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js", + "repository": { + "type": "git", + "url": "https://github.com/Azure/azure-sdk-for-js.git" + }, + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "files": [ + "dist/**/*.js", + "dist/**/*.js.map", + "dist/**/*.d.ts", + "dist/**/*.d.ts.map", + "esm/**/*.js", + "esm/**/*.js.map", + "esm/**/*.d.ts", + "esm/**/*.d.ts.map", + "src/**/*.ts", + "README.md", + "rollup.config.js", + "tsconfig.json" + ], + "scripts": { + "build": "tsc && rollup -c rollup.config.js && npm run minify", + "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/monitor-data-plane.js.map'\" -o ./dist/monitor-data-plane.min.js ./dist/monitor-data-plane.js", + "prepack": "npm install && npm run build" + }, + "sideEffects": false, + "autoPublish": true +} diff --git a/test/smoke/generated/monitor-data-plane/rollup.config.js b/test/smoke/generated/monitor-data-plane/rollup.config.js new file mode 100644 index 0000000000..4db8ae6cd1 --- /dev/null +++ b/test/smoke/generated/monitor-data-plane/rollup.config.js @@ -0,0 +1,39 @@ +/* + * 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 rollup from "rollup"; +import nodeResolve from "rollup-plugin-node-resolve"; +import sourcemaps from "rollup-plugin-sourcemaps"; + +/** + * @type {rollup.RollupFileOptions} + */ +const config = { + input: "./esm/monitorClient.js", + external: ["@azure/core-http", "@azure/core-arm"], + output: { + file: "./dist/monitor-data-plane.js", + format: "umd", + name: "MonitorDataPlane", + sourcemap: true, + globals: { + "@azure/core-http": "coreHttp", + "@azure/core-arm": "coreArm" + }, + banner: `/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ ` + }, + plugins: [nodeResolve({ module: true }), sourcemaps()] +}; + +export default config; diff --git a/test/smoke/generated/monitor-data-plane/src/models/index.ts b/test/smoke/generated/monitor-data-plane/src/models/index.ts new file mode 100644 index 0000000000..5c7930ff74 --- /dev/null +++ b/test/smoke/generated/monitor-data-plane/src/models/index.ts @@ -0,0 +1,121 @@ +/* + * 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 * as coreHttp from "@azure/core-http"; + +export interface AzureMetricsDocument { + /** + * Gets or sets Time property (in ISO 8601 format) + */ + time: string; + data: AzureMetricsData; +} + +export interface AzureMetricsData { + baseData: AzureMetricsBaseData; +} + +export interface AzureMetricsBaseData { + /** + * Gets or sets the Metric name + */ + metric: string; + /** + * Gets or sets the Metric namespace + */ + namespace: string; + /** + * Gets or sets the list of dimension names (optional) + */ + dimNames?: string[]; + /** + * Gets or sets the list of time series data for the metric (one per unique dimension combination) + */ + series: AzureTimeSeriesData[]; +} + +export interface AzureTimeSeriesData { + /** + * Gets or sets dimension values + */ + dimValues?: string[]; + /** + * Gets or sets Min value + */ + min: number; + /** + * Gets or sets Max value + */ + max: number; + /** + * Gets or sets Sum value + */ + sum: number; + /** + * Gets or sets Count value + */ + count: number; +} + +export interface AzureMetricsResult { + /** + * Http status code response + */ + statusCode?: number; + apiFailureResponse?: ApiFailureResponse; +} + +export interface ApiFailureResponse { + error?: ApiError; +} + +export interface ApiError { + /** + * Gets or sets the azure metrics error code + */ + code?: string; + /** + * Gets or sets the azure metrics error message + */ + message?: string; +} + +/** + * Contains response data for the create operation. + */ +export type MetricsCreateResponse = AzureMetricsResult & { + /** + * The underlying HTTP response. + */ + _response: coreHttp.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: AzureMetricsResult; + }; +}; + +/** + * Optional parameters. + */ +export interface MonitorClientOptionalParams + extends coreHttp.ServiceClientOptions { + /** + * server parameter + */ + $host?: string; + /** + * Overrides client endpoint. + */ + endpoint?: string; +} diff --git a/test/smoke/generated/monitor-data-plane/src/models/mappers.ts b/test/smoke/generated/monitor-data-plane/src/models/mappers.ts new file mode 100644 index 0000000000..b101cfb2c5 --- /dev/null +++ b/test/smoke/generated/monitor-data-plane/src/models/mappers.ts @@ -0,0 +1,191 @@ +/* + * 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 * as coreHttp from "@azure/core-http"; + +export const AzureMetricsDocument: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "AzureMetricsDocument", + modelProperties: { + time: { + serializedName: "time", + required: true, + type: { + name: "String" + } + }, + data: { + serializedName: "data", + type: { + name: "Composite", + className: "AzureMetricsData" + } + } + } + } +}; + +export const AzureMetricsData: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "AzureMetricsData", + modelProperties: { + baseData: { + serializedName: "baseData", + type: { + name: "Composite", + className: "AzureMetricsBaseData" + } + } + } + } +}; + +export const AzureMetricsBaseData: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "AzureMetricsBaseData", + modelProperties: { + metric: { + serializedName: "metric", + required: true, + type: { + name: "String" + } + }, + namespace: { + serializedName: "namespace", + required: true, + type: { + name: "String" + } + }, + dimNames: { + serializedName: "dimNames", + type: { + name: "Sequence", + element: { type: { name: "String" } } + } + }, + series: { + serializedName: "series", + required: true, + type: { + name: "Sequence", + element: { + type: { name: "Composite", className: "AzureTimeSeriesData" } + } + } + } + } + } +}; + +export const AzureTimeSeriesData: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "AzureTimeSeriesData", + modelProperties: { + dimValues: { + serializedName: "dimValues", + type: { + name: "Sequence", + element: { type: { name: "String" } } + } + }, + min: { + serializedName: "min", + required: true, + type: { + name: "Number" + } + }, + max: { + serializedName: "max", + required: true, + type: { + name: "Number" + } + }, + sum: { + serializedName: "sum", + required: true, + type: { + name: "Number" + } + }, + count: { + serializedName: "count", + required: true, + type: { + name: "Number" + } + } + } + } +}; + +export const AzureMetricsResult: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "AzureMetricsResult", + modelProperties: { + statusCode: { + serializedName: "statusCode", + type: { + name: "Number" + } + }, + apiFailureResponse: { + serializedName: "apiFailureResponse", + type: { + name: "Composite", + className: "ApiFailureResponse" + } + } + } + } +}; + +export const ApiFailureResponse: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "ApiFailureResponse", + modelProperties: { + error: { + serializedName: "error", + type: { + name: "Composite", + className: "ApiError" + } + } + } + } +}; + +export const ApiError: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "ApiError", + modelProperties: { + code: { + serializedName: "code", + type: { + name: "String" + } + }, + message: { + serializedName: "message", + type: { + name: "String" + } + } + } + } +}; diff --git a/test/smoke/generated/monitor-data-plane/src/models/parameters.ts b/test/smoke/generated/monitor-data-plane/src/models/parameters.ts new file mode 100644 index 0000000000..681c27a861 --- /dev/null +++ b/test/smoke/generated/monitor-data-plane/src/models/parameters.ts @@ -0,0 +1,127 @@ +/* + * 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 * as coreHttp from "@azure/core-http"; +import * as Mappers from "../models/mappers"; + +export const contentType: coreHttp.OperationParameter = { + parameterPath: ["options", "contentType"], + mapper: { + defaultValue: "application/json", + isConstant: true, + serializedName: "Content-Type", + type: { + name: "String" + } + } +}; + +export const body: coreHttp.OperationParameter = { + parameterPath: "body", + mapper: Mappers.AzureMetricsDocument +}; + +export const $host: coreHttp.OperationURLParameter = { + parameterPath: "$host", + mapper: { + serializedName: "$host", + required: true, + type: { + name: "String" + } + }, + skipEncoding: true +}; + +export const contentType1: coreHttp.OperationParameter = { + parameterPath: "contentType", + mapper: { + serializedName: "Content-Type", + required: true, + type: { + name: "String" + } + } +}; + +export const contentLength: coreHttp.OperationParameter = { + parameterPath: "contentLength", + mapper: { + serializedName: "Content-Length", + required: true, + type: { + name: "Number" + } + } +}; + +export const authorization: coreHttp.OperationParameter = { + parameterPath: "authorization", + mapper: { + serializedName: "Authorization", + required: true, + type: { + name: "String" + } + } +}; + +export const subscriptionId: coreHttp.OperationURLParameter = { + parameterPath: "subscriptionId", + mapper: { + serializedName: "subscriptionId", + required: true, + type: { + name: "String" + } + } +}; + +export const resourceGroupName: coreHttp.OperationURLParameter = { + parameterPath: "resourceGroupName", + mapper: { + serializedName: "resourceGroupName", + required: true, + type: { + name: "String" + } + } +}; + +export const resourceProvider: coreHttp.OperationURLParameter = { + parameterPath: "resourceProvider", + mapper: { + serializedName: "resourceProvider", + required: true, + type: { + name: "String" + } + } +}; + +export const resourceTypeName: coreHttp.OperationURLParameter = { + parameterPath: "resourceTypeName", + mapper: { + serializedName: "resourceTypeName", + required: true, + type: { + name: "String" + } + } +}; + +export const resourceName: coreHttp.OperationURLParameter = { + parameterPath: "resourceName", + mapper: { + serializedName: "resourceName", + required: true, + type: { + name: "String" + } + } +}; diff --git a/test/smoke/generated/monitor-data-plane/src/monitorClient.ts b/test/smoke/generated/monitor-data-plane/src/monitorClient.ts new file mode 100644 index 0000000000..403cd21a3a --- /dev/null +++ b/test/smoke/generated/monitor-data-plane/src/monitorClient.ts @@ -0,0 +1,40 @@ +/* + * 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 * as coreHttp from "@azure/core-http"; +import * as operations from "./operations"; +import * as Models from "./models"; +import * as Mappers from "./models/mappers"; +import { MonitorClientContext } from "./monitorClientContext"; + +class MonitorClient extends MonitorClientContext { + /** + * Initializes a new instance of the MonitorClient class. + * @param credentials Subscription credentials which uniquely identify client subscription. + * @param options The parameter options + */ + constructor( + credentials: coreHttp.TokenCredential | coreHttp.ServiceClientCredentials, + options?: Models.MonitorClientOptionalParams + ) { + super(credentials, options); + this.metrics = new operations.Metrics(this); + } + + metrics: operations.Metrics; +} + +// Operation Specifications + +export { + MonitorClient, + MonitorClientContext, + Models as MonitorModels, + Mappers as MonitorMappers +}; +export * from "./operations"; diff --git a/test/smoke/generated/monitor-data-plane/src/monitorClientContext.ts b/test/smoke/generated/monitor-data-plane/src/monitorClientContext.ts new file mode 100644 index 0000000000..3e3a680cea --- /dev/null +++ b/test/smoke/generated/monitor-data-plane/src/monitorClientContext.ts @@ -0,0 +1,50 @@ +/* + * 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 * as coreHttp from "@azure/core-http"; +import * as Models from "./models"; + +const packageName = "monitor-data-plane"; +const packageVersion = "1.0.0"; + +export class MonitorClientContext extends coreHttp.ServiceClient { + $host: string; + + /** + * Initializes a new instance of the MonitorClientContext class. + * @param credentials Subscription credentials which uniquely identify client subscription. + * @param options The parameter options + */ + constructor( + credentials: coreHttp.TokenCredential | coreHttp.ServiceClientCredentials, + options?: Models.MonitorClientOptionalParams + ) { + if (credentials === undefined) { + throw new Error("'credentials' cannot be null"); + } + + // Initializing default values for options + if (!options) { + options = {}; + } + + if (!options.userAgent) { + const defaultUserAgent = coreHttp.getDefaultUserAgentValue(); + options.userAgent = `${packageName}/${packageVersion} ${defaultUserAgent}`; + } + + super(credentials, options); + + this.requestContentType = "application/json; charset=utf-8"; + + this.baseUri = options.endpoint || "{$host}"; + + // Assigning values to Constant parameters + this.$host = options.$host || "https://monitoring.azure.com"; + } +} diff --git a/test/smoke/generated/monitor-data-plane/src/operations/index.ts b/test/smoke/generated/monitor-data-plane/src/operations/index.ts new file mode 100644 index 0000000000..a18dd1b918 --- /dev/null +++ b/test/smoke/generated/monitor-data-plane/src/operations/index.ts @@ -0,0 +1,9 @@ +/* + * 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. + */ + +export * from "./metrics"; diff --git a/test/smoke/generated/monitor-data-plane/src/operations/metrics.ts b/test/smoke/generated/monitor-data-plane/src/operations/metrics.ts new file mode 100644 index 0000000000..85e3032c01 --- /dev/null +++ b/test/smoke/generated/monitor-data-plane/src/operations/metrics.ts @@ -0,0 +1,107 @@ +/* + * 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 * as coreHttp from "@azure/core-http"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { MonitorClient } from "../monitorClient"; +import { AzureMetricsDocument, MetricsCreateResponse } from "../models"; + +/** + * Class representing a Metrics. + */ +export class Metrics { + private readonly client: MonitorClient; + + /** + * Initialize a new instance of the class Metrics class. + * @param client Reference to the service client + */ + constructor(client: MonitorClient) { + this.client = client; + } + + /** + * **Post the metric values for a resource**. + * @param body The Azure metrics document json payload + * @param contentType Supports application/json and application/x-ndjson + * @param contentLength Content length of the payload + * @param authorization Authorization token issue for issued for audience + * "https:\\monitoring.azure.com\" + * @param subscriptionId The azure subscription id + * @param resourceGroupName The ARM resource group name + * @param resourceProvider The ARM resource provider name + * @param resourceTypeName The ARM resource type name + * @param resourceName The ARM resource name + * @param options The options parameters. + */ + create( + body: AzureMetricsDocument, + contentType: string, + contentLength: number, + authorization: string, + subscriptionId: string, + resourceGroupName: string, + resourceProvider: string, + resourceTypeName: string, + resourceName: string, + options?: coreHttp.OperationOptions + ): Promise { + const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase( + options || {} + ); + return this.client.sendOperationRequest( + { + body, + contentType, + contentLength, + authorization, + subscriptionId, + resourceGroupName, + resourceProvider, + resourceTypeName, + resourceName, + options: operationOptions + }, + createOperationSpec + ) as Promise; + } +} +// Operation Specifications + +const serializer = new coreHttp.Serializer(Mappers, /* isXml */ false); + +const createOperationSpec: coreHttp.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProvider}/{resourceTypeName}/{resourceName}/metrics", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.AzureMetricsResult + }, + default: { + bodyMapper: Mappers.AzureMetricsResult + } + }, + requestBody: Parameters.body, + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceProvider, + Parameters.resourceTypeName, + Parameters.resourceName + ], + headerParameters: [ + Parameters.contentType, + Parameters.contentType1, + Parameters.contentLength, + Parameters.authorization + ], + serializer +}; diff --git a/test/smoke/generated/monitor-data-plane/tsconfig.json b/test/smoke/generated/monitor-data-plane/tsconfig.json new file mode 100644 index 0000000000..422b584abd --- /dev/null +++ b/test/smoke/generated/monitor-data-plane/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "es6", + "moduleResolution": "node", + "strict": true, + "target": "es5", + "sourceMap": true, + "declarationMap": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "forceConsistentCasingInFileNames": true, + "lib": ["es6", "dom"], + "declaration": true, + "outDir": "./esm", + "importHelpers": true + }, + "include": ["./src/**/*.ts"], + "exclude": ["node_modules"] +} diff --git a/test/utils/smoke-test-list.ts b/test/utils/smoke-test-list.ts index 297a51ee60..83dca5d1cf 100644 --- a/test/utils/smoke-test-list.ts +++ b/test/utils/smoke-test-list.ts @@ -1,10 +1,20 @@ export interface SpecDefinition { path: string; branch?: string; + params?: string[]; +} + +export enum AutorestParams { + ModelDedup = "--modelerfour.lenient-model-deduplication" } export const readmes: SpecDefinition[] = [ - { path: "./.tmp/specs/specification/cosmos-db/resource-manager/readme.md" }, + { path: "./.tmp/specs/specification/monitor/data-plane/readme.md" }, + { path: "./.tmp/specs/specification/graphrbac/data-plane/readme.md" }, + { + path: "./.tmp/specs/specification/cosmos-db/resource-manager/readme.md", + params: [AutorestParams.ModelDedup] + }, { path: "./.tmp/specs/specification/compute/resource-manager/readme.md" }, { path: "./.tmp/specs/specification/network/resource-manager/readme.md" }, { path: "./.tmp/specs/specification/keyvault/resource-manager/readme.md" }, diff --git a/test/utils/smoke-test.ts b/test/utils/smoke-test.ts index 1b59d9758a..95f4d1fda6 100644 --- a/test/utils/smoke-test.ts +++ b/test/utils/smoke-test.ts @@ -32,11 +32,11 @@ const onExit = (childProcess: ChildProcess) => { }); }; -const generateFromReadme = async (readmeUrl: string) => { +const generateFromReadme = async ({ path, params }: SpecDefinition) => { const regex = new RegExp( "^[^#].*?specification/([\\w-]+(/[\\w-]+)+)/readme.md" ); - const matches = readmeUrl.match(regex); + const matches = path.match(regex); if (!matches?.length) { return; } @@ -48,11 +48,12 @@ const generateFromReadme = async (readmeUrl: string) => { autorestCmd, [ `--version="3.0.6267"`, - `--require=${readmeUrl}`, + `--require=${path}`, `--typescript`, `--package-name=${projectName}`, `--output-folder=${output}`, - `--use=.` + `--use=.`, + ...(params || []) ], { stdio: [process.stdin, process.stdout, process.stderr] @@ -87,7 +88,7 @@ const verifyLibrary = async (spec: SpecDefinition): Promise => { const readmeUrl = spec.path; try { checkoutBranch(spec.branch); - const projectPath = await generateFromReadme(readmeUrl); + const projectPath = await generateFromReadme(spec); await buildGenerated(projectPath); success = true; } catch (e) { @@ -152,13 +153,7 @@ const main = async () => { chunk = readmes.slice(start, end < readmes.length ? end : readmes.length); console.log(`start: ${start}, end: ${end}, size: ${chunk.length}`); } - - try { - await verifyLibraries(chunk); - } catch (error) { - logError(error); - process.exit(-1); - } + await verifyLibraries(chunk); }; const checkoutBranch = async (branch?: string) => { @@ -173,4 +168,7 @@ const checkoutBranch = async (branch?: string) => { return await onExit(childProdcess); }; -main(); +main().catch(error => { + logError(error); + process.exit(-1); +});