diff --git a/sdk/azurestackhci/arm-azurestackhci/CHANGELOG.md b/sdk/azurestackhci/arm-azurestackhci/CHANGELOG.md index 573f4aaf034b..a93c41ad5413 100644 --- a/sdk/azurestackhci/arm-azurestackhci/CHANGELOG.md +++ b/sdk/azurestackhci/arm-azurestackhci/CHANGELOG.md @@ -1,15 +1,50 @@ # Release History + +## 3.0.0 (2022-05-19) + +**Features** -## 2.1.1 (Unreleased) - -### Features Added - -### Breaking Changes - -### Bugs Fixed - -### Other Changes - + - Added operation ArcSettings.beginCreateIdentity + - Added operation ArcSettings.beginCreateIdentityAndWait + - Added operation ArcSettings.generatePassword + - Added operation ArcSettings.update + - Added operation Clusters.beginCreateIdentity + - Added operation Clusters.beginCreateIdentityAndWait + - Added operation Clusters.beginDelete + - Added operation Clusters.beginDeleteAndWait + - Added operation Clusters.beginUploadCertificate + - Added operation Clusters.beginUploadCertificateAndWait + - Added Interface ArcConnectivityProperties + - Added Interface ArcIdentityResponse + - Added Interface ArcSettingsCreateIdentityOptionalParams + - Added Interface ArcSettingsGeneratePasswordOptionalParams + - Added Interface ArcSettingsPatch + - Added Interface ArcSettingsUpdateOptionalParams + - Added Interface ClusterIdentityResponse + - Added Interface ClustersCreateIdentityOptionalParams + - Added Interface ClustersUploadCertificateOptionalParams + - Added Interface PasswordCredential + - Added Interface RawCertificateData + - Added Interface UploadCertificateRequest + - Added Type Alias ArcSettingsCreateIdentityResponse + - Added Type Alias ArcSettingsGeneratePasswordResponse + - Added Type Alias ArcSettingsUpdateResponse + - Added Type Alias ClustersCreateIdentityResponse + - Interface ClustersDeleteOptionalParams has a new optional parameter resumeFrom + - Interface ClustersDeleteOptionalParams has a new optional parameter updateIntervalInMs + - Type Alias ArcSetting has a new parameter arcApplicationClientId + - Type Alias ArcSetting has a new parameter arcApplicationTenantId + - Type Alias ArcSetting has a new parameter arcServicePrincipalObjectId + - Type Alias ArcSetting has a new parameter arcApplicationObjectId + - Type Alias ArcSetting has a new parameter connectivityProperties + - Type Alias Cluster has a new parameter aadApplicationObjectId + - Type Alias Cluster has a new parameter aadServicePrincipalObjectId + - Type Alias Cluster has a new parameter serviceEndpoint + +**Breaking Changes** + + - Removed operation Clusters.delete + ## 2.1.0 (2022-02-28) **Features** diff --git a/sdk/azurestackhci/arm-azurestackhci/README.md b/sdk/azurestackhci/arm-azurestackhci/README.md index 3ca16d6e28bb..255b1988b853 100644 --- a/sdk/azurestackhci/arm-azurestackhci/README.md +++ b/sdk/azurestackhci/arm-azurestackhci/README.md @@ -6,7 +6,7 @@ Azure Stack HCI management service [Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/azurestackhci/arm-azurestackhci) | [Package (NPM)](https://www.npmjs.com/package/@azure/arm-azurestackhci) | -[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-azurestackhci?view=azure-node-preview) | +[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-azurestackhci) | [Samples](https://github.com/Azure-Samples/azure-samples-js-management) ## Getting started diff --git a/sdk/azurestackhci/arm-azurestackhci/_meta.json b/sdk/azurestackhci/arm-azurestackhci/_meta.json index bc82b9f1193f..b05b066a0e05 100644 --- a/sdk/azurestackhci/arm-azurestackhci/_meta.json +++ b/sdk/azurestackhci/arm-azurestackhci/_meta.json @@ -1,7 +1,8 @@ { - "commit": "20d333fa60a4a81acfd01a7bd56dd9c552301afe", + "commit": "4742065e8d48160292fbce6790710c6835f8dc4f", "readme": "specification/azurestackhci/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:\\mydev\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\azurestackhci\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-beta.16 --generate-sample=true", + "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=/mnt/vss/_work/1/s/azure-sdk-for-js ../azure-rest-api-specs/specification/azurestackhci/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", - "use": "@autorest/typescript@6.0.0-beta.16" + "release_tool": "@azure-tools/js-sdk-release-tools@2.3.0", + "use": "@autorest/typescript@6.0.0-alpha.19.20220425.1" } \ No newline at end of file diff --git a/sdk/azurestackhci/arm-azurestackhci/package.json b/sdk/azurestackhci/arm-azurestackhci/package.json index 7f3613ab6cfa..7d2c76063912 100644 --- a/sdk/azurestackhci/arm-azurestackhci/package.json +++ b/sdk/azurestackhci/arm-azurestackhci/package.json @@ -3,7 +3,7 @@ "sdk-type": "mgmt", "author": "Microsoft Corporation", "description": "A generated SDK for AzureStackHCIClient.", - "version": "2.1.1", + "version": "3.0.0", "engines": { "node": ">=12.0.0" }, @@ -11,9 +11,9 @@ "@azure/core-lro": "^2.2.0", "@azure/abort-controller": "^1.0.0", "@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": [ @@ -40,9 +40,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/azurestackhci/arm-azurestackhci", "repository": { @@ -93,7 +95,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" }, @@ -106,13 +108,5 @@ } ] }, - "autoPublish": true, - "//sampleConfiguration": { - "productName": "", - "productSlugs": [ - "azure" - ], - "disableDocsMs": true, - "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-azurestackhci?view=azure-node-preview" - } -} + "autoPublish": true +} \ No newline at end of file diff --git a/sdk/azurestackhci/arm-azurestackhci/review/arm-azurestackhci.api.md b/sdk/azurestackhci/arm-azurestackhci/review/arm-azurestackhci.api.md index 70c6530d63aa..a381027df484 100644 --- a/sdk/azurestackhci/arm-azurestackhci/review/arm-azurestackhci.api.md +++ b/sdk/azurestackhci/arm-azurestackhci/review/arm-azurestackhci.api.md @@ -13,12 +13,34 @@ import { PollOperationState } from '@azure/core-lro'; // @public export type ActionType = string; +// @public +export interface ArcConnectivityProperties { + enabled?: boolean; +} + +// @public +export interface ArcIdentityResponse { + // (undocumented) + arcApplicationClientId?: string; + // (undocumented) + arcApplicationObjectId?: string; + // (undocumented) + arcApplicationTenantId?: string; + // (undocumented) + arcServicePrincipalObjectId?: string; +} + // @public export type ArcSetting = ProxyResource & { readonly provisioningState?: ProvisioningState; arcInstanceResourceGroup?: string; + arcApplicationClientId?: string; + arcApplicationTenantId?: string; + arcServicePrincipalObjectId?: string; + arcApplicationObjectId?: string; readonly aggregateState?: ArcSettingAggregateState; readonly perNodeDetails?: PerNodeState[]; + connectivityProperties?: Record; createdBy?: string; createdByType?: CreatedByType; createdAt?: Date; @@ -38,13 +60,26 @@ export interface ArcSettingList { // @public export interface ArcSettings { + beginCreateIdentity(resourceGroupName: string, clusterName: string, arcSettingName: string, options?: ArcSettingsCreateIdentityOptionalParams): Promise, ArcSettingsCreateIdentityResponse>>; + beginCreateIdentityAndWait(resourceGroupName: string, clusterName: string, arcSettingName: string, options?: ArcSettingsCreateIdentityOptionalParams): Promise; beginDelete(resourceGroupName: string, clusterName: string, arcSettingName: string, options?: ArcSettingsDeleteOptionalParams): Promise, void>>; beginDeleteAndWait(resourceGroupName: string, clusterName: string, arcSettingName: string, options?: ArcSettingsDeleteOptionalParams): Promise; create(resourceGroupName: string, clusterName: string, arcSettingName: string, arcSetting: ArcSetting, options?: ArcSettingsCreateOptionalParams): Promise; + generatePassword(resourceGroupName: string, clusterName: string, arcSettingName: string, options?: ArcSettingsGeneratePasswordOptionalParams): Promise; get(resourceGroupName: string, clusterName: string, arcSettingName: string, options?: ArcSettingsGetOptionalParams): Promise; listByCluster(resourceGroupName: string, clusterName: string, options?: ArcSettingsListByClusterOptionalParams): PagedAsyncIterableIterator; + update(resourceGroupName: string, clusterName: string, arcSettingName: string, arcSetting: ArcSettingsPatch, options?: ArcSettingsUpdateOptionalParams): Promise; } +// @public +export interface ArcSettingsCreateIdentityOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type ArcSettingsCreateIdentityResponse = ArcIdentityResponse; + // @public export interface ArcSettingsCreateOptionalParams extends coreClient.OperationOptions { } @@ -58,6 +93,13 @@ export interface ArcSettingsDeleteOptionalParams extends coreClient.OperationOpt updateIntervalInMs?: number; } +// @public +export interface ArcSettingsGeneratePasswordOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ArcSettingsGeneratePasswordResponse = PasswordCredential; + // @public export interface ArcSettingsGetOptionalParams extends coreClient.OperationOptions { } @@ -79,6 +121,21 @@ export interface ArcSettingsListByClusterOptionalParams extends coreClient.Opera // @public export type ArcSettingsListByClusterResponse = ArcSettingList; +// @public +export interface ArcSettingsPatch { + connectivityProperties?: Record; + tags?: { + [propertyName: string]: string; + }; +} + +// @public +export interface ArcSettingsUpdateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ArcSettingsUpdateResponse = ArcSetting; + // @public (undocumented) export class AzureStackHCIClient extends coreClient.ServiceClient { // (undocumented) @@ -113,6 +170,8 @@ export type Cluster = TrackedResource & { cloudManagementEndpoint?: string; aadClientId?: string; aadTenantId?: string; + aadApplicationObjectId?: string; + aadServicePrincipalObjectId?: string; desiredProperties?: ClusterDesiredProperties; readonly reportedProperties?: ClusterReportedProperties; readonly trialDaysRemaining?: number; @@ -120,6 +179,7 @@ export type Cluster = TrackedResource & { readonly registrationTimestamp?: Date; readonly lastSyncTimestamp?: Date; readonly lastBillingTimestamp?: Date; + readonly serviceEndpoint?: string; createdBy?: string; createdByType?: CreatedByType; createdAt?: Date; @@ -134,6 +194,18 @@ export interface ClusterDesiredProperties { windowsServerSubscription?: WindowsServerSubscription; } +// @public +export interface ClusterIdentityResponse { + // (undocumented) + aadApplicationObjectId?: string; + // (undocumented) + aadClientId?: string; + // (undocumented) + aadServicePrincipalObjectId?: string; + // (undocumented) + aadTenantId?: string; +} + // @public export interface ClusterList { readonly nextLink?: string; @@ -178,14 +250,28 @@ export interface ClusterReportedProperties { // @public export interface Clusters { + beginCreateIdentity(resourceGroupName: string, clusterName: string, options?: ClustersCreateIdentityOptionalParams): Promise, ClustersCreateIdentityResponse>>; + beginCreateIdentityAndWait(resourceGroupName: string, clusterName: string, options?: ClustersCreateIdentityOptionalParams): Promise; + beginDelete(resourceGroupName: string, clusterName: string, options?: ClustersDeleteOptionalParams): Promise, void>>; + beginDeleteAndWait(resourceGroupName: string, clusterName: string, options?: ClustersDeleteOptionalParams): Promise; + beginUploadCertificate(resourceGroupName: string, clusterName: string, uploadCertificateRequest: UploadCertificateRequest, options?: ClustersUploadCertificateOptionalParams): Promise, void>>; + beginUploadCertificateAndWait(resourceGroupName: string, clusterName: string, uploadCertificateRequest: UploadCertificateRequest, options?: ClustersUploadCertificateOptionalParams): Promise; create(resourceGroupName: string, clusterName: string, cluster: Cluster, options?: ClustersCreateOptionalParams): Promise; - delete(resourceGroupName: string, clusterName: string, options?: ClustersDeleteOptionalParams): Promise; get(resourceGroupName: string, clusterName: string, options?: ClustersGetOptionalParams): Promise; listByResourceGroup(resourceGroupName: string, options?: ClustersListByResourceGroupOptionalParams): PagedAsyncIterableIterator; listBySubscription(options?: ClustersListBySubscriptionOptionalParams): PagedAsyncIterableIterator; update(resourceGroupName: string, clusterName: string, cluster: ClusterPatch, options?: ClustersUpdateOptionalParams): Promise; } +// @public +export interface ClustersCreateIdentityOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type ClustersCreateIdentityResponse = ClusterIdentityResponse; + // @public export interface ClustersCreateOptionalParams extends coreClient.OperationOptions { } @@ -195,6 +281,8 @@ export type ClustersCreateResponse = Cluster; // @public export interface ClustersDeleteOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; } // @public @@ -239,6 +327,12 @@ export interface ClustersUpdateOptionalParams extends coreClient.OperationOption // @public export type ClustersUpdateResponse = Cluster; +// @public +export interface ClustersUploadCertificateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + // @public export type CreatedByType = string; @@ -604,6 +698,18 @@ export type OperationsListResponse = OperationListResult; // @public export type Origin = string; +// @public (undocumented) +export interface PasswordCredential { + // (undocumented) + endDateTime?: Date; + // (undocumented) + keyId?: string; + // (undocumented) + secretText?: string; + // (undocumented) + startDateTime?: Date; +} + // @public export interface PerNodeExtensionState { readonly extension?: string; @@ -624,6 +730,12 @@ export type ProvisioningState = string; // @public export type ProxyResource = Resource & {}; +// @public (undocumented) +export interface RawCertificateData { + // (undocumented) + certificates?: string[]; +} + // @public export interface Resource { readonly id?: string; @@ -642,6 +754,12 @@ export type TrackedResource = Resource & { location: string; }; +// @public (undocumented) +export interface UploadCertificateRequest { + // (undocumented) + properties?: RawCertificateData; +} + // @public export type WindowsServerSubscription = string; diff --git a/sdk/azurestackhci/arm-azurestackhci/src/azureStackHCIClient.ts b/sdk/azurestackhci/arm-azurestackhci/src/azureStackHCIClient.ts index 511c3d34ad9c..c2b23e0770fc 100644 --- a/sdk/azurestackhci/arm-azurestackhci/src/azureStackHCIClient.ts +++ b/sdk/azurestackhci/arm-azurestackhci/src/azureStackHCIClient.ts @@ -7,6 +7,12 @@ */ 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 { ArcSettingsImpl, @@ -54,7 +60,7 @@ export class AzureStackHCIClient extends coreClient.ServiceClient { credential: credentials }; - const packageDetails = `azsdk-js-arm-azurestackhci/2.1.1`; + const packageDetails = `azsdk-js-arm-azurestackhci/3.0.0`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` @@ -69,19 +75,72 @@ export class AzureStackHCIClient extends coreClient.ServiceClient { userAgentOptions: { userAgentPrefix }, - baseUri: options.endpoint || "https://management.azure.com" + baseUri: + 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 || "2022-01-01"; + this.apiVersion = options.apiVersion || "2022-05-01"; this.arcSettings = new ArcSettingsImpl(this); this.clusters = new ClustersImpl(this); this.extensions = new ExtensionsImpl(this); this.operations = new OperationsImpl(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); } arcSettings: ArcSettings; diff --git a/sdk/azurestackhci/arm-azurestackhci/src/models/index.ts b/sdk/azurestackhci/arm-azurestackhci/src/models/index.ts index d78b95910e18..03c622d84d1b 100644 --- a/sdk/azurestackhci/arm-azurestackhci/src/models/index.ts +++ b/sdk/azurestackhci/arm-azurestackhci/src/models/index.ts @@ -109,6 +109,29 @@ export interface ErrorAdditionalInfo { readonly info?: Record; } +/** ArcSetting details to update. */ +export interface ArcSettingsPatch { + /** Resource tags. */ + tags?: { [propertyName: string]: string }; + /** contains connectivity related configuration for ARC resources */ + connectivityProperties?: Record; +} + +export interface PasswordCredential { + secretText?: string; + keyId?: string; + startDateTime?: Date; + endDateTime?: Date; +} + +/** ArcIdentity details. */ +export interface ArcIdentityResponse { + arcApplicationClientId?: string; + arcApplicationTenantId?: string; + arcServicePrincipalObjectId?: string; + arcApplicationObjectId?: string; +} + /** List of clusters. */ export interface ClusterList { /** List of clusters. */ @@ -232,6 +255,22 @@ export interface ClusterPatch { desiredProperties?: ClusterDesiredProperties; } +export interface UploadCertificateRequest { + properties?: RawCertificateData; +} + +export interface RawCertificateData { + certificates?: string[]; +} + +/** Cluster Identity details. */ +export interface ClusterIdentityResponse { + aadClientId?: string; + aadTenantId?: string; + aadServicePrincipalObjectId?: string; + aadApplicationObjectId?: string; +} + /** List of Extensions in HCI cluster. */ export interface ExtensionList { /** @@ -329,6 +368,12 @@ export interface OperationDisplay { readonly description?: string; } +/** Connectivity related configuration required by arc server. */ +export interface ArcConnectivityProperties { + /** True indicates ARC connectivity is enabled */ + enabled?: boolean; +} + /** The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location */ export type ProxyResource = Resource & {}; @@ -349,6 +394,14 @@ export type ArcSetting = ProxyResource & { readonly provisioningState?: ProvisioningState; /** The resource group that hosts the Arc agents, ie. Hybrid Compute Machine resources. */ arcInstanceResourceGroup?: string; + /** App id of arc AAD identity. */ + arcApplicationClientId?: string; + /** Tenant id of arc AAD identity. */ + arcApplicationTenantId?: string; + /** Object id of arc AAD service principal. */ + arcServicePrincipalObjectId?: string; + /** Object id of arc AAD identity. */ + arcApplicationObjectId?: string; /** * Aggregate state of Arc agent across the nodes in this HCI cluster. * NOTE: This property will not be serialized. It can only be populated by the server. @@ -359,6 +412,8 @@ export type ArcSetting = ProxyResource & { * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly perNodeDetails?: PerNodeState[]; + /** contains connectivity related configuration for ARC resources */ + connectivityProperties?: Record; /** The identity that created the resource. */ createdBy?: string; /** The type of identity that created the resource. */ @@ -441,6 +496,10 @@ export type Cluster = TrackedResource & { aadClientId?: string; /** Tenant id of cluster AAD identity. */ aadTenantId?: string; + /** Object id of cluster AAD identity. */ + aadApplicationObjectId?: string; + /** Id of cluster identity service principal. */ + aadServicePrincipalObjectId?: string; /** Desired properties of the cluster. */ desiredProperties?: ClusterDesiredProperties; /** @@ -473,6 +532,11 @@ export type Cluster = TrackedResource & { * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly lastBillingTimestamp?: Date; + /** + * Region specific DataPath Endpoint of the cluster. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly serviceEndpoint?: string; /** The identity that created the resource. */ createdBy?: string; /** The type of identity that created the resource. */ @@ -810,6 +874,13 @@ export interface ArcSettingsCreateOptionalParams /** Contains response data for the create operation. */ export type ArcSettingsCreateResponse = ArcSetting; +/** Optional parameters. */ +export interface ArcSettingsUpdateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the update operation. */ +export type ArcSettingsUpdateResponse = ArcSetting; + /** Optional parameters. */ export interface ArcSettingsDeleteOptionalParams extends coreClient.OperationOptions { @@ -819,6 +890,25 @@ export interface ArcSettingsDeleteOptionalParams resumeFrom?: string; } +/** Optional parameters. */ +export interface ArcSettingsGeneratePasswordOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the generatePassword operation. */ +export type ArcSettingsGeneratePasswordResponse = PasswordCredential; + +/** Optional parameters. */ +export interface ArcSettingsCreateIdentityOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the createIdentity operation. */ +export type ArcSettingsCreateIdentityResponse = ArcIdentityResponse; + /** Optional parameters. */ export interface ArcSettingsListByClusterNextOptionalParams extends coreClient.OperationOptions {} @@ -863,7 +953,33 @@ export type ClustersUpdateResponse = Cluster; /** Optional parameters. */ export interface ClustersDeleteOptionalParams - extends coreClient.OperationOptions {} + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Optional parameters. */ +export interface ClustersUploadCertificateOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Optional parameters. */ +export interface ClustersCreateIdentityOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the createIdentity operation. */ +export type ClustersCreateIdentityResponse = ClusterIdentityResponse; /** Optional parameters. */ export interface ClustersListBySubscriptionNextOptionalParams diff --git a/sdk/azurestackhci/arm-azurestackhci/src/models/mappers.ts b/sdk/azurestackhci/arm-azurestackhci/src/models/mappers.ts index c64c554c6e72..46e33b41b623 100644 --- a/sdk/azurestackhci/arm-azurestackhci/src/models/mappers.ts +++ b/sdk/azurestackhci/arm-azurestackhci/src/models/mappers.ts @@ -193,6 +193,95 @@ export const ErrorAdditionalInfo: coreClient.CompositeMapper = { } }; +export const ArcSettingsPatch: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ArcSettingsPatch", + modelProperties: { + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + }, + connectivityProperties: { + serializedName: "properties.connectivityProperties", + type: { + name: "Dictionary", + value: { type: { name: "any" } } + } + } + } + } +}; + +export const PasswordCredential: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "PasswordCredential", + modelProperties: { + secretText: { + serializedName: "secretText", + type: { + name: "String" + } + }, + keyId: { + serializedName: "keyId", + type: { + name: "String" + } + }, + startDateTime: { + serializedName: "startDateTime", + type: { + name: "DateTime" + } + }, + endDateTime: { + serializedName: "endDateTime", + type: { + name: "DateTime" + } + } + } + } +}; + +export const ArcIdentityResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ArcIdentityResponse", + modelProperties: { + arcApplicationClientId: { + serializedName: "properties.arcApplicationClientId", + type: { + name: "String" + } + }, + arcApplicationTenantId: { + serializedName: "properties.arcApplicationTenantId", + type: { + name: "String" + } + }, + arcServicePrincipalObjectId: { + serializedName: "properties.arcServicePrincipalObjectId", + type: { + name: "String" + } + }, + arcApplicationObjectId: { + serializedName: "properties.arcApplicationObjectId", + type: { + name: "String" + } + } + } + } +}; + export const ClusterList: coreClient.CompositeMapper = { type: { name: "Composite", @@ -425,6 +514,75 @@ export const ClusterPatch: coreClient.CompositeMapper = { } }; +export const UploadCertificateRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "UploadCertificateRequest", + modelProperties: { + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "RawCertificateData" + } + } + } + } +}; + +export const RawCertificateData: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "RawCertificateData", + modelProperties: { + certificates: { + serializedName: "certificates", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + } + } + } +}; + +export const ClusterIdentityResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ClusterIdentityResponse", + modelProperties: { + aadClientId: { + serializedName: "properties.aadClientId", + type: { + name: "String" + } + }, + aadTenantId: { + serializedName: "properties.aadTenantId", + type: { + name: "String" + } + }, + aadServicePrincipalObjectId: { + serializedName: "properties.aadServicePrincipalObjectId", + type: { + name: "String" + } + }, + aadApplicationObjectId: { + serializedName: "properties.aadApplicationObjectId", + type: { + name: "String" + } + } + } + } +}; + export const ExtensionList: coreClient.CompositeMapper = { type: { name: "Composite", @@ -594,6 +752,21 @@ export const OperationDisplay: coreClient.CompositeMapper = { } }; +export const ArcConnectivityProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ArcConnectivityProperties", + modelProperties: { + enabled: { + serializedName: "enabled", + type: { + name: "Boolean" + } + } + } + } +}; + export const ProxyResource: coreClient.CompositeMapper = { type: { name: "Composite", @@ -647,6 +820,30 @@ export const ArcSetting: coreClient.CompositeMapper = { name: "String" } }, + arcApplicationClientId: { + serializedName: "properties.arcApplicationClientId", + type: { + name: "String" + } + }, + arcApplicationTenantId: { + serializedName: "properties.arcApplicationTenantId", + type: { + name: "String" + } + }, + arcServicePrincipalObjectId: { + serializedName: "properties.arcServicePrincipalObjectId", + type: { + name: "String" + } + }, + arcApplicationObjectId: { + serializedName: "properties.arcApplicationObjectId", + type: { + name: "String" + } + }, aggregateState: { serializedName: "properties.aggregateState", readOnly: true, @@ -667,6 +864,13 @@ export const ArcSetting: coreClient.CompositeMapper = { } } }, + connectivityProperties: { + serializedName: "properties.connectivityProperties", + type: { + name: "Dictionary", + value: { type: { name: "any" } } + } + }, createdBy: { serializedName: "systemData.createdBy", type: { @@ -870,6 +1074,18 @@ export const Cluster: coreClient.CompositeMapper = { name: "String" } }, + aadApplicationObjectId: { + serializedName: "properties.aadApplicationObjectId", + type: { + name: "String" + } + }, + aadServicePrincipalObjectId: { + serializedName: "properties.aadServicePrincipalObjectId", + type: { + name: "String" + } + }, desiredProperties: { serializedName: "properties.desiredProperties", type: { @@ -919,6 +1135,13 @@ export const Cluster: coreClient.CompositeMapper = { name: "DateTime" } }, + serviceEndpoint: { + serializedName: "properties.serviceEndpoint", + readOnly: true, + type: { + name: "String" + } + }, createdBy: { serializedName: "systemData.createdBy", type: { diff --git a/sdk/azurestackhci/arm-azurestackhci/src/models/parameters.ts b/sdk/azurestackhci/arm-azurestackhci/src/models/parameters.ts index 60a1521159de..d14a11a57d80 100644 --- a/sdk/azurestackhci/arm-azurestackhci/src/models/parameters.ts +++ b/sdk/azurestackhci/arm-azurestackhci/src/models/parameters.ts @@ -13,8 +13,10 @@ import { } from "@azure/core-client"; import { ArcSetting as ArcSettingMapper, + ArcSettingsPatch as ArcSettingsPatchMapper, Cluster as ClusterMapper, ClusterPatch as ClusterPatchMapper, + UploadCertificateRequest as UploadCertificateRequestMapper, Extension as ExtensionMapper } from "../models/mappers"; @@ -85,7 +87,7 @@ export const clusterName: OperationURLParameter = { export const apiVersion: OperationQueryParameter = { parameterPath: "apiVersion", mapper: { - defaultValue: "2022-01-01", + defaultValue: "2022-05-01", isConstant: true, serializedName: "api-version", type: { @@ -122,6 +124,11 @@ export const arcSetting: OperationParameter = { mapper: ArcSettingMapper }; +export const arcSetting1: OperationParameter = { + parameterPath: "arcSetting", + mapper: ArcSettingsPatchMapper +}; + export const nextLink: OperationURLParameter = { parameterPath: "nextLink", mapper: { @@ -144,6 +151,11 @@ export const cluster1: OperationParameter = { mapper: ClusterPatchMapper }; +export const uploadCertificateRequest: OperationParameter = { + parameterPath: "uploadCertificateRequest", + mapper: UploadCertificateRequestMapper +}; + export const extensionName: OperationURLParameter = { parameterPath: "extensionName", mapper: { diff --git a/sdk/azurestackhci/arm-azurestackhci/src/operations/arcSettings.ts b/sdk/azurestackhci/arm-azurestackhci/src/operations/arcSettings.ts index 90c049668791..f8ac8834e714 100644 --- a/sdk/azurestackhci/arm-azurestackhci/src/operations/arcSettings.ts +++ b/sdk/azurestackhci/arm-azurestackhci/src/operations/arcSettings.ts @@ -23,7 +23,14 @@ import { ArcSettingsGetResponse, ArcSettingsCreateOptionalParams, ArcSettingsCreateResponse, + ArcSettingsPatch, + ArcSettingsUpdateOptionalParams, + ArcSettingsUpdateResponse, ArcSettingsDeleteOptionalParams, + ArcSettingsGeneratePasswordOptionalParams, + ArcSettingsGeneratePasswordResponse, + ArcSettingsCreateIdentityOptionalParams, + ArcSettingsCreateIdentityResponse, ArcSettingsListByClusterNextResponse } from "../models"; @@ -168,6 +175,27 @@ export class ArcSettingsImpl implements ArcSettings { ); } + /** + * Update ArcSettings for HCI cluster. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param arcSettingName The name of the proxy resource holding details of HCI ArcSetting information. + * @param arcSetting ArcSettings parameters that needs to be updated + * @param options The options parameters. + */ + update( + resourceGroupName: string, + clusterName: string, + arcSettingName: string, + arcSetting: ArcSettingsPatch, + options?: ArcSettingsUpdateOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, clusterName, arcSettingName, arcSetting, options }, + updateOperationSpec + ); + } + /** * Delete ArcSetting resource details of HCI Cluster. * @param resourceGroupName The name of the resource group. The name is case insensitive. @@ -225,11 +253,13 @@ export class ArcSettingsImpl implements ArcSettings { { resourceGroupName, clusterName, arcSettingName, options }, deleteOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs, lroResourceLocationConfig: "azure-async-operation" }); + await poller.poll(); + return poller; } /** @@ -254,6 +284,118 @@ export class ArcSettingsImpl implements ArcSettings { return poller.pollUntilDone(); } + /** + * Generate password for arc settings. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param arcSettingName The name of the proxy resource holding details of HCI ArcSetting information. + * @param options The options parameters. + */ + generatePassword( + resourceGroupName: string, + clusterName: string, + arcSettingName: string, + options?: ArcSettingsGeneratePasswordOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, clusterName, arcSettingName, options }, + generatePasswordOperationSpec + ); + } + + /** + * Create Aad identity for arc settings. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param arcSettingName The name of the proxy resource holding details of HCI ArcSetting information. + * @param options The options parameters. + */ + async beginCreateIdentity( + resourceGroupName: string, + clusterName: string, + arcSettingName: string, + options?: ArcSettingsCreateIdentityOptionalParams + ): Promise< + PollerLike< + PollOperationState, + ArcSettingsCreateIdentityResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { resourceGroupName, clusterName, arcSettingName, options }, + createIdentityOperationSpec + ); + const poller = new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "azure-async-operation" + }); + await poller.poll(); + return poller; + } + + /** + * Create Aad identity for arc settings. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param arcSettingName The name of the proxy resource holding details of HCI ArcSetting information. + * @param options The options parameters. + */ + async beginCreateIdentityAndWait( + resourceGroupName: string, + clusterName: string, + arcSettingName: string, + options?: ArcSettingsCreateIdentityOptionalParams + ): Promise { + const poller = await this.beginCreateIdentity( + resourceGroupName, + clusterName, + arcSettingName, + options + ); + return poller.pollUntilDone(); + } + /** * ListByClusterNext * @param resourceGroupName The name of the resource group. The name is case insensitive. @@ -346,6 +488,31 @@ const createOperationSpec: coreClient.OperationSpec = { mediaType: "json", serializer }; +const updateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}", + httpMethod: "PATCH", + responses: { + 200: { + bodyMapper: Mappers.ArcSetting + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.arcSetting1, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.clusterName, + Parameters.arcSettingName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; const deleteOperationSpec: coreClient.OperationSpec = { path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}", @@ -370,6 +537,61 @@ const deleteOperationSpec: coreClient.OperationSpec = { headerParameters: [Parameters.accept], serializer }; +const generatePasswordOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/generatePassword", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.PasswordCredential + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.clusterName, + Parameters.arcSettingName + ], + headerParameters: [Parameters.accept], + serializer +}; +const createIdentityOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/createArcIdentity", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.ArcIdentityResponse + }, + 201: { + bodyMapper: Mappers.ArcIdentityResponse + }, + 202: { + bodyMapper: Mappers.ArcIdentityResponse + }, + 204: { + bodyMapper: Mappers.ArcIdentityResponse + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.clusterName, + Parameters.arcSettingName + ], + headerParameters: [Parameters.accept], + serializer +}; const listByClusterNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", httpMethod: "GET", diff --git a/sdk/azurestackhci/arm-azurestackhci/src/operations/clusters.ts b/sdk/azurestackhci/arm-azurestackhci/src/operations/clusters.ts index 382b1bffb34a..fbc1ce5ecd43 100644 --- a/sdk/azurestackhci/arm-azurestackhci/src/operations/clusters.ts +++ b/sdk/azurestackhci/arm-azurestackhci/src/operations/clusters.ts @@ -12,6 +12,8 @@ import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; import { AzureStackHCIClient } from "../azureStackHCIClient"; +import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; +import { LroImpl } from "../lroImpl"; import { Cluster, ClustersListBySubscriptionNextOptionalParams, @@ -28,6 +30,10 @@ import { ClustersUpdateOptionalParams, ClustersUpdateResponse, ClustersDeleteOptionalParams, + UploadCertificateRequest, + ClustersUploadCertificateOptionalParams, + ClustersCreateIdentityOptionalParams, + ClustersCreateIdentityResponse, ClustersListBySubscriptionNextResponse, ClustersListByResourceGroupNextResponse } from "../models"; @@ -229,15 +235,256 @@ export class ClustersImpl implements Clusters { * @param clusterName The name of the cluster. * @param options The options parameters. */ - delete( + async beginDelete( resourceGroupName: string, clusterName: string, options?: ClustersDeleteOptionalParams - ): Promise { - return this.client.sendOperationRequest( + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, { resourceGroupName, clusterName, options }, deleteOperationSpec ); + const poller = new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + await poller.poll(); + return poller; + } + + /** + * Delete an HCI cluster. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param options The options parameters. + */ + async beginDeleteAndWait( + resourceGroupName: string, + clusterName: string, + options?: ClustersDeleteOptionalParams + ): Promise { + const poller = await this.beginDelete( + resourceGroupName, + clusterName, + options + ); + return poller.pollUntilDone(); + } + + /** + * Upload certificate. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param uploadCertificateRequest Upload certificate request. + * @param options The options parameters. + */ + async beginUploadCertificate( + resourceGroupName: string, + clusterName: string, + uploadCertificateRequest: UploadCertificateRequest, + options?: ClustersUploadCertificateOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { resourceGroupName, clusterName, uploadCertificateRequest, options }, + uploadCertificateOperationSpec + ); + const poller = new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "azure-async-operation" + }); + await poller.poll(); + return poller; + } + + /** + * Upload certificate. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param uploadCertificateRequest Upload certificate request. + * @param options The options parameters. + */ + async beginUploadCertificateAndWait( + resourceGroupName: string, + clusterName: string, + uploadCertificateRequest: UploadCertificateRequest, + options?: ClustersUploadCertificateOptionalParams + ): Promise { + const poller = await this.beginUploadCertificate( + resourceGroupName, + clusterName, + uploadCertificateRequest, + options + ); + return poller.pollUntilDone(); + } + + /** + * Create cluster identity. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param options The options parameters. + */ + async beginCreateIdentity( + resourceGroupName: string, + clusterName: string, + options?: ClustersCreateIdentityOptionalParams + ): Promise< + PollerLike< + PollOperationState, + ClustersCreateIdentityResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { resourceGroupName, clusterName, options }, + createIdentityOperationSpec + ); + const poller = new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "azure-async-operation" + }); + await poller.poll(); + return poller; + } + + /** + * Create cluster identity. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param options The options parameters. + */ + async beginCreateIdentityAndWait( + resourceGroupName: string, + clusterName: string, + options?: ClustersCreateIdentityOptionalParams + ): Promise { + const poller = await this.beginCreateIdentity( + resourceGroupName, + clusterName, + options + ); + return poller.pollUntilDone(); } /** @@ -389,11 +636,69 @@ const deleteOperationSpec: coreClient.OperationSpec = { httpMethod: "DELETE", responses: { 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.clusterName + ], + headerParameters: [Parameters.accept], + serializer +}; +const uploadCertificateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/uploadCertificate", + httpMethod: "POST", + responses: { + 200: {}, + 201: {}, + 202: {}, 204: {}, default: { bodyMapper: Mappers.ErrorResponse } }, + requestBody: Parameters.uploadCertificateRequest, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.clusterName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const createIdentityOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/createClusterIdentity", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.ClusterIdentityResponse + }, + 201: { + bodyMapper: Mappers.ClusterIdentityResponse + }, + 202: { + bodyMapper: Mappers.ClusterIdentityResponse + }, + 204: { + bodyMapper: Mappers.ClusterIdentityResponse + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, diff --git a/sdk/azurestackhci/arm-azurestackhci/src/operations/extensions.ts b/sdk/azurestackhci/arm-azurestackhci/src/operations/extensions.ts index cec0ec77d279..30e717c18ee0 100644 --- a/sdk/azurestackhci/arm-azurestackhci/src/operations/extensions.ts +++ b/sdk/azurestackhci/arm-azurestackhci/src/operations/extensions.ts @@ -241,11 +241,13 @@ export class ExtensionsImpl implements Extensions { }, createOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs, lroResourceLocationConfig: "azure-async-operation" }); + await poller.poll(); + return poller; } /** @@ -349,11 +351,13 @@ export class ExtensionsImpl implements Extensions { }, updateOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs, lroResourceLocationConfig: "original-uri" }); + await poller.poll(); + return poller; } /** @@ -449,11 +453,13 @@ export class ExtensionsImpl implements Extensions { }, deleteOperationSpec ); - return new LroEngine(lro, { + const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs, lroResourceLocationConfig: "azure-async-operation" }); + await poller.poll(); + return poller; } /** diff --git a/sdk/azurestackhci/arm-azurestackhci/src/operationsInterfaces/arcSettings.ts b/sdk/azurestackhci/arm-azurestackhci/src/operationsInterfaces/arcSettings.ts index b8541458da21..f6625f9cf045 100644 --- a/sdk/azurestackhci/arm-azurestackhci/src/operationsInterfaces/arcSettings.ts +++ b/sdk/azurestackhci/arm-azurestackhci/src/operationsInterfaces/arcSettings.ts @@ -15,7 +15,14 @@ import { ArcSettingsGetResponse, ArcSettingsCreateOptionalParams, ArcSettingsCreateResponse, - ArcSettingsDeleteOptionalParams + ArcSettingsPatch, + ArcSettingsUpdateOptionalParams, + ArcSettingsUpdateResponse, + ArcSettingsDeleteOptionalParams, + ArcSettingsGeneratePasswordOptionalParams, + ArcSettingsGeneratePasswordResponse, + ArcSettingsCreateIdentityOptionalParams, + ArcSettingsCreateIdentityResponse } from "../models"; /// @@ -60,6 +67,21 @@ export interface ArcSettings { arcSetting: ArcSetting, options?: ArcSettingsCreateOptionalParams ): Promise; + /** + * Update ArcSettings for HCI cluster. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param arcSettingName The name of the proxy resource holding details of HCI ArcSetting information. + * @param arcSetting ArcSettings parameters that needs to be updated + * @param options The options parameters. + */ + update( + resourceGroupName: string, + clusterName: string, + arcSettingName: string, + arcSetting: ArcSettingsPatch, + options?: ArcSettingsUpdateOptionalParams + ): Promise; /** * Delete ArcSetting resource details of HCI Cluster. * @param resourceGroupName The name of the resource group. The name is case insensitive. @@ -86,4 +108,48 @@ export interface ArcSettings { arcSettingName: string, options?: ArcSettingsDeleteOptionalParams ): Promise; + /** + * Generate password for arc settings. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param arcSettingName The name of the proxy resource holding details of HCI ArcSetting information. + * @param options The options parameters. + */ + generatePassword( + resourceGroupName: string, + clusterName: string, + arcSettingName: string, + options?: ArcSettingsGeneratePasswordOptionalParams + ): Promise; + /** + * Create Aad identity for arc settings. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param arcSettingName The name of the proxy resource holding details of HCI ArcSetting information. + * @param options The options parameters. + */ + beginCreateIdentity( + resourceGroupName: string, + clusterName: string, + arcSettingName: string, + options?: ArcSettingsCreateIdentityOptionalParams + ): Promise< + PollerLike< + PollOperationState, + ArcSettingsCreateIdentityResponse + > + >; + /** + * Create Aad identity for arc settings. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param arcSettingName The name of the proxy resource holding details of HCI ArcSetting information. + * @param options The options parameters. + */ + beginCreateIdentityAndWait( + resourceGroupName: string, + clusterName: string, + arcSettingName: string, + options?: ArcSettingsCreateIdentityOptionalParams + ): Promise; } diff --git a/sdk/azurestackhci/arm-azurestackhci/src/operationsInterfaces/clusters.ts b/sdk/azurestackhci/arm-azurestackhci/src/operationsInterfaces/clusters.ts index 44fdb94966e9..572953e118c3 100644 --- a/sdk/azurestackhci/arm-azurestackhci/src/operationsInterfaces/clusters.ts +++ b/sdk/azurestackhci/arm-azurestackhci/src/operationsInterfaces/clusters.ts @@ -7,6 +7,7 @@ */ import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PollerLike, PollOperationState } from "@azure/core-lro"; import { Cluster, ClustersListBySubscriptionOptionalParams, @@ -18,7 +19,11 @@ import { ClusterPatch, ClustersUpdateOptionalParams, ClustersUpdateResponse, - ClustersDeleteOptionalParams + ClustersDeleteOptionalParams, + UploadCertificateRequest, + ClustersUploadCertificateOptionalParams, + ClustersCreateIdentityOptionalParams, + ClustersCreateIdentityResponse } from "../models"; /// @@ -83,9 +88,73 @@ export interface Clusters { * @param clusterName The name of the cluster. * @param options The options parameters. */ - delete( + beginDelete( resourceGroupName: string, clusterName: string, options?: ClustersDeleteOptionalParams + ): Promise, void>>; + /** + * Delete an HCI cluster. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param options The options parameters. + */ + beginDeleteAndWait( + resourceGroupName: string, + clusterName: string, + options?: ClustersDeleteOptionalParams + ): Promise; + /** + * Upload certificate. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param uploadCertificateRequest Upload certificate request. + * @param options The options parameters. + */ + beginUploadCertificate( + resourceGroupName: string, + clusterName: string, + uploadCertificateRequest: UploadCertificateRequest, + options?: ClustersUploadCertificateOptionalParams + ): Promise, void>>; + /** + * Upload certificate. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param uploadCertificateRequest Upload certificate request. + * @param options The options parameters. + */ + beginUploadCertificateAndWait( + resourceGroupName: string, + clusterName: string, + uploadCertificateRequest: UploadCertificateRequest, + options?: ClustersUploadCertificateOptionalParams ): Promise; + /** + * Create cluster identity. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param options The options parameters. + */ + beginCreateIdentity( + resourceGroupName: string, + clusterName: string, + options?: ClustersCreateIdentityOptionalParams + ): Promise< + PollerLike< + PollOperationState, + ClustersCreateIdentityResponse + > + >; + /** + * Create cluster identity. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the cluster. + * @param options The options parameters. + */ + beginCreateIdentityAndWait( + resourceGroupName: string, + clusterName: string, + options?: ClustersCreateIdentityOptionalParams + ): Promise; } diff --git a/sdk/azurestackhci/arm-azurestackhci/test/sampleTest.ts b/sdk/azurestackhci/arm-azurestackhci/test/sampleTest.ts index 7ed89b043e1b..25aeb3ebcc36 100644 --- a/sdk/azurestackhci/arm-azurestackhci/test/sampleTest.ts +++ b/sdk/azurestackhci/arm-azurestackhci/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/azurestackhci/arm-azurestackhci/tsconfig.json b/sdk/azurestackhci/arm-azurestackhci/tsconfig.json index ebe661af00c2..3e6ae96443f3 100644 --- a/sdk/azurestackhci/arm-azurestackhci/tsconfig.json +++ b/sdk/azurestackhci/arm-azurestackhci/tsconfig.json @@ -15,17 +15,11 @@ ], "declaration": true, "outDir": "./dist-esm", - "importHelpers": true, - "paths": { - "@azure/arm-azurestackhci": [ - "./src/index" - ] - } + "importHelpers": true }, "include": [ "./src/**/*.ts", - "./test/**/*.ts", - "samples-dev/**/*.ts" + "./test/**/*.ts" ], "exclude": [ "node_modules"