There are more AWS SDK examples available in the AWS Doc SDK Examples
Use ListJobs
with an AWS SDK or CLI
The following code examples show how to use ListJobs
.
- AWS SDK for .NET
-
Note
There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository
. Set up the file locations, client, and wrapper.
// MediaConvert role Amazon Resource Name (ARN). // For information on creating this role, see // https://docs.aws.amazon.com/mediaconvert/latest/ug/creating-the-iam-role-in-mediaconvert-configured.html. var mediaConvertRole = _configuration["mediaConvertRoleARN"]; // Include the file input and output locations in settings.json or settings.local.json. var fileInput = _configuration["fileInput"]; var fileOutput = _configuration["fileOutput"]; AmazonMediaConvertClient mcClient = new AmazonMediaConvertClient(); var wrapper = new MediaConvertWrapper(mcClient);
List the jobs with a particular status.
Console.WriteLine(new string('-', 80)); Console.WriteLine($"Listing all complete jobs."); var completeJobs = await wrapper.ListAllJobsByStatus(JobStatus.COMPLETE); completeJobs.ForEach(j => { Console.WriteLine($"Job {j.Id} created on {j.CreatedAt:d} has status {j.Status}."); });
List the jobs using a paginator.
/// <summary> /// List all of the jobs with a particular status using a paginator. /// </summary> /// <param name="status">The status to use when listing jobs.</param> /// <returns>The list of jobs matching the status.</returns> public async Task<List<Job>> ListAllJobsByStatus(JobStatus? status = null) { var returnedJobs = new List<Job>(); var paginatedJobs = _amazonMediaConvert.Paginators.ListJobs( new ListJobsRequest { Status = status }); // Get the entire list using the paginator. await foreach (var job in paginatedJobs.Jobs) { returnedJobs.Add(job); } return returnedJobs; }
-
For API details, see ListJobs in AWS SDK for .NET API Reference.
-