Example #1
0
        public override void ExecuteCmdlet()
        {
            StoreClient = StoreClient ?? new StoreClient(
                CurrentSubscription.SubscriptionId,
                ServiceEndpoint,
                CurrentSubscription.Certificate,
                text => this.WriteDebug(text),
                Channel);
            CustomConfirmation = CustomConfirmation ?? new PowerShellCustomConfirmation(Host);
            WindowsAzureAddOn addon;

            if (StoreClient.TryGetAddOn(Name, out addon))
            {
                string message  = StoreClient.GetConfirmationMessage(OperationType.Set, addon.AddOn, Plan);
                bool   purchase = CustomConfirmation.ShouldProcess(Resources.SetAddOnConformation, message);

                if (purchase)
                {
                    StoreClient.UpdateAddOn(Name, Plan, PromotionCode);
                    WriteVerbose(string.Format(Resources.AddOnUpdatedMessage, Name));

                    if (PassThru.IsPresent)
                    {
                        WriteObject(true);
                    }
                }
            }
        }
Example #2
0
        public override void ExecuteCmdlet()
        {
            StoreClient = StoreClient ?? new StoreClient(
                CurrentSubscription.SubscriptionId,
                ServiceEndpoint,
                CurrentSubscription.Certificate,
                text => this.WriteDebug(text),
                Channel);
            WindowsAzureAddOn addon;

            CustomConfirmation = CustomConfirmation ?? new PowerShellCustomConfirmation(Host);

            if (!StoreClient.TryGetAddOn(Name, out addon))
            {
                string message  = StoreClient.GetConfirmationMessage(OperationType.New, AddOn, Plan);
                bool   purchase = CustomConfirmation.ShouldProcess(Resources.NewAddOnConformation, message);

                if (purchase)
                {
                    StoreClient.NewAddOn(Name, AddOn, Plan, Location, PromotionCode);
                    WriteVerbose(string.Format(Resources.AddOnCreatedMessage, Name));
                    WriteObject(true);
                }
            }
            else
            {
                throw new Exception(string.Format(Resources.AddOnNameAlreadyUsed, Name));
            }
        }
Example #3
0
        private void DeleteServer()
        {
            bool shouldUnregister = true;

            if (!Force.IsPresent)
            {
                customerConfirmation = customerConfirmation ?? new PowerShellCustomConfirmation(Host);
                shouldUnregister     = customerConfirmation.ShouldProcess(Resources.UnregisterServerCaption, Resources.UnregisterServerMessage);
            }

            if (shouldUnregister)
            {
                AzureBackupClient.UnregisterMachineContainer(Container.ResourceGroupName, Container.ResourceName, Container.Id);
            }
        }
Example #4
0
 protected override void ProcessRecord()
 {
     if (this.Force.IsPresent)
     {
         this.RemoveDnsServer();
     }
     else
     {
         CustomConfirmation = CustomConfirmation ?? new PowerShellCustomConfirmation(Host);
         bool remove = CustomConfirmation.ShouldProcess(Resources.RemoveAzureDnsServerCaption, this.GetWarningMessage());
         if (remove)
         {
             this.RemoveDnsServer();
         }
     }
 }
        public override void ExecuteCmdlet()
        {
            StoreClient = StoreClient ?? new StoreClient(CurrentSubscription);
            CustomConfirmation = CustomConfirmation ?? new PowerShellCustomConfirmation(Host);

            string message = StoreClient.GetConfirmationMessage(OperationType.Remove);
            bool remove = CustomConfirmation.ShouldProcess(Resources.RemoveAddOnConformation, message);
            if (remove)
            {
                StoreClient.RemoveAddOn(Name);
                WriteVerbose(string.Format(Resources.AddOnRemovedMessage, Name));
                if (PassThru.IsPresent)
                {
                    WriteObject(true);
                }
            }
        }
Example #6
0
        public override void ExecuteCmdlet()
        {
            StoreClient        = StoreClient ?? new StoreClient(CurrentContext.Subscription);
            CustomConfirmation = CustomConfirmation ?? new PowerShellCustomConfirmation(Host);

            string message = StoreClient.GetConfirmationMessage(OperationType.Remove);
            bool   remove  = CustomConfirmation.ShouldProcess(Resources.RemoveAddOnConformation, message);

            if (remove)
            {
                StoreClient.RemoveAddOn(Name);
                WriteVerbose(string.Format(Resources.AddOnRemovedMessage, Name));
                if (PassThru.IsPresent)
                {
                    WriteObject(true);
                }
            }
        }
        public override void ExecuteCmdlet()
        {
            StoreClient = StoreClient ?? new StoreClient(CurrentSubscription);
            CustomConfirmation = CustomConfirmation ?? new PowerShellCustomConfirmation(Host);
            WindowsAzureAddOn addon;

            if (StoreClient.TryGetAddOn(Name, out addon))
            {
                string message = StoreClient.GetConfirmationMessage(OperationType.Set, addon.AddOn, Plan);
                bool purchase = CustomConfirmation.ShouldProcess(Resources.SetAddOnConformation, message);

                if (purchase)
                {
                    StoreClient.UpdateAddOn(Name, Plan, PromotionCode);
                    WriteVerbose(string.Format(Resources.AddOnUpdatedMessage, Name));

                    if (PassThru.IsPresent)
                    {
                        WriteObject(true);
                    }
                }
            }
        }
        public override void ExecuteCmdlet()
        {
            StoreClient = StoreClient ?? new StoreClient(CurrentSubscription);
            WindowsAzureAddOn addon;
            CustomConfirmation = CustomConfirmation ?? new PowerShellCustomConfirmation(Host);

            if (!StoreClient.TryGetAddOn(Name, out addon))
            {
                string message = StoreClient.GetConfirmationMessage(OperationType.New, AddOn, Plan);
                bool purchase = CustomConfirmation.ShouldProcess(Resources.NewAddOnConformation, message);

                if (purchase)
                {
                    StoreClient.NewAddOn(Name, AddOn, Plan, Location, PromotionCode);
                    WriteVerbose(string.Format(Resources.AddOnCreatedMessage, Name));
                    WriteObject(true);
                }
            }
            else
            {
                throw new Exception(string.Format(Resources.AddOnNameAlreadyUsed, Name));
            }
        }
Example #9
0
        public override void ExecuteCmdlet()
        {
            StoreClient = StoreClient ?? new StoreClient(
                CurrentSubscription.SubscriptionId,
                ServiceEndpoint,
                CurrentSubscription.Certificate,
                text => this.WriteDebug(text),
                Channel);
            CustomConfirmation = CustomConfirmation ?? new PowerShellCustomConfirmation(Host);

            string message = StoreClient.GetConfirmationMessage(OperationType.Remove);
            bool   remove  = CustomConfirmation.ShouldProcess(Resources.RemoveAddOnConformation, message);

            if (remove)
            {
                StoreClient.RemoveAddOn(Name);
                WriteVerbose(string.Format(Resources.AddOnRemovedMessage, Name));
                if (PassThru.IsPresent)
                {
                    WriteObject(true);
                }
            }
        }