// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package batch import ( "context" "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/aws-sdk-go-v2/internal/awsutil" "github.com/aws/aws-sdk-go-v2/private/protocol" ) type ListJobsInput struct { _ struct{} `type:"structure"` // The job ID for an array job. Specifying an array job ID with this parameter // lists all child jobs from within the specified array. ArrayJobId *string `locationName:"arrayJobId" type:"string"` // The name or full Amazon Resource Name (ARN) of the job queue with which to // list jobs. JobQueue *string `locationName:"jobQueue" type:"string"` // The job status with which to filter jobs in the specified queue. If you do // not specify a status, only RUNNING jobs are returned. JobStatus JobStatus `locationName:"jobStatus" type:"string" enum:"true"` // The maximum number of results returned by ListJobs in paginated output. When // this parameter is used, ListJobs only returns maxResults results in a single // page along with a nextToken response element. The remaining results of the // initial request can be seen by sending another ListJobs request with the // returned nextToken value. This value can be between 1 and 100. If this parameter // is not used, then ListJobs returns up to 100 results and a nextToken value // if applicable. MaxResults *int64 `locationName:"maxResults" type:"integer"` // The job ID for a multi-node parallel job. Specifying a multi-node parallel // job ID with this parameter lists all nodes that are associated with the specified // job. MultiNodeJobId *string `locationName:"multiNodeJobId" type:"string"` // The nextToken value returned from a previous paginated ListJobs request where // maxResults was used and the results exceeded the value of that parameter. // Pagination continues from the end of the previous results that returned the // nextToken value. This value is null when there are no more results to return. // // This token should be treated as an opaque identifier that is only used to // retrieve the next items in a list and not for other programmatic purposes. NextToken *string `locationName:"nextToken" type:"string"` } // String returns the string representation func (s ListJobsInput) String() string { return awsutil.Prettify(s) } // MarshalFields encodes the AWS API shape using the passed in protocol encoder. func (s ListJobsInput) MarshalFields(e protocol.FieldEncoder) error { e.SetValue(protocol.HeaderTarget, "Content-Type", protocol.StringValue("application/json"), protocol.Metadata{}) if s.ArrayJobId != nil { v := *s.ArrayJobId metadata := protocol.Metadata{} e.SetValue(protocol.BodyTarget, "arrayJobId", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) } if s.JobQueue != nil { v := *s.JobQueue metadata := protocol.Metadata{} e.SetValue(protocol.BodyTarget, "jobQueue", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) } if len(s.JobStatus) > 0 { v := s.JobStatus metadata := protocol.Metadata{} e.SetValue(protocol.BodyTarget, "jobStatus", protocol.QuotedValue{ValueMarshaler: v}, metadata) } if s.MaxResults != nil { v := *s.MaxResults metadata := protocol.Metadata{} e.SetValue(protocol.BodyTarget, "maxResults", protocol.Int64Value(v), metadata) } if s.MultiNodeJobId != nil { v := *s.MultiNodeJobId metadata := protocol.Metadata{} e.SetValue(protocol.BodyTarget, "multiNodeJobId", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) } if s.NextToken != nil { v := *s.NextToken metadata := protocol.Metadata{} e.SetValue(protocol.BodyTarget, "nextToken", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) } return nil } type ListJobsOutput struct { _ struct{} `type:"structure"` // A list of job summaries that match the request. // // JobSummaryList is a required field JobSummaryList []JobSummary `locationName:"jobSummaryList" type:"list" required:"true"` // The nextToken value to include in a future ListJobs request. When the results // of a ListJobs request exceed maxResults, this value can be used to retrieve // the next page of results. This value is null when there are no more results // to return. NextToken *string `locationName:"nextToken" type:"string"` } // String returns the string representation func (s ListJobsOutput) String() string { return awsutil.Prettify(s) } // MarshalFields encodes the AWS API shape using the passed in protocol encoder. func (s ListJobsOutput) MarshalFields(e protocol.FieldEncoder) error { if s.JobSummaryList != nil { v := s.JobSummaryList metadata := protocol.Metadata{} ls0 := e.List(protocol.BodyTarget, "jobSummaryList", metadata) ls0.Start() for _, v1 := range v { ls0.ListAddFields(v1) } ls0.End() } if s.NextToken != nil { v := *s.NextToken metadata := protocol.Metadata{} e.SetValue(protocol.BodyTarget, "nextToken", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) } return nil } const opListJobs = "ListJobs" // ListJobsRequest returns a request value for making API operation for // AWS Batch. // // Returns a list of AWS Batch jobs. // // You must specify only one of the following: // // * a job queue ID to return a list of jobs in that job queue // // * a multi-node parallel job ID to return a list of that job's nodes // // * an array job ID to return a list of that job's children // // You can filter the results by job status with the jobStatus parameter. If // you do not specify a status, only RUNNING jobs are returned. // // // Example sending a request using ListJobsRequest. // req := client.ListJobsRequest(params) // resp, err := req.Send(context.TODO()) // if err == nil { // fmt.Println(resp) // } // // Please also see https://docs.aws.amazon.com/goto/WebAPI/batch-2016-08-10/ListJobs func (c *Client) ListJobsRequest(input *ListJobsInput) ListJobsRequest { op := &aws.Operation{ Name: opListJobs, HTTPMethod: "POST", HTTPPath: "/v1/listjobs", Paginator: &aws.Paginator{ InputTokens: []string{"nextToken"}, OutputTokens: []string{"nextToken"}, LimitToken: "maxResults", TruncationToken: "", }, } if input == nil { input = &ListJobsInput{} } req := c.newRequest(op, input, &ListJobsOutput{}) return ListJobsRequest{Request: req, Input: input, Copy: c.ListJobsRequest} } // ListJobsRequest is the request type for the // ListJobs API operation. type ListJobsRequest struct { *aws.Request Input *ListJobsInput Copy func(*ListJobsInput) ListJobsRequest } // Send marshals and sends the ListJobs API request. func (r ListJobsRequest) Send(ctx context.Context) (*ListJobsResponse, error) { r.Request.SetContext(ctx) err := r.Request.Send() if err != nil { return nil, err } resp := &ListJobsResponse{ ListJobsOutput: r.Request.Data.(*ListJobsOutput), response: &aws.Response{Request: r.Request}, } return resp, nil } // NewListJobsRequestPaginator returns a paginator for ListJobs. // Use Next method to get the next page, and CurrentPage to get the current // response page from the paginator. Next will return false, if there are // no more pages, or an error was encountered. // // Note: This operation can generate multiple requests to a service. // // // Example iterating over pages. // req := client.ListJobsRequest(input) // p := batch.NewListJobsRequestPaginator(req) // // for p.Next(context.TODO()) { // page := p.CurrentPage() // } // // if err := p.Err(); err != nil { // return err // } // func NewListJobsPaginator(req ListJobsRequest) ListJobsPaginator { return ListJobsPaginator{ Pager: aws.Pager{ NewRequest: func(ctx context.Context) (*aws.Request, error) { var inCpy *ListJobsInput if req.Input != nil { tmp := *req.Input inCpy = &tmp } newReq := req.Copy(inCpy) newReq.SetContext(ctx) return newReq.Request, nil }, }, } } // ListJobsPaginator is used to paginate the request. This can be done by // calling Next and CurrentPage. type ListJobsPaginator struct { aws.Pager } func (p *ListJobsPaginator) CurrentPage() *ListJobsOutput { return p.Pager.CurrentPage().(*ListJobsOutput) } // ListJobsResponse is the response type for the // ListJobs API operation. type ListJobsResponse struct { *ListJobsOutput response *aws.Response } // SDKResponseMetdata returns the response metadata for the // ListJobs request. func (r *ListJobsResponse) SDKResponseMetdata() *aws.Response { return r.response }