public override void ExecuteCmdlet()
        {
            base.ExecuteCmdlet();
            ExecuteClientAction(() =>
            {
                if (ShouldProcess(this.VMScaleSetName, VerbsLifecycle.Start))
                {
                    string resourceGroupName = this.ResourceGroupName;
                    string vmScaleSetName    = this.VMScaleSetName;

                    var result = VirtualMachineScaleSetRollingUpgradesClient.StartOSUpgradeWithHttpMessagesAsync(resourceGroupName, vmScaleSetName).GetAwaiter().GetResult();
                    PSOperationStatusResponse output = new PSOperationStatusResponse
                    {
                        StartTime = this.StartTime,
                        EndTime   = DateTime.Now
                    };

                    if (result != null && result.Request != null && result.Request.RequestUri != null)
                    {
                        output.Name = GetOperationIdFromUrlString(result.Request.RequestUri.ToString());
                    }

                    WriteObject(output);
                }
            });
        }
        protected void ExecuteVirtualMachineScaleSetRollingUpgradeCancelMethod(object[] invokeMethodInputParameters)
        {
            string resourceGroupName = (string)ParseParameter(invokeMethodInputParameters[0]);
            string vmScaleSetName    = (string)ParseParameter(invokeMethodInputParameters[1]);

            VirtualMachineScaleSetRollingUpgradesClient.Cancel(resourceGroupName, vmScaleSetName);
        }
        public override void ExecuteCmdlet()
        {
            base.ExecuteCmdlet();
            ExecuteClientAction(() =>
            {
                if (ShouldProcess(this.VMScaleSetName, VerbsLifecycle.Stop) &&
                    (this.Force.IsPresent ||
                     this.ShouldContinue(Properties.Resources.ResourceStoppingConfirmation,
                                         "Stop-AzureRmVmssRollingUpgrade operation")))
                {
                    string resourceGroupName = this.ResourceGroupName;
                    string vmScaleSetName    = this.VMScaleSetName;

                    var result = VirtualMachineScaleSetRollingUpgradesClient.CancelWithHttpMessagesAsync(resourceGroupName, vmScaleSetName).GetAwaiter().GetResult();
                    PSOperationStatusResponse output = new PSOperationStatusResponse
                    {
                        StartTime = this.StartTime,
                        EndTime   = DateTime.Now
                    };

                    if (result != null && result.Request != null && result.Request.RequestUri != null)
                    {
                        output.Name = GetOperationIdFromUrlString(result.Request.RequestUri.ToString());
                    }

                    WriteObject(output);
                }
            });
        }
Пример #4
0
        protected void ExecuteVirtualMachineScaleSetRollingUpgradeStartOSUpgradeMethod(object[] invokeMethodInputParameters)
        {
            string resourceGroupName = (string)ParseParameter(invokeMethodInputParameters[0]);
            string vmScaleSetName    = (string)ParseParameter(invokeMethodInputParameters[1]);

            var result = VirtualMachineScaleSetRollingUpgradesClient.StartOSUpgrade(resourceGroupName, vmScaleSetName);

            WriteObject(result);
        }
        protected override void ProcessRecord()
        {
            ExecuteClientAction(() =>
            {
                string resourceGroupName = this.ResourceGroupName;
                string vmScaleSetName    = this.VMScaleSetName;

                var result   = VirtualMachineScaleSetRollingUpgradesClient.GetLatest(resourceGroupName, vmScaleSetName);
                var psObject = new PSRollingUpgradeStatusInfo();
                ComputeAutomationAutoMapperProfile.Mapper.Map <RollingUpgradeStatusInfo, PSRollingUpgradeStatusInfo>(result, psObject);
                WriteObject(psObject);
            });
        }
Пример #6
0
        public override void ExecuteCmdlet()
        {
            ExecuteClientAction(() =>
            {
                if (ShouldProcess(this.VMScaleSetName, VerbsLifecycle.Start))
                {
                    string resourceGroupName = this.ResourceGroupName;
                    string vmScaleSetName    = this.VMScaleSetName;

                    var result   = VirtualMachineScaleSetRollingUpgradesClient.StartOSUpgrade(resourceGroupName, vmScaleSetName);
                    var psObject = new PSOperationStatusResponse();
                    ComputeAutomationAutoMapperProfile.Mapper.Map <Azure.Management.Compute.Models.OperationStatusResponse, PSOperationStatusResponse>(result, psObject);
                    WriteObject(psObject);
                }
            });
        }
Пример #7
0
        protected override void ProcessRecord()
        {
            ExecuteClientAction(() =>
            {
                if (ShouldProcess(this.VMScaleSetName, VerbsLifecycle.Stop) &&
                    (this.Force.IsPresent ||
                     this.ShouldContinue(Properties.Resources.ResourceStoppingConfirmation,
                                         "Stop-AzureRmVmssRollingUpgrade operation")))
                {
                    string resourceGroupName = this.ResourceGroupName;
                    string vmScaleSetName    = this.VMScaleSetName;

                    var result   = VirtualMachineScaleSetRollingUpgradesClient.Cancel(resourceGroupName, vmScaleSetName);
                    var psObject = new PSOperationStatusResponse();
                    ComputeAutomationAutoMapperProfile.Mapper.Map <Azure.Management.Compute.Models.OperationStatusResponse, PSOperationStatusResponse>(result, psObject);
                    WriteObject(psObject);
                }
            });
        }
        private void StartRollingUpdate(string ResourceGroup, string vmssName)
        {
            if (ShouldProcess(vmssName, VerbsLifecycle.Start))
            {
                var result = VirtualMachineScaleSetRollingUpgradesClient.StartExtensionUpgradeWithHttpMessagesAsync(ResourceGroup, vmssName).GetAwaiter().GetResult();
                PSOperationStatusResponse output = new PSOperationStatusResponse
                {
                    StartTime = this.StartTime,
                    EndTime   = DateTime.Now
                };

                if (result != null && result.Request != null && result.Request.RequestUri != null)
                {
                    output.Name = GetOperationIdFromUrlString(result.Request.RequestUri.ToString());
                }


                WriteObject(output);
            }
        }