/// <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(
         asrVaultCreds.ResourceGroupName, 
         asrVaultCreds.ResourceName, 
         extendedInfoArgs, 
         this.GetRequestHeaders(false));
 }
 /// <summary>
 /// Get the vault extended info.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.SiteRecoveryVault.IVaultExtendedInfoOperations.
 /// </param>
 /// <param name='resourceGroupName'>
 /// Required. The name of the resource group containing the job
 /// collection.
 /// </param>
 /// <param name='resourceName'>
 /// Required. The name of the resource.
 /// </param>
 /// <param name='extendedInfoArgs'>
 /// Required. Create resource exnteded 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();
 }
Esempio n. 3
0
        /// <summary>
        /// Returns the Xml representation of this object.
        /// </summary>
        /// <returns>the xml as string</returns>
        public ResourceExtendedInformationArgs Translate()
        {
            if (string.IsNullOrEmpty(this.Etag))
            {
                this.Etag = Guid.NewGuid().ToString();
            }

            string serializedInfo = Utilities.Serialize<ResourceExtendedInfo>(this);
            ResourceExtendedInformationArgs extendedInfoArgs = new ResourceExtendedInformationArgs(
                Constants.VaultExtendedInfoContractVersion,
                serializedInfo,
                this.Etag);

            return extendedInfoArgs;
        }
Esempio n. 4
0
        public void CreateAndRetrieveVaultExtendedInfo()
        {
            using (UndoContext context = UndoContext.Current)
            {
                context.Start();
                var rsmClient = GetRecoveryServicesClient(CustomHttpHandler);

                ResourceExtendedInformationArgs args =
                    new ResourceExtendedInformationArgs("1.0", "extendedinfo", Guid.NewGuid().ToString());

                AzureOperationResponse response = rsmClient.VaultExtendedInfo.CreateExtendedInfo(resourceGroupName, resourceName, args, RequestHeaders);
                Assert.Equal(HttpStatusCode.NoContent, response.StatusCode);

                ResourceExtendedInformationResponse extendedInfoResponse = rsmClient.VaultExtendedInfo.GetExtendedInfo(resourceGroupName, resourceName, RequestHeaders);
                Assert.NotNull(extendedInfoResponse.ResourceExtendedInformation.ExtendedInfo);
                Assert.Equal(HttpStatusCode.OK, extendedInfoResponse.StatusCode);
            }
        }
 /// <summary>
 /// Get the vault extended info.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.SiteRecoveryVault.IVaultExtendedInfoOperations.
 /// </param>
 /// <param name='resourceGroupName'>
 /// Required. The name of the resource group containing the job
 /// collection.
 /// </param>
 /// <param name='resourceName'>
 /// Required. The name of the resource.
 /// </param>
 /// <param name='extendedInfoArgs'>
 /// Required. Create resource exnteded 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);
 }