protected void ExecuteVirtualMachineScaleSetVMRedeployMethod(object[] invokeMethodInputParameters) { string resourceGroupName = (string)ParseParameter(invokeMethodInputParameters[0]); string vmScaleSetName = (string)ParseParameter(invokeMethodInputParameters[1]); string instanceId = (string)ParseParameter(invokeMethodInputParameters[2]); VirtualMachineScaleSetVMsClient.Redeploy(resourceGroupName, vmScaleSetName, instanceId); }
public override void ExecuteCmdlet() { ExecuteClientAction(() => { if (ShouldProcess(this.VMScaleSetName, VerbsCommon.Set)) { string resourceGroupName = this.ResourceGroupName; string vmScaleSetName = this.VMScaleSetName; string instanceId = this.InstanceId; if (this.ParameterSetName.Equals("FriendMethod")) { var result = VirtualMachineScaleSetVMsClient.ReimageAll(resourceGroupName, vmScaleSetName, instanceId); var psObject = new PSOperationStatusResponse(); ComputeAutomationAutoMapperProfile.Mapper.Map <Azure.Management.Compute.Models.OperationStatusResponse, PSOperationStatusResponse>(result, psObject); WriteObject(psObject); } else if (this.ParameterSetName.Equals("RedeployMethodParameter")) { var result = VirtualMachineScaleSetVMsClient.Redeploy(resourceGroupName, vmScaleSetName, instanceId); var psObject = new PSOperationStatusResponse(); ComputeAutomationAutoMapperProfile.Mapper.Map <Azure.Management.Compute.Models.OperationStatusResponse, PSOperationStatusResponse>(result, psObject); WriteObject(psObject); } else if (this.ParameterSetName.Equals("PerformMaintenanceMethodParameter")) { var result = VirtualMachineScaleSetVMsClient.PerformMaintenance(resourceGroupName, vmScaleSetName, instanceId); var psObject = new PSOperationStatusResponse(); ComputeAutomationAutoMapperProfile.Mapper.Map <Azure.Management.Compute.Models.OperationStatusResponse, PSOperationStatusResponse>(result, psObject); WriteObject(psObject); } else { var result = VirtualMachineScaleSetVMsClient.Reimage(resourceGroupName, vmScaleSetName, instanceId); var psObject = new PSOperationStatusResponse(); ComputeAutomationAutoMapperProfile.Mapper.Map <Azure.Management.Compute.Models.OperationStatusResponse, PSOperationStatusResponse>(result, psObject); WriteObject(psObject); } } }); }