From 8d1f46ffa21ab7899aa67857478db40fb690feac Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 13 Jul 2021 10:36:53 +0000 Subject: [PATCH] CodeGen from PR 14752 in Azure/azure-rest-api-specs Added new version in Microsoft.RecoveryServices and s360 fixups (#14752) * Copied files to new version * Changes in examples for new version * Fixed typo in readme file * Modified api version in json files * Fixed the field name for user assigned identity * Fixed the examples * Fixing other examples * Changed the tag in readme file for sdk generation * Reverted the previous commit * s360 fixups for Microsoft.RecoveryServices * Added word in custom words * Fixed the Semantic error for enum Move State * Changing Object Id back to Principal Id * Changing description in swagger * Modified description and removed Inner error --- .../arm-recoveryservices/LICENSE.txt | 2 +- .../arm-recoveryservices/README.md | 8 +- .../arm-recoveryservices/package.json | 2 +- .../arm-recoveryservices/src/models/index.ts | 292 ++++++++++++++++- .../src/models/mappers.ts | 308 +++++++++++++++++- .../src/models/operationsMappers.ts | 4 +- .../src/models/parameters.ts | 10 + .../privateLinkResourcesOperationsMappers.ts | 2 + .../src/models/recoveryServicesMappers.ts | 4 +- .../src/models/vaultCertificatesMappers.ts | 7 +- .../vaultExtendedInfoOperationsMappers.ts | 9 +- .../src/models/vaultsMappers.ts | 9 +- .../src/operations/vaults.ts | 111 +++---- .../src/recoveryServicesClient.ts | 132 ++++++++ .../src/recoveryServicesClientContext.ts | 10 +- 15 files changed, 827 insertions(+), 83 deletions(-) diff --git a/sdk/recoveryservices/arm-recoveryservices/LICENSE.txt b/sdk/recoveryservices/arm-recoveryservices/LICENSE.txt index ea8fb1516028..2d3163745319 100644 --- a/sdk/recoveryservices/arm-recoveryservices/LICENSE.txt +++ b/sdk/recoveryservices/arm-recoveryservices/LICENSE.txt @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2020 Microsoft +Copyright (c) 2021 Microsoft Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/sdk/recoveryservices/arm-recoveryservices/README.md b/sdk/recoveryservices/arm-recoveryservices/README.md index ab315519a42c..b572e4c37244 100644 --- a/sdk/recoveryservices/arm-recoveryservices/README.md +++ b/sdk/recoveryservices/arm-recoveryservices/README.md @@ -1,11 +1,11 @@ ## Azure RecoveryServicesClient SDK for JavaScript -This package contains an isomorphic SDK (runs both in Node.js and in browsers) for RecoveryServicesClient. +This package contains an isomorphic SDK (runs both in node.js and in browsers) for RecoveryServicesClient. ### Currently supported environments - [LTS versions of Node.js](https://nodejs.org/about/releases/) -- Latest versions of Safari, Chrome, Edge, and Firefox. +- Latest versions of Safari, Chrome, Edge and Firefox. ### Prerequisites @@ -21,7 +21,6 @@ Install both packages using the below command: ```bash npm install --save @azure/arm-recoveryservices @azure/identity ``` - > **Note**: You may have used either `@azure/ms-rest-nodeauth` or `@azure/ms-rest-browserauth` in the past. These packages are in maintenance mode receiving critical bug fixes, but no new features. If you are on a [Node.js that has LTS status](https://nodejs.org/about/releases/), or are writing a client side browser application, we strongly encourage you to upgrade to `@azure/identity` which uses the latest versions of Azure Active Directory and MSAL APIs and provides more authentication options. @@ -37,7 +36,6 @@ If you are on a [Node.js that has LTS status](https://nodejs.org/about/releases/ In the below samples, we pass the credential and the Azure subscription id to instantiate the client. Once the client is created, explore the operations on it either in your favorite editor or in our [API reference documentation](https://docs.microsoft.com/javascript/api) to get started. - #### nodejs - Authentication, client creation, and list replicationUsages as an example written in JavaScript. ##### Sample code @@ -87,7 +85,7 @@ In browser applications, we recommend using the `InteractiveBrowserCredential` t const credential = new InteractiveBrowserCredential( { clientId: "", - tenantId: "" + tenant: "" }); const client = new Azure.ArmRecoveryservices.RecoveryServicesClient(creds, subscriptionId); const resourceGroupName = "testresourceGroupName"; diff --git a/sdk/recoveryservices/arm-recoveryservices/package.json b/sdk/recoveryservices/arm-recoveryservices/package.json index 1ecba9962174..4f19d0546e1f 100644 --- a/sdk/recoveryservices/arm-recoveryservices/package.json +++ b/sdk/recoveryservices/arm-recoveryservices/package.json @@ -27,7 +27,7 @@ "rollup-plugin-sourcemaps": "^0.4.2", "uglify-js": "^3.6.0" }, - "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/recoveryservices/arm-recoveryservices", + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/recoveryservices/arm-recoveryservices", "repository": { "type": "git", "url": "https://github.com/Azure/azure-sdk-for-js.git" diff --git a/sdk/recoveryservices/arm-recoveryservices/src/models/index.ts b/sdk/recoveryservices/arm-recoveryservices/src/models/index.ts index 38ce19130963..f0ddbd870721 100644 --- a/sdk/recoveryservices/arm-recoveryservices/src/models/index.ts +++ b/sdk/recoveryservices/arm-recoveryservices/src/models/index.ts @@ -140,6 +140,10 @@ export interface ResourceCertificateAndAadDetails { * Azure Management Endpoint Audience. */ azureManagementEndpointAudience: string; + /** + * Service Resource Id. + */ + serviceResourceId?: string; } /** @@ -426,7 +430,7 @@ export interface Resource extends BaseResource { /** * Optional ETag. */ - eTag?: string; + etag?: string; } /** @@ -437,6 +441,10 @@ export interface Sku { * The Sku name. Possible values include: 'Standard', 'RS0' */ name: SkuName; + /** + * The Sku tier. + */ + tier?: string; } /** @@ -520,6 +528,22 @@ export interface UpgradeDetails { readonly previousResourceId?: string; } +/** + * A resource identity that is managed by the user of the service. + */ +export interface UserIdentity { + /** + * The principal ID of the user-assigned identity. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly principalId?: string; + /** + * The client ID of the user-assigned identity. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly clientId?: string; +} + /** * Identity for the resource. */ @@ -535,9 +559,18 @@ export interface IdentityData { */ readonly tenantId?: string; /** - * The identity type. Possible values include: 'SystemAssigned', 'None' + * The type of managed identity used. The type 'SystemAssigned, UserAssigned' includes both an + * implicitly created identity and a set of user-assigned identities. The type 'None' will remove + * any identities. Possible values include: 'SystemAssigned', 'None', 'UserAssigned', + * 'SystemAssigned, UserAssigned' */ type: ResourceIdentityType; + /** + * The list of user-assigned identities associated with the resource. The user-assigned identity + * dictionary keys will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + */ + userAssignedIdentities?: { [propertyName: string]: UserIdentity }; } /** @@ -600,6 +633,44 @@ export interface PrivateEndpointConnectionVaultProperties { properties?: PrivateEndpointConnection; } +/** + * The properties of the Key Vault which hosts CMK + */ +export interface CmkKeyVaultProperties { + /** + * The key uri of the Customer Managed Key + */ + keyUri?: string; +} + +/** + * The details of the identity used for CMK + */ +export interface CmkKekIdentity { + /** + * Indicate that system assigned identity should be used. Mutually exclusive with + * 'userAssignedIdentity' field + */ + useSystemAssignedIdentity?: boolean; + /** + * The user assigned identity to be used to grant permissions in case the type of identity used + * is UserAssigned + */ + userAssignedIdentity?: string; +} + +/** + * Customer Managed Key details of the resource. + */ +export interface VaultPropertiesEncryption { + keyVaultProperties?: CmkKeyVaultProperties; + kekIdentity?: CmkKekIdentity; + /** + * Enabling/Disabling the Double Encryption state. Possible values include: 'Enabled', 'Disabled' + */ + infrastructureEncryption?: InfrastructureEncryptionState; +} + /** * Properties of the vault. */ @@ -625,6 +696,42 @@ export interface VaultProperties { * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly privateEndpointStateForSiteRecovery?: VaultPrivateEndpointState; + /** + * Customer Managed Key details of the resource. + */ + encryption?: VaultPropertiesEncryption; +} + +/** + * Metadata pertaining to creation and last modification of the resource. + */ +export interface SystemData { + /** + * The identity that created the resource. + */ + createdBy?: string; + /** + * The type of identity that created the resource. Possible values include: 'User', + * 'Application', 'ManagedIdentity', 'Key' + */ + createdByType?: CreatedByType; + /** + * The timestamp of resource creation (UTC). + */ + createdAt?: Date; + /** + * The identity that last modified the resource. + */ + lastModifiedBy?: string; + /** + * The type of identity that last modified the resource. Possible values include: 'User', + * 'Application', 'ManagedIdentity', 'Key' + */ + lastModifiedByType?: CreatedByType; + /** + * The type of identity that last modified the resource. + */ + lastModifiedAt?: Date; } /** @@ -634,6 +741,7 @@ export interface Vault extends TrackedResource { identity?: IdentityData; properties?: VaultProperties; sku?: Sku; + systemData?: SystemData; } /** @@ -704,6 +812,85 @@ export interface PrivateLinkResource { readonly type?: string; } +/** + * The resource management error additional info. + */ +export interface ErrorAdditionalInfo { + /** + * The additional info. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly info?: any; + /** + * The additional info type. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly type?: string; +} + +/** + * The resource management error response. + */ +export interface ErrorModel { + /** + * The error additional info. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly additionalInfo?: ErrorAdditionalInfo[]; + /** + * The error code. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly code?: string; + /** + * The error details. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly details?: ErrorModel[]; + /** + * The error message. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly message?: string; + /** + * The error target. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly target?: string; +} + +/** + * Operation Resource + */ +export interface OperationResource { + /** + * End time of the operation + */ + endTime?: Date; + /** + * Required if status == failed or status == canceled. This is the OData v4 error format, used by + * the RPC and will go into the v2.2 Azure REST API guidelines. + */ + error?: ErrorModel; + /** + * It should match what is used to GET the operation result + */ + id?: string; + /** + * It must match the last segment of the "id" field, and will typically be a GUID / system + * generated value + */ + name?: string; + /** + * The status of the operation. (InProgress/Success/Failed/Cancelled) + */ + status?: string; + /** + * Start time of the operation + */ + startTime?: Date; +} + /** * The name of usage. */ @@ -842,11 +1029,12 @@ export type TriggerType = 'UserTriggered' | 'ForcedUpgrade'; /** * Defines values for ResourceIdentityType. - * Possible values include: 'SystemAssigned', 'None' + * Possible values include: 'SystemAssigned', 'None', 'UserAssigned', 'SystemAssigned, + * UserAssigned' * @readonly * @enum {string} */ -export type ResourceIdentityType = 'SystemAssigned' | 'None'; +export type ResourceIdentityType = 'SystemAssigned' | 'None' | 'UserAssigned' | 'SystemAssigned, UserAssigned'; /** * Defines values for ProvisioningState. @@ -872,6 +1060,22 @@ export type PrivateEndpointConnectionStatus = 'Pending' | 'Approved' | 'Rejected */ export type VaultPrivateEndpointState = 'None' | 'Enabled'; +/** + * Defines values for InfrastructureEncryptionState. + * Possible values include: 'Enabled', 'Disabled' + * @readonly + * @enum {string} + */ +export type InfrastructureEncryptionState = 'Enabled' | 'Disabled'; + +/** + * Defines values for CreatedByType. + * Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + * @readonly + * @enum {string} + */ +export type CreatedByType = 'User' | 'Application' | 'ManagedIdentity' | 'Key'; + /** * Defines values for UsagesUnit. * Possible values include: 'Count', 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', @@ -1101,6 +1305,46 @@ export type VaultsUpdateResponse = Vault & { }; }; +/** + * Contains response data for the beginCreateOrUpdate operation. + */ +export type VaultsBeginCreateOrUpdateResponse = Vault & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: Vault; + }; +}; + +/** + * Contains response data for the beginUpdate operation. + */ +export type VaultsBeginUpdateResponse = Vault & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: Vault; + }; +}; + /** * Contains response data for the listBySubscriptionIdNext operation. */ @@ -1241,6 +1485,46 @@ export type VaultExtendedInfoUpdateResponse = VaultExtendedInfoResource & { }; }; +/** + * Contains response data for the getOperationStatus operation. + */ +export type GetOperationStatusResponse = OperationResource & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: OperationResource; + }; +}; + +/** + * Contains response data for the getOperationResult operation. + */ +export type GetOperationResultResponse = Vault & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: Vault; + }; +}; + /** * Contains response data for the listByVaults operation. */ diff --git a/sdk/recoveryservices/arm-recoveryservices/src/models/mappers.ts b/sdk/recoveryservices/arm-recoveryservices/src/models/mappers.ts index f3645eb5e803..80bd3b0515e6 100644 --- a/sdk/recoveryservices/arm-recoveryservices/src/models/mappers.ts +++ b/sdk/recoveryservices/arm-recoveryservices/src/models/mappers.ts @@ -164,6 +164,12 @@ export const ResourceCertificateAndAadDetails: msRest.CompositeMapper = { type: { name: "String" } + }, + serviceResourceId: { + serializedName: "serviceResourceId", + type: { + name: "String" + } } } } @@ -577,8 +583,8 @@ export const Resource: msRest.CompositeMapper = { name: "String" } }, - eTag: { - serializedName: "eTag", + etag: { + serializedName: "etag", type: { name: "String" } @@ -599,6 +605,12 @@ export const Sku: msRest.CompositeMapper = { type: { name: "String" } + }, + tier: { + serializedName: "tier", + type: { + name: "String" + } } } } @@ -734,6 +746,30 @@ export const UpgradeDetails: msRest.CompositeMapper = { } }; +export const UserIdentity: msRest.CompositeMapper = { + serializedName: "UserIdentity", + type: { + name: "Composite", + className: "UserIdentity", + modelProperties: { + principalId: { + readOnly: true, + serializedName: "principalId", + type: { + name: "String" + } + }, + clientId: { + readOnly: true, + serializedName: "clientId", + type: { + name: "String" + } + } + } + } +}; + export const IdentityData: msRest.CompositeMapper = { serializedName: "IdentityData", type: { @@ -760,6 +796,18 @@ export const IdentityData: msRest.CompositeMapper = { type: { name: "String" } + }, + userAssignedIdentities: { + serializedName: "userAssignedIdentities", + type: { + name: "Dictionary", + value: { + type: { + name: "Composite", + className: "UserIdentity" + } + } + } } } } @@ -868,6 +916,74 @@ export const PrivateEndpointConnectionVaultProperties: msRest.CompositeMapper = } }; +export const CmkKeyVaultProperties: msRest.CompositeMapper = { + serializedName: "CmkKeyVaultProperties", + type: { + name: "Composite", + className: "CmkKeyVaultProperties", + modelProperties: { + keyUri: { + serializedName: "keyUri", + type: { + name: "String" + } + } + } + } +}; + +export const CmkKekIdentity: msRest.CompositeMapper = { + serializedName: "CmkKekIdentity", + type: { + name: "Composite", + className: "CmkKekIdentity", + modelProperties: { + useSystemAssignedIdentity: { + serializedName: "useSystemAssignedIdentity", + type: { + name: "Boolean" + } + }, + userAssignedIdentity: { + serializedName: "userAssignedIdentity", + type: { + name: "String" + } + } + } + } +}; + +export const VaultPropertiesEncryption: msRest.CompositeMapper = { + serializedName: "VaultProperties_encryption", + type: { + name: "Composite", + className: "VaultPropertiesEncryption", + modelProperties: { + keyVaultProperties: { + serializedName: "keyVaultProperties", + type: { + name: "Composite", + className: "CmkKeyVaultProperties" + } + }, + kekIdentity: { + serializedName: "kekIdentity", + type: { + name: "Composite", + className: "CmkKekIdentity" + } + }, + infrastructureEncryption: { + serializedName: "infrastructureEncryption", + type: { + name: "String" + } + } + } + } +}; + export const VaultProperties: msRest.CompositeMapper = { serializedName: "VaultProperties", type: { @@ -914,6 +1030,59 @@ export const VaultProperties: msRest.CompositeMapper = { type: { name: "String" } + }, + encryption: { + serializedName: "encryption", + type: { + name: "Composite", + className: "VaultPropertiesEncryption" + } + } + } + } +}; + +export const SystemData: msRest.CompositeMapper = { + serializedName: "systemData", + type: { + name: "Composite", + className: "SystemData", + modelProperties: { + createdBy: { + serializedName: "createdBy", + type: { + name: "String" + } + }, + createdByType: { + serializedName: "createdByType", + type: { + name: "String" + } + }, + createdAt: { + serializedName: "createdAt", + type: { + name: "DateTime" + } + }, + lastModifiedBy: { + serializedName: "lastModifiedBy", + type: { + name: "String" + } + }, + lastModifiedByType: { + serializedName: "lastModifiedByType", + type: { + name: "String" + } + }, + lastModifiedAt: { + serializedName: "lastModifiedAt", + type: { + name: "DateTime" + } } } } @@ -946,6 +1115,13 @@ export const Vault: msRest.CompositeMapper = { name: "Composite", className: "Sku" } + }, + systemData: { + serializedName: "systemData", + type: { + name: "Composite", + className: "SystemData" + } } } } @@ -1080,6 +1256,134 @@ export const PrivateLinkResource: msRest.CompositeMapper = { } }; +export const ErrorAdditionalInfo: msRest.CompositeMapper = { + serializedName: "ErrorAdditionalInfo", + type: { + name: "Composite", + className: "ErrorAdditionalInfo", + modelProperties: { + info: { + readOnly: true, + serializedName: "info", + type: { + name: "Object" + } + }, + type: { + readOnly: true, + serializedName: "type", + type: { + name: "String" + } + } + } + } +}; + +export const ErrorModel: msRest.CompositeMapper = { + serializedName: "Error", + type: { + name: "Composite", + className: "ErrorModel", + modelProperties: { + additionalInfo: { + readOnly: true, + serializedName: "additionalInfo", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ErrorAdditionalInfo" + } + } + } + }, + code: { + readOnly: true, + serializedName: "code", + type: { + name: "String" + } + }, + details: { + readOnly: true, + serializedName: "details", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ErrorModel" + } + } + } + }, + message: { + readOnly: true, + serializedName: "message", + type: { + name: "String" + } + }, + target: { + readOnly: true, + serializedName: "target", + type: { + name: "String" + } + } + } + } +}; + +export const OperationResource: msRest.CompositeMapper = { + serializedName: "OperationResource", + type: { + name: "Composite", + className: "OperationResource", + modelProperties: { + endTime: { + serializedName: "endTime", + type: { + name: "DateTime" + } + }, + error: { + serializedName: "error", + type: { + name: "Composite", + className: "ErrorModel" + } + }, + id: { + serializedName: "id", + type: { + name: "String" + } + }, + name: { + serializedName: "name", + type: { + name: "String" + } + }, + status: { + serializedName: "status", + type: { + name: "String" + } + }, + startTime: { + serializedName: "startTime", + type: { + name: "DateTime" + } + } + } + } +}; + export const NameInfo: msRest.CompositeMapper = { serializedName: "NameInfo", type: { diff --git a/sdk/recoveryservices/arm-recoveryservices/src/models/operationsMappers.ts b/sdk/recoveryservices/arm-recoveryservices/src/models/operationsMappers.ts index cf239cd893a5..b503924f7fba 100644 --- a/sdk/recoveryservices/arm-recoveryservices/src/models/operationsMappers.ts +++ b/sdk/recoveryservices/arm-recoveryservices/src/models/operationsMappers.ts @@ -14,5 +14,7 @@ export { ClientDiscoveryForServiceSpecification, ClientDiscoveryResponse, ClientDiscoveryValueForSingleApi, - CloudError + CloudError, + ErrorAdditionalInfo, + ErrorModel } from "../models/mappers"; diff --git a/sdk/recoveryservices/arm-recoveryservices/src/models/parameters.ts b/sdk/recoveryservices/arm-recoveryservices/src/models/parameters.ts index 7c4f3dbc4093..0da842c17473 100644 --- a/sdk/recoveryservices/arm-recoveryservices/src/models/parameters.ts +++ b/sdk/recoveryservices/arm-recoveryservices/src/models/parameters.ts @@ -70,6 +70,16 @@ export const nextPageLink: msRest.OperationURLParameter = { }, skipEncoding: true }; +export const operationId: msRest.OperationURLParameter = { + parameterPath: "operationId", + mapper: { + required: true, + serializedName: "operationId", + type: { + name: "String" + } + } +}; export const privateLinkResourceName: msRest.OperationURLParameter = { parameterPath: "privateLinkResourceName", mapper: { diff --git a/sdk/recoveryservices/arm-recoveryservices/src/models/privateLinkResourcesOperationsMappers.ts b/sdk/recoveryservices/arm-recoveryservices/src/models/privateLinkResourcesOperationsMappers.ts index 8b1a986c0039..f9201672ed2f 100644 --- a/sdk/recoveryservices/arm-recoveryservices/src/models/privateLinkResourcesOperationsMappers.ts +++ b/sdk/recoveryservices/arm-recoveryservices/src/models/privateLinkResourcesOperationsMappers.ts @@ -9,6 +9,8 @@ export { discriminators, CloudError, + ErrorAdditionalInfo, + ErrorModel, PrivateLinkResource, PrivateLinkResources } from "../models/mappers"; diff --git a/sdk/recoveryservices/arm-recoveryservices/src/models/recoveryServicesMappers.ts b/sdk/recoveryservices/arm-recoveryservices/src/models/recoveryServicesMappers.ts index 665c4167517e..1e2e76caa085 100644 --- a/sdk/recoveryservices/arm-recoveryservices/src/models/recoveryServicesMappers.ts +++ b/sdk/recoveryservices/arm-recoveryservices/src/models/recoveryServicesMappers.ts @@ -10,5 +10,7 @@ export { discriminators, CheckNameAvailabilityParameters, CheckNameAvailabilityResult, - CloudError + CloudError, + ErrorAdditionalInfo, + ErrorModel } from "../models/mappers"; diff --git a/sdk/recoveryservices/arm-recoveryservices/src/models/vaultCertificatesMappers.ts b/sdk/recoveryservices/arm-recoveryservices/src/models/vaultCertificatesMappers.ts index 038a0ef44654..6edf1f3ecf54 100644 --- a/sdk/recoveryservices/arm-recoveryservices/src/models/vaultCertificatesMappers.ts +++ b/sdk/recoveryservices/arm-recoveryservices/src/models/vaultCertificatesMappers.ts @@ -11,6 +11,8 @@ export { BaseResource, CertificateRequest, CloudError, + CmkKekIdentity, + CmkKeyVaultProperties, IdentityData, PatchTrackedResource, PatchVault, @@ -24,10 +26,13 @@ export { ResourceCertificateAndAcsDetails, ResourceCertificateDetails, Sku, + SystemData, TrackedResource, UpgradeDetails, + UserIdentity, Vault, VaultCertificateResponse, VaultExtendedInfoResource, - VaultProperties + VaultProperties, + VaultPropertiesEncryption } from "../models/mappers"; diff --git a/sdk/recoveryservices/arm-recoveryservices/src/models/vaultExtendedInfoOperationsMappers.ts b/sdk/recoveryservices/arm-recoveryservices/src/models/vaultExtendedInfoOperationsMappers.ts index cbdfd07cd245..148ce456fcca 100644 --- a/sdk/recoveryservices/arm-recoveryservices/src/models/vaultExtendedInfoOperationsMappers.ts +++ b/sdk/recoveryservices/arm-recoveryservices/src/models/vaultExtendedInfoOperationsMappers.ts @@ -10,6 +10,10 @@ export { discriminators, BaseResource, CloudError, + CmkKekIdentity, + CmkKeyVaultProperties, + ErrorAdditionalInfo, + ErrorModel, IdentityData, PatchTrackedResource, PatchVault, @@ -22,10 +26,13 @@ export { ResourceCertificateAndAcsDetails, ResourceCertificateDetails, Sku, + SystemData, TrackedResource, UpgradeDetails, + UserIdentity, Vault, VaultCertificateResponse, VaultExtendedInfoResource, - VaultProperties + VaultProperties, + VaultPropertiesEncryption } from "../models/mappers"; diff --git a/sdk/recoveryservices/arm-recoveryservices/src/models/vaultsMappers.ts b/sdk/recoveryservices/arm-recoveryservices/src/models/vaultsMappers.ts index 9daea6407eac..ade64458d488 100644 --- a/sdk/recoveryservices/arm-recoveryservices/src/models/vaultsMappers.ts +++ b/sdk/recoveryservices/arm-recoveryservices/src/models/vaultsMappers.ts @@ -10,6 +10,10 @@ export { discriminators, BaseResource, CloudError, + CmkKekIdentity, + CmkKeyVaultProperties, + ErrorAdditionalInfo, + ErrorModel, IdentityData, PatchTrackedResource, PatchVault, @@ -22,11 +26,14 @@ export { ResourceCertificateAndAcsDetails, ResourceCertificateDetails, Sku, + SystemData, TrackedResource, UpgradeDetails, + UserIdentity, Vault, VaultCertificateResponse, VaultExtendedInfoResource, VaultList, - VaultProperties + VaultProperties, + VaultPropertiesEncryption } from "../models/mappers"; diff --git a/sdk/recoveryservices/arm-recoveryservices/src/operations/vaults.ts b/sdk/recoveryservices/arm-recoveryservices/src/operations/vaults.ts index 969d6f0b82fa..baa38e377c53 100644 --- a/sdk/recoveryservices/arm-recoveryservices/src/operations/vaults.ts +++ b/sdk/recoveryservices/arm-recoveryservices/src/operations/vaults.ts @@ -8,6 +8,7 @@ */ import * as msRest from "@azure/ms-rest-js"; +import * as msRestAzure from "@azure/ms-rest-azure-js"; import * as Models from "../models"; import * as Mappers from "../models/vaultsMappers"; import * as Parameters from "../models/parameters"; @@ -124,34 +125,9 @@ export class Vaults { * @param [options] The optional parameters * @returns Promise */ - createOrUpdate(resourceGroupName: string, vaultName: string, vault: Models.Vault, options?: msRest.RequestOptionsBase): Promise; - /** - * @param resourceGroupName The name of the resource group where the recovery services vault is - * present. - * @param vaultName The name of the recovery services vault. - * @param vault Recovery Services Vault to be created. - * @param callback The callback - */ - createOrUpdate(resourceGroupName: string, vaultName: string, vault: Models.Vault, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName The name of the resource group where the recovery services vault is - * present. - * @param vaultName The name of the recovery services vault. - * @param vault Recovery Services Vault to be created. - * @param options The optional parameters - * @param callback The callback - */ - createOrUpdate(resourceGroupName: string, vaultName: string, vault: Models.Vault, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - createOrUpdate(resourceGroupName: string, vaultName: string, vault: Models.Vault, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - resourceGroupName, - vaultName, - vault, - options - }, - createOrUpdateOperationSpec, - callback) as Promise; + createOrUpdate(resourceGroupName: string, vaultName: string, vault: Models.Vault, options?: msRest.RequestOptionsBase): Promise { + return this.beginCreateOrUpdate(resourceGroupName,vaultName,vault,options) + .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; } /** @@ -198,34 +174,51 @@ export class Vaults { * @param [options] The optional parameters * @returns Promise */ - update(resourceGroupName: string, vaultName: string, vault: Models.PatchVault, options?: msRest.RequestOptionsBase): Promise; + update(resourceGroupName: string, vaultName: string, vault: Models.PatchVault, options?: msRest.RequestOptionsBase): Promise { + return this.beginUpdate(resourceGroupName,vaultName,vault,options) + .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; + } + /** + * Creates or updates a Recovery Services vault. * @param resourceGroupName The name of the resource group where the recovery services vault is * present. * @param vaultName The name of the recovery services vault. * @param vault Recovery Services Vault to be created. - * @param callback The callback + * @param [options] The optional parameters + * @returns Promise */ - update(resourceGroupName: string, vaultName: string, vault: Models.PatchVault, callback: msRest.ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, vaultName: string, vault: Models.Vault, options?: msRest.RequestOptionsBase): Promise { + return this.client.sendLRORequest( + { + resourceGroupName, + vaultName, + vault, + options + }, + beginCreateOrUpdateOperationSpec, + options); + } + /** + * Updates the vault. * @param resourceGroupName The name of the resource group where the recovery services vault is * present. * @param vaultName The name of the recovery services vault. * @param vault Recovery Services Vault to be created. - * @param options The optional parameters - * @param callback The callback + * @param [options] The optional parameters + * @returns Promise */ - update(resourceGroupName: string, vaultName: string, vault: Models.PatchVault, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - update(resourceGroupName: string, vaultName: string, vault: Models.PatchVault, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( + beginUpdate(resourceGroupName: string, vaultName: string, vault: Models.PatchVault, options?: msRest.RequestOptionsBase): Promise { + return this.client.sendLRORequest( { resourceGroupName, vaultName, vault, options }, - updateOperationSpec, - callback) as Promise; + beginUpdateOperationSpec, + options); } /** @@ -359,8 +352,8 @@ const getOperationSpec: msRest.OperationSpec = { serializer }; -const createOrUpdateOperationSpec: msRest.OperationSpec = { - httpMethod: "PUT", +const deleteMethodOperationSpec: msRest.OperationSpec = { + httpMethod: "DELETE", path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}", urlParameters: [ Parameters.subscriptionId, @@ -373,20 +366,8 @@ const createOrUpdateOperationSpec: msRest.OperationSpec = { headerParameters: [ Parameters.acceptLanguage ], - requestBody: { - parameterPath: "vault", - mapper: { - ...Mappers.Vault, - required: true - } - }, responses: { - 200: { - bodyMapper: Mappers.Vault - }, - 201: { - bodyMapper: Mappers.Vault - }, + 200: {}, default: { bodyMapper: Mappers.CloudError } @@ -394,8 +375,8 @@ const createOrUpdateOperationSpec: msRest.OperationSpec = { serializer }; -const deleteMethodOperationSpec: msRest.OperationSpec = { - httpMethod: "DELETE", +const beginCreateOrUpdateOperationSpec: msRest.OperationSpec = { + httpMethod: "PUT", path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}", urlParameters: [ Parameters.subscriptionId, @@ -408,8 +389,20 @@ const deleteMethodOperationSpec: msRest.OperationSpec = { headerParameters: [ Parameters.acceptLanguage ], + requestBody: { + parameterPath: "vault", + mapper: { + ...Mappers.Vault, + required: true + } + }, responses: { - 200: {}, + 200: { + bodyMapper: Mappers.Vault + }, + 201: { + bodyMapper: Mappers.Vault + }, default: { bodyMapper: Mappers.CloudError } @@ -417,7 +410,7 @@ const deleteMethodOperationSpec: msRest.OperationSpec = { serializer }; -const updateOperationSpec: msRest.OperationSpec = { +const beginUpdateOperationSpec: msRest.OperationSpec = { httpMethod: "PATCH", path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}", urlParameters: [ @@ -442,9 +435,7 @@ const updateOperationSpec: msRest.OperationSpec = { 200: { bodyMapper: Mappers.Vault }, - 201: { - bodyMapper: Mappers.Vault - }, + 202: {}, default: { bodyMapper: Mappers.CloudError } diff --git a/sdk/recoveryservices/arm-recoveryservices/src/recoveryServicesClient.ts b/sdk/recoveryservices/arm-recoveryservices/src/recoveryServicesClient.ts index d15c270d9e32..83fe1d5c0d10 100644 --- a/sdk/recoveryservices/arm-recoveryservices/src/recoveryServicesClient.ts +++ b/sdk/recoveryservices/arm-recoveryservices/src/recoveryServicesClient.ts @@ -11,6 +11,7 @@ import * as msRest from "@azure/ms-rest-js"; import { TokenCredential } from "@azure/core-auth"; import * as Models from "./models"; import * as Mappers from "./models/mappers"; +import * as Parameters from "./models/parameters"; import * as operations from "./operations"; import { RecoveryServicesClientContext } from "./recoveryServicesClientContext"; @@ -50,9 +51,140 @@ class RecoveryServicesClient extends RecoveryServicesClientContext { this.vaultExtendedInfo = new operations.VaultExtendedInfoOperations(this); this.usages = new operations.Usages(this); } + + /** + * Gets the operation status for a resource. + * @param resourceGroupName The name of the resource group where the recovery services vault is + * present. + * @param vaultName The name of the recovery services vault. + * @param operationId + * @param [options] The optional parameters + * @returns Promise + */ + getOperationStatus(resourceGroupName: string, vaultName: string, operationId: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param resourceGroupName The name of the resource group where the recovery services vault is + * present. + * @param vaultName The name of the recovery services vault. + * @param operationId + * @param callback The callback + */ + getOperationStatus(resourceGroupName: string, vaultName: string, operationId: string, callback: msRest.ServiceCallback): void; + /** + * @param resourceGroupName The name of the resource group where the recovery services vault is + * present. + * @param vaultName The name of the recovery services vault. + * @param operationId + * @param options The optional parameters + * @param callback The callback + */ + getOperationStatus(resourceGroupName: string, vaultName: string, operationId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + getOperationStatus(resourceGroupName: string, vaultName: string, operationId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.sendOperationRequest( + { + resourceGroupName, + vaultName, + operationId, + options + }, + getOperationStatusOperationSpec, + callback) as Promise; + } + + /** + * Gets the operation result for a resource. + * @param resourceGroupName The name of the resource group where the recovery services vault is + * present. + * @param vaultName The name of the recovery services vault. + * @param operationId + * @param [options] The optional parameters + * @returns Promise + */ + getOperationResult(resourceGroupName: string, vaultName: string, operationId: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param resourceGroupName The name of the resource group where the recovery services vault is + * present. + * @param vaultName The name of the recovery services vault. + * @param operationId + * @param callback The callback + */ + getOperationResult(resourceGroupName: string, vaultName: string, operationId: string, callback: msRest.ServiceCallback): void; + /** + * @param resourceGroupName The name of the resource group where the recovery services vault is + * present. + * @param vaultName The name of the recovery services vault. + * @param operationId + * @param options The optional parameters + * @param callback The callback + */ + getOperationResult(resourceGroupName: string, vaultName: string, operationId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + getOperationResult(resourceGroupName: string, vaultName: string, operationId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.sendOperationRequest( + { + resourceGroupName, + vaultName, + operationId, + options + }, + getOperationResultOperationSpec, + callback) as Promise; + } } // Operation Specifications +const serializer = new msRest.Serializer(Mappers); +const getOperationStatusOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/operationStatus/{operationId}", + urlParameters: [ + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.vaultName, + Parameters.operationId + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.OperationResource + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; + +const getOperationResultOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/operationResults/{operationId}", + urlParameters: [ + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.vaultName, + Parameters.operationId + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.Vault + }, + 202: {}, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; export { RecoveryServicesClient, diff --git a/sdk/recoveryservices/arm-recoveryservices/src/recoveryServicesClientContext.ts b/sdk/recoveryservices/arm-recoveryservices/src/recoveryServicesClientContext.ts index 9d0b92a7d8d7..1cbd7bd3057a 100644 --- a/sdk/recoveryservices/arm-recoveryservices/src/recoveryServicesClientContext.ts +++ b/sdk/recoveryservices/arm-recoveryservices/src/recoveryServicesClientContext.ts @@ -9,8 +9,8 @@ import * as Models from "./models"; import * as msRest from "@azure/ms-rest-js"; -import { TokenCredential } from "@azure/core-auth"; import * as msRestAzure from "@azure/ms-rest-azure-js"; +import { TokenCredential } from "@azure/core-auth"; const packageName = "@azure/arm-recoveryservices"; const packageVersion = "4.2.0"; @@ -42,14 +42,14 @@ export class RecoveryServicesClientContext extends msRestAzure.AzureServiceClien if (!options) { options = {}; } - if(!options.userAgent) { + if (!options.userAgent) { const defaultUserAgent = msRestAzure.getDefaultUserAgentValue(); options.userAgent = `${packageName}/${packageVersion} ${defaultUserAgent}`; } super(credentials, options); - this.apiVersion = '2016-06-01'; + this.apiVersion = '2021-03-01'; this.acceptLanguage = 'en-US'; this.longRunningOperationRetryTimeout = 30; this.baseUri = options.baseUri || this.baseUri || "https://management.azure.com"; @@ -57,10 +57,10 @@ export class RecoveryServicesClientContext extends msRestAzure.AzureServiceClien this.credentials = credentials; this.subscriptionId = subscriptionId; - if(options.acceptLanguage !== null && options.acceptLanguage !== undefined) { + if (options.acceptLanguage !== null && options.acceptLanguage !== undefined) { this.acceptLanguage = options.acceptLanguage; } - if(options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) { + if (options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) { this.longRunningOperationRetryTimeout = options.longRunningOperationRetryTimeout; } }