1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package machinelearning 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/machinelearning/types" 11 "github.com/aws/smithy-go/middleware" 12 smithyhttp "github.com/aws/smithy-go/transport/http" 13) 14 15// Returns a list of MLModel that match the search criteria in the request. 16func (c *Client) DescribeMLModels(ctx context.Context, params *DescribeMLModelsInput, optFns ...func(*Options)) (*DescribeMLModelsOutput, error) { 17 if params == nil { 18 params = &DescribeMLModelsInput{} 19 } 20 21 result, metadata, err := c.invokeOperation(ctx, "DescribeMLModels", params, optFns, addOperationDescribeMLModelsMiddlewares) 22 if err != nil { 23 return nil, err 24 } 25 26 out := result.(*DescribeMLModelsOutput) 27 out.ResultMetadata = metadata 28 return out, nil 29} 30 31type DescribeMLModelsInput struct { 32 33 // The equal to operator. The MLModel results will have FilterVariable values that 34 // exactly match the value specified with EQ. 35 EQ *string 36 37 // Use one of the following variables to filter a list of MLModel: 38 // 39 // * CreatedAt - 40 // Sets the search criteria to MLModel creation date. 41 // 42 // * Status - Sets the search 43 // criteria to MLModel status. 44 // 45 // * Name - Sets the search criteria to the contents 46 // of MLModelName. 47 // 48 // * IAMUser - Sets the search criteria to the user account that 49 // invoked the MLModel creation. 50 // 51 // * TrainingDataSourceId - Sets the search criteria 52 // to the DataSource used to train one or more MLModel. 53 // 54 // * RealtimeEndpointStatus - 55 // Sets the search criteria to the MLModel real-time endpoint status. 56 // 57 // * 58 // MLModelType - Sets the search criteria to MLModel type: binary, regression, or 59 // multi-class. 60 // 61 // * Algorithm - Sets the search criteria to the algorithm that the 62 // MLModel uses. 63 // 64 // * TrainingDataURI - Sets the search criteria to the data file(s) 65 // used in training a MLModel. The URL can identify either a file or an Amazon 66 // Simple Storage Service (Amazon S3) bucket or directory. 67 FilterVariable types.MLModelFilterVariable 68 69 // The greater than or equal to operator. The MLModel results will have 70 // FilterVariable values that are greater than or equal to the value specified with 71 // GE. 72 GE *string 73 74 // The greater than operator. The MLModel results will have FilterVariable values 75 // that are greater than the value specified with GT. 76 GT *string 77 78 // The less than or equal to operator. The MLModel results will have FilterVariable 79 // values that are less than or equal to the value specified with LE. 80 LE *string 81 82 // The less than operator. The MLModel results will have FilterVariable values that 83 // are less than the value specified with LT. 84 LT *string 85 86 // The number of pages of information to include in the result. The range of 87 // acceptable values is 1 through 100. The default value is 100. 88 Limit *int32 89 90 // The not equal to operator. The MLModel results will have FilterVariable values 91 // not equal to the value specified with NE. 92 NE *string 93 94 // The ID of the page in the paginated results. 95 NextToken *string 96 97 // A string that is found at the beginning of a variable, such as Name or Id. For 98 // example, an MLModel could have the Name2014-09-09-HolidayGiftMailer. To search 99 // for this MLModel, select Name for the FilterVariable and any of the following 100 // strings for the Prefix: 101 // 102 // * 2014-09 103 // 104 // * 2014-09-09 105 // 106 // * 2014-09-09-Holiday 107 Prefix *string 108 109 // A two-value parameter that determines the sequence of the resulting list of 110 // MLModel. 111 // 112 // * asc - Arranges the list in ascending order (A-Z, 0-9). 113 // 114 // * dsc - 115 // Arranges the list in descending order (Z-A, 9-0). 116 // 117 // Results are sorted by 118 // FilterVariable. 119 SortOrder types.SortOrder 120} 121 122// Represents the output of a DescribeMLModels operation. The content is 123// essentially a list of MLModel. 124type DescribeMLModelsOutput struct { 125 126 // The ID of the next page in the paginated results that indicates at least one 127 // more page follows. 128 NextToken *string 129 130 // A list of MLModel that meet the search criteria. 131 Results []types.MLModel 132 133 // Metadata pertaining to the operation's result. 134 ResultMetadata middleware.Metadata 135} 136 137func addOperationDescribeMLModelsMiddlewares(stack *middleware.Stack, options Options) (err error) { 138 err = stack.Serialize.Add(&awsAwsjson11_serializeOpDescribeMLModels{}, middleware.After) 139 if err != nil { 140 return err 141 } 142 err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpDescribeMLModels{}, middleware.After) 143 if err != nil { 144 return err 145 } 146 if err = addSetLoggerMiddleware(stack, options); err != nil { 147 return err 148 } 149 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 150 return err 151 } 152 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 153 return err 154 } 155 if err = addResolveEndpointMiddleware(stack, options); err != nil { 156 return err 157 } 158 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 159 return err 160 } 161 if err = addRetryMiddlewares(stack, options); err != nil { 162 return err 163 } 164 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 165 return err 166 } 167 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 168 return err 169 } 170 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 171 return err 172 } 173 if err = addClientUserAgent(stack); err != nil { 174 return err 175 } 176 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 177 return err 178 } 179 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 180 return err 181 } 182 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeMLModels(options.Region), middleware.Before); err != nil { 183 return err 184 } 185 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 186 return err 187 } 188 if err = addResponseErrorMiddleware(stack); err != nil { 189 return err 190 } 191 if err = addRequestResponseLogging(stack, options); err != nil { 192 return err 193 } 194 return nil 195} 196 197// DescribeMLModelsAPIClient is a client that implements the DescribeMLModels 198// operation. 199type DescribeMLModelsAPIClient interface { 200 DescribeMLModels(context.Context, *DescribeMLModelsInput, ...func(*Options)) (*DescribeMLModelsOutput, error) 201} 202 203var _ DescribeMLModelsAPIClient = (*Client)(nil) 204 205// DescribeMLModelsPaginatorOptions is the paginator options for DescribeMLModels 206type DescribeMLModelsPaginatorOptions struct { 207 // The number of pages of information to include in the result. The range of 208 // acceptable values is 1 through 100. The default value is 100. 209 Limit int32 210 211 // Set to true if pagination should stop if the service returns a pagination token 212 // that matches the most recent token provided to the service. 213 StopOnDuplicateToken bool 214} 215 216// DescribeMLModelsPaginator is a paginator for DescribeMLModels 217type DescribeMLModelsPaginator struct { 218 options DescribeMLModelsPaginatorOptions 219 client DescribeMLModelsAPIClient 220 params *DescribeMLModelsInput 221 nextToken *string 222 firstPage bool 223} 224 225// NewDescribeMLModelsPaginator returns a new DescribeMLModelsPaginator 226func NewDescribeMLModelsPaginator(client DescribeMLModelsAPIClient, params *DescribeMLModelsInput, optFns ...func(*DescribeMLModelsPaginatorOptions)) *DescribeMLModelsPaginator { 227 options := DescribeMLModelsPaginatorOptions{} 228 if params.Limit != nil { 229 options.Limit = *params.Limit 230 } 231 232 for _, fn := range optFns { 233 fn(&options) 234 } 235 236 if params == nil { 237 params = &DescribeMLModelsInput{} 238 } 239 240 return &DescribeMLModelsPaginator{ 241 options: options, 242 client: client, 243 params: params, 244 firstPage: true, 245 } 246} 247 248// HasMorePages returns a boolean indicating whether more pages are available 249func (p *DescribeMLModelsPaginator) HasMorePages() bool { 250 return p.firstPage || p.nextToken != nil 251} 252 253// NextPage retrieves the next DescribeMLModels page. 254func (p *DescribeMLModelsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*DescribeMLModelsOutput, error) { 255 if !p.HasMorePages() { 256 return nil, fmt.Errorf("no more pages available") 257 } 258 259 params := *p.params 260 params.NextToken = p.nextToken 261 262 var limit *int32 263 if p.options.Limit > 0 { 264 limit = &p.options.Limit 265 } 266 params.Limit = limit 267 268 result, err := p.client.DescribeMLModels(ctx, ¶ms, optFns...) 269 if err != nil { 270 return nil, err 271 } 272 p.firstPage = false 273 274 prevToken := p.nextToken 275 p.nextToken = result.NextToken 276 277 if p.options.StopOnDuplicateToken && prevToken != nil && p.nextToken != nil && *prevToken == *p.nextToken { 278 p.nextToken = nil 279 } 280 281 return result, nil 282} 283 284func newServiceMetadataMiddleware_opDescribeMLModels(region string) *awsmiddleware.RegisterServiceMetadata { 285 return &awsmiddleware.RegisterServiceMetadata{ 286 Region: region, 287 ServiceID: ServiceID, 288 SigningName: "machinelearning", 289 OperationName: "DescribeMLModels", 290 } 291} 292