protected void ExecuteVirtualMachineRunCommandGetMethod(object[] invokeMethodInputParameters)
        {
            string location  = (string)ParseParameter(invokeMethodInputParameters[0]);
            string commandId = (string)ParseParameter(invokeMethodInputParameters[1]);

            if (!string.IsNullOrEmpty(location) && !string.IsNullOrEmpty(commandId))
            {
                var result = VirtualMachineRunCommandsClient.Get(location, commandId);
                WriteObject(result);
            }
            else if (!string.IsNullOrEmpty(location))
            {
                var result       = VirtualMachineRunCommandsClient.List(location);
                var resultList   = result.ToList();
                var nextPageLink = result.NextPageLink;
                while (!string.IsNullOrEmpty(nextPageLink))
                {
                    var pageResult = VirtualMachineRunCommandsClient.ListNext(nextPageLink);
                    foreach (var pageItem in pageResult)
                    {
                        resultList.Add(pageItem);
                    }
                    nextPageLink = pageResult.NextPageLink;
                }
                WriteObject(resultList, true);
            }
        }
Пример #2
0
        protected void ExecuteVirtualMachineRunCommandListNextMethod(object[] invokeMethodInputParameters)
        {
            string nextPageLink = (string)ParseParameter(invokeMethodInputParameters[0]);

            var result = VirtualMachineRunCommandsClient.ListNext(nextPageLink);

            WriteObject(result);
        }
Пример #3
0
        public override void ExecuteCmdlet()
        {
            base.ExecuteCmdlet();
            ExecuteClientAction(() =>
            {
                string location  = this.Location.Canonicalize();
                string commandId = this.CommandId;

                if (!string.IsNullOrEmpty(location) && !string.IsNullOrEmpty(commandId))
                {
                    var result   = VirtualMachineRunCommandsClient.Get(location, commandId);
                    var psObject = new PSRunCommandDocument();
                    ComputeAutomationAutoMapperProfile.Mapper.Map <RunCommandDocument, PSRunCommandDocument>(result, psObject);
                    WriteObject(psObject);
                }
                else if (!string.IsNullOrEmpty(location))
                {
                    var result       = VirtualMachineRunCommandsClient.List(location);
                    var resultList   = result.ToList();
                    var nextPageLink = result.NextPageLink;
                    while (!string.IsNullOrEmpty(nextPageLink))
                    {
                        var pageResult = VirtualMachineRunCommandsClient.ListNext(nextPageLink);
                        foreach (var pageItem in pageResult)
                        {
                            resultList.Add(pageItem);
                        }
                        nextPageLink = pageResult.NextPageLink;
                    }
                    var psObject = new List <PSRunCommandDocumentBase>();
                    foreach (var r in resultList)
                    {
                        psObject.Add(ComputeAutomationAutoMapperProfile.Mapper.Map <RunCommandDocumentBase, PSRunCommandDocumentBase>(r));
                    }
                    WriteObject(psObject, true);
                }
            });
        }