Ejemplo n.º 1
0
        /// <summary>
        /// Connect to an Azure subscription and obtain storage service keys.
        /// </summary>
        protected override void AzureExecute()
        {
            var regenerateKeys = new RegenerateKeys();
            regenerateKeys.KeyType = this.KeyType.Get(this.ActivityContext);

            try
            {
                StorageService storageService = this.RetryCall(s => this.Channel.RegenerateStorageServiceKeys(s, this.ServiceName.Get(this.ActivityContext), regenerateKeys));              
                this.StorageKeys.Set(this.ActivityContext, storageService.StorageServiceKeys);
            }
            catch (EndpointNotFoundException ex)
            {
                this.LogBuildMessage(ex.Message);
                this.StorageKeys.Set(this.ActivityContext, null);
            }
        }
Ejemplo n.º 2
0
		public void NewStorageKeyProcess()
		{
			Func<string, StorageService> func = null;
			StorageServiceKeyOperationContext storageServiceKeyOperationContext = null;
			RegenerateKeys regenerateKey = new RegenerateKeys();
			regenerateKey.KeyType = this.KeyType;
			RegenerateKeys regenerateKey1 = regenerateKey;
			using (OperationContextScope operationContextScope = new OperationContextScope((IContextChannel)base.Channel))
			{
				try
				{
					CmdletExtensions.WriteVerboseOutputForObject(this, regenerateKey1);
					NewAzureStorageKeyCommand newAzureStorageKeyCommand = this;
					if (func == null)
					{
						func = (string s) => base.Channel.RegenerateStorageServiceKeys(s, this.StorageAccountName, regenerateKey1);
					}
					StorageService storageService = ((CmdletBase<IServiceManagement>)newAzureStorageKeyCommand).RetryCall<StorageService>(func);
					if (storageService != null)
					{
						StorageServiceKeyOperationContext storageAccountName = new StorageServiceKeyOperationContext();
						storageAccountName.StorageAccountName = this.StorageAccountName;
						storageAccountName.Primary = storageService.StorageServiceKeys.Primary;
						storageAccountName.Secondary = storageService.StorageServiceKeys.Secondary;
						storageServiceKeyOperationContext = storageAccountName;
					}
					Operation operation = base.WaitForOperation(base.CommandRuntime.ToString());
					storageServiceKeyOperationContext.set_OperationDescription(base.CommandRuntime.ToString());
					storageServiceKeyOperationContext.set_OperationId(operation.OperationTrackingId);
					storageServiceKeyOperationContext.set_OperationStatus(operation.Status);
					base.WriteObject(storageServiceKeyOperationContext, true);
				}
				catch (CommunicationException communicationException1)
				{
					CommunicationException communicationException = communicationException1;
					this.WriteErrorDetails(communicationException);
				}
			}
		}
 public IAsyncResult BeginRegenerateStorageServiceKeys(string subscriptionId, string serviceName, RegenerateKeys regenerateKeys, AsyncCallback callback, object state)
 {
     SimpleServiceManagementAsyncResult result = new SimpleServiceManagementAsyncResult();
     result.Values["subscriptionId"] = subscriptionId;
     result.Values["serviceName"] = serviceName;
     result.Values["regenerateKeys"] = regenerateKeys;
     result.Values["callback"] = callback;
     result.Values["state"] = state;
     return result;
 }
Ejemplo n.º 4
0
 public static StorageService RegenerateStorageServiceKeys(this IServiceManagement proxy, string subscriptionId, string name, RegenerateKeys regenerateKeys)
 {
     return proxy.EndRegenerateStorageServiceKeys(proxy.BeginRegenerateStorageServiceKeys(subscriptionId, name, regenerateKeys, null, null));
 }
 public static StorageService RegenerateStorageServiceKeys(this IServiceManagement proxy, string subscriptionId, string name, RegenerateKeys regenerateKeys)
 {
     return(proxy.EndRegenerateStorageServiceKeys(proxy.BeginRegenerateStorageServiceKeys(subscriptionId, name, regenerateKeys, null, null)));
 }
Ejemplo n.º 6
0
 protected override void PerformOperation(IServiceManagement channel)
 {
     Console.WriteLine("Regenerating Storage Key");
     var key = new RegenerateKeys()
     {
         KeyType = KeyType
     };
     var keys = channel.RegenerateStorageServiceKeys(SubscriptionId, StorageServiceName, key);
     Utility.LogObject(keys);
 }