Skip to content
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

[Ruby] Making credentials nil by default #1677

Merged
merged 3 commits into from
Jan 11, 2017
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 @@ -264,11 +264,8 @@ internal StorageAccountsOperations(StorageManagementClient client)
public async Task<AzureOperationResponse<StorageAccount>> CreateWithHttpMessagesAsync(string resourceGroupName, string accountName, StorageAccountCreateParameters parameters, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
// Send Request
AzureOperationResponse<StorageAccount> _response = await BeginCreateWithHttpMessagesAsync(
resourceGroupName, accountName, parameters, customHeaders, cancellationToken);
return await Client.GetPutOrPatchOperationResultAsync(_response,
customHeaders,
cancellationToken);
AzureOperationResponse<StorageAccount> _response = await BeginCreateWithHttpMessagesAsync(resourceGroupName, accountName, parameters, customHeaders, cancellationToken).ConfigureAwait(false);
return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public static partial class StorageAccountsOperationsExtensions
/// </param>
public static CheckNameAvailabilityResult CheckNameAvailability(this IStorageAccountsOperations operations, StorageAccountCheckNameAvailabilityParameters accountName)
{
return Task.Factory.StartNew(s => ((IStorageAccountsOperations)s).CheckNameAvailabilityAsync(accountName), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
return operations.CheckNameAvailabilityAsync(accountName).GetAwaiter().GetResult();
}

/// <summary>
Expand Down Expand Up @@ -75,7 +75,7 @@ public static CheckNameAvailabilityResult CheckNameAvailability(this IStorageAcc
/// </param>
public static StorageAccount Create(this IStorageAccountsOperations operations, string resourceGroupName, string accountName, StorageAccountCreateParameters parameters)
{
return Task.Factory.StartNew(s => ((IStorageAccountsOperations)s).CreateAsync(resourceGroupName, accountName, parameters), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
return operations.CreateAsync(resourceGroupName, accountName, parameters).GetAwaiter().GetResult();
}

/// <summary>
Expand Down Expand Up @@ -126,7 +126,7 @@ public static StorageAccount Create(this IStorageAccountsOperations operations,
/// </param>
public static void Delete(this IStorageAccountsOperations operations, string resourceGroupName, string accountName)
{
Task.Factory.StartNew(s => ((IStorageAccountsOperations)s).DeleteAsync(resourceGroupName, accountName), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
operations.DeleteAsync(resourceGroupName, accountName).GetAwaiter().GetResult();
}

/// <summary>
Expand Down Expand Up @@ -169,7 +169,7 @@ public static void Delete(this IStorageAccountsOperations operations, string res
/// </param>
public static StorageAccount GetProperties(this IStorageAccountsOperations operations, string resourceGroupName, string accountName)
{
return Task.Factory.StartNew(s => ((IStorageAccountsOperations)s).GetPropertiesAsync(resourceGroupName, accountName), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
return operations.GetPropertiesAsync(resourceGroupName, accountName).GetAwaiter().GetResult();
}

/// <summary>
Expand Down Expand Up @@ -230,7 +230,7 @@ public static StorageAccount GetProperties(this IStorageAccountsOperations opera
/// </param>
public static StorageAccount Update(this IStorageAccountsOperations operations, string resourceGroupName, string accountName, StorageAccountUpdateParameters parameters)
{
return Task.Factory.StartNew(s => ((IStorageAccountsOperations)s).UpdateAsync(resourceGroupName, accountName, parameters), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
return operations.UpdateAsync(resourceGroupName, accountName, parameters).GetAwaiter().GetResult();
}

/// <summary>
Expand Down Expand Up @@ -287,7 +287,7 @@ public static StorageAccount Update(this IStorageAccountsOperations operations,
/// </param>
public static StorageAccountKeys ListKeys(this IStorageAccountsOperations operations, string resourceGroupName, string accountName)
{
return Task.Factory.StartNew(s => ((IStorageAccountsOperations)s).ListKeysAsync(resourceGroupName, accountName), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
return operations.ListKeysAsync(resourceGroupName, accountName).GetAwaiter().GetResult();
}

/// <summary>
Expand Down Expand Up @@ -322,7 +322,7 @@ public static StorageAccountKeys ListKeys(this IStorageAccountsOperations operat
/// </param>
public static IEnumerable<StorageAccount> List(this IStorageAccountsOperations operations)
{
return Task.Factory.StartNew(s => ((IStorageAccountsOperations)s).ListAsync(), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
return operations.ListAsync().GetAwaiter().GetResult();
}

/// <summary>
Expand Down Expand Up @@ -356,7 +356,7 @@ public static IEnumerable<StorageAccount> List(this IStorageAccountsOperations o
/// </param>
public static IEnumerable<StorageAccount> ListByResourceGroup(this IStorageAccountsOperations operations, string resourceGroupName)
{
return Task.Factory.StartNew(s => ((IStorageAccountsOperations)s).ListByResourceGroupAsync(resourceGroupName), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult();
}

/// <summary>
Expand Down Expand Up @@ -401,7 +401,7 @@ public static IEnumerable<StorageAccount> ListByResourceGroup(this IStorageAccou
/// </param>
public static StorageAccountKeys RegenerateKey(this IStorageAccountsOperations operations, string resourceGroupName, string accountName, StorageAccountRegenerateKeyParameters regenerateKey)
{
return Task.Factory.StartNew(s => ((IStorageAccountsOperations)s).RegenerateKeyAsync(resourceGroupName, accountName, regenerateKey), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
return operations.RegenerateKeyAsync(resourceGroupName, accountName, regenerateKey).GetAwaiter().GetResult();
}

/// <summary>
Expand Down Expand Up @@ -456,7 +456,7 @@ public static StorageAccountKeys RegenerateKey(this IStorageAccountsOperations o
/// </param>
public static StorageAccount BeginCreate(this IStorageAccountsOperations operations, string resourceGroupName, string accountName, StorageAccountCreateParameters parameters)
{
return Task.Factory.StartNew(s => ((IStorageAccountsOperations)s).BeginCreateAsync(resourceGroupName, accountName, parameters), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
return operations.BeginCreateAsync(resourceGroupName, accountName, parameters).GetAwaiter().GetResult();
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public static partial class UsageOperationsExtensions
/// </param>
public static IEnumerable<Usage> List(this IUsageOperations operations)
{
return Task.Factory.StartNew(s => ((IUsageOperations)s).ListAsync(), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
return operations.ListAsync().GetAwaiter().GetResult();
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,11 @@ class StorageManagementClient < MsRestAzure::AzureServiceClient
# @param base_url [String] the base URI of the service.
# @param options [Array] filters to be applied to the HTTP requests.
#
def initialize(credentials, base_url = nil, options = nil)
def initialize(credentials = nil, base_url = nil, options = nil)
super(credentials, options)
@base_url = base_url || 'https://management.azure.com'

fail ArgumentError, 'credentials is nil' if credentials.nil?
fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials)
fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?
@credentials = credentials

@storage_accounts = StorageAccounts.new(self)
Expand Down
Loading