public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context) { ListJobsResponse response = new ListJobsResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.IsStartElement) { if (context.TestExpression("ListJobsResult", 2)) { UnmarshallResult(context, response); continue; } if (context.TestExpression("ResponseMetadata", 2)) { response.ResponseMetadata = ResponseMetadataUnmarshaller.Instance.Unmarshall(context); } } } return(response); }
public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems) { AmazonGlacierConfig config = new AmazonGlacierConfig(); config.RegionEndpoint = region; ConfigureClient(config); AmazonGlacierClient client = new AmazonGlacierClient(creds, config); ListJobsResponse resp = new ListJobsResponse(); do { ListJobsRequest req = new ListJobsRequest { Marker = resp.Marker , Limit = maxItems }; resp = client.ListJobs(req); CheckError(resp.HttpStatusCode, "200"); foreach (var obj in resp.JobList) { AddObject(obj); } }while (!string.IsNullOrEmpty(resp.Marker)); }
public static ListJobsResponse Unmarshall(UnmarshallerContext context) { ListJobsResponse listJobsResponse = new ListJobsResponse(); listJobsResponse.HttpResponse = context.HttpResponse; listJobsResponse.RequestId = context.StringValue("ListJobs.RequestId"); listJobsResponse.TotalCount = context.IntegerValue("ListJobs.TotalCount"); listJobsResponse.PageNumber = context.IntegerValue("ListJobs.PageNumber"); listJobsResponse.PageSize = context.IntegerValue("ListJobs.PageSize"); List <ListJobsResponse.ListJobs_JobInfo> listJobsResponse_jobs = new List <ListJobsResponse.ListJobs_JobInfo>(); for (int i = 0; i < context.Length("ListJobs.Jobs.Length"); i++) { ListJobsResponse.ListJobs_JobInfo jobInfo = new ListJobsResponse.ListJobs_JobInfo(); jobInfo.Id = context.StringValue("ListJobs.Jobs[" + i + "].Id"); jobInfo.Name = context.StringValue("ListJobs.Jobs[" + i + "].Name"); jobInfo.Type = context.StringValue("ListJobs.Jobs[" + i + "].Type"); jobInfo.RunParameter = context.StringValue("ListJobs.Jobs[" + i + "].RunParameter"); jobInfo.FailAct = context.StringValue("ListJobs.Jobs[" + i + "].FailAct"); jobInfo.MaxRetry = context.IntegerValue("ListJobs.Jobs[" + i + "].MaxRetry"); jobInfo.RetryInterval = context.IntegerValue("ListJobs.Jobs[" + i + "].RetryInterval"); listJobsResponse_jobs.Add(jobInfo); } listJobsResponse.Jobs = listJobsResponse_jobs; return(listJobsResponse); }
private static void UnmarshallResult(XmlUnmarshallerContext context, ListJobsResponse response) { int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; if (context.IsStartOfDocument) { targetDepth += 2; } while (context.ReadAtDepth(originalDepth)) { if (context.IsStartElement || context.IsAttribute) { if (context.TestExpression("IsTruncated", targetDepth)) { var unmarshaller = BoolUnmarshaller.Instance; response.IsTruncated = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("Jobs/member", targetDepth)) { var unmarshaller = JobUnmarshaller.Instance; var item = unmarshaller.Unmarshall(context); response.Jobs.Add(item); continue; } } } return; }
/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { ListJobsResponse response = new ListJobsResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.TestExpression("jobs", targetDepth)) { var unmarshaller = new ListUnmarshaller <Job, JobUnmarshaller>(JobUnmarshaller.Instance); response.Jobs = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("nextToken", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.NextToken = unmarshaller.Unmarshall(context); continue; } } return(response); }
private static void UnmarshallResult(XmlUnmarshallerContext context, ListJobsResponse response) { int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; if (context.IsStartOfDocument) { targetDepth += 1; } while (context.Read()) { if (context.IsStartElement || context.IsAttribute) { if (context.TestExpression("Jobs/member", targetDepth)) { var unmarshaller = JobListDescriptorUnmarshaller.Instance; response.Jobs.Add(unmarshaller.Unmarshall(context)); continue; } if (context.TestExpression("NextToken", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.NextToken = unmarshaller.Unmarshall(context); continue; } } else if (context.IsEndElement && context.CurrentDepth < originalDepth) { return; } } return; }
public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems) { AmazonMediaConvertConfig config = new AmazonMediaConvertConfig(); config.RegionEndpoint = region; ConfigureClient(config); AmazonMediaConvertClient client = new AmazonMediaConvertClient(creds, config); ListJobsResponse resp = new ListJobsResponse(); do { ListJobsRequest req = new ListJobsRequest { NextToken = resp.NextToken , MaxResults = maxItems }; resp = client.ListJobs(req); CheckError(resp.HttpStatusCode, "200"); foreach (var obj in resp.Jobs) { AddObject(obj); } }while (!string.IsNullOrEmpty(resp.NextToken)); }
/// <summary> /// <para> This operation returns the jobs associated with the requester. /// AWS Import/Export lists the jobs in reverse chronological order based /// on the date of creation. For example if Job Test1 was created /// 2009Dec30 and Test2 was created 2010Feb05, the ListJobs operation /// would return Test2 followed by Test1. </para> /// </summary> /// /// <param name="listJobsRequest">Container for the necessary parameters /// to execute the ListJobs service method on AmazonImportExport.</param> /// /// <returns>The response from the ListJobs service method, as returned by /// AmazonImportExport.</returns> /// /// <exception cref="InvalidParameterException"/> /// <exception cref="InvalidAccessKeyIdException"/> public ListJobsResponse ListJobs(ListJobsRequest listJobsRequest) { IRequest <ListJobsRequest> request = new ListJobsRequestMarshaller().Marshall(listJobsRequest); ListJobsResponse response = Invoke <ListJobsRequest, ListJobsResponse> (request, this.signer, ListJobsResponseUnmarshaller.GetInstance()); return(response); }
/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { ListJobsResponse response = new ListJobsResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.TestExpression("JobList", targetDepth)) { var unmarshaller = new ListUnmarshaller <GlacierJobDescription, GlacierJobDescriptionUnmarshaller>(GlacierJobDescriptionUnmarshaller.Instance); response.JobList = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("Marker", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.Marker = unmarshaller.Unmarshall(context); continue; } } return(response); }
/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context) { ListJobsResponse response = new ListJobsResponse(); UnmarshallResult(context, response); return(response); }
public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { ListJobsResponse response = new ListJobsResponse(); context.Read(); response.ListJobsResult = ListJobsResultUnmarshaller.GetInstance().Unmarshall(context); return(response); }
public void ListJobsMaxCountTest() { // Verify default max count Assert.Equal(Microsoft.Azure.Commands.Batch.Utils.Constants.DefaultMaxCount, cmdlet.MaxCount); // Setup cmdlet to list Jobs without filters and a max count BatchAccountContext context = BatchTestHelpers.CreateBatchContextWithKeys(); cmdlet.BatchContext = context; cmdlet.WorkItem = BatchTestHelpers.CreatePSCloudWorkItem(); cmdlet.Name = null; cmdlet.Filter = null; int maxCount = 2; cmdlet.MaxCount = maxCount; string[] namesOfConstructedJobs = new[] { "job-0000000001", "job-0000000002", "job-0000000003" }; // Build some Jobs instead of querying the service on a ListJobs call YieldInjectionInterceptor interceptor = new YieldInjectionInterceptor((opContext, request) => { if (request is ListJobsRequest) { ListJobsResponse response = BatchTestHelpers.CreateListJobsResponse(namesOfConstructedJobs); Task <object> task = Task <object> .Factory.StartNew(() => { return(response); }); return(task); } return(null); }); cmdlet.AdditionalBehaviors = new List <BatchClientBehavior>() { interceptor }; // Setup the cmdlet to write pipeline output to a list that can be examined later List <PSCloudJob> pipeline = new List <PSCloudJob>(); commandRuntimeMock.Setup(r => r.WriteObject(It.IsAny <PSCloudJob>())) .Callback <object>(j => pipeline.Add((PSCloudJob)j)); cmdlet.ExecuteCmdlet(); // Verify that the max count was respected Assert.Equal(maxCount, pipeline.Count); // Verify setting max count <= 0 doesn't return nothing cmdlet.MaxCount = -5; pipeline.Clear(); cmdlet.ExecuteCmdlet(); Assert.Equal(namesOfConstructedJobs.Length, pipeline.Count); }
public async Task <IActionResult> ListJobs() { ListJobsRequest request = new ListJobsRequest { VaultName = S3Settings.VaultName }; ListJobsResponse response = await GlacierClient.ListJobsAsync(request); return(new JsonResult(response.JobList)); }
private static List <GlacierJobDescription> ListInventory(string vaultName) { using (IAmazonGlacier client = new AmazonGlacierClient(RegionEndpoint.EUWest1)) { ListJobsRequest request = new ListJobsRequest() { VaultName = vaultName }; ListJobsResponse response = client.ListJobs(request); return(response.JobList); } }
public void ListBatchJobsByODataFilterTest() { // Setup cmdlet to list Jobs using an OData filter. Use WorkItemName input. BatchAccountContext context = BatchTestHelpers.CreateBatchContextWithKeys(); cmdlet.BatchContext = context; cmdlet.WorkItemName = "workItem"; cmdlet.Name = null; cmdlet.Filter = "state -eq 'active'"; string[] namesOfConstructedJobs = new[] { "job-0000000001", "job-0000000002" }; // Build some Jobs instead of querying the service on a ListJobs call YieldInjectionInterceptor interceptor = new YieldInjectionInterceptor((opContext, request) => { if (request is ListJobsRequest) { ListJobsResponse response = BatchTestHelpers.CreateListJobsResponse(namesOfConstructedJobs); Task <object> task = Task <object> .Factory.StartNew(() => { return(response); }); return(task); } return(null); }); cmdlet.AdditionalBehaviors = new List <BatchClientBehavior>() { interceptor }; // Setup the cmdlet to write pipeline output to a list that can be examined later List <PSCloudJob> pipeline = new List <PSCloudJob>(); commandRuntimeMock.Setup(r => r.WriteObject(It.IsAny <PSCloudJob>())) .Callback <object>(j => pipeline.Add((PSCloudJob)j)); cmdlet.ExecuteCmdlet(); // Verify that the cmdlet wrote the constructed Jobs to the pipeline Assert.Equal(2, pipeline.Count); int jobCount = 0; foreach (PSCloudJob j in pipeline) { Assert.True(namesOfConstructedJobs.Contains(j.Name)); jobCount++; } Assert.Equal(namesOfConstructedJobs.Length, jobCount); }
private static void UnmarshallResult(JsonUnmarshallerContext context, ListJobsResponse response) { int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; while (context.Read()) { if (context.TestExpression("JobList", targetDepth)) { context.Read(); if (context.CurrentTokenType == JsonToken.Null) { response.JobList = null; continue; } response.JobList = new List <GlacierJobDescription>(); GlacierJobDescriptionUnmarshaller unmarshaller = GlacierJobDescriptionUnmarshaller.GetInstance(); while (context.Read()) { JsonToken token = context.CurrentTokenType; if (token == JsonToken.ArrayStart) { continue; } if (token == JsonToken.ArrayEnd) { break; } response.JobList.Add(unmarshaller.Unmarshall(context)); } continue; } if (context.TestExpression("Marker", targetDepth)) { context.Read(); response.Marker = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.CurrentDepth <= originalDepth) { return; } } return; }
public override async Task <ListJobsResponse> ListJobs(ListJobsRequest request, ServerCallContext context) { var jobs = await _organizationApp.GetJobsAsync(); var items = jobs.Select(x => new ListJobsResponse.Types.Job { Id = x.Id, Title = x.Title, }); var result = new ListJobsResponse(); result.Items.AddRange(items); return(result); }
public void JobListJobsRequest() { ListJobsResponse response = Zencoder.ListJobs(); Assert.IsTrue(response.Success); AutoResetEvent[] handles = new AutoResetEvent[] { new AutoResetEvent(false) }; Zencoder.ListJobs( r => { Assert.IsTrue(r.Success); handles[0].Set(); }); WaitHandle.WaitAll(handles); }
/// <summary> /// Builds a ListJobsResponse object /// </summary> public static ListJobsResponse CreateListJobsResponse(IEnumerable <string> jobNames) { ListJobsResponse response = new ListJobsResponse(); SetProperty(response, "StatusCode", HttpStatusCode.OK); List <Job> jobs = new List <Job>(); foreach (string name in jobNames) { Job job = new Job(); SetProperty(job, "Name", name); jobs.Add(job); } SetProperty(response, "Jobs", jobs); return(response); }
public static ListJobsResponse Unmarshall(UnmarshallerContext context) { ListJobsResponse listJobsResponse = new ListJobsResponse(); listJobsResponse.HttpResponse = context.HttpResponse; listJobsResponse.RequestId = context.StringValue("ListJobs.RequestId"); listJobsResponse.TotalCount = context.IntegerValue("ListJobs.TotalCount"); listJobsResponse.PageNumber = context.IntegerValue("ListJobs.PageNumber"); listJobsResponse.PageSize = context.IntegerValue("ListJobs.PageSize"); List <ListJobsResponse.ListJobs_JobInfo> listJobsResponse_jobs = new List <ListJobsResponse.ListJobs_JobInfo>(); for (int i = 0; i < context.Length("ListJobs.Jobs.Length"); i++) { ListJobsResponse.ListJobs_JobInfo jobInfo = new ListJobsResponse.ListJobs_JobInfo(); jobInfo.Id = context.StringValue("ListJobs.Jobs[" + i + "].Id"); jobInfo.Name = context.StringValue("ListJobs.Jobs[" + i + "].Name"); jobInfo.Owner = context.StringValue("ListJobs.Jobs[" + i + "].Owner"); jobInfo.NodeList = context.StringValue("ListJobs.Jobs[" + i + "].NodeList"); jobInfo.Priority = context.IntegerValue("ListJobs.Jobs[" + i + "].Priority"); jobInfo.State = context.StringValue("ListJobs.Jobs[" + i + "].State"); jobInfo.SubmitTime = context.StringValue("ListJobs.Jobs[" + i + "].SubmitTime"); jobInfo.StartTime = context.StringValue("ListJobs.Jobs[" + i + "].StartTime"); jobInfo.LastModifyTime = context.StringValue("ListJobs.Jobs[" + i + "].LastModifyTime"); jobInfo.Stdout = context.StringValue("ListJobs.Jobs[" + i + "].Stdout"); jobInfo.Stderr = context.StringValue("ListJobs.Jobs[" + i + "].Stderr"); jobInfo.ShellPath = context.StringValue("ListJobs.Jobs[" + i + "].ShellPath"); jobInfo.Comment = context.StringValue("ListJobs.Jobs[" + i + "].Comment"); jobInfo.ArrayRequest = context.StringValue("ListJobs.Jobs[" + i + "].ArrayRequest"); ListJobsResponse.ListJobs_JobInfo.ListJobs_Resources resources = new ListJobsResponse.ListJobs_JobInfo.ListJobs_Resources(); resources.Nodes = context.IntegerValue("ListJobs.Jobs[" + i + "].Resources.Nodes"); resources.Cores = context.IntegerValue("ListJobs.Jobs[" + i + "].Resources.Cores"); jobInfo.Resources = resources; listJobsResponse_jobs.Add(jobInfo); } listJobsResponse.Jobs = listJobsResponse_jobs; return(listJobsResponse); }
public async Task <List <Job> > listJobs() { String mediaConvertEndpoint = ""; if (String.IsNullOrEmpty(mediaConvertEndpoint)) { // Obtain the customer-specific MediaConvert endpoint AmazonMediaConvertClient client = new AmazonMediaConvertClient(Amazon.RegionEndpoint.USEast1); DescribeEndpointsRequest describeRequest = new DescribeEndpointsRequest(); DescribeEndpointsResponse describeResponse = await client.DescribeEndpointsAsync(describeRequest); mediaConvertEndpoint = describeResponse.Endpoints[0].Url; } AmazonMediaConvertConfig mcConfig = new AmazonMediaConvertConfig { ServiceURL = mediaConvertEndpoint }; String key = ""; String secret = ""; try { StreamReader sr = new StreamReader("c:\\temp\\awskey.txt"); key = sr.ReadLine(); secret = sr.ReadLine(); } catch (Exception ex) { Console.WriteLine("Could not read the file"); } AmazonMediaConvertClient mcClient = new AmazonMediaConvertClient(key, secret, mcConfig); ListJobsRequest req = new ListJobsRequest(); ListJobsResponse listJobs = await mcClient.ListJobsAsync(req); return(listJobs.Jobs); }
public void JobListJobsFromJson() { ListJobsResponse response = ListJobsResponse.FromJson(ListJobsResponseJson); Assert.AreEqual(1, response.Jobs.Length); Job first = response.Jobs.First(); Assert.AreEqual(new DateTime(2010, 1, 1), first.FinishedAt); Assert.AreEqual(1, first.Id); Assert.AreEqual(JobState.Finished, first.State); Assert.AreEqual("mpeg4", first.InputMediaFile.Format); Assert.AreEqual(24883, first.InputMediaFile.DurationInMiliseconds); Assert.AreEqual(2, first.InputMediaFile.Channels); Assert.AreEqual("h264", first.InputMediaFile.VideoCodec); Assert.AreEqual(1, first.OutputMediaFiles.Length); OutputMediaFile output = first.OutputMediaFiles.First(); Assert.AreEqual(AudioCodec.Aac, output.AudioCodec); Assert.AreEqual(false, output.Test); }
public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context) { ListJobsResponse response = new ListJobsResponse(); while (context.Read()) { if (context.IsStartElement) { if (context.TestExpression("ListJobsResult", 2)) { response.ListJobsResult = ListJobsResultUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("ResponseMetadata", 2)) { response.ResponseMetadata = ResponseMetadataUnmarshaller.GetInstance().Unmarshall(context); } } } return(response); }
private static void UnmarshallResult(XmlUnmarshallerContext context, ListJobsResponse response) { int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; if (context.IsStartOfDocument) { targetDepth += 2; } while (context.Read()) { if (context.IsStartElement || context.IsAttribute) { if (context.TestExpression("Jobs/member", targetDepth)) { response.Jobs.Add(JobUnmarshaller.GetInstance().Unmarshall(context)); continue; } if (context.TestExpression("IsTruncated", targetDepth)) { response.IsTruncated = BoolUnmarshaller.GetInstance().Unmarshall(context); continue; } } else if (context.IsEndElement && context.CurrentDepth < originalDepth) { return; } } return; }
public static ListJobsResponse Unmarshall(UnmarshallerContext context) { ListJobsResponse listJobsResponse = new ListJobsResponse(); listJobsResponse.HttpResponse = context.HttpResponse; listJobsResponse.RequestId = context.StringValue("ListJobs.RequestId"); listJobsResponse.Success = context.BooleanValue("ListJobs.Success"); listJobsResponse.Code = context.StringValue("ListJobs.Code"); listJobsResponse.Message = context.StringValue("ListJobs.Message"); listJobsResponse.HttpStatusCode = context.IntegerValue("ListJobs.HttpStatusCode"); List <ListJobsResponse.ListJobs_Job> listJobsResponse_jobs = new List <ListJobsResponse.ListJobs_Job>(); for (int i = 0; i < context.Length("ListJobs.Jobs.Length"); i++) { ListJobsResponse.ListJobs_Job job = new ListJobsResponse.ListJobs_Job(); job.JobId = context.StringValue("ListJobs.Jobs[" + i + "].JobId"); job.JobGroupId = context.StringValue("ListJobs.Jobs[" + i + "].JobGroupId"); job.ScenarioId = context.StringValue("ListJobs.Jobs[" + i + "].ScenarioId"); job.StrategyId = context.StringValue("ListJobs.Jobs[" + i + "].StrategyId"); job.Priority = context.IntegerValue("ListJobs.Jobs[" + i + "].Priority"); job.SystemPriority = context.IntegerValue("ListJobs.Jobs[" + i + "].SystemPriority"); job.Status = context.StringValue("ListJobs.Jobs[" + i + "].Status"); job.ReferenceId = context.StringValue("ListJobs.Jobs[" + i + "].ReferenceId"); job.FailureReason = context.StringValue("ListJobs.Jobs[" + i + "].FailureReason"); List <string> job_callingNumbers = new List <string>(); for (int j = 0; j < context.Length("ListJobs.Jobs[" + i + "].CallingNumbers.Length"); j++) { job_callingNumbers.Add(context.StringValue("ListJobs.Jobs[" + i + "].CallingNumbers[" + j + "]")); } job.CallingNumbers = job_callingNumbers; List <ListJobsResponse.ListJobs_Job.ListJobs_Contact> job_contacts = new List <ListJobsResponse.ListJobs_Job.ListJobs_Contact>(); for (int j = 0; j < context.Length("ListJobs.Jobs[" + i + "].Contacts.Length"); j++) { ListJobsResponse.ListJobs_Job.ListJobs_Contact contact = new ListJobsResponse.ListJobs_Job.ListJobs_Contact(); contact.ContactId = context.StringValue("ListJobs.Jobs[" + i + "].Contacts[" + j + "].ContactId"); contact.ContactName = context.StringValue("ListJobs.Jobs[" + i + "].Contacts[" + j + "].ContactName"); contact.Honorific = context.StringValue("ListJobs.Jobs[" + i + "].Contacts[" + j + "].Honorific"); contact.Role = context.StringValue("ListJobs.Jobs[" + i + "].Contacts[" + j + "].Role"); contact.PhoneNumber = context.StringValue("ListJobs.Jobs[" + i + "].Contacts[" + j + "].PhoneNumber"); contact.State = context.StringValue("ListJobs.Jobs[" + i + "].Contacts[" + j + "].State"); contact.ReferenceId = context.StringValue("ListJobs.Jobs[" + i + "].Contacts[" + j + "].ReferenceId"); contact.JobId = context.StringValue("ListJobs.Jobs[" + i + "].Contacts[" + j + "].JobId"); job_contacts.Add(contact); } job.Contacts = job_contacts; List <ListJobsResponse.ListJobs_Job.ListJobs_KeyValuePair> job_extras = new List <ListJobsResponse.ListJobs_Job.ListJobs_KeyValuePair>(); for (int j = 0; j < context.Length("ListJobs.Jobs[" + i + "].Extras.Length"); j++) { ListJobsResponse.ListJobs_Job.ListJobs_KeyValuePair keyValuePair = new ListJobsResponse.ListJobs_Job.ListJobs_KeyValuePair(); keyValuePair.Key = context.StringValue("ListJobs.Jobs[" + i + "].Extras[" + j + "].Key"); keyValuePair._Value = context.StringValue("ListJobs.Jobs[" + i + "].Extras[" + j + "].Value"); job_extras.Add(keyValuePair); } job.Extras = job_extras; List <ListJobsResponse.ListJobs_Job.ListJobs_Task> job_tasks = new List <ListJobsResponse.ListJobs_Job.ListJobs_Task>(); for (int j = 0; j < context.Length("ListJobs.Jobs[" + i + "].Tasks.Length"); j++) { ListJobsResponse.ListJobs_Job.ListJobs_Task task = new ListJobsResponse.ListJobs_Job.ListJobs_Task(); task.TaskId = context.StringValue("ListJobs.Jobs[" + i + "].Tasks[" + j + "].TaskId"); task.JobId = context.StringValue("ListJobs.Jobs[" + i + "].Tasks[" + j + "].JobId"); task.ScenarioId = context.StringValue("ListJobs.Jobs[" + i + "].Tasks[" + j + "].ScenarioId"); task.ChatbotId = context.StringValue("ListJobs.Jobs[" + i + "].Tasks[" + j + "].ChatbotId"); task.PlanedTime = context.LongValue("ListJobs.Jobs[" + i + "].Tasks[" + j + "].PlanedTime"); task.ActualTime = context.LongValue("ListJobs.Jobs[" + i + "].Tasks[" + j + "].ActualTime"); task.CallingNumber = context.StringValue("ListJobs.Jobs[" + i + "].Tasks[" + j + "].CallingNumber"); task.CalledNumber = context.StringValue("ListJobs.Jobs[" + i + "].Tasks[" + j + "].CalledNumber"); task.CallId = context.StringValue("ListJobs.Jobs[" + i + "].Tasks[" + j + "].CallId"); task.Status = context.StringValue("ListJobs.Jobs[" + i + "].Tasks[" + j + "].Status"); task.Brief = context.StringValue("ListJobs.Jobs[" + i + "].Tasks[" + j + "].Brief"); task.Duration = context.IntegerValue("ListJobs.Jobs[" + i + "].Tasks[" + j + "].Duration"); ListJobsResponse.ListJobs_Job.ListJobs_Task.ListJobs_Contact2 contact2 = new ListJobsResponse.ListJobs_Job.ListJobs_Task.ListJobs_Contact2(); contact2.ContactId = context.StringValue("ListJobs.Jobs[" + i + "].Tasks[" + j + "].Contact.ContactId"); contact2.ContactName = context.StringValue("ListJobs.Jobs[" + i + "].Tasks[" + j + "].Contact.ContactName"); contact2.Honorific = context.StringValue("ListJobs.Jobs[" + i + "].Tasks[" + j + "].Contact.Honorific"); contact2.Role = context.StringValue("ListJobs.Jobs[" + i + "].Tasks[" + j + "].Contact.Role"); contact2.PhoneNumber = context.StringValue("ListJobs.Jobs[" + i + "].Tasks[" + j + "].Contact.PhoneNumber"); contact2.State = context.StringValue("ListJobs.Jobs[" + i + "].Tasks[" + j + "].Contact.State"); contact2.ReferenceId = context.StringValue("ListJobs.Jobs[" + i + "].Tasks[" + j + "].Contact.ReferenceId"); contact2.JobId = context.StringValue("ListJobs.Jobs[" + i + "].Tasks[" + j + "].Contact.JobId"); task.Contact2 = contact2; List <ListJobsResponse.ListJobs_Job.ListJobs_Task.ListJobs_ConversationDetail> task_conversation = new List <ListJobsResponse.ListJobs_Job.ListJobs_Task.ListJobs_ConversationDetail>(); for (int k = 0; k < context.Length("ListJobs.Jobs[" + i + "].Tasks[" + j + "].Conversation.Length"); k++) { ListJobsResponse.ListJobs_Job.ListJobs_Task.ListJobs_ConversationDetail conversationDetail = new ListJobsResponse.ListJobs_Job.ListJobs_Task.ListJobs_ConversationDetail(); conversationDetail.Timestamp = context.LongValue("ListJobs.Jobs[" + i + "].Tasks[" + j + "].Conversation[" + k + "].Timestamp"); conversationDetail.Speaker = context.StringValue("ListJobs.Jobs[" + i + "].Tasks[" + j + "].Conversation[" + k + "].Speaker"); conversationDetail.Script = context.StringValue("ListJobs.Jobs[" + i + "].Tasks[" + j + "].Conversation[" + k + "].Script"); List <ListJobsResponse.ListJobs_Job.ListJobs_Task.ListJobs_ConversationDetail.ListJobs_SummaryItem> conversationDetail_summary1 = new List <ListJobsResponse.ListJobs_Job.ListJobs_Task.ListJobs_ConversationDetail.ListJobs_SummaryItem>(); for (int l = 0; l < context.Length("ListJobs.Jobs[" + i + "].Tasks[" + j + "].Conversation[" + k + "].Summary.Length"); l++) { ListJobsResponse.ListJobs_Job.ListJobs_Task.ListJobs_ConversationDetail.ListJobs_SummaryItem summaryItem = new ListJobsResponse.ListJobs_Job.ListJobs_Task.ListJobs_ConversationDetail.ListJobs_SummaryItem(); summaryItem.Category = context.StringValue("ListJobs.Jobs[" + i + "].Tasks[" + j + "].Conversation[" + k + "].Summary[" + l + "].Category"); summaryItem.SummaryName = context.StringValue("ListJobs.Jobs[" + i + "].Tasks[" + j + "].Conversation[" + k + "].Summary[" + l + "].SummaryName"); summaryItem.Content = context.StringValue("ListJobs.Jobs[" + i + "].Tasks[" + j + "].Conversation[" + k + "].Summary[" + l + "].Content"); conversationDetail_summary1.Add(summaryItem); } conversationDetail.Summary1 = conversationDetail_summary1; task_conversation.Add(conversationDetail); } task.Conversation = task_conversation; job_tasks.Add(task); } job.Tasks = job_tasks; List <ListJobsResponse.ListJobs_Job.ListJobs_SummaryItem3> job_summary = new List <ListJobsResponse.ListJobs_Job.ListJobs_SummaryItem3>(); for (int j = 0; j < context.Length("ListJobs.Jobs[" + i + "].Summary.Length"); j++) { ListJobsResponse.ListJobs_Job.ListJobs_SummaryItem3 summaryItem3 = new ListJobsResponse.ListJobs_Job.ListJobs_SummaryItem3(); summaryItem3.Category = context.StringValue("ListJobs.Jobs[" + i + "].Summary[" + j + "].Category"); summaryItem3.SummaryName = context.StringValue("ListJobs.Jobs[" + i + "].Summary[" + j + "].SummaryName"); summaryItem3.Content = context.StringValue("ListJobs.Jobs[" + i + "].Summary[" + j + "].Content"); job_summary.Add(summaryItem3); } job.Summary = job_summary; listJobsResponse_jobs.Add(job); } listJobsResponse.Jobs = listJobsResponse_jobs; return(listJobsResponse); }
public static ListJobsResponse Unmarshall(UnmarshallerContext _ctx) { ListJobsResponse listJobsResponse = new ListJobsResponse(); listJobsResponse.HttpResponse = _ctx.HttpResponse; listJobsResponse.RequestId = _ctx.StringValue("ListJobs.RequestId"); listJobsResponse.Code = _ctx.IntegerValue("ListJobs.Code"); listJobsResponse.Message = _ctx.StringValue("ListJobs.Message"); listJobsResponse.Success = _ctx.BooleanValue("ListJobs.Success"); ListJobsResponse.ListJobs_Data data = new ListJobsResponse.ListJobs_Data(); List <ListJobsResponse.ListJobs_Data.ListJobs_Job> data_jobs = new List <ListJobsResponse.ListJobs_Data.ListJobs_Job>(); for (int i = 0; i < _ctx.Length("ListJobs.Data.Jobs.Length"); i++) { ListJobsResponse.ListJobs_Data.ListJobs_Job job = new ListJobsResponse.ListJobs_Data.ListJobs_Job(); job.ClassName = _ctx.StringValue("ListJobs.Data.Jobs[" + i + "].ClassName"); job.JarUrl = _ctx.StringValue("ListJobs.Data.Jobs[" + i + "].JarUrl"); job.Content = _ctx.StringValue("ListJobs.Data.Jobs[" + i + "].Content"); job.Name = _ctx.StringValue("ListJobs.Data.Jobs[" + i + "].Name"); job.Description = _ctx.StringValue("ListJobs.Data.Jobs[" + i + "].Description"); job.Status = _ctx.IntegerValue("ListJobs.Data.Jobs[" + i + "].Status"); job.ExecuteMode = _ctx.StringValue("ListJobs.Data.Jobs[" + i + "].ExecuteMode"); job.Parameters = _ctx.StringValue("ListJobs.Data.Jobs[" + i + "].Parameters"); job.MaxConcurrency = _ctx.StringValue("ListJobs.Data.Jobs[" + i + "].MaxConcurrency"); job.MaxAttempt = _ctx.IntegerValue("ListJobs.Data.Jobs[" + i + "].MaxAttempt"); job.AttemptInterval = _ctx.IntegerValue("ListJobs.Data.Jobs[" + i + "].AttemptInterval"); job.JobId = _ctx.LongValue("ListJobs.Data.Jobs[" + i + "].JobId"); ListJobsResponse.ListJobs_Data.ListJobs_Job.ListJobs_MapTaskXAttrs mapTaskXAttrs = new ListJobsResponse.ListJobs_Data.ListJobs_Job.ListJobs_MapTaskXAttrs(); mapTaskXAttrs.PageSize = _ctx.IntegerValue("ListJobs.Data.Jobs[" + i + "].MapTaskXAttrs.PageSize"); mapTaskXAttrs.ConsumerSize = _ctx.IntegerValue("ListJobs.Data.Jobs[" + i + "].MapTaskXAttrs.ConsumerSize"); mapTaskXAttrs.QueueSize = _ctx.IntegerValue("ListJobs.Data.Jobs[" + i + "].MapTaskXAttrs.QueueSize"); mapTaskXAttrs.DispatcherSize = _ctx.IntegerValue("ListJobs.Data.Jobs[" + i + "].MapTaskXAttrs.DispatcherSize"); mapTaskXAttrs.TaskMaxAttempt = _ctx.IntegerValue("ListJobs.Data.Jobs[" + i + "].MapTaskXAttrs.TaskMaxAttempt"); mapTaskXAttrs.TaskAttemptInterval = _ctx.IntegerValue("ListJobs.Data.Jobs[" + i + "].MapTaskXAttrs.TaskAttemptInterval"); job.MapTaskXAttrs = mapTaskXAttrs; ListJobsResponse.ListJobs_Data.ListJobs_Job.ListJobs_TimeConfig timeConfig = new ListJobsResponse.ListJobs_Data.ListJobs_Job.ListJobs_TimeConfig(); timeConfig.TimeType = _ctx.IntegerValue("ListJobs.Data.Jobs[" + i + "].TimeConfig.TimeType"); timeConfig.TimeExpression = _ctx.StringValue("ListJobs.Data.Jobs[" + i + "].TimeConfig.TimeExpression"); timeConfig.Calendar = _ctx.StringValue("ListJobs.Data.Jobs[" + i + "].TimeConfig.Calendar"); timeConfig.DataOffset = _ctx.IntegerValue("ListJobs.Data.Jobs[" + i + "].TimeConfig.DataOffset"); job.TimeConfig = timeConfig; ListJobsResponse.ListJobs_Data.ListJobs_Job.ListJobs_JobMonitorInfo jobMonitorInfo = new ListJobsResponse.ListJobs_Data.ListJobs_Job.ListJobs_JobMonitorInfo(); ListJobsResponse.ListJobs_Data.ListJobs_Job.ListJobs_JobMonitorInfo.ListJobs_MonitorConfig monitorConfig = new ListJobsResponse.ListJobs_Data.ListJobs_Job.ListJobs_JobMonitorInfo.ListJobs_MonitorConfig(); monitorConfig.TimeoutEnable = _ctx.BooleanValue("ListJobs.Data.Jobs[" + i + "].JobMonitorInfo.MonitorConfig.TimeoutEnable"); monitorConfig.Timeout = _ctx.LongValue("ListJobs.Data.Jobs[" + i + "].JobMonitorInfo.MonitorConfig.Timeout"); monitorConfig.TimeoutKillEnable = _ctx.BooleanValue("ListJobs.Data.Jobs[" + i + "].JobMonitorInfo.MonitorConfig.TimeoutKillEnable"); monitorConfig.FailEnable = _ctx.BooleanValue("ListJobs.Data.Jobs[" + i + "].JobMonitorInfo.MonitorConfig.FailEnable"); monitorConfig.SendChannel = _ctx.StringValue("ListJobs.Data.Jobs[" + i + "].JobMonitorInfo.MonitorConfig.SendChannel"); jobMonitorInfo.MonitorConfig = monitorConfig; List <ListJobsResponse.ListJobs_Data.ListJobs_Job.ListJobs_JobMonitorInfo.ListJobs_ContactInfoItem> jobMonitorInfo_contactInfo = new List <ListJobsResponse.ListJobs_Data.ListJobs_Job.ListJobs_JobMonitorInfo.ListJobs_ContactInfoItem>(); for (int j = 0; j < _ctx.Length("ListJobs.Data.Jobs[" + i + "].JobMonitorInfo.ContactInfo.Length"); j++) { ListJobsResponse.ListJobs_Data.ListJobs_Job.ListJobs_JobMonitorInfo.ListJobs_ContactInfoItem contactInfoItem = new ListJobsResponse.ListJobs_Data.ListJobs_Job.ListJobs_JobMonitorInfo.ListJobs_ContactInfoItem(); contactInfoItem.UserName = _ctx.StringValue("ListJobs.Data.Jobs[" + i + "].JobMonitorInfo.ContactInfo[" + j + "].UserName"); contactInfoItem.UserPhone = _ctx.StringValue("ListJobs.Data.Jobs[" + i + "].JobMonitorInfo.ContactInfo[" + j + "].UserPhone"); jobMonitorInfo_contactInfo.Add(contactInfoItem); } jobMonitorInfo.ContactInfo = jobMonitorInfo_contactInfo; job.JobMonitorInfo = jobMonitorInfo; data_jobs.Add(job); } data.Jobs = data_jobs; listJobsResponse.Data = data; return(listJobsResponse); }
/// <summary> /// Builds a ListJobsResponse object /// </summary> public static ListJobsResponse CreateListJobsResponse(IEnumerable<string> jobNames) { ListJobsResponse response = new ListJobsResponse(); SetProperty(response, "StatusCode", HttpStatusCode.OK); List<Job> jobs = new List<Job>(); foreach (string name in jobNames) { Job job = new Job(); SetProperty(job, "Name", name); jobs.Add(job); } SetProperty(response, "Jobs", jobs); return response; }