Skip to content

[Storage] Update Storage.Management Track1 SDK code #20135

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -884,6 +884,19 @@ internal EncryptionScopesOperations(StorageManagementClient client)
/// Storage account names must be between 3 and 24 characters in length and use
/// numbers and lower-case letters only.
/// </param>
/// <param name='maxpagesize'>
/// Optional, specifies the maximum number of encryption scopes that will be
/// included in the list response.
/// </param>
/// <param name='filter'>
/// Optional. When specified, only encryption scope names starting with the
/// filter will be listed.
/// </param>
/// <param name='include'>
/// Optional, when specified, will list encryption scopes with the specific
/// state. Defaults to All. Possible values include: 'All', 'Enabled',
/// 'Disabled'
/// </param>
/// <param name='customHeaders'>
/// Headers that will be added to request.
/// </param>
Expand All @@ -905,7 +918,7 @@ internal EncryptionScopesOperations(StorageManagementClient client)
/// <return>
/// A response object containing the response body and response headers.
/// </return>
public async Task<AzureOperationResponse<IPage<EncryptionScope>>> ListWithHttpMessagesAsync(string resourceGroupName, string accountName, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
public async Task<AzureOperationResponse<IPage<EncryptionScope>>> ListWithHttpMessagesAsync(string resourceGroupName, string accountName, int? maxpagesize = default(int?), string filter = default(string), string include = default(string), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (resourceGroupName == null)
{
Expand Down Expand Up @@ -963,6 +976,17 @@ internal EncryptionScopesOperations(StorageManagementClient client)
throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1);
}
}
if (maxpagesize != null)
{
if (maxpagesize > 5000)
{
throw new ValidationException(ValidationRules.InclusiveMaximum, "maxpagesize", 5000);
}
if (maxpagesize < 1)
{
throw new ValidationException(ValidationRules.InclusiveMinimum, "maxpagesize", 1);
}
}
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
Expand All @@ -972,6 +996,9 @@ internal EncryptionScopesOperations(StorageManagementClient client)
Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
tracingParameters.Add("resourceGroupName", resourceGroupName);
tracingParameters.Add("accountName", accountName);
tracingParameters.Add("maxpagesize", maxpagesize);
tracingParameters.Add("filter", filter);
tracingParameters.Add("include", include);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters);
}
Expand All @@ -986,6 +1013,18 @@ internal EncryptionScopesOperations(StorageManagementClient client)
{
_queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
}
if (maxpagesize != null)
{
_queryParameters.Add(string.Format("$maxpagesize={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(maxpagesize, Client.SerializationSettings).Trim('"'))));
}
if (filter != null)
{
_queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter)));
}
if (include != null)
{
_queryParameters.Add(string.Format("$include={0}", System.Uri.EscapeDataString(include)));
}
if (_queryParameters.Count > 0)
{
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,22 @@ public static EncryptionScope Get(this IEncryptionScopesOperations operations, s
/// Storage account names must be between 3 and 24 characters in length and use
/// numbers and lower-case letters only.
/// </param>
public static IPage<EncryptionScope> List(this IEncryptionScopesOperations operations, string resourceGroupName, string accountName)
/// <param name='maxpagesize'>
/// Optional, specifies the maximum number of encryption scopes that will be
/// included in the list response.
/// </param>
/// <param name='filter'>
/// Optional. When specified, only encryption scope names starting with the
/// filter will be listed.
/// </param>
/// <param name='include'>
/// Optional, when specified, will list encryption scopes with the specific
/// state. Defaults to All. Possible values include: 'All', 'Enabled',
/// 'Disabled'
/// </param>
public static IPage<EncryptionScope> List(this IEncryptionScopesOperations operations, string resourceGroupName, string accountName, int? maxpagesize = default(int?), string filter = default(string), string include = default(string))
{
return operations.ListAsync(resourceGroupName, accountName).GetAwaiter().GetResult();
return operations.ListAsync(resourceGroupName, accountName, maxpagesize, filter, include).GetAwaiter().GetResult();
}

/// <summary>
Expand All @@ -252,12 +265,25 @@ public static IPage<EncryptionScope> List(this IEncryptionScopesOperations opera
/// Storage account names must be between 3 and 24 characters in length and use
/// numbers and lower-case letters only.
/// </param>
/// <param name='maxpagesize'>
/// Optional, specifies the maximum number of encryption scopes that will be
/// included in the list response.
/// </param>
/// <param name='filter'>
/// Optional. When specified, only encryption scope names starting with the
/// filter will be listed.
/// </param>
/// <param name='include'>
/// Optional, when specified, will list encryption scopes with the specific
/// state. Defaults to All. Possible values include: 'All', 'Enabled',
/// 'Disabled'
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<IPage<EncryptionScope>> ListAsync(this IEncryptionScopesOperations operations, string resourceGroupName, string accountName, CancellationToken cancellationToken = default(CancellationToken))
public static async Task<IPage<EncryptionScope>> ListAsync(this IEncryptionScopesOperations operations, string resourceGroupName, string accountName, int? maxpagesize = default(int?), string filter = default(string), string include = default(string), CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, accountName, null, cancellationToken).ConfigureAwait(false))
using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, accountName, maxpagesize, filter, include, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,19 @@ public partial interface IEncryptionScopesOperations
/// group. Storage account names must be between 3 and 24 characters in
/// length and use numbers and lower-case letters only.
/// </param>
/// <param name='maxpagesize'>
/// Optional, specifies the maximum number of encryption scopes that
/// will be included in the list response.
/// </param>
/// <param name='filter'>
/// Optional. When specified, only encryption scope names starting with
/// the filter will be listed.
/// </param>
/// <param name='include'>
/// Optional, when specified, will list encryption scopes with the
/// specific state. Defaults to All. Possible values include: 'All',
/// 'Enabled', 'Disabled'
/// </param>
/// <param name='customHeaders'>
/// The headers that will be added to request.
/// </param>
Expand All @@ -168,7 +181,7 @@ public partial interface IEncryptionScopesOperations
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown when a required parameter is null
/// </exception>
Task<AzureOperationResponse<IPage<EncryptionScope>>> ListWithHttpMessagesAsync(string resourceGroupName, string accountName, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
Task<AzureOperationResponse<IPage<EncryptionScope>>> ListWithHttpMessagesAsync(string resourceGroupName, string accountName, int? maxpagesize = default(int?), string filter = default(string), string include = default(string), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
/// <summary>
/// Lists all the encryption scopes available under the specified
/// storage account.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -361,10 +361,20 @@ public partial interface IStorageAccountsOperations
/// </exception>
Task<AzureOperationResponse<ListServiceSasResponse>> ListServiceSASWithHttpMessagesAsync(string resourceGroupName, string accountName, ServiceSasParameters parameters, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
/// <summary>
/// Failover request can be triggered for a storage account in case of
/// availability issues. The failover occurs from the storage account's
/// primary cluster to secondary cluster for RA-GRS accounts. The
/// secondary cluster will become primary after failover.
/// A failover request can be triggered for a storage account in the
/// event a primary endpoint becomes unavailable for any reason. The
/// failover occurs from the storage account's primary cluster to the
/// secondary cluster for RA-GRS accounts. The secondary cluster will
/// become primary after failover and the account is converted to LRS.
/// In the case of a Planned Failover, the primary and secondary
/// clusters are swapped after failover and the account remains
/// geo-replicated. Failover should continue to be used in the event of
/// availability issues as Planned failover is only available while the
/// primary and secondary endpoints are available. The primary use case
/// of a Planned Failover is disaster recovery testing drills. This
/// type of failover is invoked by setting FailoverType parameter to
/// 'Planned'. Learn more about the failover options here-
/// https://learn.microsoft.com/en-us/azure/storage/common/storage-disaster-recovery-guidance
/// </summary>
/// <param name='resourceGroupName'>
/// The name of the resource group within the user's subscription. The
Expand All @@ -375,6 +385,10 @@ public partial interface IStorageAccountsOperations
/// group. Storage account names must be between 3 and 24 characters in
/// length and use numbers and lower-case letters only.
/// </param>
/// <param name='failoverType'>
/// The parameter is set to 'Planned' to indicate whether a Planned
/// failover is requested. Possible values include: 'Planned'
/// </param>
/// <param name='customHeaders'>
/// The headers that will be added to request.
/// </param>
Expand All @@ -387,7 +401,7 @@ public partial interface IStorageAccountsOperations
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown when a required parameter is null
/// </exception>
Task<AzureOperationResponse> FailoverWithHttpMessagesAsync(string resourceGroupName, string accountName, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
Task<AzureOperationResponse> FailoverWithHttpMessagesAsync(string resourceGroupName, string accountName, FailoverType? failoverType = default(FailoverType?), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
/// <summary>
/// Live Migration of storage account to enable Hns
/// </summary>
Expand Down Expand Up @@ -541,10 +555,20 @@ public partial interface IStorageAccountsOperations
/// </exception>
Task<AzureOperationResponse<StorageAccount>> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string accountName, StorageAccountCreateParameters parameters, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
/// <summary>
/// Failover request can be triggered for a storage account in case of
/// availability issues. The failover occurs from the storage account's
/// primary cluster to secondary cluster for RA-GRS accounts. The
/// secondary cluster will become primary after failover.
/// A failover request can be triggered for a storage account in the
/// event a primary endpoint becomes unavailable for any reason. The
/// failover occurs from the storage account's primary cluster to the
/// secondary cluster for RA-GRS accounts. The secondary cluster will
/// become primary after failover and the account is converted to LRS.
/// In the case of a Planned Failover, the primary and secondary
/// clusters are swapped after failover and the account remains
/// geo-replicated. Failover should continue to be used in the event of
/// availability issues as Planned failover is only available while the
/// primary and secondary endpoints are available. The primary use case
/// of a Planned Failover is disaster recovery testing drills. This
/// type of failover is invoked by setting FailoverType parameter to
/// 'Planned'. Learn more about the failover options here-
/// https://learn.microsoft.com/en-us/azure/storage/common/storage-disaster-recovery-guidance
/// </summary>
/// <param name='resourceGroupName'>
/// The name of the resource group within the user's subscription. The
Expand All @@ -555,6 +579,10 @@ public partial interface IStorageAccountsOperations
/// group. Storage account names must be between 3 and 24 characters in
/// length and use numbers and lower-case letters only.
/// </param>
/// <param name='failoverType'>
/// The parameter is set to 'Planned' to indicate whether a Planned
/// failover is requested. Possible values include: 'Planned'
/// </param>
/// <param name='customHeaders'>
/// The headers that will be added to request.
/// </param>
Expand All @@ -567,7 +595,7 @@ public partial interface IStorageAccountsOperations
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown when a required parameter is null
/// </exception>
Task<AzureOperationResponse> BeginFailoverWithHttpMessagesAsync(string resourceGroupName, string accountName, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
Task<AzureOperationResponse> BeginFailoverWithHttpMessagesAsync(string resourceGroupName, string accountName, FailoverType? failoverType = default(FailoverType?), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
/// <summary>
/// Live Migration of storage account to enable Hns
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// <auto-generated>
// 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.
// </auto-generated>

namespace Microsoft.Azure.Management.Storage.Models
{
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.Runtime;
using System.Runtime.Serialization;

/// <summary>
/// Defines values for FailoverType.
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public enum FailoverType
{
[EnumMember(Value = "Planned")]
Planned
}
internal static class FailoverTypeEnumExtension
{
internal static string ToSerializedValue(this FailoverType? value)
{
return value == null ? null : ((FailoverType)value).ToSerializedValue();
}

internal static string ToSerializedValue(this FailoverType value)
{
switch( value )
{
case FailoverType.Planned:
return "Planned";
}
return null;
}

internal static FailoverType? ParseFailoverType(this string value)
{
switch( value )
{
case "Planned":
return FailoverType.Planned;
}
return null;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// <auto-generated>
// 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.
// </auto-generated>

namespace Microsoft.Azure.Management.Storage.Models
{

/// <summary>
/// Defines values for ListEncryptionScopesInclude.
/// </summary>
public static class ListEncryptionScopesInclude
{
public const string All = "All";
public const string Enabled = "Enabled";
public const string Disabled = "Disabled";
}
}
Loading