Microsoft.Azure.Commands.HDInsight.GetAzureHDInsightJobCommand.ExecuteCmdlet C# (CSharp) Method

ExecuteCmdlet() public method

public ExecuteCmdlet ( ) : void
return void
        public override void ExecuteCmdlet()
        {
            if (ResourceGroupName == null)
            {
                ResourceGroupName = GetResourceGroupByAccountName(ClusterName);
            }

            _clusterName = GetClusterConnection(ResourceGroupName, ClusterName);

            if (NumOfJobs > 0)
            {
                var jobs = HDInsightJobClient.ListJobsAfterJobId(JobId, NumOfJobs).Select(job => new AzureHDInsightJob(job.Detail, HDInsightJobClient.ClusterName));
                WriteObject(jobs, true);
            }
            else if (JobId != null)
            {
                var job = HDInsightJobClient.GetJob(JobId);
                var jobDetails = new AzureHDInsightJob(job.JobDetail, HDInsightJobClient.ClusterName);
                WriteObject(jobDetails);
            }
            else
            {
                var jobs = HDInsightJobClient.ListJobs().Select(job => job.Id);
                WriteObject(jobs, true);
            }
        }
    }
GetAzureHDInsightJobCommand