/// <summary> /// Creates the extended information for the vault /// </summary> /// <param name="extendedInfoArgs">extended info to be created</param> /// <returns>Vault Extended Information</returns> public AzureOperationResponse CreateExtendedInfo(ResourceExtendedInformationArgs extendedInfoArgs) { return this.recoveryServicesClient.VaultExtendedInfo.CreateExtendedInfo( arsVaultCreds.ResourceGroupName, arsVaultCreds.ResourceName, extendedInfoArgs, this.GetRequestHeaders()); }
/// <summary> /// Get the vault extended info. /// </summary> /// <param name='operations'> /// Reference to the /// Microsoft.Azure.Management.RecoveryServices.IVaultExtendedInfoOperations. /// </param> /// <param name='resourceGroupName'> /// Required. The name of the Resource group/ Cloud service containing /// the resource/ Vault collection. /// </param> /// <param name='resourceName'> /// Required. The name of the resource. /// </param> /// <param name='extendedInfoArgs'> /// Required. Create resource extended info input parameters. /// </param> /// <param name='customRequestHeaders'> /// Optional. Request header parameters. /// </param> /// <returns> /// A standard service response including an HTTP status code and /// request ID. /// </returns> public static AzureOperationResponse CreateExtendedInfo(this IVaultExtendedInfoOperations operations, string resourceGroupName, string resourceName, ResourceExtendedInformationArgs extendedInfoArgs, CustomRequestHeaders customRequestHeaders) { return Task.Factory.StartNew((object s) => { return ((IVaultExtendedInfoOperations)s).CreateExtendedInfoAsync(resourceGroupName, resourceName, extendedInfoArgs, customRequestHeaders); } , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); }
/// <summary> /// Method to create the extended info for the vault. /// </summary> /// <returns>returns the object as task</returns> private ResourceExtendedInformation CreateVaultExtendedInformation() { ResourceExtendedInformation extendedInformation = new ResourceExtendedInformation(); extendedInformation.Properties = new ResourceExtendedInfoProperties(); extendedInformation.Properties.IntegrityKey = Utilities.GenerateRandomKey(128); extendedInformation.Properties.Algorithm = CryptoAlgorithm.None.ToString(); ResourceExtendedInformationArgs extendedInfoArgs = new ResourceExtendedInformationArgs(); extendedInfoArgs.Properties = new ResourceExtendedInfoProperties(); extendedInfoArgs.Properties.Algorithm = extendedInformation.Properties.Algorithm; extendedInfoArgs.Properties.IntegrityKey = extendedInformation.Properties.IntegrityKey; this.CreateExtendedInfo(extendedInfoArgs); return extendedInformation; }
/// <summary> /// Get the vault extended info. /// </summary> /// <param name='operations'> /// Reference to the /// Microsoft.Azure.Management.RecoveryServices.IVaultExtendedInfoOperations. /// </param> /// <param name='resourceGroupName'> /// Required. The name of the Resource group/ Cloud service containing /// the resource/ Vault collection. /// </param> /// <param name='resourceName'> /// Required. The name of the resource. /// </param> /// <param name='extendedInfoArgs'> /// Required. Create resource extended info input parameters. /// </param> /// <param name='customRequestHeaders'> /// Optional. Request header parameters. /// </param> /// <returns> /// A standard service response including an HTTP status code and /// request ID. /// </returns> public static Task<AzureOperationResponse> CreateExtendedInfoAsync(this IVaultExtendedInfoOperations operations, string resourceGroupName, string resourceName, ResourceExtendedInformationArgs extendedInfoArgs, CustomRequestHeaders customRequestHeaders) { return operations.CreateExtendedInfoAsync(resourceGroupName, resourceName, extendedInfoArgs, customRequestHeaders, CancellationToken.None); }
public void CreateAndRetrieveVaultExtendedInfo() { using (UndoContext context = UndoContext.Current) { context.Start(); var rsmClient = GetRecoveryServicesClient(CustomHttpHandler); ResourceExtendedInformation extendedInformation = new ResourceExtendedInformation(); extendedInformation.Properties = new ResourceExtendedInfoProperties(); extendedInformation.Properties.IntegrityKey = "integrity key"; extendedInformation.Properties.Algorithm = "none"; ResourceExtendedInformationArgs extendedInfoArgs = new ResourceExtendedInformationArgs(); extendedInfoArgs.Properties = new ResourceExtendedInfoProperties(); extendedInfoArgs.Properties.Algorithm = extendedInformation.Properties.Algorithm; extendedInfoArgs.Properties.IntegrityKey = extendedInformation.Properties.IntegrityKey; AzureOperationResponse response = rsmClient.VaultExtendedInfo.CreateExtendedInfo(resourceGroupName, resourceName, extendedInfoArgs, RequestHeaders); Assert.Equal(HttpStatusCode.OK, response.StatusCode); ResourceExtendedInformationResponse extendedInfoResponse = rsmClient.VaultExtendedInfo.GetExtendedInfo(resourceGroupName, resourceName, RequestHeaders); Assert.NotNull(extendedInfoResponse.ResourceExtendedInformation.Properties.IntegrityKey); Assert.Equal(HttpStatusCode.OK, extendedInfoResponse.StatusCode); } }