diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index e29ea4a82c83..27e31d6cc2c3 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -3955,7 +3955,7 @@ packages: resolution: {integrity: sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==} deprecated: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797) dependencies: - ms: 2.1.1 + ms: 2.1.3 dev: false /debug@3.2.7: @@ -4207,7 +4207,7 @@ packages: dependencies: semver: 7.5.4 shelljs: 0.8.5 - typescript: 5.3.0-dev.20231002 + typescript: 5.3.0-dev.20231003 dev: false /eastasianwidth@0.2.0: @@ -5215,7 +5215,7 @@ packages: fs.realpath: 1.0.0 inflight: 1.0.6 inherits: 2.0.4 - minimatch: 3.0.4 + minimatch: 3.1.2 once: 1.4.0 path-is-absolute: 1.0.1 dev: false @@ -8937,8 +8937,8 @@ packages: hasBin: true dev: false - /typescript@5.3.0-dev.20231002: - resolution: {integrity: sha512-TQXM13rrDgID8W4Ok4KDQAqwLUjLcAXL+NKv0zJiIEQfa0bOM0yoRiSgvcjaCJ4lZT4bScrq3vHspVM2x8rkOQ==} + /typescript@5.3.0-dev.20231003: + resolution: {integrity: sha512-OyUdPjo1wNYs+PVDr9ARcEPs0aOqdxterOFzQzWK6DR4tsadKPbrOx8JgTOvSUwhkNOxBOEh7BonqV2uNsTxvA==} engines: {node: '>=14.17'} hasBin: true dev: false @@ -11345,10 +11345,11 @@ packages: dev: false file:projects/arm-confidentialledger.tgz: - resolution: {integrity: sha512-MMuHm6rSqLONHfbtgCFU5NrpEOx6XPys5bHhrA/3JTzfDGR1V9kkrv6C6GVLq0NooQVOiLrVDiI0oHWrgoW+xw==, tarball: file:projects/arm-confidentialledger.tgz} + resolution: {integrity: sha512-nRuQRlkOyYTJHv+1L77dvdkgFGGjJoQH3DL9fFJbIApY8lh6oHt6QPM5JtA6+VnTLF7ndXK+FS7P2d+3Jjk4ug==, tarball: file:projects/arm-confidentialledger.tgz} name: '@rush-temp/arm-confidentialledger' version: 0.0.0 dependencies: + '@azure/identity': 2.1.0 '@microsoft/api-extractor': 7.38.0(@types/node@14.18.63) '@rollup/plugin-commonjs': 24.1.0(rollup@2.79.1) '@rollup/plugin-json': 6.0.0(rollup@2.79.1) @@ -11360,8 +11361,8 @@ packages: cross-env: 7.0.3 dotenv: 16.3.1 mkdirp: 2.1.6 - mocha: 10.2.0 - rimraf: 3.0.2 + mocha: 7.2.0 + rimraf: 5.0.5 rollup: 2.79.1 rollup-plugin-sourcemaps: 0.6.3(@types/node@14.18.63)(rollup@2.79.1) ts-node: 10.9.1(@types/node@14.18.63)(typescript@5.0.4) @@ -11371,6 +11372,7 @@ packages: transitivePeerDependencies: - '@swc/core' - '@swc/wasm' + - supports-color dev: false file:projects/arm-confluent.tgz: diff --git a/sdk/confidentialledger/arm-confidentialledger/CHANGELOG.md b/sdk/confidentialledger/arm-confidentialledger/CHANGELOG.md index 96762621cfbc..bd70507ba65a 100644 --- a/sdk/confidentialledger/arm-confidentialledger/CHANGELOG.md +++ b/sdk/confidentialledger/arm-confidentialledger/CHANGELOG.md @@ -1,23 +1,26 @@ # Release History - -## 1.3.0-beta.2 (Unreleased) - -### Features Added - -### Breaking Changes - -### Bugs Fixed - -### Other Changes - -## 1.3.0-beta.1 (2023-04-19) + +## 1.3.0-beta.2 (2023-10-03) **Features** - Added operation group ManagedCCFOperations + - Added operation Ledger.beginBackup + - Added operation Ledger.beginBackupAndWait + - Added operation Ledger.beginRestore + - Added operation Ledger.beginRestoreAndWait - Added Interface CertificateTags + - Added Interface ConfidentialLedgerBackup + - Added Interface ConfidentialLedgerBackupResponse + - Added Interface ConfidentialLedgerRestore + - Added Interface ConfidentialLedgerRestoreResponse - Added Interface DeploymentType + - Added Interface LedgerBackupOptionalParams + - Added Interface LedgerRestoreOptionalParams - Added Interface ManagedCCF + - Added Interface ManagedCCFBackup + - Added Interface ManagedCCFBackupOptionalParams + - Added Interface ManagedCCFBackupResponse - Added Interface ManagedCCFCreateOptionalParams - Added Interface ManagedCCFDeleteOptionalParams - Added Interface ManagedCCFGetOptionalParams @@ -27,19 +30,30 @@ - Added Interface ManagedCCFListBySubscriptionNextOptionalParams - Added Interface ManagedCCFListBySubscriptionOptionalParams - Added Interface ManagedCCFProperties + - Added Interface ManagedCCFRestore + - Added Interface ManagedCCFRestoreOptionalParams + - Added Interface ManagedCCFRestoreResponse - Added Interface ManagedCCFUpdateOptionalParams - Added Interface MemberIdentityCertificate - Added Interface TrackedResource - Added Type Alias LanguageRuntime + - Added Type Alias LedgerBackupResponse + - Added Type Alias LedgerRestoreResponse + - Added Type Alias LedgerSku + - Added Type Alias ManagedCCFBackupOperationResponse - Added Type Alias ManagedCCFCreateResponse - Added Type Alias ManagedCCFGetResponse - Added Type Alias ManagedCCFListByResourceGroupNextResponse - Added Type Alias ManagedCCFListByResourceGroupResponse - Added Type Alias ManagedCCFListBySubscriptionNextResponse - Added Type Alias ManagedCCFListBySubscriptionResponse + - Added Type Alias ManagedCCFRestoreOperationResponse + - Added Type Alias ManagedCCFUpdateResponse - Added Type Alias RunningState + - Interface LedgerProperties has a new optional parameter ledgerSku - Interface LedgerProperties has a new optional parameter runningState - Added Enum KnownLanguageRuntime + - Added Enum KnownLedgerSku - Added Enum KnownRunningState @@ -60,4 +74,4 @@ ## 1.0.0 (2022-05-30) -The package of @azure/arm-confidentialledger is using our next generation design principles. To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/js/mgmt/quickstart ). +The package of @azure/arm-confidentialledger is using our next generation design principles. To learn more, please refer to our documentation [Quick Start](https://aka.ms/js-track2-quickstart). diff --git a/sdk/confidentialledger/arm-confidentialledger/_meta.json b/sdk/confidentialledger/arm-confidentialledger/_meta.json index 2608349fc342..e291e0831536 100644 --- a/sdk/confidentialledger/arm-confidentialledger/_meta.json +++ b/sdk/confidentialledger/arm-confidentialledger/_meta.json @@ -1,8 +1,8 @@ { - "commit": "536b9a8ae0f41df1f1479b1a42c8d656cbf0c8d6", + "commit": "69d86e5b13cc0d9b3bb1fe7cfff2299afbcc51f2", "readme": "specification/confidentialledger/resource-manager/readme.md", - "autorest_command": "autorest --version=3.9.3 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\Git\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\confidentialledger\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-rc.10 --generate-sample=true", + "autorest_command": "autorest --version=3.9.7 --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/confidentialledger/resource-manager/readme.md --use=@autorest/typescript@^6.0.4", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "release_tool": "@azure-tools/js-sdk-release-tools@2.6.2", - "use": "@autorest/typescript@6.0.0-rc.10" + "release_tool": "@azure-tools/js-sdk-release-tools@2.7.2", + "use": "@autorest/typescript@^6.0.4" } \ No newline at end of file diff --git a/sdk/confidentialledger/arm-confidentialledger/package.json b/sdk/confidentialledger/arm-confidentialledger/package.json index 6ff709efa341..36e22ff8579f 100644 --- a/sdk/confidentialledger/arm-confidentialledger/package.json +++ b/sdk/confidentialledger/arm-confidentialledger/package.json @@ -8,12 +8,12 @@ "node": ">=14.0.0" }, "dependencies": { - "@azure/core-lro": "^2.5.0", + "@azure/core-lro": "^2.5.4", "@azure/abort-controller": "^1.0.0", "@azure/core-paging": "^1.2.0", "@azure/core-client": "^1.7.0", "@azure/core-auth": "^1.3.0", - "@azure/core-rest-pipeline": "^1.8.0", + "@azure/core-rest-pipeline": "^1.12.0", "tslib": "^2.2.0" }, "keywords": [ @@ -38,18 +38,18 @@ "rollup-plugin-sourcemaps": "^0.6.3", "typescript": "~5.0.0", "uglify-js": "^3.4.9", - "rimraf": "^3.0.0", + "rimraf": "^5.0.0", "dotenv": "^16.0.0", - "@azure/identity": "^3.3.0", + "@azure/identity": "^2.0.1", "@azure-tools/test-recorder": "^3.0.0", "@azure-tools/test-credential": "^1.0.0", - "mocha": "^10.0.0", + "mocha": "^7.1.1", "@types/chai": "^4.2.8", "chai": "^4.2.0", "cross-env": "^7.0.2", "@types/node": "^14.0.0", - "@azure/dev-tool": "^1.0.0", - "ts-node": "^10.0.0" + "ts-node": "^10.0.0", + "@azure/dev-tool": "^1.0.0" }, "repository": { "type": "git", @@ -84,7 +84,7 @@ "extract-api": "api-extractor run --local", "lint": "echo skipped", "audit": "echo skipped", - "clean": "rimraf dist dist-browser dist-esm test-dist temp types *.tgz *.log", + "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", "build:browser": "echo skipped", "build:test": "echo skipped", @@ -112,13 +112,5 @@ ] }, "autoPublish": true, - "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/confidentialledger/arm-confidentialledger", - "//sampleConfiguration": { - "productName": "", - "productSlugs": [ - "azure" - ], - "disableDocsMs": true, - "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-confidentialledger?view=azure-node-preview" - } -} + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/confidentialledger/arm-confidentialledger" +} \ No newline at end of file diff --git a/sdk/confidentialledger/arm-confidentialledger/review/arm-confidentialledger.api.md b/sdk/confidentialledger/arm-confidentialledger/review/arm-confidentialledger.api.md index e7bba8cd1299..cd725c576278 100644 --- a/sdk/confidentialledger/arm-confidentialledger/review/arm-confidentialledger.api.md +++ b/sdk/confidentialledger/arm-confidentialledger/review/arm-confidentialledger.api.md @@ -58,6 +58,17 @@ export interface ConfidentialLedger extends TrackedResource { properties?: LedgerProperties; } +// @public +export interface ConfidentialLedgerBackup { + restoreRegion?: string; + uri: string; +} + +// @public +export interface ConfidentialLedgerBackupResponse { + readonly message?: string; +} + // @public (undocumented) export class ConfidentialLedgerClient extends coreClient.ServiceClient { // (undocumented) @@ -89,6 +100,18 @@ export interface ConfidentialLedgerList { value?: ConfidentialLedger[]; } +// @public +export interface ConfidentialLedgerRestore { + fileShareName: string; + restoreRegion: string; + uri: string; +} + +// @public +export interface ConfidentialLedgerRestoreResponse { + readonly message?: string; +} + // @public export type CreatedByType = string; @@ -148,6 +171,13 @@ export enum KnownLedgerRoleName { Reader = "Reader" } +// @public +export enum KnownLedgerSku { + Basic = "Basic", + Standard = "Standard", + Unknown = "Unknown" +} + // @public export enum KnownLedgerType { Private = "Private", @@ -180,10 +210,14 @@ export type LanguageRuntime = string; // @public export interface Ledger { + beginBackup(resourceGroupName: string, ledgerName: string, confidentialLedger: ConfidentialLedgerBackup, options?: LedgerBackupOptionalParams): Promise, LedgerBackupResponse>>; + beginBackupAndWait(resourceGroupName: string, ledgerName: string, confidentialLedger: ConfidentialLedgerBackup, options?: LedgerBackupOptionalParams): Promise; beginCreate(resourceGroupName: string, ledgerName: string, confidentialLedger: ConfidentialLedger, options?: LedgerCreateOptionalParams): Promise, LedgerCreateResponse>>; beginCreateAndWait(resourceGroupName: string, ledgerName: string, confidentialLedger: ConfidentialLedger, options?: LedgerCreateOptionalParams): Promise; beginDelete(resourceGroupName: string, ledgerName: string, options?: LedgerDeleteOptionalParams): Promise, void>>; beginDeleteAndWait(resourceGroupName: string, ledgerName: string, options?: LedgerDeleteOptionalParams): Promise; + beginRestore(resourceGroupName: string, ledgerName: string, confidentialLedger: ConfidentialLedgerRestore, options?: LedgerRestoreOptionalParams): Promise, LedgerRestoreResponse>>; + beginRestoreAndWait(resourceGroupName: string, ledgerName: string, confidentialLedger: ConfidentialLedgerRestore, options?: LedgerRestoreOptionalParams): Promise; beginUpdate(resourceGroupName: string, ledgerName: string, confidentialLedger: ConfidentialLedger, options?: LedgerUpdateOptionalParams): Promise, LedgerUpdateResponse>>; beginUpdateAndWait(resourceGroupName: string, ledgerName: string, confidentialLedger: ConfidentialLedger, options?: LedgerUpdateOptionalParams): Promise; get(resourceGroupName: string, ledgerName: string, options?: LedgerGetOptionalParams): Promise; @@ -191,6 +225,15 @@ export interface Ledger { listBySubscription(options?: LedgerListBySubscriptionOptionalParams): PagedAsyncIterableIterator; } +// @public +export interface LedgerBackupOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type LedgerBackupResponse = ConfidentialLedgerBackupResponse; + // @public export interface LedgerCreateOptionalParams extends coreClient.OperationOptions { resumeFrom?: string; @@ -250,15 +293,28 @@ export interface LedgerProperties { readonly identityServiceUri?: string; readonly ledgerInternalNamespace?: string; readonly ledgerName?: string; + ledgerSku?: LedgerSku; ledgerType?: LedgerType; readonly ledgerUri?: string; readonly provisioningState?: ProvisioningState; runningState?: RunningState; } +// @public +export interface LedgerRestoreOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type LedgerRestoreResponse = ConfidentialLedgerRestoreResponse; + // @public export type LedgerRoleName = string; +// @public +export type LedgerSku = string; + // @public export type LedgerType = string; @@ -276,6 +332,26 @@ export interface ManagedCCF extends TrackedResource { properties?: ManagedCCFProperties; } +// @public +export interface ManagedCCFBackup { + restoreRegion?: string; + uri: string; +} + +// @public +export type ManagedCCFBackupOperationResponse = ManagedCCFBackupResponse; + +// @public +export interface ManagedCCFBackupOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface ManagedCCFBackupResponse { + readonly message?: string; +} + // @public export interface ManagedCCFCreateOptionalParams extends coreClient.OperationOptions { resumeFrom?: string; @@ -336,12 +412,16 @@ export type ManagedCCFListBySubscriptionResponse = ManagedCCFList; // @public export interface ManagedCCFOperations { + beginBackup(resourceGroupName: string, appName: string, managedCCF: ManagedCCFBackup, options?: ManagedCCFBackupOptionalParams): Promise, ManagedCCFBackupOperationResponse>>; + beginBackupAndWait(resourceGroupName: string, appName: string, managedCCF: ManagedCCFBackup, options?: ManagedCCFBackupOptionalParams): Promise; beginCreate(resourceGroupName: string, appName: string, managedCCF: ManagedCCF, options?: ManagedCCFCreateOptionalParams): Promise, ManagedCCFCreateResponse>>; beginCreateAndWait(resourceGroupName: string, appName: string, managedCCF: ManagedCCF, options?: ManagedCCFCreateOptionalParams): Promise; beginDelete(resourceGroupName: string, appName: string, options?: ManagedCCFDeleteOptionalParams): Promise, void>>; beginDeleteAndWait(resourceGroupName: string, appName: string, options?: ManagedCCFDeleteOptionalParams): Promise; - beginUpdate(resourceGroupName: string, appName: string, managedCCF: ManagedCCF, options?: ManagedCCFUpdateOptionalParams): Promise, void>>; - beginUpdateAndWait(resourceGroupName: string, appName: string, managedCCF: ManagedCCF, options?: ManagedCCFUpdateOptionalParams): Promise; + beginRestore(resourceGroupName: string, appName: string, managedCCF: ManagedCCFRestore, options?: ManagedCCFRestoreOptionalParams): Promise, ManagedCCFRestoreOperationResponse>>; + beginRestoreAndWait(resourceGroupName: string, appName: string, managedCCF: ManagedCCFRestore, options?: ManagedCCFRestoreOptionalParams): Promise; + beginUpdate(resourceGroupName: string, appName: string, managedCCF: ManagedCCF, options?: ManagedCCFUpdateOptionalParams): Promise, ManagedCCFUpdateResponse>>; + beginUpdateAndWait(resourceGroupName: string, appName: string, managedCCF: ManagedCCF, options?: ManagedCCFUpdateOptionalParams): Promise; get(resourceGroupName: string, appName: string, options?: ManagedCCFGetOptionalParams): Promise; listByResourceGroup(resourceGroupName: string, options?: ManagedCCFListByResourceGroupOptionalParams): PagedAsyncIterableIterator; listBySubscription(options?: ManagedCCFListBySubscriptionOptionalParams): PagedAsyncIterableIterator; @@ -356,6 +436,28 @@ export interface ManagedCCFProperties { memberIdentityCertificates?: MemberIdentityCertificate[]; nodeCount?: number; readonly provisioningState?: ProvisioningState; + runningState?: RunningState; +} + +// @public +export interface ManagedCCFRestore { + fileShareName: string; + restoreRegion: string; + uri: string; +} + +// @public +export type ManagedCCFRestoreOperationResponse = ManagedCCFRestoreResponse; + +// @public +export interface ManagedCCFRestoreOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface ManagedCCFRestoreResponse { + readonly message?: string; } // @public @@ -364,6 +466,9 @@ export interface ManagedCCFUpdateOptionalParams extends coreClient.OperationOpti updateIntervalInMs?: number; } +// @public +export type ManagedCCFUpdateResponse = ManagedCCF; + // @public export interface MemberIdentityCertificate { certificate?: string; diff --git a/sdk/confidentialledger/arm-confidentialledger/src/confidentialLedgerClient.ts b/sdk/confidentialledger/arm-confidentialledger/src/confidentialLedgerClient.ts index 172069e12599..d2b47857e2b5 100644 --- a/sdk/confidentialledger/arm-confidentialledger/src/confidentialLedgerClient.ts +++ b/sdk/confidentialledger/arm-confidentialledger/src/confidentialLedgerClient.ts @@ -118,7 +118,7 @@ export class ConfidentialLedgerClient extends coreClient.ServiceClient { // Assigning values to Constant parameters this.$host = options.$host || "https://management.azure.com"; - this.apiVersion = options.apiVersion || "2023-01-26-preview"; + this.apiVersion = options.apiVersion || "2023-06-28-preview"; this.operations = new OperationsImpl(this); this.ledger = new LedgerImpl(this); this.managedCCFOperations = new ManagedCCFOperationsImpl(this); diff --git a/sdk/confidentialledger/arm-confidentialledger/src/models/index.ts b/sdk/confidentialledger/arm-confidentialledger/src/models/index.ts index 348e026296b5..08f4c1940c62 100644 --- a/sdk/confidentialledger/arm-confidentialledger/src/models/index.ts +++ b/sdk/confidentialledger/arm-confidentialledger/src/models/index.ts @@ -142,6 +142,8 @@ export interface LedgerProperties { * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly provisioningState?: ProvisioningState; + /** SKU associated with the ledger */ + ledgerSku?: LedgerSku; /** Array of all AAD based Security Principals. */ aadBasedSecurityPrincipals?: AADBasedSecurityPrincipal[]; /** Array of all cert based Security Principals. */ @@ -214,6 +216,42 @@ export interface ConfidentialLedgerList { nextLink?: string; } +/** Object representing Backup properties of a Confidential Ledger Resource. */ +export interface ConfidentialLedgerBackup { + /** The region where the backup of the ledger will eventually be restored to. */ + restoreRegion?: string; + /** SAS URI used to access the backup Fileshare. */ + uri: string; +} + +/** Object representing the backup response of a Confidential Ledger Resource. */ +export interface ConfidentialLedgerBackupResponse { + /** + * Response body stating if the ledger is being backed up. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly message?: string; +} + +/** Object representing Restore properties of a Confidential Ledger Resource. */ +export interface ConfidentialLedgerRestore { + /** Fileshare where the ledger backup is stored. */ + fileShareName: string; + /** The region the ledger is being restored to. */ + restoreRegion: string; + /** SAS URI used to access the backup fileshare. */ + uri: string; +} + +/** Object representing the restore response of a Confidential Ledger Resource. */ +export interface ConfidentialLedgerRestoreResponse { + /** + * Response body stating if the ledger is being restored. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly message?: string; +} + /** Additional Managed CCF properties. */ export interface ManagedCCFProperties { /** @@ -235,8 +273,10 @@ export interface ManagedCCFProperties { memberIdentityCertificates?: MemberIdentityCertificate[]; /** Deployment Type of Managed CCF */ deploymentType?: DeploymentType; + /** Object representing RunningState for Managed CCF. */ + runningState?: RunningState; /** - * Provisioning state of Ledger Resource + * Provisioning state of Managed CCF Resource * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly provisioningState?: ProvisioningState; @@ -270,6 +310,42 @@ export interface ManagedCCFList { nextLink?: string; } +/** Object representing Backup properties of a Managed CCF Resource. */ +export interface ManagedCCFBackup { + /** The region where the backup of the managed CCF resource will eventually be restored to. */ + restoreRegion?: string; + /** SAS URI used to access the backup Fileshare. */ + uri: string; +} + +/** Object representing the backup response of a Managed CCF Resource. */ +export interface ManagedCCFBackupResponse { + /** + * Response body stating if the managed CCF resource is being backed up. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly message?: string; +} + +/** Object representing Restore properties of Managed CCF Resource. */ +export interface ManagedCCFRestore { + /** Fileshare where the managed CCF resource backup is stored. */ + fileShareName: string; + /** The region the managed CCF resource is being restored to. */ + restoreRegion: string; + /** SAS URI used to access the backup Fileshare. */ + uri: string; +} + +/** Object representing the restore response of a Managed CCF Resource. */ +export interface ManagedCCFRestoreResponse { + /** + * Response body stating if the managed CCF resource is being restored. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly message?: string; +} + /** Tags for Managed CCF Certificates */ export interface CertificateTags { /** Additional tags for Managed CCF Certificates */ @@ -395,6 +471,27 @@ export enum KnownProvisioningState { */ export type ProvisioningState = string; +/** Known values of {@link LedgerSku} that the service accepts. */ +export enum KnownLedgerSku { + /** Standard */ + Standard = "Standard", + /** Basic */ + Basic = "Basic", + /** Unknown */ + Unknown = "Unknown" +} + +/** + * Defines values for LedgerSku. \ + * {@link KnownLedgerSku} can be used interchangeably with LedgerSku, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Standard** \ + * **Basic** \ + * **Unknown** + */ +export type LedgerSku = string; + /** Known values of {@link LedgerRoleName} that the service accepts. */ export enum KnownLedgerRoleName { /** Reader */ @@ -538,6 +635,30 @@ export interface LedgerListBySubscriptionOptionalParams /** Contains response data for the listBySubscription operation. */ export type LedgerListBySubscriptionResponse = ConfidentialLedgerList; +/** Optional parameters. */ +export interface LedgerBackupOptionalParams + 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 backup operation. */ +export type LedgerBackupResponse = ConfidentialLedgerBackupResponse; + +/** Optional parameters. */ +export interface LedgerRestoreOptionalParams + 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 restore operation. */ +export type LedgerRestoreResponse = ConfidentialLedgerRestoreResponse; + /** Optional parameters. */ export interface LedgerListByResourceGroupNextOptionalParams extends coreClient.OperationOptions {} @@ -589,6 +710,9 @@ export interface ManagedCCFUpdateOptionalParams resumeFrom?: string; } +/** Contains response data for the update operation. */ +export type ManagedCCFUpdateResponse = ManagedCCF; + /** Optional parameters. */ export interface ManagedCCFListByResourceGroupOptionalParams extends coreClient.OperationOptions { @@ -609,6 +733,30 @@ export interface ManagedCCFListBySubscriptionOptionalParams /** Contains response data for the listBySubscription operation. */ export type ManagedCCFListBySubscriptionResponse = ManagedCCFList; +/** Optional parameters. */ +export interface ManagedCCFBackupOptionalParams + 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 backup operation. */ +export type ManagedCCFBackupOperationResponse = ManagedCCFBackupResponse; + +/** Optional parameters. */ +export interface ManagedCCFRestoreOptionalParams + 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 restore operation. */ +export type ManagedCCFRestoreOperationResponse = ManagedCCFRestoreResponse; + /** Optional parameters. */ export interface ManagedCCFListByResourceGroupNextOptionalParams extends coreClient.OperationOptions {} diff --git a/sdk/confidentialledger/arm-confidentialledger/src/models/mappers.ts b/sdk/confidentialledger/arm-confidentialledger/src/models/mappers.ts index 153c4c4abed1..83312099ffc2 100644 --- a/sdk/confidentialledger/arm-confidentialledger/src/models/mappers.ts +++ b/sdk/confidentialledger/arm-confidentialledger/src/models/mappers.ts @@ -294,6 +294,12 @@ export const LedgerProperties: coreClient.CompositeMapper = { name: "String" } }, + ledgerSku: { + serializedName: "ledgerSku", + type: { + name: "String" + } + }, aadBasedSecurityPrincipals: { serializedName: "aadBasedSecurityPrincipals", type: { @@ -479,6 +485,90 @@ export const ConfidentialLedgerList: coreClient.CompositeMapper = { } }; +export const ConfidentialLedgerBackup: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ConfidentialLedgerBackup", + modelProperties: { + restoreRegion: { + serializedName: "restoreRegion", + type: { + name: "String" + } + }, + uri: { + serializedName: "uri", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const ConfidentialLedgerBackupResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ConfidentialLedgerBackupResponse", + modelProperties: { + message: { + serializedName: "message", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const ConfidentialLedgerRestore: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ConfidentialLedgerRestore", + modelProperties: { + fileShareName: { + serializedName: "fileShareName", + required: true, + type: { + name: "String" + } + }, + restoreRegion: { + serializedName: "restoreRegion", + required: true, + type: { + name: "String" + } + }, + uri: { + serializedName: "uri", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const ConfidentialLedgerRestoreResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ConfidentialLedgerRestoreResponse", + modelProperties: { + message: { + serializedName: "message", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + export const ManagedCCFProperties: coreClient.CompositeMapper = { type: { name: "Composite", @@ -524,6 +614,12 @@ export const ManagedCCFProperties: coreClient.CompositeMapper = { className: "DeploymentType" } }, + runningState: { + serializedName: "runningState", + type: { + name: "String" + } + }, provisioningState: { serializedName: "provisioningState", readOnly: true, @@ -617,6 +713,90 @@ export const ManagedCCFList: coreClient.CompositeMapper = { } }; +export const ManagedCCFBackup: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ManagedCCFBackup", + modelProperties: { + restoreRegion: { + serializedName: "restoreRegion", + type: { + name: "String" + } + }, + uri: { + serializedName: "uri", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const ManagedCCFBackupResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ManagedCCFBackupResponse", + modelProperties: { + message: { + serializedName: "message", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const ManagedCCFRestore: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ManagedCCFRestore", + modelProperties: { + fileShareName: { + serializedName: "fileShareName", + required: true, + type: { + name: "String" + } + }, + restoreRegion: { + serializedName: "restoreRegion", + required: true, + type: { + name: "String" + } + }, + uri: { + serializedName: "uri", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const ManagedCCFRestoreResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ManagedCCFRestoreResponse", + modelProperties: { + message: { + serializedName: "message", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + export const CertificateTags: coreClient.CompositeMapper = { type: { name: "Composite", diff --git a/sdk/confidentialledger/arm-confidentialledger/src/models/parameters.ts b/sdk/confidentialledger/arm-confidentialledger/src/models/parameters.ts index c5e868499cc2..d16c78604d15 100644 --- a/sdk/confidentialledger/arm-confidentialledger/src/models/parameters.ts +++ b/sdk/confidentialledger/arm-confidentialledger/src/models/parameters.ts @@ -14,7 +14,11 @@ import { import { CheckNameAvailabilityRequest as CheckNameAvailabilityRequestMapper, ConfidentialLedger as ConfidentialLedgerMapper, - ManagedCCF as ManagedCCFMapper + ConfidentialLedgerBackup as ConfidentialLedgerBackupMapper, + ConfidentialLedgerRestore as ConfidentialLedgerRestoreMapper, + ManagedCCF as ManagedCCFMapper, + ManagedCCFBackup as ManagedCCFBackupMapper, + ManagedCCFRestore as ManagedCCFRestoreMapper } from "../models/mappers"; export const accept: OperationParameter = { @@ -44,7 +48,7 @@ export const $host: OperationURLParameter = { export const apiVersion: OperationQueryParameter = { parameterPath: "apiVersion", mapper: { - defaultValue: "2023-01-26-preview", + defaultValue: "2023-06-28-preview", isConstant: true, serializedName: "api-version", type: { @@ -140,6 +144,16 @@ export const filter: OperationQueryParameter = { } }; +export const confidentialLedger1: OperationParameter = { + parameterPath: "confidentialLedger", + mapper: ConfidentialLedgerBackupMapper +}; + +export const confidentialLedger2: OperationParameter = { + parameterPath: "confidentialLedger", + mapper: ConfidentialLedgerRestoreMapper +}; + export const appName: OperationURLParameter = { parameterPath: "appName", mapper: { @@ -158,3 +172,13 @@ export const managedCCF: OperationParameter = { parameterPath: "managedCCF", mapper: ManagedCCFMapper }; + +export const managedCCF1: OperationParameter = { + parameterPath: "managedCCF", + mapper: ManagedCCFBackupMapper +}; + +export const managedCCF2: OperationParameter = { + parameterPath: "managedCCF", + mapper: ManagedCCFRestoreMapper +}; diff --git a/sdk/confidentialledger/arm-confidentialledger/src/operations/ledger.ts b/sdk/confidentialledger/arm-confidentialledger/src/operations/ledger.ts index 646edfc2845f..e08ab58c7663 100644 --- a/sdk/confidentialledger/arm-confidentialledger/src/operations/ledger.ts +++ b/sdk/confidentialledger/arm-confidentialledger/src/operations/ledger.ts @@ -34,6 +34,12 @@ import { LedgerCreateResponse, LedgerUpdateOptionalParams, LedgerUpdateResponse, + ConfidentialLedgerBackup, + LedgerBackupOptionalParams, + LedgerBackupResponse, + ConfidentialLedgerRestore, + LedgerRestoreOptionalParams, + LedgerRestoreResponse, LedgerListByResourceGroupNextResponse, LedgerListBySubscriptionNextResponse } from "../models"; @@ -486,6 +492,193 @@ export class LedgerImpl implements Ledger { ); } + /** + * Backs up a Confidential Ledger Resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ledgerName Name of the Confidential Ledger + * @param confidentialLedger Confidential Ledger Backup Request Body + * @param options The options parameters. + */ + async beginBackup( + resourceGroupName: string, + ledgerName: string, + confidentialLedger: ConfidentialLedgerBackup, + options?: LedgerBackupOptionalParams + ): Promise< + SimplePollerLike, LedgerBackupResponse> + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, ledgerName, confidentialLedger, options }, + spec: backupOperationSpec + }); + const poller = await createHttpPoller< + LedgerBackupResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + await poller.poll(); + return poller; + } + + /** + * Backs up a Confidential Ledger Resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ledgerName Name of the Confidential Ledger + * @param confidentialLedger Confidential Ledger Backup Request Body + * @param options The options parameters. + */ + async beginBackupAndWait( + resourceGroupName: string, + ledgerName: string, + confidentialLedger: ConfidentialLedgerBackup, + options?: LedgerBackupOptionalParams + ): Promise { + const poller = await this.beginBackup( + resourceGroupName, + ledgerName, + confidentialLedger, + options + ); + return poller.pollUntilDone(); + } + + /** + * Restores a Confidential Ledger Resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ledgerName Name of the Confidential Ledger + * @param confidentialLedger Confidential Ledger Restore Request Body + * @param options The options parameters. + */ + async beginRestore( + resourceGroupName: string, + ledgerName: string, + confidentialLedger: ConfidentialLedgerRestore, + options?: LedgerRestoreOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + LedgerRestoreResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, ledgerName, confidentialLedger, options }, + spec: restoreOperationSpec + }); + const poller = await createHttpPoller< + LedgerRestoreResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + await poller.poll(); + return poller; + } + + /** + * Restores a Confidential Ledger Resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ledgerName Name of the Confidential Ledger + * @param confidentialLedger Confidential Ledger Restore Request Body + * @param options The options parameters. + */ + async beginRestoreAndWait( + resourceGroupName: string, + ledgerName: string, + confidentialLedger: ConfidentialLedgerRestore, + options?: LedgerRestoreOptionalParams + ): Promise { + const poller = await this.beginRestore( + resourceGroupName, + ledgerName, + confidentialLedger, + options + ); + return poller.pollUntilDone(); + } + /** * ListByResourceGroupNext * @param resourceGroupName The name of the resource group. The name is case insensitive. @@ -670,6 +863,72 @@ const listBySubscriptionOperationSpec: coreClient.OperationSpec = { headerParameters: [Parameters.accept], serializer }; +const backupOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConfidentialLedger/ledgers/{ledgerName}/backup", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.ConfidentialLedgerBackupResponse + }, + 201: { + bodyMapper: Mappers.ConfidentialLedgerBackupResponse + }, + 202: { + bodyMapper: Mappers.ConfidentialLedgerBackupResponse + }, + 204: { + bodyMapper: Mappers.ConfidentialLedgerBackupResponse + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.confidentialLedger1, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.ledgerName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const restoreOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConfidentialLedger/ledgers/{ledgerName}/restore", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.ConfidentialLedgerRestoreResponse + }, + 201: { + bodyMapper: Mappers.ConfidentialLedgerRestoreResponse + }, + 202: { + bodyMapper: Mappers.ConfidentialLedgerRestoreResponse + }, + 204: { + bodyMapper: Mappers.ConfidentialLedgerRestoreResponse + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.confidentialLedger2, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.ledgerName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", httpMethod: "GET", diff --git a/sdk/confidentialledger/arm-confidentialledger/src/operations/managedCCFOperations.ts b/sdk/confidentialledger/arm-confidentialledger/src/operations/managedCCFOperations.ts index b2ca96adc15e..5247074e823e 100644 --- a/sdk/confidentialledger/arm-confidentialledger/src/operations/managedCCFOperations.ts +++ b/sdk/confidentialledger/arm-confidentialledger/src/operations/managedCCFOperations.ts @@ -33,6 +33,13 @@ import { ManagedCCFCreateOptionalParams, ManagedCCFCreateResponse, ManagedCCFUpdateOptionalParams, + ManagedCCFUpdateResponse, + ManagedCCFBackup, + ManagedCCFBackupOptionalParams, + ManagedCCFBackupOperationResponse, + ManagedCCFRestore, + ManagedCCFRestoreOptionalParams, + ManagedCCFRestoreOperationResponse, ManagedCCFListByResourceGroupNextResponse, ManagedCCFListBySubscriptionNextResponse } from "../models"; @@ -376,11 +383,16 @@ export class ManagedCCFOperationsImpl implements ManagedCCFOperations { appName: string, managedCCF: ManagedCCF, options?: ManagedCCFUpdateOptionalParams - ): Promise, void>> { + ): Promise< + SimplePollerLike< + OperationState, + ManagedCCFUpdateResponse + > + > { const directSendOperation = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec - ): Promise => { + ): Promise => { return this.client.sendOperationRequest(args, spec); }; const sendOperationFn = async ( @@ -421,7 +433,10 @@ export class ManagedCCFOperationsImpl implements ManagedCCFOperations { args: { resourceGroupName, appName, managedCCF, options }, spec: updateOperationSpec }); - const poller = await createHttpPoller>(lro, { + const poller = await createHttpPoller< + ManagedCCFUpdateResponse, + OperationState + >(lro, { restoreFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); @@ -441,7 +456,7 @@ export class ManagedCCFOperationsImpl implements ManagedCCFOperations { appName: string, managedCCF: ManagedCCF, options?: ManagedCCFUpdateOptionalParams - ): Promise { + ): Promise { const poller = await this.beginUpdate( resourceGroupName, appName, @@ -479,6 +494,196 @@ export class ManagedCCFOperationsImpl implements ManagedCCFOperations { ); } + /** + * Backs up a Managed CCF Resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param appName Name of the Managed CCF + * @param managedCCF Managed CCF Backup Request Body + * @param options The options parameters. + */ + async beginBackup( + resourceGroupName: string, + appName: string, + managedCCF: ManagedCCFBackup, + options?: ManagedCCFBackupOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + ManagedCCFBackupOperationResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, appName, managedCCF, options }, + spec: backupOperationSpec + }); + const poller = await createHttpPoller< + ManagedCCFBackupOperationResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + await poller.poll(); + return poller; + } + + /** + * Backs up a Managed CCF Resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param appName Name of the Managed CCF + * @param managedCCF Managed CCF Backup Request Body + * @param options The options parameters. + */ + async beginBackupAndWait( + resourceGroupName: string, + appName: string, + managedCCF: ManagedCCFBackup, + options?: ManagedCCFBackupOptionalParams + ): Promise { + const poller = await this.beginBackup( + resourceGroupName, + appName, + managedCCF, + options + ); + return poller.pollUntilDone(); + } + + /** + * Restores a Managed CCF Resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param appName Name of the Managed CCF + * @param managedCCF Managed CCF Restore Request Body + * @param options The options parameters. + */ + async beginRestore( + resourceGroupName: string, + appName: string, + managedCCF: ManagedCCFRestore, + options?: ManagedCCFRestoreOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + ManagedCCFRestoreOperationResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, appName, managedCCF, options }, + spec: restoreOperationSpec + }); + const poller = await createHttpPoller< + ManagedCCFRestoreOperationResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + await poller.poll(); + return poller; + } + + /** + * Restores a Managed CCF Resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param appName Name of the Managed CCF + * @param managedCCF Managed CCF Restore Request Body + * @param options The options parameters. + */ + async beginRestoreAndWait( + resourceGroupName: string, + appName: string, + managedCCF: ManagedCCFRestore, + options?: ManagedCCFRestoreOptionalParams + ): Promise { + const poller = await this.beginRestore( + resourceGroupName, + appName, + managedCCF, + options + ); + return poller.pollUntilDone(); + } + /** * ListByResourceGroupNext * @param resourceGroupName The name of the resource group. The name is case insensitive. @@ -597,10 +802,18 @@ const updateOperationSpec: coreClient.OperationSpec = { "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConfidentialLedger/managedCCFs/{appName}", httpMethod: "PATCH", responses: { - 200: {}, - 201: {}, - 202: {}, - 204: {}, + 200: { + bodyMapper: Mappers.ManagedCCF + }, + 201: { + bodyMapper: Mappers.ManagedCCF + }, + 202: { + bodyMapper: Mappers.ManagedCCF + }, + 204: { + bodyMapper: Mappers.ManagedCCF + }, default: { bodyMapper: Mappers.ErrorResponse } @@ -655,6 +868,72 @@ const listBySubscriptionOperationSpec: coreClient.OperationSpec = { headerParameters: [Parameters.accept], serializer }; +const backupOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConfidentialLedger/managedCCFs/{appName}/backup", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.ManagedCCFBackupResponse + }, + 201: { + bodyMapper: Mappers.ManagedCCFBackupResponse + }, + 202: { + bodyMapper: Mappers.ManagedCCFBackupResponse + }, + 204: { + bodyMapper: Mappers.ManagedCCFBackupResponse + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.managedCCF1, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.appName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const restoreOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConfidentialLedger/managedCCFs/{appName}/restore", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.ManagedCCFRestoreResponse + }, + 201: { + bodyMapper: Mappers.ManagedCCFRestoreResponse + }, + 202: { + bodyMapper: Mappers.ManagedCCFRestoreResponse + }, + 204: { + bodyMapper: Mappers.ManagedCCFRestoreResponse + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.managedCCF2, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.appName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", httpMethod: "GET", diff --git a/sdk/confidentialledger/arm-confidentialledger/src/operationsInterfaces/ledger.ts b/sdk/confidentialledger/arm-confidentialledger/src/operationsInterfaces/ledger.ts index e7078b004574..f749e991eadf 100644 --- a/sdk/confidentialledger/arm-confidentialledger/src/operationsInterfaces/ledger.ts +++ b/sdk/confidentialledger/arm-confidentialledger/src/operationsInterfaces/ledger.ts @@ -18,7 +18,13 @@ import { LedgerCreateOptionalParams, LedgerCreateResponse, LedgerUpdateOptionalParams, - LedgerUpdateResponse + LedgerUpdateResponse, + ConfidentialLedgerBackup, + LedgerBackupOptionalParams, + LedgerBackupResponse, + ConfidentialLedgerRestore, + LedgerRestoreOptionalParams, + LedgerRestoreResponse } from "../models"; /// @@ -129,4 +135,63 @@ export interface Ledger { confidentialLedger: ConfidentialLedger, options?: LedgerUpdateOptionalParams ): Promise; + /** + * Backs up a Confidential Ledger Resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ledgerName Name of the Confidential Ledger + * @param confidentialLedger Confidential Ledger Backup Request Body + * @param options The options parameters. + */ + beginBackup( + resourceGroupName: string, + ledgerName: string, + confidentialLedger: ConfidentialLedgerBackup, + options?: LedgerBackupOptionalParams + ): Promise< + SimplePollerLike, LedgerBackupResponse> + >; + /** + * Backs up a Confidential Ledger Resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ledgerName Name of the Confidential Ledger + * @param confidentialLedger Confidential Ledger Backup Request Body + * @param options The options parameters. + */ + beginBackupAndWait( + resourceGroupName: string, + ledgerName: string, + confidentialLedger: ConfidentialLedgerBackup, + options?: LedgerBackupOptionalParams + ): Promise; + /** + * Restores a Confidential Ledger Resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ledgerName Name of the Confidential Ledger + * @param confidentialLedger Confidential Ledger Restore Request Body + * @param options The options parameters. + */ + beginRestore( + resourceGroupName: string, + ledgerName: string, + confidentialLedger: ConfidentialLedgerRestore, + options?: LedgerRestoreOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + LedgerRestoreResponse + > + >; + /** + * Restores a Confidential Ledger Resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ledgerName Name of the Confidential Ledger + * @param confidentialLedger Confidential Ledger Restore Request Body + * @param options The options parameters. + */ + beginRestoreAndWait( + resourceGroupName: string, + ledgerName: string, + confidentialLedger: ConfidentialLedgerRestore, + options?: LedgerRestoreOptionalParams + ): Promise; } diff --git a/sdk/confidentialledger/arm-confidentialledger/src/operationsInterfaces/managedCCFOperations.ts b/sdk/confidentialledger/arm-confidentialledger/src/operationsInterfaces/managedCCFOperations.ts index a2da92855da3..eeb05e32ef44 100644 --- a/sdk/confidentialledger/arm-confidentialledger/src/operationsInterfaces/managedCCFOperations.ts +++ b/sdk/confidentialledger/arm-confidentialledger/src/operationsInterfaces/managedCCFOperations.ts @@ -17,7 +17,14 @@ import { ManagedCCFDeleteOptionalParams, ManagedCCFCreateOptionalParams, ManagedCCFCreateResponse, - ManagedCCFUpdateOptionalParams + ManagedCCFUpdateOptionalParams, + ManagedCCFUpdateResponse, + ManagedCCFBackup, + ManagedCCFBackupOptionalParams, + ManagedCCFBackupOperationResponse, + ManagedCCFRestore, + ManagedCCFRestoreOptionalParams, + ManagedCCFRestoreOperationResponse } from "../models"; /// @@ -115,7 +122,12 @@ export interface ManagedCCFOperations { appName: string, managedCCF: ManagedCCF, options?: ManagedCCFUpdateOptionalParams - ): Promise, void>>; + ): Promise< + SimplePollerLike< + OperationState, + ManagedCCFUpdateResponse + > + >; /** * Updates properties of Managed CCF * @param resourceGroupName The name of the resource group. The name is case insensitive. @@ -128,5 +140,67 @@ export interface ManagedCCFOperations { appName: string, managedCCF: ManagedCCF, options?: ManagedCCFUpdateOptionalParams - ): Promise; + ): Promise; + /** + * Backs up a Managed CCF Resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param appName Name of the Managed CCF + * @param managedCCF Managed CCF Backup Request Body + * @param options The options parameters. + */ + beginBackup( + resourceGroupName: string, + appName: string, + managedCCF: ManagedCCFBackup, + options?: ManagedCCFBackupOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + ManagedCCFBackupOperationResponse + > + >; + /** + * Backs up a Managed CCF Resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param appName Name of the Managed CCF + * @param managedCCF Managed CCF Backup Request Body + * @param options The options parameters. + */ + beginBackupAndWait( + resourceGroupName: string, + appName: string, + managedCCF: ManagedCCFBackup, + options?: ManagedCCFBackupOptionalParams + ): Promise; + /** + * Restores a Managed CCF Resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param appName Name of the Managed CCF + * @param managedCCF Managed CCF Restore Request Body + * @param options The options parameters. + */ + beginRestore( + resourceGroupName: string, + appName: string, + managedCCF: ManagedCCFRestore, + options?: ManagedCCFRestoreOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + ManagedCCFRestoreOperationResponse + > + >; + /** + * Restores a Managed CCF Resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param appName Name of the Managed CCF + * @param managedCCF Managed CCF Restore Request Body + * @param options The options parameters. + */ + beginRestoreAndWait( + resourceGroupName: string, + appName: string, + managedCCF: ManagedCCFRestore, + options?: ManagedCCFRestoreOptionalParams + ): Promise; } diff --git a/sdk/confidentialledger/arm-confidentialledger/test/sampleTest.ts b/sdk/confidentialledger/arm-confidentialledger/test/sampleTest.ts new file mode 100644 index 000000000000..25aeb3ebcc36 --- /dev/null +++ b/sdk/confidentialledger/arm-confidentialledger/test/sampleTest.ts @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + Recorder, + RecorderStartOptions, + env +} from "@azure-tools/test-recorder"; +import { assert } from "chai"; +import { Context } from "mocha"; + +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(this: Context) { + recorder = new Recorder(this.currentTest); + await recorder.start(recorderOptions); + }); + + afterEach(async function() { + await recorder.stop(); + }); + + it("sample test", async function() { + console.log("Hi, I'm a test!"); + }); +}); diff --git a/sdk/confidentialledger/arm-confidentialledger/tsconfig.json b/sdk/confidentialledger/arm-confidentialledger/tsconfig.json index 125d598a0eb4..3e6ae96443f3 100644 --- a/sdk/confidentialledger/arm-confidentialledger/tsconfig.json +++ b/sdk/confidentialledger/arm-confidentialledger/tsconfig.json @@ -15,17 +15,11 @@ ], "declaration": true, "outDir": "./dist-esm", - "importHelpers": true, - "paths": { - "@azure/arm-confidentialledger": [ - "./src/index" - ] - } + "importHelpers": true }, "include": [ "./src/**/*.ts", - "./test/**/*.ts", - "samples-dev/**/*.ts" + "./test/**/*.ts" ], "exclude": [ "node_modules"