diff --git a/sdk/azurestack/arm-azurestack/CHANGELOG.md b/sdk/azurestack/arm-azurestack/CHANGELOG.md index 4c3b672ac4ee..403c4fd627b9 100644 --- a/sdk/azurestack/arm-azurestack/CHANGELOG.md +++ b/sdk/azurestack/arm-azurestack/CHANGELOG.md @@ -1,18 +1,8 @@ # Release History + +## 3.0.0 (2022-07-18) -## 3.0.0-beta.3 (Unreleased) - -### Features Added - -### Breaking Changes - -### Bugs Fixed - -### Other Changes - -## 3.0.0-beta.2 (2022-04-11) - -The package of @azure/arm-azurestack is using our next generation design principles since version 3.0.0-beta.2, which contains breaking changes. +The package of @azure/arm-azurestack is using our next generation design principles since version 3.0.0, which contains breaking changes. To understand the detail of the change, please refer to [Changelog](https://aka.ms/js-track2-changelog). diff --git a/sdk/azurestack/arm-azurestack/README.md b/sdk/azurestack/arm-azurestack/README.md index 63268d32bacb..b2b140425be1 100644 --- a/sdk/azurestack/arm-azurestack/README.md +++ b/sdk/azurestack/arm-azurestack/README.md @@ -6,7 +6,7 @@ Azure Stack [Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/azurestack/arm-azurestack) | [Package (NPM)](https://www.npmjs.com/package/@azure/arm-azurestack) | -[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-azurestack?view=azure-node-preview) | +[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-azurestack) | [Samples](https://github.com/Azure-Samples/azure-samples-js-management) ## Getting started diff --git a/sdk/azurestack/arm-azurestack/_meta.json b/sdk/azurestack/arm-azurestack/_meta.json index 027a451ea2c2..1b53eea2bd3d 100644 --- a/sdk/azurestack/arm-azurestack/_meta.json +++ b/sdk/azurestack/arm-azurestack/_meta.json @@ -1,8 +1,8 @@ { - "commit": "4042a47cff72c950d35dd72149895b044ed79713", - "readme": "specification\\azurestack\\resource-manager\\readme.md", - "autorest_command": "autorest --version=3.7.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\work\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\batch\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-alpha.18.20220329.1 --generate-sample=true", + "commit": "1207fba03e84b9af2ccd4428fbbcdbf2380e739c", + "readme": "specification/azurestack/resource-manager/readme.md", + "autorest_command": "autorest --version=3.7.3 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-js ../azure-rest-api-specs/specification/azurestack/resource-manager/readme.md --use=@autorest/typescript@6.0.0-alpha.19.20220425.1", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "release_tool": "@azure-tools/js-sdk-release-tools@2.2.1", - "use": "@autorest/typescript@6.0.0-alpha.18.20220329.1" -} + "release_tool": "@azure-tools/js-sdk-release-tools@2.4.0", + "use": "@autorest/typescript@6.0.0-alpha.19.20220425.1" +} \ No newline at end of file diff --git a/sdk/azurestack/arm-azurestack/package.json b/sdk/azurestack/arm-azurestack/package.json index d0194877ff58..e7d12c9b0821 100644 --- a/sdk/azurestack/arm-azurestack/package.json +++ b/sdk/azurestack/arm-azurestack/package.json @@ -3,15 +3,15 @@ "sdk-type": "mgmt", "author": "Microsoft Corporation", "description": "A generated SDK for AzureStackManagementClient.", - "version": "3.0.0-beta.3", + "version": "3.0.0", "engines": { "node": ">=12.0.0" }, "dependencies": { "@azure/core-paging": "^1.2.0", - "@azure/core-client": "^1.0.0", + "@azure/core-client": "^1.5.0", "@azure/core-auth": "^1.3.0", - "@azure/core-rest-pipeline": "^1.1.0", + "@azure/core-rest-pipeline": "^1.8.0", "tslib": "^2.2.0" }, "keywords": [ @@ -38,9 +38,11 @@ "uglify-js": "^3.4.9", "rimraf": "^3.0.0", "@azure/identity": "^2.0.1", - "@azure-tools/test-recorder": "^1.0.0", + "@azure-tools/test-recorder": "^2.0.0", + "@azure-tools/test-credential": "^1.0.0", "mocha": "^7.1.1", - "cross-env": "^7.0.2" + "cross-env": "^7.0.2", + "@azure/dev-tool": "^1.0.0" }, "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/azurestack/arm-azurestack", "repository": { @@ -91,7 +93,7 @@ "unit-test:node": "cross-env TEST_MODE=playback npm run integration-test:node", "unit-test:browser": "echo skipped", "integration-test": "npm run integration-test:node && npm run integration-test:browser", - "integration-test:node": "mocha -r esm --require ts-node/register --timeout 1200000 --full-trace test/*.ts --reporter ../../../common/tools/mocha-multi-reporter.js", + "integration-test:node": "dev-tool run test:node-ts-input -- --timeout 1200000 'test/*.ts'", "integration-test:browser": "echo skipped", "docs": "echo skipped" }, @@ -104,13 +106,5 @@ } ] }, - "autoPublish": true, - "//sampleConfiguration": { - "productName": "", - "productSlugs": [ - "azure" - ], - "disableDocsMs": true, - "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-azurestack?view=azure-node-preview" - } -} + "autoPublish": true +} \ No newline at end of file diff --git a/sdk/azurestack/arm-azurestack/review/arm-azurestack.api.md b/sdk/azurestack/arm-azurestack/review/arm-azurestack.api.md index 4ff2b06c2a23..bcf42ea881aa 100644 --- a/sdk/azurestack/arm-azurestack/review/arm-azurestack.api.md +++ b/sdk/azurestack/arm-azurestack/review/arm-azurestack.api.md @@ -25,7 +25,7 @@ export class AzureStackManagementClient extends coreClient.ServiceClient { // (undocumented) customerSubscriptions: CustomerSubscriptions; // (undocumented) - linkedSubscriptions: LinkedSubscriptions; + deploymentLicense: DeploymentLicense; // (undocumented) operations: Operations; // (undocumented) @@ -100,12 +100,8 @@ export type CompatibilityIssue = string; // @public export type ComputeRole = string; -// @public -export type CreatedByType = string; - // @public export type CustomerSubscription = Resource & { - readonly systemData?: SystemData; tenantId?: string; }; @@ -161,6 +157,29 @@ export interface DataDiskImage { readonly sourceBlobSasUri?: string; } +// @public +export interface DeploymentLicense { + create(deploymentLicenseRequest: DeploymentLicenseRequest, options?: DeploymentLicenseCreateOptionalParams): Promise; +} + +// @public +export interface DeploymentLicenseCreateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type DeploymentLicenseCreateResponse = DeploymentLicenseResponse; + +// @public +export interface DeploymentLicenseRequest { + verificationVersion?: string; +} + +// @public +export interface DeploymentLicenseResponse { + signature?: string; + temporaryLicenseChain?: string[]; +} + // @public export interface DeviceConfiguration { readonly deviceVersion?: string; @@ -257,18 +276,6 @@ export enum KnownComputeRole { PaaS = "PaaS" } -// @public -export enum KnownCreatedByType { - // (undocumented) - Application = "Application", - // (undocumented) - Key = "Key", - // (undocumented) - ManagedIdentity = "ManagedIdentity", - // (undocumented) - User = "User" -} - // @public export enum KnownLocation { // (undocumented) @@ -285,93 +292,6 @@ export enum KnownOperatingSystem { Windows = "Windows" } -// @public -export type LinkedSubscription = TrackedResource & { - linkedSubscriptionId?: string; - registrationResourceId?: string; - readonly deviceId?: string; - readonly deviceObjectId?: string; - readonly deviceLinkState?: string; - readonly lastConnectedTime?: string; - readonly deviceConnectionStatus?: string; -}; - -// @public -export interface LinkedSubscriptionParameter { - linkedSubscriptionId: string; - location: Location_2; - registrationResourceId: string; -} - -// @public -export interface LinkedSubscriptions { - createOrUpdate(resourceGroup: string, linkedSubscriptionName: string, resource: LinkedSubscriptionParameter, options?: LinkedSubscriptionsCreateOrUpdateOptionalParams): Promise; - delete(resourceGroup: string, linkedSubscriptionName: string, options?: LinkedSubscriptionsDeleteOptionalParams): Promise; - get(resourceGroup: string, linkedSubscriptionName: string, options?: LinkedSubscriptionsGetOptionalParams): Promise; - listByResourceGroup(resourceGroup: string, options?: LinkedSubscriptionsListByResourceGroupOptionalParams): PagedAsyncIterableIterator; - listBySubscription(options?: LinkedSubscriptionsListBySubscriptionOptionalParams): PagedAsyncIterableIterator; - update(resourceGroup: string, linkedSubscriptionName: string, resource: LinkedSubscriptionParameter, options?: LinkedSubscriptionsUpdateOptionalParams): Promise; -} - -// @public -export interface LinkedSubscriptionsCreateOrUpdateOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type LinkedSubscriptionsCreateOrUpdateResponse = LinkedSubscription; - -// @public -export interface LinkedSubscriptionsDeleteOptionalParams extends coreClient.OperationOptions { -} - -// @public -export interface LinkedSubscriptionsGetOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type LinkedSubscriptionsGetResponse = LinkedSubscription; - -// @public -export interface LinkedSubscriptionsList { - nextLink?: string; - value?: LinkedSubscription[]; -} - -// @public -export interface LinkedSubscriptionsListByResourceGroupNextOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type LinkedSubscriptionsListByResourceGroupNextResponse = LinkedSubscriptionsList; - -// @public -export interface LinkedSubscriptionsListByResourceGroupOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type LinkedSubscriptionsListByResourceGroupResponse = LinkedSubscriptionsList; - -// @public -export interface LinkedSubscriptionsListBySubscriptionNextOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type LinkedSubscriptionsListBySubscriptionNextResponse = LinkedSubscriptionsList; - -// @public -export interface LinkedSubscriptionsListBySubscriptionOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type LinkedSubscriptionsListBySubscriptionResponse = LinkedSubscriptionsList; - -// @public -export interface LinkedSubscriptionsUpdateOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type LinkedSubscriptionsUpdateResponse = LinkedSubscription; - // @public type Location_2 = string; export { Location_2 as Location } @@ -427,7 +347,6 @@ export interface OsDiskImage { // @public export type Product = Resource & { - readonly systemData?: SystemData; displayName?: string; description?: string; publisherDisplayName?: string; @@ -487,6 +406,7 @@ export interface Products { getProducts(resourceGroup: string, registrationName: string, productName: string, options?: ProductsGetProductsOptionalParams): Promise; list(resourceGroup: string, registrationName: string, options?: ProductsListOptionalParams): PagedAsyncIterableIterator; listDetails(resourceGroup: string, registrationName: string, productName: string, options?: ProductsListDetailsOptionalParams): Promise; + listProducts(resourceGroup: string, registrationName: string, productName: string, options?: ProductsListProductsOptionalParams): Promise; uploadLog(resourceGroup: string, registrationName: string, productName: string, options?: ProductsUploadLogOptionalParams): Promise; } @@ -531,6 +451,14 @@ export type ProductsListNextResponse = ProductList; export interface ProductsListOptionalParams extends coreClient.OperationOptions { } +// @public +export interface ProductsListProductsOptionalParams extends coreClient.OperationOptions { + deviceConfiguration?: DeviceConfiguration; +} + +// @public +export type ProductsListProductsResponse = ProductList; + // @public export type ProductsListResponse = ProductList; @@ -648,24 +576,12 @@ export interface Resource { readonly type?: string; } -// @public -export interface SystemData { - createdAt?: Date; - createdBy?: string; - createdByType?: CreatedByType; - lastModifiedAt?: Date; - lastModifiedBy?: string; - lastModifiedByType?: CreatedByType; -} - // @public export interface TrackedResource { etag?: string; readonly id?: string; - readonly kind?: string; location: Location_2; readonly name?: string; - readonly systemData?: SystemData; tags?: { [propertyName: string]: string; }; diff --git a/sdk/azurestack/arm-azurestack/src/azureStackManagementClient.ts b/sdk/azurestack/arm-azurestack/src/azureStackManagementClient.ts index 5fa19cc4caa5..b50bc18670b9 100644 --- a/sdk/azurestack/arm-azurestack/src/azureStackManagementClient.ts +++ b/sdk/azurestack/arm-azurestack/src/azureStackManagementClient.ts @@ -7,22 +7,28 @@ */ import * as coreClient from "@azure/core-client"; +import * as coreRestPipeline from "@azure/core-rest-pipeline"; +import { + PipelineRequest, + PipelineResponse, + SendRequest +} from "@azure/core-rest-pipeline"; import * as coreAuth from "@azure/core-auth"; import { OperationsImpl, CloudManifestFileImpl, + DeploymentLicenseImpl, CustomerSubscriptionsImpl, ProductsImpl, - RegistrationsImpl, - LinkedSubscriptionsImpl + RegistrationsImpl } from "./operations"; import { Operations, CloudManifestFile, + DeploymentLicense, CustomerSubscriptions, Products, - Registrations, - LinkedSubscriptions + Registrations } from "./operationsInterfaces"; import { AzureStackManagementClientOptionalParams } from "./models"; @@ -59,7 +65,7 @@ export class AzureStackManagementClient extends coreClient.ServiceClient { credential: credentials }; - const packageDetails = `azsdk-js-arm-azurestack/3.0.0-beta.3`; + const packageDetails = `azsdk-js-arm-azurestack/3.0.0`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` @@ -78,24 +84,76 @@ export class AzureStackManagementClient extends coreClient.ServiceClient { options.endpoint ?? options.baseUri ?? "https://management.azure.com" }; super(optionsWithDefaults); + + if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) { + const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies(); + const bearerTokenAuthenticationPolicyFound = pipelinePolicies.some( + (pipelinePolicy) => + pipelinePolicy.name === + coreRestPipeline.bearerTokenAuthenticationPolicyName + ); + if (!bearerTokenAuthenticationPolicyFound) { + this.pipeline.removePolicy({ + name: coreRestPipeline.bearerTokenAuthenticationPolicyName + }); + this.pipeline.addPolicy( + coreRestPipeline.bearerTokenAuthenticationPolicy({ + scopes: `${optionsWithDefaults.baseUri}/.default`, + challengeCallbacks: { + authorizeRequestOnChallenge: + coreClient.authorizeRequestOnClaimChallenge + } + }) + ); + } + } // Parameter assignments this.subscriptionId = subscriptionId; // Assigning values to Constant parameters this.$host = options.$host || "https://management.azure.com"; - this.apiVersion = options.apiVersion || "2020-06-01-preview"; + this.apiVersion = options.apiVersion || "2022-06-01"; this.operations = new OperationsImpl(this); this.cloudManifestFile = new CloudManifestFileImpl(this); + this.deploymentLicense = new DeploymentLicenseImpl(this); this.customerSubscriptions = new CustomerSubscriptionsImpl(this); this.products = new ProductsImpl(this); this.registrations = new RegistrationsImpl(this); - this.linkedSubscriptions = new LinkedSubscriptionsImpl(this); + this.addCustomApiVersionPolicy(options.apiVersion); + } + + /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */ + private addCustomApiVersionPolicy(apiVersion?: string) { + if (!apiVersion) { + return; + } + const apiVersionPolicy = { + name: "CustomApiVersionPolicy", + async sendRequest( + request: PipelineRequest, + next: SendRequest + ): Promise { + const param = request.url.split("?"); + if (param.length > 1) { + const newParams = param[1].split("&").map((item) => { + if (item.indexOf("api-version") > -1) { + return item.replace(/(?<==).*$/, apiVersion); + } else { + return item; + } + }); + request.url = param[0] + "?" + newParams.join("&"); + } + return next(request); + } + }; + this.pipeline.addPolicy(apiVersionPolicy); } operations: Operations; cloudManifestFile: CloudManifestFile; + deploymentLicense: DeploymentLicense; customerSubscriptions: CustomerSubscriptions; products: Products; registrations: Registrations; - linkedSubscriptions: LinkedSubscriptions; } diff --git a/sdk/azurestack/arm-azurestack/src/models/index.ts b/sdk/azurestack/arm-azurestack/src/models/index.ts index 5b0251477320..ec293ec57681 100644 --- a/sdk/azurestack/arm-azurestack/src/models/index.ts +++ b/sdk/azurestack/arm-azurestack/src/models/index.ts @@ -104,6 +104,20 @@ export interface Resource { etag?: string; } +/** Request details for generating a deployment license. */ +export interface DeploymentLicenseRequest { + /** Signing verification public key version. */ + verificationVersion?: string; +} + +/** A license that can be used to deploy an Azure Stack device. */ +export interface DeploymentLicenseResponse { + /** A license chain that can be used to temporarily activate an Azure Stack device. */ + temporaryLicenseChain?: string[]; + /** Signature of the license chain. */ + signature?: string; +} + /** Pageable list of customer subscriptions. */ export interface CustomerSubscriptionList { /** URI to the next page. */ @@ -112,22 +126,6 @@ export interface CustomerSubscriptionList { value?: CustomerSubscription[]; } -/** Metadata pertaining to creation and last modification of the resource. */ -export interface SystemData { - /** The identity that created the resource. */ - createdBy?: string; - /** The type of identity that created the resource. */ - createdByType?: CreatedByType; - /** The timestamp of resource creation (UTC). */ - createdAt?: Date; - /** The identity that last modified the resource. */ - lastModifiedBy?: string; - /** The type of identity that last modified the resource. */ - lastModifiedByType?: CreatedByType; - /** The timestamp of resource last modification (UTC) */ - lastModifiedAt?: Date; -} - /** Pageable list of products. */ export interface ProductList { /** URI to the next page. */ @@ -448,16 +446,6 @@ export interface TrackedResource { * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly type?: string; - /** - * The kind of the resource. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly kind?: string; - /** - * Metadata pertaining to creation and last modification of the resource. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly systemData?: SystemData; /** Location of the resource. */ location: Location; /** Custom tags for the resource. */ @@ -480,24 +468,6 @@ export interface ActivationKeyResult { activationKey?: string; } -/** List of linked subscriptions with paging support. */ -export interface LinkedSubscriptionsList { - /** URI to the next page. */ - nextLink?: string; - /** List of Linked Subscriptions */ - value?: LinkedSubscription[]; -} - -/** Linked Subscription resource */ -export interface LinkedSubscriptionParameter { - /** Location of the resource. */ - location: Location; - /** The identifier associated with the device subscription. */ - linkedSubscriptionId: string; - /** The identifier associated with the device registration. */ - registrationResourceId: string; -} - /** Cloud specific manifest GET response. */ export type CloudManifestFileResponse = Resource & { /** Cloud specific manifest data. */ @@ -506,22 +476,12 @@ export type CloudManifestFileResponse = Resource & { /** Customer subscription. */ export type CustomerSubscription = Resource & { - /** - * Metadata pertaining to creation and last modification of the resource. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly systemData?: SystemData; /** Tenant Id. */ tenantId?: string; }; /** Product information. */ export type Product = Resource & { - /** - * Metadata pertaining to creation and last modification of the resource. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly systemData?: SystemData; /** The display name of the product. */ displayName?: string; /** The description of the product. */ @@ -574,59 +534,6 @@ export type Registration = TrackedResource & { billingModel?: string; }; -/** Linked Subscription information. */ -export type LinkedSubscription = TrackedResource & { - /** The identifier associated with the device subscription. */ - linkedSubscriptionId?: string; - /** The identifier associated with the device registration. */ - registrationResourceId?: string; - /** - * The identifier of the Azure Stack device for remote management. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly deviceId?: string; - /** - * The object identifier associated with the Azure Stack device connecting to Azure. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly deviceObjectId?: string; - /** - * The connection state of the Azure Stack device. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly deviceLinkState?: string; - /** - * The last remote management connection time for the Azure Stack device connected to the linked subscription resource. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly lastConnectedTime?: string; - /** - * The status of the remote management connection of the Azure Stack device. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly deviceConnectionStatus?: string; -}; - -/** Known values of {@link CreatedByType} that the service accepts. */ -export enum KnownCreatedByType { - User = "User", - Application = "Application", - ManagedIdentity = "ManagedIdentity", - Key = "Key" -} - -/** - * Defines values for CreatedByType. \ - * {@link KnownCreatedByType} can be used interchangeably with CreatedByType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **User** \ - * **Application** \ - * **ManagedIdentity** \ - * **Key** - */ -export type CreatedByType = string; - /** Known values of {@link CompatibilityIssue} that the service accepts. */ export enum KnownCompatibilityIssue { HigherDeviceVersionRequired = "HigherDeviceVersionRequired", @@ -762,6 +669,13 @@ export interface CloudManifestFileGetOptionalParams /** Contains response data for the get operation. */ export type CloudManifestFileGetResponse = CloudManifestFileResponse; +/** Optional parameters. */ +export interface DeploymentLicenseCreateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the create operation. */ +export type DeploymentLicenseCreateResponse = DeploymentLicenseResponse; + /** Optional parameters. */ export interface CustomerSubscriptionsListOptionalParams extends coreClient.OperationOptions {} @@ -815,6 +729,16 @@ export interface ProductsListDetailsOptionalParams /** Contains response data for the listDetails operation. */ export type ProductsListDetailsResponse = ExtendedProduct; +/** Optional parameters. */ +export interface ProductsListProductsOptionalParams + extends coreClient.OperationOptions { + /** Device configuration. */ + deviceConfiguration?: DeviceConfiguration; +} + +/** Contains response data for the listProducts operation. */ +export type ProductsListProductsResponse = ProductList; + /** Optional parameters. */ export interface ProductsGetProductsOptionalParams extends coreClient.OperationOptions { @@ -916,59 +840,6 @@ export interface RegistrationsListBySubscriptionNextOptionalParams /** Contains response data for the listBySubscriptionNext operation. */ export type RegistrationsListBySubscriptionNextResponse = RegistrationList; -/** Optional parameters. */ -export interface LinkedSubscriptionsListByResourceGroupOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listByResourceGroup operation. */ -export type LinkedSubscriptionsListByResourceGroupResponse = LinkedSubscriptionsList; - -/** Optional parameters. */ -export interface LinkedSubscriptionsListBySubscriptionOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listBySubscription operation. */ -export type LinkedSubscriptionsListBySubscriptionResponse = LinkedSubscriptionsList; - -/** Optional parameters. */ -export interface LinkedSubscriptionsGetOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the get operation. */ -export type LinkedSubscriptionsGetResponse = LinkedSubscription; - -/** Optional parameters. */ -export interface LinkedSubscriptionsDeleteOptionalParams - extends coreClient.OperationOptions {} - -/** Optional parameters. */ -export interface LinkedSubscriptionsCreateOrUpdateOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the createOrUpdate operation. */ -export type LinkedSubscriptionsCreateOrUpdateResponse = LinkedSubscription; - -/** Optional parameters. */ -export interface LinkedSubscriptionsUpdateOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the update operation. */ -export type LinkedSubscriptionsUpdateResponse = LinkedSubscription; - -/** Optional parameters. */ -export interface LinkedSubscriptionsListByResourceGroupNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listByResourceGroupNext operation. */ -export type LinkedSubscriptionsListByResourceGroupNextResponse = LinkedSubscriptionsList; - -/** Optional parameters. */ -export interface LinkedSubscriptionsListBySubscriptionNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listBySubscriptionNext operation. */ -export type LinkedSubscriptionsListBySubscriptionNextResponse = LinkedSubscriptionsList; - /** Optional parameters. */ export interface AzureStackManagementClientOptionalParams extends coreClient.ServiceClientOptions { diff --git a/sdk/azurestack/arm-azurestack/src/models/mappers.ts b/sdk/azurestack/arm-azurestack/src/models/mappers.ts index bfee8cb65cac..24582bfdace1 100644 --- a/sdk/azurestack/arm-azurestack/src/models/mappers.ts +++ b/sdk/azurestack/arm-azurestack/src/models/mappers.ts @@ -233,72 +233,68 @@ export const Resource: coreClient.CompositeMapper = { } }; -export const CustomerSubscriptionList: coreClient.CompositeMapper = { +export const DeploymentLicenseRequest: coreClient.CompositeMapper = { type: { name: "Composite", - className: "CustomerSubscriptionList", + className: "DeploymentLicenseRequest", modelProperties: { - nextLink: { - serializedName: "nextLink", + verificationVersion: { + serializedName: "verificationVersion", type: { name: "String" } - }, - value: { - serializedName: "value", + } + } + } +}; + +export const DeploymentLicenseResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DeploymentLicenseResponse", + modelProperties: { + temporaryLicenseChain: { + serializedName: "temporaryLicenseChain", type: { name: "Sequence", element: { type: { - name: "Composite", - className: "CustomerSubscription" + name: "String" } } } + }, + signature: { + serializedName: "signature", + type: { + name: "String" + } } } } }; -export const SystemData: coreClient.CompositeMapper = { +export const CustomerSubscriptionList: coreClient.CompositeMapper = { type: { name: "Composite", - className: "SystemData", + className: "CustomerSubscriptionList", modelProperties: { - createdBy: { - serializedName: "createdBy", - type: { - name: "String" - } - }, - createdByType: { - serializedName: "createdByType", - type: { - name: "String" - } - }, - createdAt: { - serializedName: "createdAt", - type: { - name: "DateTime" - } - }, - lastModifiedBy: { - serializedName: "lastModifiedBy", - type: { - name: "String" - } - }, - lastModifiedByType: { - serializedName: "lastModifiedByType", + nextLink: { + serializedName: "nextLink", type: { name: "String" } }, - lastModifiedAt: { - serializedName: "lastModifiedAt", + value: { + serializedName: "value", type: { - name: "DateTime" + name: "Sequence", + element: { + type: { + name: "Composite", + className: "CustomerSubscription" + } + } } } } @@ -883,20 +879,6 @@ export const TrackedResource: coreClient.CompositeMapper = { name: "String" } }, - kind: { - serializedName: "kind", - readOnly: true, - type: { - name: "String" - } - }, - systemData: { - serializedName: "systemData", - type: { - name: "Composite", - className: "SystemData" - } - }, location: { serializedName: "location", required: true, @@ -959,63 +941,6 @@ export const ActivationKeyResult: coreClient.CompositeMapper = { } }; -export const LinkedSubscriptionsList: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "LinkedSubscriptionsList", - modelProperties: { - nextLink: { - serializedName: "nextLink", - type: { - name: "String" - } - }, - value: { - serializedName: "value", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "LinkedSubscription" - } - } - } - } - } - } -}; - -export const LinkedSubscriptionParameter: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "LinkedSubscriptionParameter", - modelProperties: { - location: { - serializedName: "location", - required: true, - type: { - name: "String" - } - }, - linkedSubscriptionId: { - serializedName: "properties.linkedSubscriptionId", - required: true, - type: { - name: "String" - } - }, - registrationResourceId: { - serializedName: "properties.registrationResourceId", - required: true, - type: { - name: "String" - } - } - } - } -}; - export const CloudManifestFileResponse: coreClient.CompositeMapper = { type: { name: "Composite", @@ -1039,13 +964,6 @@ export const CustomerSubscription: coreClient.CompositeMapper = { className: "CustomerSubscription", modelProperties: { ...Resource.type.modelProperties, - systemData: { - serializedName: "systemData", - type: { - name: "Composite", - className: "SystemData" - } - }, tenantId: { serializedName: "properties.tenantId", type: { @@ -1062,13 +980,6 @@ export const Product: coreClient.CompositeMapper = { className: "Product", modelProperties: { ...Resource.type.modelProperties, - systemData: { - serializedName: "systemData", - type: { - name: "Composite", - className: "SystemData" - } - }, displayName: { serializedName: "properties.displayName", type: { @@ -1228,60 +1139,3 @@ export const Registration: coreClient.CompositeMapper = { } } }; - -export const LinkedSubscription: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "LinkedSubscription", - modelProperties: { - ...TrackedResource.type.modelProperties, - linkedSubscriptionId: { - serializedName: "properties.linkedSubscriptionId", - type: { - name: "String" - } - }, - registrationResourceId: { - serializedName: "properties.registrationResourceId", - type: { - name: "String" - } - }, - deviceId: { - serializedName: "properties.deviceId", - readOnly: true, - type: { - name: "String" - } - }, - deviceObjectId: { - serializedName: "properties.deviceObjectId", - readOnly: true, - type: { - name: "String" - } - }, - deviceLinkState: { - serializedName: "properties.deviceLinkState", - readOnly: true, - type: { - name: "String" - } - }, - lastConnectedTime: { - serializedName: "properties.lastConnectedTime", - readOnly: true, - type: { - name: "String" - } - }, - deviceConnectionStatus: { - serializedName: "properties.deviceConnectionStatus", - readOnly: true, - type: { - name: "String" - } - } - } - } -}; diff --git a/sdk/azurestack/arm-azurestack/src/models/parameters.ts b/sdk/azurestack/arm-azurestack/src/models/parameters.ts index d06c11f1e495..4e1bc9b0575a 100644 --- a/sdk/azurestack/arm-azurestack/src/models/parameters.ts +++ b/sdk/azurestack/arm-azurestack/src/models/parameters.ts @@ -12,11 +12,11 @@ import { OperationQueryParameter } from "@azure/core-client"; import { + DeploymentLicenseRequest as DeploymentLicenseRequestMapper, CustomerSubscription as CustomerSubscriptionMapper, DeviceConfiguration as DeviceConfigurationMapper, MarketplaceProductLogUpdate as MarketplaceProductLogUpdateMapper, - RegistrationParameter as RegistrationParameterMapper, - LinkedSubscriptionParameter as LinkedSubscriptionParameterMapper + RegistrationParameter as RegistrationParameterMapper } from "../models/mappers"; export const accept: OperationParameter = { @@ -46,7 +46,7 @@ export const $host: OperationURLParameter = { export const apiVersion: OperationQueryParameter = { parameterPath: "apiVersion", mapper: { - defaultValue: "2020-06-01-preview", + defaultValue: "2022-06-01", isConstant: true, serializedName: "api-version", type: { @@ -88,6 +88,23 @@ export const versionCreationDate: OperationQueryParameter = { } }; +export const contentType: OperationParameter = { + parameterPath: ["options", "contentType"], + mapper: { + defaultValue: "application/json", + isConstant: true, + serializedName: "Content-Type", + type: { + name: "String" + } + } +}; + +export const deploymentLicenseRequest: OperationParameter = { + parameterPath: "deploymentLicenseRequest", + mapper: DeploymentLicenseRequestMapper +}; + export const subscriptionId: OperationURLParameter = { parameterPath: "subscriptionId", mapper: { @@ -132,18 +149,6 @@ export const customerSubscriptionName: OperationURLParameter = { } }; -export const contentType: OperationParameter = { - parameterPath: ["options", "contentType"], - mapper: { - defaultValue: "application/json", - isConstant: true, - serializedName: "Content-Type", - type: { - name: "String" - } - } -}; - export const customerCreationParameters: OperationParameter = { parameterPath: "customerCreationParameters", mapper: CustomerSubscriptionMapper @@ -174,19 +179,3 @@ export const token: OperationParameter = { parameterPath: "token", mapper: RegistrationParameterMapper }; - -export const linkedSubscriptionName: OperationURLParameter = { - parameterPath: "linkedSubscriptionName", - mapper: { - serializedName: "linkedSubscriptionName", - required: true, - type: { - name: "String" - } - } -}; - -export const resource: OperationParameter = { - parameterPath: "resource", - mapper: LinkedSubscriptionParameterMapper -}; diff --git a/sdk/azurestack/arm-azurestack/src/operations/deploymentLicense.ts b/sdk/azurestack/arm-azurestack/src/operations/deploymentLicense.ts new file mode 100644 index 000000000000..a56dfc299a35 --- /dev/null +++ b/sdk/azurestack/arm-azurestack/src/operations/deploymentLicense.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 { DeploymentLicense } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { AzureStackManagementClient } from "../azureStackManagementClient"; +import { + DeploymentLicenseRequest, + DeploymentLicenseCreateOptionalParams, + DeploymentLicenseCreateResponse +} from "../models"; + +/** Class containing DeploymentLicense operations. */ +export class DeploymentLicenseImpl implements DeploymentLicense { + private readonly client: AzureStackManagementClient; + + /** + * Initialize a new instance of the class DeploymentLicense class. + * @param client Reference to the service client + */ + constructor(client: AzureStackManagementClient) { + this.client = client; + } + + /** + * Creates a license that can be used to deploy an Azure Stack device. + * @param deploymentLicenseRequest Request body for creating a deployment license. + * @param options The options parameters. + */ + create( + deploymentLicenseRequest: DeploymentLicenseRequest, + options?: DeploymentLicenseCreateOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { deploymentLicenseRequest, options }, + createOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const createOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStack/generateDeploymentLicense", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.DeploymentLicenseResponse + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.deploymentLicenseRequest, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; diff --git a/sdk/azurestack/arm-azurestack/src/operations/index.ts b/sdk/azurestack/arm-azurestack/src/operations/index.ts index a1fbeecf7ca7..0d660f45bf2c 100644 --- a/sdk/azurestack/arm-azurestack/src/operations/index.ts +++ b/sdk/azurestack/arm-azurestack/src/operations/index.ts @@ -8,7 +8,7 @@ export * from "./operations"; export * from "./cloudManifestFile"; +export * from "./deploymentLicense"; export * from "./customerSubscriptions"; export * from "./products"; export * from "./registrations"; -export * from "./linkedSubscriptions"; diff --git a/sdk/azurestack/arm-azurestack/src/operations/linkedSubscriptions.ts b/sdk/azurestack/arm-azurestack/src/operations/linkedSubscriptions.ts deleted file mode 100644 index 23a74b0207ff..000000000000 --- a/sdk/azurestack/arm-azurestack/src/operations/linkedSubscriptions.ts +++ /dev/null @@ -1,450 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { PagedAsyncIterableIterator } from "@azure/core-paging"; -import { LinkedSubscriptions } from "../operationsInterfaces"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers"; -import * as Parameters from "../models/parameters"; -import { AzureStackManagementClient } from "../azureStackManagementClient"; -import { - LinkedSubscription, - LinkedSubscriptionsListByResourceGroupNextOptionalParams, - LinkedSubscriptionsListByResourceGroupOptionalParams, - LinkedSubscriptionsListBySubscriptionNextOptionalParams, - LinkedSubscriptionsListBySubscriptionOptionalParams, - LinkedSubscriptionsListByResourceGroupResponse, - LinkedSubscriptionsListBySubscriptionResponse, - LinkedSubscriptionsGetOptionalParams, - LinkedSubscriptionsGetResponse, - LinkedSubscriptionsDeleteOptionalParams, - LinkedSubscriptionParameter, - LinkedSubscriptionsCreateOrUpdateOptionalParams, - LinkedSubscriptionsCreateOrUpdateResponse, - LinkedSubscriptionsUpdateOptionalParams, - LinkedSubscriptionsUpdateResponse, - LinkedSubscriptionsListByResourceGroupNextResponse, - LinkedSubscriptionsListBySubscriptionNextResponse -} from "../models"; - -/// -/** Class containing LinkedSubscriptions operations. */ -export class LinkedSubscriptionsImpl implements LinkedSubscriptions { - private readonly client: AzureStackManagementClient; - - /** - * Initialize a new instance of the class LinkedSubscriptions class. - * @param client Reference to the service client - */ - constructor(client: AzureStackManagementClient) { - this.client = client; - } - - /** - * Returns a list of all linked subscriptions under current resource group. - * @param resourceGroup Name of the resource group. - * @param options The options parameters. - */ - public listByResourceGroup( - resourceGroup: string, - options?: LinkedSubscriptionsListByResourceGroupOptionalParams - ): PagedAsyncIterableIterator { - const iter = this.listByResourceGroupPagingAll(resourceGroup, options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: () => { - return this.listByResourceGroupPagingPage(resourceGroup, options); - } - }; - } - - private async *listByResourceGroupPagingPage( - resourceGroup: string, - options?: LinkedSubscriptionsListByResourceGroupOptionalParams - ): AsyncIterableIterator { - let result = await this._listByResourceGroup(resourceGroup, options); - yield result.value || []; - let continuationToken = result.nextLink; - while (continuationToken) { - result = await this._listByResourceGroupNext( - resourceGroup, - continuationToken, - options - ); - continuationToken = result.nextLink; - yield result.value || []; - } - } - - private async *listByResourceGroupPagingAll( - resourceGroup: string, - options?: LinkedSubscriptionsListByResourceGroupOptionalParams - ): AsyncIterableIterator { - for await (const page of this.listByResourceGroupPagingPage( - resourceGroup, - options - )) { - yield* page; - } - } - - /** - * Returns a list of all linked subscriptions under current subscription. - * @param options The options parameters. - */ - public listBySubscription( - options?: LinkedSubscriptionsListBySubscriptionOptionalParams - ): PagedAsyncIterableIterator { - const iter = this.listBySubscriptionPagingAll(options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: () => { - return this.listBySubscriptionPagingPage(options); - } - }; - } - - private async *listBySubscriptionPagingPage( - options?: LinkedSubscriptionsListBySubscriptionOptionalParams - ): AsyncIterableIterator { - let result = await this._listBySubscription(options); - yield result.value || []; - let continuationToken = result.nextLink; - while (continuationToken) { - result = await this._listBySubscriptionNext(continuationToken, options); - continuationToken = result.nextLink; - yield result.value || []; - } - } - - private async *listBySubscriptionPagingAll( - options?: LinkedSubscriptionsListBySubscriptionOptionalParams - ): AsyncIterableIterator { - for await (const page of this.listBySubscriptionPagingPage(options)) { - yield* page; - } - } - - /** - * Returns a list of all linked subscriptions under current resource group. - * @param resourceGroup Name of the resource group. - * @param options The options parameters. - */ - private _listByResourceGroup( - resourceGroup: string, - options?: LinkedSubscriptionsListByResourceGroupOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { resourceGroup, options }, - listByResourceGroupOperationSpec - ); - } - - /** - * Returns a list of all linked subscriptions under current subscription. - * @param options The options parameters. - */ - private _listBySubscription( - options?: LinkedSubscriptionsListBySubscriptionOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { options }, - listBySubscriptionOperationSpec - ); - } - - /** - * Returns the properties of a Linked Subscription resource. - * @param resourceGroup Name of the resource group. - * @param linkedSubscriptionName Name of the Linked Subscription resource. - * @param options The options parameters. - */ - get( - resourceGroup: string, - linkedSubscriptionName: string, - options?: LinkedSubscriptionsGetOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { resourceGroup, linkedSubscriptionName, options }, - getOperationSpec - ); - } - - /** - * Delete the requested Linked Subscription resource. - * @param resourceGroup Name of the resource group. - * @param linkedSubscriptionName Name of the Linked Subscription resource. - * @param options The options parameters. - */ - delete( - resourceGroup: string, - linkedSubscriptionName: string, - options?: LinkedSubscriptionsDeleteOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { resourceGroup, linkedSubscriptionName, options }, - deleteOperationSpec - ); - } - - /** - * Create or update a linked subscription resource. - * @param resourceGroup Name of the resource group. - * @param linkedSubscriptionName Name of the Linked Subscription resource. - * @param resource Linked subscription resource parameter. - * @param options The options parameters. - */ - createOrUpdate( - resourceGroup: string, - linkedSubscriptionName: string, - resource: LinkedSubscriptionParameter, - options?: LinkedSubscriptionsCreateOrUpdateOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { resourceGroup, linkedSubscriptionName, resource, options }, - createOrUpdateOperationSpec - ); - } - - /** - * Patch a Linked Subscription resource. - * @param resourceGroup Name of the resource group. - * @param linkedSubscriptionName Name of the Linked Subscription resource. - * @param resource Linked subscription resource parameter. - * @param options The options parameters. - */ - update( - resourceGroup: string, - linkedSubscriptionName: string, - resource: LinkedSubscriptionParameter, - options?: LinkedSubscriptionsUpdateOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { resourceGroup, linkedSubscriptionName, resource, options }, - updateOperationSpec - ); - } - - /** - * ListByResourceGroupNext - * @param resourceGroup Name of the resource group. - * @param nextLink The nextLink from the previous successful call to the ListByResourceGroup method. - * @param options The options parameters. - */ - private _listByResourceGroupNext( - resourceGroup: string, - nextLink: string, - options?: LinkedSubscriptionsListByResourceGroupNextOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { resourceGroup, nextLink, options }, - listByResourceGroupNextOperationSpec - ); - } - - /** - * ListBySubscriptionNext - * @param nextLink The nextLink from the previous successful call to the ListBySubscription method. - * @param options The options parameters. - */ - private _listBySubscriptionNext( - nextLink: string, - options?: LinkedSubscriptionsListBySubscriptionNextOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { nextLink, options }, - listBySubscriptionNextOperationSpec - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const listByResourceGroupOperationSpec: coreClient.OperationSpec = { - path: - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/linkedSubscriptions", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.LinkedSubscriptionsList - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroup - ], - headerParameters: [Parameters.accept], - serializer -}; -const listBySubscriptionOperationSpec: coreClient.OperationSpec = { - path: - "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStack/linkedSubscriptions", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.LinkedSubscriptionsList - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host, Parameters.subscriptionId], - headerParameters: [Parameters.accept], - serializer -}; -const getOperationSpec: coreClient.OperationSpec = { - path: - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/linkedSubscriptions/{linkedSubscriptionName}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.LinkedSubscription - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroup, - Parameters.linkedSubscriptionName - ], - headerParameters: [Parameters.accept], - serializer -}; -const deleteOperationSpec: coreClient.OperationSpec = { - path: - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/linkedSubscriptions/{linkedSubscriptionName}", - httpMethod: "DELETE", - responses: { - 200: {}, - 204: {}, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroup, - Parameters.linkedSubscriptionName - ], - headerParameters: [Parameters.accept], - serializer -}; -const createOrUpdateOperationSpec: coreClient.OperationSpec = { - path: - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/linkedSubscriptions/{linkedSubscriptionName}", - httpMethod: "PUT", - responses: { - 200: { - bodyMapper: Mappers.LinkedSubscription - }, - 201: { - bodyMapper: Mappers.LinkedSubscription - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - requestBody: Parameters.resource, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroup, - Parameters.linkedSubscriptionName - ], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer -}; -const updateOperationSpec: coreClient.OperationSpec = { - path: - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/linkedSubscriptions/{linkedSubscriptionName}", - httpMethod: "PATCH", - responses: { - 200: { - bodyMapper: Mappers.LinkedSubscription - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - requestBody: Parameters.resource, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroup, - Parameters.linkedSubscriptionName - ], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer -}; -const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.LinkedSubscriptionsList - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.nextLink, - Parameters.subscriptionId, - Parameters.resourceGroup - ], - headerParameters: [Parameters.accept], - serializer -}; -const listBySubscriptionNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.LinkedSubscriptionsList - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.nextLink, - Parameters.subscriptionId - ], - headerParameters: [Parameters.accept], - serializer -}; diff --git a/sdk/azurestack/arm-azurestack/src/operations/products.ts b/sdk/azurestack/arm-azurestack/src/operations/products.ts index faa8d74b2dea..8cc980b0c481 100644 --- a/sdk/azurestack/arm-azurestack/src/operations/products.ts +++ b/sdk/azurestack/arm-azurestack/src/operations/products.ts @@ -21,6 +21,8 @@ import { ProductsGetResponse, ProductsListDetailsOptionalParams, ProductsListDetailsResponse, + ProductsListProductsOptionalParams, + ProductsListProductsResponse, ProductsGetProductsOptionalParams, ProductsGetProductsResponse, ProductsGetProductOptionalParams, @@ -157,6 +159,25 @@ export class ProductsImpl implements Products { ); } + /** + * Returns a list of products. + * @param resourceGroup Name of the resource group. + * @param registrationName Name of the Azure Stack registration. + * @param productName Name of the product. + * @param options The options parameters. + */ + listProducts( + resourceGroup: string, + registrationName: string, + productName: string, + options?: ProductsListProductsOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroup, registrationName, productName, options }, + listProductsOperationSpec + ); + } + /** * Returns a list of products. * @param resourceGroup Name of the resource group. @@ -304,6 +325,31 @@ const listDetailsOperationSpec: coreClient.OperationSpec = { headerParameters: [Parameters.accept], serializer }; +const listProductsOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/products/{productName}/listProducts", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.ProductList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.deviceConfiguration, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroup, + Parameters.registrationName, + Parameters.productName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; const getProductsOperationSpec: coreClient.OperationSpec = { path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/products/{productName}/getProducts", diff --git a/sdk/azurestack/arm-azurestack/src/operationsInterfaces/deploymentLicense.ts b/sdk/azurestack/arm-azurestack/src/operationsInterfaces/deploymentLicense.ts new file mode 100644 index 000000000000..611efbba43c1 --- /dev/null +++ b/sdk/azurestack/arm-azurestack/src/operationsInterfaces/deploymentLicense.ts @@ -0,0 +1,26 @@ +/* + * 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 { + DeploymentLicenseRequest, + DeploymentLicenseCreateOptionalParams, + DeploymentLicenseCreateResponse +} from "../models"; + +/** Interface representing a DeploymentLicense. */ +export interface DeploymentLicense { + /** + * Creates a license that can be used to deploy an Azure Stack device. + * @param deploymentLicenseRequest Request body for creating a deployment license. + * @param options The options parameters. + */ + create( + deploymentLicenseRequest: DeploymentLicenseRequest, + options?: DeploymentLicenseCreateOptionalParams + ): Promise; +} diff --git a/sdk/azurestack/arm-azurestack/src/operationsInterfaces/index.ts b/sdk/azurestack/arm-azurestack/src/operationsInterfaces/index.ts index a1fbeecf7ca7..0d660f45bf2c 100644 --- a/sdk/azurestack/arm-azurestack/src/operationsInterfaces/index.ts +++ b/sdk/azurestack/arm-azurestack/src/operationsInterfaces/index.ts @@ -8,7 +8,7 @@ export * from "./operations"; export * from "./cloudManifestFile"; +export * from "./deploymentLicense"; export * from "./customerSubscriptions"; export * from "./products"; export * from "./registrations"; -export * from "./linkedSubscriptions"; diff --git a/sdk/azurestack/arm-azurestack/src/operationsInterfaces/linkedSubscriptions.ts b/sdk/azurestack/arm-azurestack/src/operationsInterfaces/linkedSubscriptions.ts deleted file mode 100644 index 9047155c8e8d..000000000000 --- a/sdk/azurestack/arm-azurestack/src/operationsInterfaces/linkedSubscriptions.ts +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { PagedAsyncIterableIterator } from "@azure/core-paging"; -import { - LinkedSubscription, - LinkedSubscriptionsListByResourceGroupOptionalParams, - LinkedSubscriptionsListBySubscriptionOptionalParams, - LinkedSubscriptionsGetOptionalParams, - LinkedSubscriptionsGetResponse, - LinkedSubscriptionsDeleteOptionalParams, - LinkedSubscriptionParameter, - LinkedSubscriptionsCreateOrUpdateOptionalParams, - LinkedSubscriptionsCreateOrUpdateResponse, - LinkedSubscriptionsUpdateOptionalParams, - LinkedSubscriptionsUpdateResponse -} from "../models"; - -/// -/** Interface representing a LinkedSubscriptions. */ -export interface LinkedSubscriptions { - /** - * Returns a list of all linked subscriptions under current resource group. - * @param resourceGroup Name of the resource group. - * @param options The options parameters. - */ - listByResourceGroup( - resourceGroup: string, - options?: LinkedSubscriptionsListByResourceGroupOptionalParams - ): PagedAsyncIterableIterator; - /** - * Returns a list of all linked subscriptions under current subscription. - * @param options The options parameters. - */ - listBySubscription( - options?: LinkedSubscriptionsListBySubscriptionOptionalParams - ): PagedAsyncIterableIterator; - /** - * Returns the properties of a Linked Subscription resource. - * @param resourceGroup Name of the resource group. - * @param linkedSubscriptionName Name of the Linked Subscription resource. - * @param options The options parameters. - */ - get( - resourceGroup: string, - linkedSubscriptionName: string, - options?: LinkedSubscriptionsGetOptionalParams - ): Promise; - /** - * Delete the requested Linked Subscription resource. - * @param resourceGroup Name of the resource group. - * @param linkedSubscriptionName Name of the Linked Subscription resource. - * @param options The options parameters. - */ - delete( - resourceGroup: string, - linkedSubscriptionName: string, - options?: LinkedSubscriptionsDeleteOptionalParams - ): Promise; - /** - * Create or update a linked subscription resource. - * @param resourceGroup Name of the resource group. - * @param linkedSubscriptionName Name of the Linked Subscription resource. - * @param resource Linked subscription resource parameter. - * @param options The options parameters. - */ - createOrUpdate( - resourceGroup: string, - linkedSubscriptionName: string, - resource: LinkedSubscriptionParameter, - options?: LinkedSubscriptionsCreateOrUpdateOptionalParams - ): Promise; - /** - * Patch a Linked Subscription resource. - * @param resourceGroup Name of the resource group. - * @param linkedSubscriptionName Name of the Linked Subscription resource. - * @param resource Linked subscription resource parameter. - * @param options The options parameters. - */ - update( - resourceGroup: string, - linkedSubscriptionName: string, - resource: LinkedSubscriptionParameter, - options?: LinkedSubscriptionsUpdateOptionalParams - ): Promise; -} diff --git a/sdk/azurestack/arm-azurestack/src/operationsInterfaces/products.ts b/sdk/azurestack/arm-azurestack/src/operationsInterfaces/products.ts index b13423f1af26..e7f3f35aab61 100644 --- a/sdk/azurestack/arm-azurestack/src/operationsInterfaces/products.ts +++ b/sdk/azurestack/arm-azurestack/src/operationsInterfaces/products.ts @@ -14,6 +14,8 @@ import { ProductsGetResponse, ProductsListDetailsOptionalParams, ProductsListDetailsResponse, + ProductsListProductsOptionalParams, + ProductsListProductsResponse, ProductsGetProductsOptionalParams, ProductsGetProductsResponse, ProductsGetProductOptionalParams, @@ -62,6 +64,19 @@ export interface Products { productName: string, options?: ProductsListDetailsOptionalParams ): Promise; + /** + * Returns a list of products. + * @param resourceGroup Name of the resource group. + * @param registrationName Name of the Azure Stack registration. + * @param productName Name of the product. + * @param options The options parameters. + */ + listProducts( + resourceGroup: string, + registrationName: string, + productName: string, + options?: ProductsListProductsOptionalParams + ): Promise; /** * Returns a list of products. * @param resourceGroup Name of the resource group. diff --git a/sdk/azurestack/arm-azurestack/test/sampleTest.ts b/sdk/azurestack/arm-azurestack/test/sampleTest.ts index 7ed89b043e1b..25aeb3ebcc36 100644 --- a/sdk/azurestack/arm-azurestack/test/sampleTest.ts +++ b/sdk/azurestack/arm-azurestack/test/sampleTest.ts @@ -7,35 +7,30 @@ */ import { - env, - record, - RecorderEnvironmentSetup, - Recorder + Recorder, + RecorderStartOptions, + env } from "@azure-tools/test-recorder"; -import * as assert from "assert"; +import { assert } from "chai"; +import { Context } from "mocha"; -const recorderEnvSetup: RecorderEnvironmentSetup = { - replaceableVariables: { - AZURE_CLIENT_ID: "azure_client_id", - AZURE_CLIENT_SECRET: "azure_client_secret", - AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888", - SUBSCRIPTION_ID: "azure_subscription_id" - }, - customizationsOnRecordings: [ - (recording: any): any => - recording.replace( - /"access_token":"[^"]*"/g, - `"access_token":"access_token"` - ) - ], - queryParametersToSkip: [] +const replaceableVariables: Record = { + AZURE_CLIENT_ID: "azure_client_id", + AZURE_CLIENT_SECRET: "azure_client_secret", + AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888", + SUBSCRIPTION_ID: "azure_subscription_id" +}; + +const recorderOptions: RecorderStartOptions = { + envSetupForPlayback: replaceableVariables }; describe("My test", () => { let recorder: Recorder; - beforeEach(async function() { - recorder = record(this, recorderEnvSetup); + beforeEach(async function(this: Context) { + recorder = new Recorder(this.currentTest); + await recorder.start(recorderOptions); }); afterEach(async function() { diff --git a/sdk/azurestack/arm-azurestack/tsconfig.json b/sdk/azurestack/arm-azurestack/tsconfig.json index 6d19a52ae487..3e6ae96443f3 100644 --- a/sdk/azurestack/arm-azurestack/tsconfig.json +++ b/sdk/azurestack/arm-azurestack/tsconfig.json @@ -15,17 +15,11 @@ ], "declaration": true, "outDir": "./dist-esm", - "importHelpers": true, - "paths": { - "@azure/arm-azurestack": [ - "./src/index" - ] - } + "importHelpers": true }, "include": [ "./src/**/*.ts", - "./test/**/*.ts", - "samples-dev/**/*.ts" + "./test/**/*.ts" ], "exclude": [ "node_modules"