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);
        }
Exemple #2
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)
            {
                LogBuildMessage(ex.Message);
                this.StorageKeys.Set(this.ActivityContext, null);
            }
        }
Exemple #3
0
        protected override void OnProcessRecord()
        {
            var regenerateKeys = new RegenerateKeys
            {
                KeyType = this.KeyType
            };

            ExecuteClientActionInOCS(
                regenerateKeys, this.CommandRuntime.ToString(),
                s => this.Channel.RegenerateStorageServiceKeys(s, this.StorageAccountName, regenerateKeys),
                (operation, storageService) => new StorageServiceKeyOperationContext
            {
                StorageAccountName   = this.StorageAccountName,
                Primary              = storageService.StorageServiceKeys.Primary,
                Secondary            = storageService.StorageServiceKeys.Secondary,
                OperationDescription = this.CommandRuntime.ToString(),
                OperationId          = operation.OperationTrackingId,
                OperationStatus      = operation.Status
            });
        }
        protected override void OnProcessRecord()
        {
            var regenerateKeys = new RegenerateKeys
            {
                KeyType = this.KeyType
            };

            ExecuteClientActionInOCS(
                regenerateKeys, this.CommandRuntime.ToString(),
                s => this.Channel.RegenerateStorageServiceKeys(s, this.StorageAccountName, regenerateKeys),
                (operation, storageService) => new StorageServiceKeyOperationContext
                {
                    StorageAccountName = this.StorageAccountName,
                    Primary = storageService.StorageServiceKeys.Primary,
                    Secondary = storageService.StorageServiceKeys.Secondary,
                    OperationDescription = this.CommandRuntime.ToString(),
                    OperationId = operation.OperationTrackingId,
                    OperationStatus = operation.Status
                });
        }
Exemple #5
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 static StorageService RegenerateStorageServiceKeys(this IServiceManagement proxy, string subscriptionId, string name, RegenerateKeys regenerateKeys)
 {
     return(proxy.EndRegenerateStorageServiceKeys(proxy.BeginRegenerateStorageServiceKeys(subscriptionId, name, regenerateKeys, null, null)));
 }
 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;
 }
 public static StorageService RegenerateStorageServiceKeys(this IServiceManagement proxy, string subscriptionId, string name, RegenerateKeys regenerateKeys)
 {
     return proxy.EndRegenerateStorageServiceKeys(proxy.BeginRegenerateStorageServiceKeys(subscriptionId, name, regenerateKeys, null, null));
 }