diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/ISKUsOperations.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/ISkusOperations.cs similarity index 100% rename from sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/ISKUsOperations.cs rename to sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/ISkusOperations.cs diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/IStorageAccountsOperations.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/IStorageAccountsOperations.cs index c57d1156e266..4ec2cbf65be1 100644 --- a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/IStorageAccountsOperations.cs +++ b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/IStorageAccountsOperations.cs @@ -124,8 +124,9 @@ public partial interface IStorageAccountsOperations /// /// May be used to expand the properties within account's properties. /// By default, data is not included when fetching properties. - /// Currently we only support geoReplicationStats. Possible values - /// include: 'geoReplicationStats' + /// Currently we only support geoReplicationStats and + /// blobRestoreStatus. Possible values include: 'geoReplicationStats', + /// 'blobRestoreStatus' /// /// /// The headers that will be added to request. @@ -388,6 +389,40 @@ public partial interface IStorageAccountsOperations /// Task FailoverWithHttpMessagesAsync(string resourceGroupName, string accountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Restore blobs in the specified blob ranges + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// 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. + /// + /// + /// Restore blob to the specified time. + /// + /// + /// Blob ranges to restore. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> RestoreBlobRangesWithHttpMessagesAsync(string resourceGroupName, string accountName, System.DateTime timeToRestore, IList blobRanges, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Revoke user delegation keys. /// /// @@ -477,6 +512,40 @@ public partial interface IStorageAccountsOperations /// Task BeginFailoverWithHttpMessagesAsync(string resourceGroupName, string accountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Restore blobs in the specified blob ranges + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// 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. + /// + /// + /// Restore blob to the specified time. + /// + /// + /// Blob ranges to restore. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginRestoreBlobRangesWithHttpMessagesAsync(string resourceGroupName, string accountName, System.DateTime timeToRestore, IList blobRanges, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Lists all the storage accounts available under the subscription. /// Note that storage keys are not returned; use the ListKeys operation /// for this. diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/BlobRestoreParameters.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/BlobRestoreParameters.cs new file mode 100644 index 000000000000..8db713d814cc --- /dev/null +++ b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/BlobRestoreParameters.cs @@ -0,0 +1,86 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Storage.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Blob restore parameters + /// + public partial class BlobRestoreParameters + { + /// + /// Initializes a new instance of the BlobRestoreParameters class. + /// + public BlobRestoreParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BlobRestoreParameters class. + /// + /// Restore blob to the specified + /// time. + /// Blob ranges to restore. + public BlobRestoreParameters(System.DateTime timeToRestore, IList blobRanges) + { + TimeToRestore = timeToRestore; + BlobRanges = blobRanges; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets restore blob to the specified time. + /// + [JsonProperty(PropertyName = "timeToRestore")] + public System.DateTime TimeToRestore { get; set; } + + /// + /// Gets or sets blob ranges to restore. + /// + [JsonProperty(PropertyName = "blobRanges")] + public IList BlobRanges { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (BlobRanges == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "BlobRanges"); + } + if (BlobRanges != null) + { + foreach (var element in BlobRanges) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/BlobRestoreProgressStatus.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/BlobRestoreProgressStatus.cs new file mode 100644 index 000000000000..7b463a30955f --- /dev/null +++ b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/BlobRestoreProgressStatus.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Storage.Models +{ + + /// + /// Defines values for BlobRestoreProgressStatus. + /// + public static class BlobRestoreProgressStatus + { + public const string InProgress = "InProgress"; + public const string Complete = "Complete"; + public const string Failed = "Failed"; + } +} diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/BlobRestoreRange.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/BlobRestoreRange.cs new file mode 100644 index 000000000000..ef46542d4e54 --- /dev/null +++ b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/BlobRestoreRange.cs @@ -0,0 +1,79 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Storage.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Blob range + /// + public partial class BlobRestoreRange + { + /// + /// Initializes a new instance of the BlobRestoreRange class. + /// + public BlobRestoreRange() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BlobRestoreRange class. + /// + /// Blob start range. Empty means account + /// start. + /// Blob end range. Empty means account + /// end. + public BlobRestoreRange(string startRange, string endRange) + { + StartRange = startRange; + EndRange = endRange; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets blob start range. Empty means account start. + /// + [JsonProperty(PropertyName = "startRange")] + public string StartRange { get; set; } + + /// + /// Gets or sets blob end range. Empty means account end. + /// + [JsonProperty(PropertyName = "endRange")] + public string EndRange { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (StartRange == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "StartRange"); + } + if (EndRange == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "EndRange"); + } + } + } +} diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/BlobRestoreStatus.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/BlobRestoreStatus.cs new file mode 100644 index 000000000000..36621b5ea9f5 --- /dev/null +++ b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/BlobRestoreStatus.cs @@ -0,0 +1,98 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Storage.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Blob restore status. + /// + public partial class BlobRestoreStatus + { + /// + /// Initializes a new instance of the BlobRestoreStatus class. + /// + public BlobRestoreStatus() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BlobRestoreStatus class. + /// + /// The status of blob restore progress. Possible + /// values are: - InProgress: Indicates that blob restore is ongoing. - + /// Complete: Indicates that blob restore has been completed + /// successfully. - Failed: Indicates that blob restore is failed. + /// Possible values include: 'InProgress', 'Complete', 'Failed' + /// Failure reason when blob restore is + /// failed. + /// Id for tracking blob restore + /// request. + /// Blob restore request parameters. + public BlobRestoreStatus(string status = default(string), string failureReason = default(string), string restoreId = default(string), BlobRestoreParameters parameters = default(BlobRestoreParameters)) + { + Status = status; + FailureReason = failureReason; + RestoreId = restoreId; + Parameters = parameters; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the status of blob restore progress. Possible values are: - + /// InProgress: Indicates that blob restore is ongoing. - Complete: + /// Indicates that blob restore has been completed successfully. - + /// Failed: Indicates that blob restore is failed. Possible values + /// include: 'InProgress', 'Complete', 'Failed' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; private set; } + + /// + /// Gets failure reason when blob restore is failed. + /// + [JsonProperty(PropertyName = "failureReason")] + public string FailureReason { get; private set; } + + /// + /// Gets id for tracking blob restore request. + /// + [JsonProperty(PropertyName = "restoreId")] + public string RestoreId { get; private set; } + + /// + /// Gets blob restore request parameters. + /// + [JsonProperty(PropertyName = "parameters")] + public BlobRestoreParameters Parameters { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Parameters != null) + { + Parameters.Validate(); + } + } + } +} diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/BlobServiceProperties.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/BlobServiceProperties.cs index 2006365b87e9..4481c5f46501 100644 --- a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/BlobServiceProperties.cs +++ b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/BlobServiceProperties.cs @@ -53,8 +53,10 @@ public BlobServiceProperties() /// enabled if set to true. /// The blob service properties for change /// feed events. + /// The blob service properties for blob + /// restore policy. /// Sku name and tier. - public BlobServiceProperties(string id = default(string), string name = default(string), string type = default(string), CorsRules cors = default(CorsRules), string defaultServiceVersion = default(string), DeleteRetentionPolicy deleteRetentionPolicy = default(DeleteRetentionPolicy), bool? automaticSnapshotPolicyEnabled = default(bool?), ChangeFeed changeFeed = default(ChangeFeed), Sku sku = default(Sku)) + public BlobServiceProperties(string id = default(string), string name = default(string), string type = default(string), CorsRules cors = default(CorsRules), string defaultServiceVersion = default(string), DeleteRetentionPolicy deleteRetentionPolicy = default(DeleteRetentionPolicy), bool? automaticSnapshotPolicyEnabled = default(bool?), ChangeFeed changeFeed = default(ChangeFeed), RestorePolicyProperties restorePolicy = default(RestorePolicyProperties), Sku sku = default(Sku)) : base(id, name, type) { Cors = cors; @@ -62,6 +64,7 @@ public BlobServiceProperties() DeleteRetentionPolicy = deleteRetentionPolicy; AutomaticSnapshotPolicyEnabled = automaticSnapshotPolicyEnabled; ChangeFeed = changeFeed; + RestorePolicy = restorePolicy; Sku = sku; CustomInit(); } @@ -107,6 +110,12 @@ public BlobServiceProperties() [JsonProperty(PropertyName = "properties.changeFeed")] public ChangeFeed ChangeFeed { get; set; } + /// + /// Gets or sets the blob service properties for blob restore policy. + /// + [JsonProperty(PropertyName = "properties.restorePolicy")] + public RestorePolicyProperties RestorePolicy { get; set; } + /// /// Gets sku name and tier. /// @@ -125,6 +134,10 @@ public virtual void Validate() { DeleteRetentionPolicy.Validate(); } + if (RestorePolicy != null) + { + RestorePolicy.Validate(); + } if (Sku != null) { Sku.Validate(); diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/IpRule.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/IPRule.cs similarity index 100% rename from sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/IpRule.cs rename to sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/IPRule.cs diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/RestorePolicyProperties.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/RestorePolicyProperties.cs new file mode 100644 index 000000000000..792966b60b40 --- /dev/null +++ b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/RestorePolicyProperties.cs @@ -0,0 +1,80 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Storage.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The blob service properties for blob restore policy + /// + public partial class RestorePolicyProperties + { + /// + /// Initializes a new instance of the RestorePolicyProperties class. + /// + public RestorePolicyProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RestorePolicyProperties class. + /// + /// Blob restore is enabled if set to + /// true. + /// how long this blob can be restored. It should be + /// great than zero and less than DeleteRetentionPolicy.days. + public RestorePolicyProperties(bool enabled, int? days = default(int?)) + { + Enabled = enabled; + Days = days; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets blob restore is enabled if set to true. + /// + [JsonProperty(PropertyName = "enabled")] + public bool Enabled { get; set; } + + /// + /// Gets or sets how long this blob can be restored. It should be great + /// than zero and less than DeleteRetentionPolicy.days. + /// + [JsonProperty(PropertyName = "days")] + public int? Days { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Days > 365) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "Days", 365); + } + if (Days < 1) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "Days", 1); + } + } + } +} diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/signedResource.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/SignedResource.cs similarity index 100% rename from sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/signedResource.cs rename to sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/SignedResource.cs diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/StorageAccount.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/StorageAccount.cs index 8033b1e268ba..4d69c7cd4c7f 100644 --- a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/StorageAccount.cs +++ b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/StorageAccount.cs @@ -104,7 +104,8 @@ public StorageAccount() /// connection associated with the specified storage account /// Maintains information about the /// network routing choice opted by the user for data transfer - public StorageAccount(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), Sku sku = default(Sku), string kind = default(string), Identity identity = default(Identity), ProvisioningState? provisioningState = default(ProvisioningState?), Endpoints primaryEndpoints = default(Endpoints), string primaryLocation = default(string), AccountStatus? statusOfPrimary = default(AccountStatus?), System.DateTime? lastGeoFailoverTime = default(System.DateTime?), string secondaryLocation = default(string), AccountStatus? statusOfSecondary = default(AccountStatus?), System.DateTime? creationTime = default(System.DateTime?), CustomDomain customDomain = default(CustomDomain), Endpoints secondaryEndpoints = default(Endpoints), Encryption encryption = default(Encryption), AccessTier? accessTier = default(AccessTier?), AzureFilesIdentityBasedAuthentication azureFilesIdentityBasedAuthentication = default(AzureFilesIdentityBasedAuthentication), bool? enableHttpsTrafficOnly = default(bool?), NetworkRuleSet networkRuleSet = default(NetworkRuleSet), bool? isHnsEnabled = default(bool?), GeoReplicationStats geoReplicationStats = default(GeoReplicationStats), bool? failoverInProgress = default(bool?), string largeFileSharesState = default(string), IList privateEndpointConnections = default(IList), RoutingPreference routingPreference = default(RoutingPreference)) + /// Blob restore status + public StorageAccount(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), Sku sku = default(Sku), string kind = default(string), Identity identity = default(Identity), ProvisioningState? provisioningState = default(ProvisioningState?), Endpoints primaryEndpoints = default(Endpoints), string primaryLocation = default(string), AccountStatus? statusOfPrimary = default(AccountStatus?), System.DateTime? lastGeoFailoverTime = default(System.DateTime?), string secondaryLocation = default(string), AccountStatus? statusOfSecondary = default(AccountStatus?), System.DateTime? creationTime = default(System.DateTime?), CustomDomain customDomain = default(CustomDomain), Endpoints secondaryEndpoints = default(Endpoints), Encryption encryption = default(Encryption), AccessTier? accessTier = default(AccessTier?), AzureFilesIdentityBasedAuthentication azureFilesIdentityBasedAuthentication = default(AzureFilesIdentityBasedAuthentication), bool? enableHttpsTrafficOnly = default(bool?), NetworkRuleSet networkRuleSet = default(NetworkRuleSet), bool? isHnsEnabled = default(bool?), GeoReplicationStats geoReplicationStats = default(GeoReplicationStats), bool? failoverInProgress = default(bool?), string largeFileSharesState = default(string), IList privateEndpointConnections = default(IList), RoutingPreference routingPreference = default(RoutingPreference), BlobRestoreStatus blobRestoreStatus = default(BlobRestoreStatus)) : base(location, id, name, type, tags) { Sku = sku; @@ -131,6 +132,7 @@ public StorageAccount() LargeFileSharesState = largeFileSharesState; PrivateEndpointConnections = privateEndpointConnections; RoutingPreference = routingPreference; + BlobRestoreStatus = blobRestoreStatus; CustomInit(); } @@ -312,6 +314,12 @@ public StorageAccount() [JsonProperty(PropertyName = "properties.routingPreference")] public RoutingPreference RoutingPreference { get; set; } + /// + /// Gets blob restore status + /// + [JsonProperty(PropertyName = "properties.blobRestoreStatus")] + public BlobRestoreStatus BlobRestoreStatus { get; private set; } + /// /// Validate the object. /// @@ -351,6 +359,10 @@ public override void Validate() } } } + if (BlobRestoreStatus != null) + { + BlobRestoreStatus.Validate(); + } } } } diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/StorageAccountExpand.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/StorageAccountExpand.cs index 4b10ee816d0f..affddd3fffff 100644 --- a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/StorageAccountExpand.cs +++ b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/StorageAccountExpand.cs @@ -22,7 +22,9 @@ namespace Microsoft.Azure.Management.Storage.Models public enum StorageAccountExpand { [EnumMember(Value = "geoReplicationStats")] - GeoReplicationStats + GeoReplicationStats, + [EnumMember(Value = "blobRestoreStatus")] + BlobRestoreStatus } internal static class StorageAccountExpandEnumExtension { @@ -37,6 +39,8 @@ internal static string ToSerializedValue(this StorageAccountExpand value) { case StorageAccountExpand.GeoReplicationStats: return "geoReplicationStats"; + case StorageAccountExpand.BlobRestoreStatus: + return "blobRestoreStatus"; } return null; } @@ -47,6 +51,8 @@ internal static string ToSerializedValue(this StorageAccountExpand value) { case "geoReplicationStats": return StorageAccountExpand.GeoReplicationStats; + case "blobRestoreStatus": + return StorageAccountExpand.BlobRestoreStatus; } return null; } diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/SdkInfo_StorageManagementClient.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/SdkInfo_StorageManagementClient.cs index 39d9250ccca6..2742c80e5fdd 100644 --- a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/SdkInfo_StorageManagementClient.cs +++ b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/SdkInfo_StorageManagementClient.cs @@ -33,16 +33,5 @@ public static IEnumerable> ApiInfo_StorageManageme }.AsEnumerable(); } } - // BEGIN: Code Generation Metadata Section - public static readonly String AutoRestVersion = "latest"; - public static readonly String AutoRestBootStrapperVersion = "autorest@2.0.4407"; - public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/storage/resource-manager/readme.md --csharp --version=latest --reflect-api-versions --csharp.output-folder=C:\\code\\srpsdk\\sdk\\storage\\Microsoft.Azure.Management.Storage\\src\\Generated"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "ab39a9391daabde74622420b4cde8eda443f0084"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } - diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/SKUsOperations.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/SkusOperations.cs similarity index 100% rename from sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/SKUsOperations.cs rename to sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/SkusOperations.cs diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/SKUsOperationsExtensions.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/SkusOperationsExtensions.cs similarity index 100% rename from sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/SKUsOperationsExtensions.cs rename to sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/SkusOperationsExtensions.cs diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/StorageAccountsOperations.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/StorageAccountsOperations.cs index 02a609a3bbc4..9b2d926d398a 100644 --- a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/StorageAccountsOperations.cs +++ b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/StorageAccountsOperations.cs @@ -528,7 +528,8 @@ internal StorageAccountsOperations(StorageManagementClient client) /// /// May be used to expand the properties within account's properties. By /// default, data is not included when fetching properties. Currently we only - /// support geoReplicationStats. Possible values include: 'geoReplicationStats' + /// support geoReplicationStats and blobRestoreStatus. Possible values include: + /// 'geoReplicationStats', 'blobRestoreStatus' /// /// /// Headers that will be added to request. @@ -2487,6 +2488,37 @@ internal StorageAccountsOperations(StorageManagementClient client) return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } + /// + /// Restore blobs in the specified blob ranges + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// 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. + /// + /// + /// Restore blob to the specified time. + /// + /// + /// Blob ranges to restore. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> RestoreBlobRangesWithHttpMessagesAsync(string resourceGroupName, string accountName, System.DateTime timeToRestore, IList blobRanges, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginRestoreBlobRangesWithHttpMessagesAsync(resourceGroupName, accountName, timeToRestore, blobRanges, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + /// /// Revoke user delegation keys. /// @@ -3187,6 +3219,296 @@ internal StorageAccountsOperations(StorageManagementClient client) return _result; } + /// + /// Restore blobs in the specified blob ranges + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// 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. + /// + /// + /// Restore blob to the specified time. + /// + /// + /// Blob ranges to restore. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginRestoreBlobRangesWithHttpMessagesAsync(string resourceGroupName, string accountName, System.DateTime timeToRestore, IList blobRanges, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (accountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "accountName"); + } + if (accountName != null) + { + if (accountName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "accountName", 24); + } + if (accountName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "accountName", 3); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (blobRanges == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "blobRanges"); + } + if (blobRanges != null) + { + foreach (var element in blobRanges) + { + if (element != null) + { + element.Validate(); + } + } + } + BlobRestoreParameters parameters = new BlobRestoreParameters(); + if (blobRanges != null) + { + parameters.TimeToRestore = timeToRestore; + parameters.BlobRanges = blobRanges; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginRestoreBlobRanges", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/restoreBlobRanges").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + /// /// Lists all the storage accounts available under the subscription. Note that /// storage keys are not returned; use the ListKeys operation for this. diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/StorageAccountsOperationsExtensions.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/StorageAccountsOperationsExtensions.cs index ff52cb085a58..d922e625d2c8 100644 --- a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/StorageAccountsOperationsExtensions.cs +++ b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/StorageAccountsOperationsExtensions.cs @@ -180,7 +180,8 @@ public static void Delete(this IStorageAccountsOperations operations, string res /// /// May be used to expand the properties within account's properties. By /// default, data is not included when fetching properties. Currently we only - /// support geoReplicationStats. Possible values include: 'geoReplicationStats' + /// support geoReplicationStats and blobRestoreStatus. Possible values include: + /// 'geoReplicationStats', 'blobRestoreStatus' /// public static StorageAccount GetProperties(this IStorageAccountsOperations operations, string resourceGroupName, string accountName, StorageAccountExpand? expand = default(StorageAccountExpand?)) { @@ -207,7 +208,8 @@ public static void Delete(this IStorageAccountsOperations operations, string res /// /// May be used to expand the properties within account's properties. By /// default, data is not included when fetching properties. Currently we only - /// support geoReplicationStats. Possible values include: 'geoReplicationStats' + /// support geoReplicationStats and blobRestoreStatus. Possible values include: + /// 'geoReplicationStats', 'blobRestoreStatus' /// /// /// The cancellation token. @@ -625,6 +627,64 @@ public static void Failover(this IStorageAccountsOperations operations, string r (await operations.FailoverWithHttpMessagesAsync(resourceGroupName, accountName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } + /// + /// Restore blobs in the specified blob ranges + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// 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. + /// + /// + /// Restore blob to the specified time. + /// + /// + /// Blob ranges to restore. + /// + public static BlobRestoreStatus RestoreBlobRanges(this IStorageAccountsOperations operations, string resourceGroupName, string accountName, System.DateTime timeToRestore, IList blobRanges) + { + return operations.RestoreBlobRangesAsync(resourceGroupName, accountName, timeToRestore, blobRanges).GetAwaiter().GetResult(); + } + + /// + /// Restore blobs in the specified blob ranges + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// 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. + /// + /// + /// Restore blob to the specified time. + /// + /// + /// Blob ranges to restore. + /// + /// + /// The cancellation token. + /// + public static async Task RestoreBlobRangesAsync(this IStorageAccountsOperations operations, string resourceGroupName, string accountName, System.DateTime timeToRestore, IList blobRanges, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.RestoreBlobRangesWithHttpMessagesAsync(resourceGroupName, accountName, timeToRestore, blobRanges, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Revoke user delegation keys. /// @@ -777,6 +837,64 @@ public static void BeginFailover(this IStorageAccountsOperations operations, str (await operations.BeginFailoverWithHttpMessagesAsync(resourceGroupName, accountName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } + /// + /// Restore blobs in the specified blob ranges + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// 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. + /// + /// + /// Restore blob to the specified time. + /// + /// + /// Blob ranges to restore. + /// + public static BlobRestoreStatus BeginRestoreBlobRanges(this IStorageAccountsOperations operations, string resourceGroupName, string accountName, System.DateTime timeToRestore, IList blobRanges) + { + return operations.BeginRestoreBlobRangesAsync(resourceGroupName, accountName, timeToRestore, blobRanges).GetAwaiter().GetResult(); + } + + /// + /// Restore blobs in the specified blob ranges + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// 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. + /// + /// + /// Restore blob to the specified time. + /// + /// + /// Blob ranges to restore. + /// + /// + /// The cancellation token. + /// + public static async Task BeginRestoreBlobRangesAsync(this IStorageAccountsOperations operations, string resourceGroupName, string accountName, System.DateTime timeToRestore, IList blobRanges, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginRestoreBlobRangesWithHttpMessagesAsync(resourceGroupName, accountName, timeToRestore, blobRanges, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Lists all the storage accounts available under the subscription. Note that /// storage keys are not returned; use the ListKeys operation for this.