/// <summary>
 /// Retrieve a list of test job streams identified by runbook name.
 /// (see http://aka.ms/azureautomationsdk/jobstreamoperations for
 /// more information)
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.Automation.IJobStreamOperations.
 /// </param>
 /// <param name='resourceGroupName'>
 /// Required. The name of the resource group
 /// </param>
 /// <param name='automationAccount'>
 /// Required. The automation account name.
 /// </param>
 /// <param name='runbookName'>
 /// Required. The runbook name.
 /// </param>
 /// <param name='parameters'>
 /// Optional. The parameters supplied to the list job stream's stream
 /// items operation.
 /// </param>
 /// <returns>
 /// The response model for the list job stream operation.
 /// </returns>
 public static Task<JobStreamListResponse> ListTestJobStreamsAsync(this IJobStreamOperations operations, string resourceGroupName, string automationAccount, string runbookName, JobStreamListParameters parameters)
 {
     return operations.ListTestJobStreamsAsync(resourceGroupName, automationAccount, runbookName, parameters, CancellationToken.None);
 }
 /// <summary>
 /// Retrieve a list of test job streams identified by runbook name.
 /// (see http://aka.ms/azureautomationsdk/jobstreamoperations for
 /// more information)
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.Automation.IJobStreamOperations.
 /// </param>
 /// <param name='resourceGroupName'>
 /// Required. The name of the resource group
 /// </param>
 /// <param name='automationAccount'>
 /// Required. The automation account name.
 /// </param>
 /// <param name='runbookName'>
 /// Required. The runbook name.
 /// </param>
 /// <param name='parameters'>
 /// Optional. The parameters supplied to the list job stream's stream
 /// items operation.
 /// </param>
 /// <returns>
 /// The response model for the list job stream operation.
 /// </returns>
 public static JobStreamListResponse ListTestJobStreams(this IJobStreamOperations operations, string resourceGroupName, string automationAccount, string runbookName, JobStreamListParameters parameters)
 {
     return Task.Factory.StartNew((object s) => 
     {
         return ((IJobStreamOperations)s).ListTestJobStreamsAsync(resourceGroupName, automationAccount, runbookName, parameters);
     }
     , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
 }
Ejemplo n.º 3
0
        public IEnumerable<JobStream> GetJobStream(string resourceGroupName, string automationAccountName, Guid jobId, DateTimeOffset? time,
            string streamType, ref string nextLink)
        {
            var listParams = new AutomationManagement.Models.JobStreamListParameters();

            if (time.HasValue)
            {
                listParams.Time = this.FormatDateTime(time.Value);
            }

            if (streamType != null)
            {
                listParams.StreamType = streamType;
            }

            JobStreamListResponse response;

            if (string.IsNullOrEmpty(nextLink))
            {
                response = this.automationManagementClient.JobStreams.List(resourceGroupName, automationAccountName, jobId, listParams);
            }
            else
            {
                response = this.automationManagementClient.JobStreams.ListNext(nextLink);
            }

            nextLink = response.NextLink;
            return
                response.JobStreams.Select(
                    stream => this.CreateJobStreamFromJobStreamModel(stream, resourceGroupName, automationAccountName, jobId));
        }
Ejemplo n.º 4
0
        private JobModelProxy GetDraftJobDetails(RunbookModelProxy runbook)
        {
            var job = _client.TestJobs.Get(_connectionData.AzureRMGroupName, _connectionData.AzureAutomationAccount, runbook.RunbookName);

            if (job.StatusCode != System.Net.HttpStatusCode.OK)
                return null;

            var jobModel = new JobModelProxy(new Vendor.Azure.Job
            {
                JobID = Guid.NewGuid(),
                Id = string.Empty,
                WarningCount = 0,
                ErrorCount = 0,
                JobException = job.TestJob.Exception,
                CreationTime = job.TestJob.CreationTime.DateTime,
                EndTime = (job.TestJob.EndTime != null ? job.TestJob.EndTime.DateTime : default(DateTime?)),
                JobStatus = job.TestJob.Status,
                JobStatusDeteails = job.TestJob.StatusDetails,
                LastModifiedTime = job.TestJob.LastModifiedTime.DateTime,
                StartTime = (job.TestJob.StartTime != null ? job.TestJob.StartTime.DateTime : default(DateTime?))
            }, Context);

            var jobStreamParameters = new JobStreamListParameters();
            jobStreamParameters.StreamType = "Any";

            var streams = default(JobStreamListResponse);
            do
            {
                if (streams != null)
                    streams = _client.JobStreams.ListNext(streams.NextLink);
                else
                    streams = _client.JobStreams.ListTestJobStreams(_connectionData.AzureRMGroupName, _connectionData.AzureAutomationAccount, runbook.RunbookName, jobStreamParameters);

                if (streams.StatusCode != System.Net.HttpStatusCode.OK)
                    return jobModel;

                var output = streams.JobStreams.Select(s => new JobOutput
                {
                    JobID = jobModel.JobID,
                    RunbookVersionID = runbook.DraftRunbookVersionID.Value,
                    StreamText = s.Properties.Summary,
                    StreamTime = s.Properties.Time.DateTime,
                    StreamTypeName = s.Properties.StreamType
                }).ToList();

                foreach (var o in output)
                    jobModel.Result.Add(o);
            }
            while (streams.NextLink != null);

            return jobModel;
        }
Ejemplo n.º 5
0
        public IEnumerable<Model.JobStream> GetDscCompilationJobStream(string resourceGroupName, string automationAccountName, Guid jobId, DateTimeOffset? time, string streamType)
        {
            using (var request = new RequestSettings(this.automationManagementClient))
            {
                var listParams = new AutomationManagement.Models.JobStreamListParameters();

                if (time.HasValue)
                {
                    listParams.Time = this.FormatDateTime(time.Value);
                }

                if (streamType != null)
                {
                    listParams.StreamType = streamType;
                }
                else
                {
                    listParams.StreamType = CompilationJobStreamType.Any.ToString();
                }

                var jobStreams = this.automationManagementClient.JobStreams.List(resourceGroupName, automationAccountName, jobId, listParams).JobStreams;
                return jobStreams.Select(stream => this.CreateJobStreamFromJobStreamModel(stream, resourceGroupName, automationAccountName, jobId)).ToList();
            }
        }