1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package devicefarm 4 5import ( 6 "context" 7 "fmt" 8 awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" 9 "github.com/aws/aws-sdk-go-v2/aws/signer/v4" 10 "github.com/aws/aws-sdk-go-v2/service/devicefarm/types" 11 "github.com/aws/smithy-go/middleware" 12 smithyhttp "github.com/aws/smithy-go/transport/http" 13) 14 15// Gets information about unique problems, such as exceptions or crashes. Unique 16// problems are defined as a single instance of an error across a run, job, or 17// suite. For example, if a call in your application consistently raises an 18// exception (OutOfBoundsException in MyActivity.java:386), ListUniqueProblems 19// returns a single entry instead of many individual entries for that exception. 20func (c *Client) ListUniqueProblems(ctx context.Context, params *ListUniqueProblemsInput, optFns ...func(*Options)) (*ListUniqueProblemsOutput, error) { 21 if params == nil { 22 params = &ListUniqueProblemsInput{} 23 } 24 25 result, metadata, err := c.invokeOperation(ctx, "ListUniqueProblems", params, optFns, c.addOperationListUniqueProblemsMiddlewares) 26 if err != nil { 27 return nil, err 28 } 29 30 out := result.(*ListUniqueProblemsOutput) 31 out.ResultMetadata = metadata 32 return out, nil 33} 34 35// Represents a request to the list unique problems operation. 36type ListUniqueProblemsInput struct { 37 38 // The unique problems' ARNs. 39 // 40 // This member is required. 41 Arn *string 42 43 // An identifier that was returned from the previous call to this operation, which 44 // can be used to return the next set of items in the list. 45 NextToken *string 46 47 noSmithyDocumentSerde 48} 49 50// Represents the result of a list unique problems request. 51type ListUniqueProblemsOutput struct { 52 53 // If the number of items that are returned is significantly large, this is an 54 // identifier that is also returned. It can be used in a subsequent call to this 55 // operation to return the next set of items in the list. 56 NextToken *string 57 58 // Information about the unique problems. Allowed values include: 59 // 60 // * PENDING 61 // 62 // * 63 // PASSED 64 // 65 // * WARNED 66 // 67 // * FAILED 68 // 69 // * SKIPPED 70 // 71 // * ERRORED 72 // 73 // * STOPPED 74 UniqueProblems map[string][]types.UniqueProblem 75 76 // Metadata pertaining to the operation's result. 77 ResultMetadata middleware.Metadata 78 79 noSmithyDocumentSerde 80} 81 82func (c *Client) addOperationListUniqueProblemsMiddlewares(stack *middleware.Stack, options Options) (err error) { 83 err = stack.Serialize.Add(&awsAwsjson11_serializeOpListUniqueProblems{}, middleware.After) 84 if err != nil { 85 return err 86 } 87 err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpListUniqueProblems{}, middleware.After) 88 if err != nil { 89 return err 90 } 91 if err = addSetLoggerMiddleware(stack, options); err != nil { 92 return err 93 } 94 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 95 return err 96 } 97 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 98 return err 99 } 100 if err = addResolveEndpointMiddleware(stack, options); err != nil { 101 return err 102 } 103 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 104 return err 105 } 106 if err = addRetryMiddlewares(stack, options); err != nil { 107 return err 108 } 109 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 110 return err 111 } 112 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 113 return err 114 } 115 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 116 return err 117 } 118 if err = addClientUserAgent(stack); err != nil { 119 return err 120 } 121 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 122 return err 123 } 124 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 125 return err 126 } 127 if err = addOpListUniqueProblemsValidationMiddleware(stack); err != nil { 128 return err 129 } 130 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListUniqueProblems(options.Region), middleware.Before); err != nil { 131 return err 132 } 133 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 134 return err 135 } 136 if err = addResponseErrorMiddleware(stack); err != nil { 137 return err 138 } 139 if err = addRequestResponseLogging(stack, options); err != nil { 140 return err 141 } 142 return nil 143} 144 145// ListUniqueProblemsAPIClient is a client that implements the ListUniqueProblems 146// operation. 147type ListUniqueProblemsAPIClient interface { 148 ListUniqueProblems(context.Context, *ListUniqueProblemsInput, ...func(*Options)) (*ListUniqueProblemsOutput, error) 149} 150 151var _ ListUniqueProblemsAPIClient = (*Client)(nil) 152 153// ListUniqueProblemsPaginatorOptions is the paginator options for 154// ListUniqueProblems 155type ListUniqueProblemsPaginatorOptions struct { 156 // Set to true if pagination should stop if the service returns a pagination token 157 // that matches the most recent token provided to the service. 158 StopOnDuplicateToken bool 159} 160 161// ListUniqueProblemsPaginator is a paginator for ListUniqueProblems 162type ListUniqueProblemsPaginator struct { 163 options ListUniqueProblemsPaginatorOptions 164 client ListUniqueProblemsAPIClient 165 params *ListUniqueProblemsInput 166 nextToken *string 167 firstPage bool 168} 169 170// NewListUniqueProblemsPaginator returns a new ListUniqueProblemsPaginator 171func NewListUniqueProblemsPaginator(client ListUniqueProblemsAPIClient, params *ListUniqueProblemsInput, optFns ...func(*ListUniqueProblemsPaginatorOptions)) *ListUniqueProblemsPaginator { 172 if params == nil { 173 params = &ListUniqueProblemsInput{} 174 } 175 176 options := ListUniqueProblemsPaginatorOptions{} 177 178 for _, fn := range optFns { 179 fn(&options) 180 } 181 182 return &ListUniqueProblemsPaginator{ 183 options: options, 184 client: client, 185 params: params, 186 firstPage: true, 187 } 188} 189 190// HasMorePages returns a boolean indicating whether more pages are available 191func (p *ListUniqueProblemsPaginator) HasMorePages() bool { 192 return p.firstPage || p.nextToken != nil 193} 194 195// NextPage retrieves the next ListUniqueProblems page. 196func (p *ListUniqueProblemsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListUniqueProblemsOutput, error) { 197 if !p.HasMorePages() { 198 return nil, fmt.Errorf("no more pages available") 199 } 200 201 params := *p.params 202 params.NextToken = p.nextToken 203 204 result, err := p.client.ListUniqueProblems(ctx, ¶ms, optFns...) 205 if err != nil { 206 return nil, err 207 } 208 p.firstPage = false 209 210 prevToken := p.nextToken 211 p.nextToken = result.NextToken 212 213 if p.options.StopOnDuplicateToken && prevToken != nil && p.nextToken != nil && *prevToken == *p.nextToken { 214 p.nextToken = nil 215 } 216 217 return result, nil 218} 219 220func newServiceMetadataMiddleware_opListUniqueProblems(region string) *awsmiddleware.RegisterServiceMetadata { 221 return &awsmiddleware.RegisterServiceMetadata{ 222 Region: region, 223 ServiceID: ServiceID, 224 SigningName: "devicefarm", 225 OperationName: "ListUniqueProblems", 226 } 227} 228