///GENMHASH:837770291CB03D6C2AB9BDA889A5B07D:916D2188C6A5919A33DB6C700CE38C2A internal async Task <BatchAccountKeys> RegenerateKeysAsync(AccountKeyType keyType, CancellationToken cancellationToken = default(CancellationToken)) { BatchAccountKeysInner keys = await Manager.Inner.BatchAccount.RegenerateKeyAsync(ResourceGroupName, Name, new BatchAccountRegenerateKeyParametersInner { KeyName = keyType }, cancellationToken); return(new BatchAccountKeys(keys.Primary, keys.Secondary)); }
internal static string ToSerializedValue(this AccountKeyType value) { switch (value) { case AccountKeyType.Primary: return("Primary"); case AccountKeyType.Secondary: return("Secondary"); } return(null); }
public QueryKeyParameters(AccountKeyType accountKeyType) { switch (accountKeyType) { case AccountKeyType.ViewKey: KeyTypeString = "view_key"; break; case AccountKeyType.SpendKey: KeyTypeString = "spend_key"; break; case AccountKeyType.Mnemonic: KeyTypeString = "mnemonic"; break; } }
public void RegenBatchAccountKeysTest() { string newPrimaryKey = "newPrimaryKey"; string newSecondaryKey = "newSecondaryKey"; string accountName = "account01"; string resourceGroup = "resourceGroup"; AccountKeyType keyType = AccountKeyType.Primary; AccountResource accountResource = BatchTestHelpers.CreateAccountResource(accountName, resourceGroup); BatchAccountContext expected = BatchAccountContext.ConvertAccountResourceToNewAccountContext(accountResource); expected.PrimaryAccountKey = newPrimaryKey; expected.SecondaryAccountKey = newSecondaryKey; batchClientMock.Setup(b => b.RegenerateKeys(resourceGroup, accountName, keyType)).Returns(expected); cmdlet.AccountName = accountName; cmdlet.ResourceGroupName = resourceGroup; cmdlet.KeyType = keyType.ToString(); cmdlet.ExecuteCmdlet(); commandRuntimeMock.Verify(r => r.WriteObject(expected), Times.Once()); }
/// <summary> /// Generates new key for the Batch account /// </summary> /// <param name="resourceGroupName">The name of the resource group the account is under. If unspecified, it will be looked up.</param> /// <param name="accountName">The account name</param> /// <param name="keyType">The type of key to regenerate</param> /// <returns>The BatchAccountContext object with the regenerated keys</returns> public virtual BatchAccountContext RegenerateKeys(string resourceGroupName, string accountName, AccountKeyType keyType) { if (string.IsNullOrEmpty(resourceGroupName)) { // use resource mgr to see if account exists and then use resource group name to do the actual lookup resourceGroupName = GetGroupForAccount(accountName); } var regenResponse = BatchManagementClient.BatchAccount.RegenerateKey(resourceGroupName, accountName, keyType); var context = GetAccount(resourceGroupName, accountName); context.PrimaryAccountKey = regenResponse.Primary; context.SecondaryAccountKey = regenResponse.Secondary; // build a new context to put the keys into return(context); }
/// <summary> /// Generates new key for the Batch account /// </summary> /// <param name="resourceGroupName">The name of the resource group the account is under. If unspecified, it will be looked up.</param> /// <param name="accountName">The account name</param> /// <param name="keyType">The type of key to regenerate</param> /// <returns>The BatchAccountContext object with the regenerated keys</returns> public virtual BatchAccountContext RegenerateKeys(string resourceGroupName, string accountName, AccountKeyType keyType) { if (string.IsNullOrEmpty(resourceGroupName)) { // use resource mgr to see if account exists and then use resource group name to do the actual lookup resourceGroupName = GetGroupForAccount(accountName); } // build a new context to put the keys into var context = GetAccount(resourceGroupName, accountName); var regenResponse = BatchManagementClient.Accounts.RegenerateKey(resourceGroupName, accountName, new BatchAccountRegenerateKeyParameters { KeyName = keyType }); context.PrimaryAccountKey = regenResponse.PrimaryKey; context.SecondaryAccountKey = regenResponse.SecondaryKey; return context; }
public string QueryKey(AccountKeyType keyType) { var keyContainer = JsonPostData <KeyValueContainer>(new QueryKey(keyType)); return(keyContainer != null && keyContainer.Error == null ? keyContainer.Result.Value : null); }
/// <summary> /// Regenerates the access keys for the Batch account. /// </summary> /// <param name="keyType">The type if key to regenerate.</param> /// <return>Regenerated access keys for this Batch account.</return> Microsoft.Azure.Management.Batch.Fluent.BatchAccountKeys Microsoft.Azure.Management.Batch.Fluent.IBatchAccount.RegenerateKeys(AccountKeyType keyType) { return(Extensions.Synchronize(() => this.RegenerateKeysAsync(keyType))); }
internal BatchAccountContext() { this.keyInUse = AccountKeyType.Primary; }
/// <summary> /// Regenerates the specified account key for the Batch account. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='resourceGroupName'> /// The name of the resource group that contains the Batch account. /// </param> /// <param name='accountName'> /// The name of the Batch account. /// </param> /// <param name='keyName'> /// The type of account key to regenerate. Possible values include: 'Primary', /// 'Secondary' /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <BatchAccountKeys> RegenerateKeyAsync(this IBatchAccountOperations operations, string resourceGroupName, string accountName, AccountKeyType keyName, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.RegenerateKeyWithHttpMessagesAsync(resourceGroupName, accountName, keyName, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Regenerates the specified account key for the Batch account. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='resourceGroupName'> /// The name of the resource group that contains the Batch account. /// </param> /// <param name='accountName'> /// The name of the Batch account. /// </param> /// <param name='keyName'> /// The type of account key to regenerate. Possible values include: 'Primary', /// 'Secondary' /// </param> public static BatchAccountKeys RegenerateKey(this IBatchAccountOperations operations, string resourceGroupName, string accountName, AccountKeyType keyName) { return(operations.RegenerateKeyAsync(resourceGroupName, accountName, keyName).GetAwaiter().GetResult()); }
/// <summary> /// Initializes a new instance of the /// BatchAccountRegenerateKeyParameters class. /// </summary> /// <param name="keyName">The type of account key to regenerate. /// Possible values include: 'Primary', 'Secondary'</param> public BatchAccountRegenerateKeyParameters(AccountKeyType keyName) { KeyName = keyName; CustomInit(); }
public QueryKey(AccountKeyType accountKeyType) : base("query_key", new QueryKeyParameters(accountKeyType)) { }