Example #1
0
 /// <summary>
 /// Sets the managementpolicy to the specified storage account.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceGroupName'>
 /// The name of the resource group within the user's subscription. The name is
 /// case insensitive.
 /// </param>
 /// <param name='accountName'>
 /// The name of the storage account within the specified resource group.
 /// Storage account names must be between 3 and 24 characters in length and use
 /// numbers and lower-case letters only.
 /// </param>
 /// <param name='policy'>
 /// The Storage Account ManagementPolicy, in JSON format. See more details in:
 /// https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <ManagementPolicyInner> CreateOrUpdateAsync(this IManagementPoliciesOperations operations, string resourceGroupName, string accountName, ManagementPolicySchema policy, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, accountName, policy, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
Example #2
0
 /// <summary>
 /// Gets the data policy rules associated with the specified storage account.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceGroupName'>
 /// The name of the resource group within the user's subscription. The name is
 /// case insensitive.
 /// </param>
 /// <param name='accountName'>
 /// The name of the storage account within the specified resource group.
 /// Storage account names must be between 3 and 24 characters in length and use
 /// numbers and lower-case letters only.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <StorageAccountManagementPolicies> GetAsync(this IManagementPoliciesOperations operations, string resourceGroupName, string accountName, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, accountName, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
Example #3
0
        private async Task <Microsoft.Azure.Management.Storage.Fluent.IManagementPolicy> UpdateResourceAsync(CancellationToken cancellationToken = default(CancellationToken))
        {
            IManagementPoliciesOperations client = this.manager.Inner.ManagementPolicies;
            ManagementPolicyInner         managementPolicyInner = await client.CreateOrUpdateAsync(this.resourceGroupName, this.accountName, this.upolicy);

            ResetCreateUpdateParameters();
            this.SetInner(managementPolicyInner);
            return(this);
        }
Example #4
0
 /// <summary>
 /// Initializes client properties.
 /// </summary>
 private void Initialize()
 {
     Operations         = new Operations(this);
     Skus               = new SkusOperations(this);
     StorageAccounts    = new StorageAccountsOperations(this);
     Usages             = new UsagesOperations(this);
     BlobServices       = new BlobServicesOperations(this);
     BlobContainers     = new BlobContainersOperations(this);
     ManagementPolicies = new ManagementPoliciesOperations(this);
     BaseUri            = new System.Uri("https://management.azure.com");
     AcceptLanguage     = "en-US";
     LongRunningOperationRetryTimeout = 30;
     GenerateClientRequestId          = true;
     SerializationSettings            = new JsonSerializerSettings
     {
         Formatting            = Newtonsoft.Json.Formatting.Indented,
         DateFormatHandling    = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
         DateTimeZoneHandling  = Newtonsoft.Json.DateTimeZoneHandling.Utc,
         NullValueHandling     = Newtonsoft.Json.NullValueHandling.Ignore,
         ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
         ContractResolver      = new ReadOnlyJsonContractResolver(),
         Converters            = new List <JsonConverter>
         {
             new Iso8601TimeSpanConverter()
         }
     };
     SerializationSettings.Converters.Add(new TransformationJsonConverter());
     DeserializationSettings = new JsonSerializerSettings
     {
         DateFormatHandling    = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
         DateTimeZoneHandling  = Newtonsoft.Json.DateTimeZoneHandling.Utc,
         NullValueHandling     = Newtonsoft.Json.NullValueHandling.Ignore,
         ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
         ContractResolver      = new ReadOnlyJsonContractResolver(),
         Converters            = new List <JsonConverter>
         {
             new Iso8601TimeSpanConverter()
         }
     };
     CustomInitialize();
     DeserializationSettings.Converters.Add(new TransformationJsonConverter());
     DeserializationSettings.Converters.Add(new CloudErrorJsonConverter());
 }
Example #5
0
 /// <summary>
 /// Sets the data policy rules associated with the specified storage account.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceGroupName'>
 /// The name of the resource group within the user's subscription. The name is
 /// case insensitive.
 /// </param>
 /// <param name='accountName'>
 /// The name of the storage account within the specified resource group.
 /// Storage account names must be between 3 and 24 characters in length and use
 /// numbers and lower-case letters only.
 /// </param>
 /// <param name='policy'>
 /// The Storage Account ManagementPolicies Rules, in JSON format. See more
 /// details in:
 /// https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts.
 /// </param>
 public static StorageAccountManagementPolicies CreateOrUpdate(this IManagementPoliciesOperations operations, string resourceGroupName, string accountName, object policy = default(object))
 {
     return(operations.CreateOrUpdateAsync(resourceGroupName, accountName, policy).GetAwaiter().GetResult());
 }
Example #6
0
 /// <summary>
 /// Gets the data policy rules associated with the specified storage account.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceGroupName'>
 /// The name of the resource group within the user's subscription. The name is
 /// case insensitive.
 /// </param>
 /// <param name='accountName'>
 /// The name of the storage account within the specified resource group.
 /// Storage account names must be between 3 and 24 characters in length and use
 /// numbers and lower-case letters only.
 /// </param>
 public static StorageAccountManagementPolicies Get(this IManagementPoliciesOperations operations, string resourceGroupName, string accountName)
 {
     return(operations.GetAsync(resourceGroupName, accountName).GetAwaiter().GetResult());
 }
Example #7
0
 /// <summary>
 /// Deletes the data policy rules associated with the specified storage
 /// account.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceGroupName'>
 /// The name of the resource group within the user's subscription. The name is
 /// case insensitive.
 /// </param>
 /// <param name='accountName'>
 /// The name of the storage account within the specified resource group.
 /// Storage account names must be between 3 and 24 characters in length and use
 /// numbers and lower-case letters only.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task DeleteAsync(this IManagementPoliciesOperations operations, string resourceGroupName, string accountName, CancellationToken cancellationToken = default(CancellationToken))
 {
     (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, accountName, null, cancellationToken).ConfigureAwait(false)).Dispose();
 }
Example #8
0
 /// <summary>
 /// Deletes the data policy rules associated with the specified storage
 /// account.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceGroupName'>
 /// The name of the resource group within the user's subscription. The name is
 /// case insensitive.
 /// </param>
 /// <param name='accountName'>
 /// The name of the storage account within the specified resource group.
 /// Storage account names must be between 3 and 24 characters in length and use
 /// numbers and lower-case letters only.
 /// </param>
 public static void Delete(this IManagementPoliciesOperations operations, string resourceGroupName, string accountName)
 {
     operations.DeleteAsync(resourceGroupName, accountName).GetAwaiter().GetResult();
 }
Example #9
0
        protected override async Task <ManagementPolicyInner> GetInnerAsync(CancellationToken cancellationToken = default(CancellationToken))
        {
            IManagementPoliciesOperations client = this.manager.Inner.ManagementPolicies;

            return(await client.GetAsync(this.resourceGroupName, this.accountName));
        }
 /// <summary>
 /// Sets the managementpolicy to the specified storage account.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceGroupName'>
 /// The name of the resource group within the user's subscription. The name is
 /// case insensitive.
 /// </param>
 /// <param name='accountName'>
 /// The name of the storage account within the specified resource group.
 /// Storage account names must be between 3 and 24 characters in length and use
 /// numbers and lower-case letters only.
 /// </param>
 /// <param name='policy'>
 /// The Storage Account ManagementPolicy, in JSON format. See more details in:
 /// https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts.
 /// </param>
 public static ManagementPolicy CreateOrUpdate(this IManagementPoliciesOperations operations, string resourceGroupName, string accountName, ManagementPolicySchema policy)
 {
     return(operations.CreateOrUpdateAsync(resourceGroupName, accountName, policy).GetAwaiter().GetResult());
 }