github.com/aavshr/aws-sdk-go@v1.41.3/service/forecastqueryservice/api.go (about) 1 // Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. 2 3 package forecastqueryservice 4 5 import ( 6 "fmt" 7 8 "github.com/aavshr/aws-sdk-go/aws" 9 "github.com/aavshr/aws-sdk-go/aws/awsutil" 10 "github.com/aavshr/aws-sdk-go/aws/request" 11 "github.com/aavshr/aws-sdk-go/private/protocol" 12 ) 13 14 const opQueryForecast = "QueryForecast" 15 16 // QueryForecastRequest generates a "aws/request.Request" representing the 17 // client's request for the QueryForecast operation. The "output" return 18 // value will be populated with the request's response once the request completes 19 // successfully. 20 // 21 // Use "Send" method on the returned Request to send the API call to the service. 22 // the "output" return value is not valid until after Send returns without error. 23 // 24 // See QueryForecast for more information on using the QueryForecast 25 // API call, and error handling. 26 // 27 // This method is useful when you want to inject custom logic or configuration 28 // into the SDK's request lifecycle. Such as custom headers, or retry logic. 29 // 30 // 31 // // Example sending a request using the QueryForecastRequest method. 32 // req, resp := client.QueryForecastRequest(params) 33 // 34 // err := req.Send() 35 // if err == nil { // resp is now filled 36 // fmt.Println(resp) 37 // } 38 // 39 // See also, https://docs.aws.amazon.com/goto/WebAPI/forecastquery-2018-06-26/QueryForecast 40 func (c *ForecastQueryService) QueryForecastRequest(input *QueryForecastInput) (req *request.Request, output *QueryForecastOutput) { 41 op := &request.Operation{ 42 Name: opQueryForecast, 43 HTTPMethod: "POST", 44 HTTPPath: "/", 45 } 46 47 if input == nil { 48 input = &QueryForecastInput{} 49 } 50 51 output = &QueryForecastOutput{} 52 req = c.newRequest(op, input, output) 53 return 54 } 55 56 // QueryForecast API operation for Amazon Forecast Query Service. 57 // 58 // Retrieves a forecast for a single item, filtered by the supplied criteria. 59 // 60 // The criteria is a key-value pair. The key is either item_id (or the equivalent 61 // non-timestamp, non-target field) from the TARGET_TIME_SERIES dataset, or 62 // one of the forecast dimensions specified as part of the FeaturizationConfig 63 // object. 64 // 65 // By default, QueryForecast returns the complete date range for the filtered 66 // forecast. You can request a specific date range. 67 // 68 // To get the full forecast, use the CreateForecastExportJob (https://docs.aws.amazon.com/en_us/forecast/latest/dg/API_CreateForecastExportJob.html) 69 // operation. 70 // 71 // The forecasts generated by Amazon Forecast are in the same timezone as the 72 // dataset that was used to create the predictor. 73 // 74 // Returns awserr.Error for service API and SDK errors. Use runtime type assertions 75 // with awserr.Error's Code and Message methods to get detailed information about 76 // the error. 77 // 78 // See the AWS API reference guide for Amazon Forecast Query Service's 79 // API operation QueryForecast for usage and error information. 80 // 81 // Returned Error Types: 82 // * ResourceNotFoundException 83 // We can't find that resource. Check the information that you've provided and 84 // try again. 85 // 86 // * ResourceInUseException 87 // The specified resource is in use. 88 // 89 // * InvalidInputException 90 // The value is invalid or is too long. 91 // 92 // * LimitExceededException 93 // The limit on the number of requests per second has been exceeded. 94 // 95 // * InvalidNextTokenException 96 // The token is not valid. Tokens expire after 24 hours. 97 // 98 // See also, https://docs.aws.amazon.com/goto/WebAPI/forecastquery-2018-06-26/QueryForecast 99 func (c *ForecastQueryService) QueryForecast(input *QueryForecastInput) (*QueryForecastOutput, error) { 100 req, out := c.QueryForecastRequest(input) 101 return out, req.Send() 102 } 103 104 // QueryForecastWithContext is the same as QueryForecast with the addition of 105 // the ability to pass a context and additional request options. 106 // 107 // See QueryForecast for details on how to use this API operation. 108 // 109 // The context must be non-nil and will be used for request cancellation. If 110 // the context is nil a panic will occur. In the future the SDK may create 111 // sub-contexts for http.Requests. See https://golang.org/pkg/context/ 112 // for more information on using Contexts. 113 func (c *ForecastQueryService) QueryForecastWithContext(ctx aws.Context, input *QueryForecastInput, opts ...request.Option) (*QueryForecastOutput, error) { 114 req, out := c.QueryForecastRequest(input) 115 req.SetContext(ctx) 116 req.ApplyOptions(opts...) 117 return out, req.Send() 118 } 119 120 // The forecast value for a specific date. Part of the Forecast object. 121 type DataPoint struct { 122 _ struct{} `type:"structure"` 123 124 // The timestamp of the specific forecast. 125 Timestamp *string `type:"string"` 126 127 // The forecast value. 128 Value *float64 `type:"double"` 129 } 130 131 // String returns the string representation. 132 // 133 // API parameter values that are decorated as "sensitive" in the API will not 134 // be included in the string output. The member name will be present, but the 135 // value will be replaced with "sensitive". 136 func (s DataPoint) String() string { 137 return awsutil.Prettify(s) 138 } 139 140 // GoString returns the string representation. 141 // 142 // API parameter values that are decorated as "sensitive" in the API will not 143 // be included in the string output. The member name will be present, but the 144 // value will be replaced with "sensitive". 145 func (s DataPoint) GoString() string { 146 return s.String() 147 } 148 149 // SetTimestamp sets the Timestamp field's value. 150 func (s *DataPoint) SetTimestamp(v string) *DataPoint { 151 s.Timestamp = &v 152 return s 153 } 154 155 // SetValue sets the Value field's value. 156 func (s *DataPoint) SetValue(v float64) *DataPoint { 157 s.Value = &v 158 return s 159 } 160 161 // Provides information about a forecast. Returned as part of the QueryForecast 162 // response. 163 type Forecast struct { 164 _ struct{} `type:"structure"` 165 166 // The forecast. 167 // 168 // The string of the string-to-array map is one of the following values: 169 // 170 // * p10 171 // 172 // * p50 173 // 174 // * p90 175 Predictions map[string][]*DataPoint `type:"map"` 176 } 177 178 // String returns the string representation. 179 // 180 // API parameter values that are decorated as "sensitive" in the API will not 181 // be included in the string output. The member name will be present, but the 182 // value will be replaced with "sensitive". 183 func (s Forecast) String() string { 184 return awsutil.Prettify(s) 185 } 186 187 // GoString returns the string representation. 188 // 189 // API parameter values that are decorated as "sensitive" in the API will not 190 // be included in the string output. The member name will be present, but the 191 // value will be replaced with "sensitive". 192 func (s Forecast) GoString() string { 193 return s.String() 194 } 195 196 // SetPredictions sets the Predictions field's value. 197 func (s *Forecast) SetPredictions(v map[string][]*DataPoint) *Forecast { 198 s.Predictions = v 199 return s 200 } 201 202 // The value is invalid or is too long. 203 type InvalidInputException struct { 204 _ struct{} `type:"structure"` 205 RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` 206 207 Message_ *string `locationName:"Message" type:"string"` 208 } 209 210 // String returns the string representation. 211 // 212 // API parameter values that are decorated as "sensitive" in the API will not 213 // be included in the string output. The member name will be present, but the 214 // value will be replaced with "sensitive". 215 func (s InvalidInputException) String() string { 216 return awsutil.Prettify(s) 217 } 218 219 // GoString returns the string representation. 220 // 221 // API parameter values that are decorated as "sensitive" in the API will not 222 // be included in the string output. The member name will be present, but the 223 // value will be replaced with "sensitive". 224 func (s InvalidInputException) GoString() string { 225 return s.String() 226 } 227 228 func newErrorInvalidInputException(v protocol.ResponseMetadata) error { 229 return &InvalidInputException{ 230 RespMetadata: v, 231 } 232 } 233 234 // Code returns the exception type name. 235 func (s *InvalidInputException) Code() string { 236 return "InvalidInputException" 237 } 238 239 // Message returns the exception's message. 240 func (s *InvalidInputException) Message() string { 241 if s.Message_ != nil { 242 return *s.Message_ 243 } 244 return "" 245 } 246 247 // OrigErr always returns nil, satisfies awserr.Error interface. 248 func (s *InvalidInputException) OrigErr() error { 249 return nil 250 } 251 252 func (s *InvalidInputException) Error() string { 253 return fmt.Sprintf("%s: %s", s.Code(), s.Message()) 254 } 255 256 // Status code returns the HTTP status code for the request's response error. 257 func (s *InvalidInputException) StatusCode() int { 258 return s.RespMetadata.StatusCode 259 } 260 261 // RequestID returns the service's response RequestID for request. 262 func (s *InvalidInputException) RequestID() string { 263 return s.RespMetadata.RequestID 264 } 265 266 // The token is not valid. Tokens expire after 24 hours. 267 type InvalidNextTokenException struct { 268 _ struct{} `type:"structure"` 269 RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` 270 271 Message_ *string `locationName:"Message" type:"string"` 272 } 273 274 // String returns the string representation. 275 // 276 // API parameter values that are decorated as "sensitive" in the API will not 277 // be included in the string output. The member name will be present, but the 278 // value will be replaced with "sensitive". 279 func (s InvalidNextTokenException) String() string { 280 return awsutil.Prettify(s) 281 } 282 283 // GoString returns the string representation. 284 // 285 // API parameter values that are decorated as "sensitive" in the API will not 286 // be included in the string output. The member name will be present, but the 287 // value will be replaced with "sensitive". 288 func (s InvalidNextTokenException) GoString() string { 289 return s.String() 290 } 291 292 func newErrorInvalidNextTokenException(v protocol.ResponseMetadata) error { 293 return &InvalidNextTokenException{ 294 RespMetadata: v, 295 } 296 } 297 298 // Code returns the exception type name. 299 func (s *InvalidNextTokenException) Code() string { 300 return "InvalidNextTokenException" 301 } 302 303 // Message returns the exception's message. 304 func (s *InvalidNextTokenException) Message() string { 305 if s.Message_ != nil { 306 return *s.Message_ 307 } 308 return "" 309 } 310 311 // OrigErr always returns nil, satisfies awserr.Error interface. 312 func (s *InvalidNextTokenException) OrigErr() error { 313 return nil 314 } 315 316 func (s *InvalidNextTokenException) Error() string { 317 return fmt.Sprintf("%s: %s", s.Code(), s.Message()) 318 } 319 320 // Status code returns the HTTP status code for the request's response error. 321 func (s *InvalidNextTokenException) StatusCode() int { 322 return s.RespMetadata.StatusCode 323 } 324 325 // RequestID returns the service's response RequestID for request. 326 func (s *InvalidNextTokenException) RequestID() string { 327 return s.RespMetadata.RequestID 328 } 329 330 // The limit on the number of requests per second has been exceeded. 331 type LimitExceededException struct { 332 _ struct{} `type:"structure"` 333 RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` 334 335 Message_ *string `locationName:"Message" type:"string"` 336 } 337 338 // String returns the string representation. 339 // 340 // API parameter values that are decorated as "sensitive" in the API will not 341 // be included in the string output. The member name will be present, but the 342 // value will be replaced with "sensitive". 343 func (s LimitExceededException) String() string { 344 return awsutil.Prettify(s) 345 } 346 347 // GoString returns the string representation. 348 // 349 // API parameter values that are decorated as "sensitive" in the API will not 350 // be included in the string output. The member name will be present, but the 351 // value will be replaced with "sensitive". 352 func (s LimitExceededException) GoString() string { 353 return s.String() 354 } 355 356 func newErrorLimitExceededException(v protocol.ResponseMetadata) error { 357 return &LimitExceededException{ 358 RespMetadata: v, 359 } 360 } 361 362 // Code returns the exception type name. 363 func (s *LimitExceededException) Code() string { 364 return "LimitExceededException" 365 } 366 367 // Message returns the exception's message. 368 func (s *LimitExceededException) Message() string { 369 if s.Message_ != nil { 370 return *s.Message_ 371 } 372 return "" 373 } 374 375 // OrigErr always returns nil, satisfies awserr.Error interface. 376 func (s *LimitExceededException) OrigErr() error { 377 return nil 378 } 379 380 func (s *LimitExceededException) Error() string { 381 return fmt.Sprintf("%s: %s", s.Code(), s.Message()) 382 } 383 384 // Status code returns the HTTP status code for the request's response error. 385 func (s *LimitExceededException) StatusCode() int { 386 return s.RespMetadata.StatusCode 387 } 388 389 // RequestID returns the service's response RequestID for request. 390 func (s *LimitExceededException) RequestID() string { 391 return s.RespMetadata.RequestID 392 } 393 394 type QueryForecastInput struct { 395 _ struct{} `type:"structure"` 396 397 // The end date for the forecast. Specify the date using this format: yyyy-MM-dd'T'HH:mm:ss 398 // (ISO 8601 format). For example, 2015-01-01T20:00:00. 399 EndDate *string `type:"string"` 400 401 // The filtering criteria to apply when retrieving the forecast. For example, 402 // to get the forecast for client_21 in the electricity usage dataset, specify 403 // the following: 404 // 405 // {"item_id" : "client_21"} 406 // 407 // To get the full forecast, use the CreateForecastExportJob (https://docs.aws.amazon.com/en_us/forecast/latest/dg/API_CreateForecastExportJob.html) 408 // operation. 409 // 410 // Filters is a required field 411 Filters map[string]*string `min:"1" type:"map" required:"true"` 412 413 // The Amazon Resource Name (ARN) of the forecast to query. 414 // 415 // ForecastArn is a required field 416 ForecastArn *string `type:"string" required:"true"` 417 418 // If the result of the previous request was truncated, the response includes 419 // a NextToken. To retrieve the next set of results, use the token in the next 420 // request. Tokens expire after 24 hours. 421 NextToken *string `min:"1" type:"string"` 422 423 // The start date for the forecast. Specify the date using this format: yyyy-MM-dd'T'HH:mm:ss 424 // (ISO 8601 format). For example, 2015-01-01T08:00:00. 425 StartDate *string `type:"string"` 426 } 427 428 // String returns the string representation. 429 // 430 // API parameter values that are decorated as "sensitive" in the API will not 431 // be included in the string output. The member name will be present, but the 432 // value will be replaced with "sensitive". 433 func (s QueryForecastInput) String() string { 434 return awsutil.Prettify(s) 435 } 436 437 // GoString returns the string representation. 438 // 439 // API parameter values that are decorated as "sensitive" in the API will not 440 // be included in the string output. The member name will be present, but the 441 // value will be replaced with "sensitive". 442 func (s QueryForecastInput) GoString() string { 443 return s.String() 444 } 445 446 // Validate inspects the fields of the type to determine if they are valid. 447 func (s *QueryForecastInput) Validate() error { 448 invalidParams := request.ErrInvalidParams{Context: "QueryForecastInput"} 449 if s.Filters == nil { 450 invalidParams.Add(request.NewErrParamRequired("Filters")) 451 } 452 if s.Filters != nil && len(s.Filters) < 1 { 453 invalidParams.Add(request.NewErrParamMinLen("Filters", 1)) 454 } 455 if s.ForecastArn == nil { 456 invalidParams.Add(request.NewErrParamRequired("ForecastArn")) 457 } 458 if s.NextToken != nil && len(*s.NextToken) < 1 { 459 invalidParams.Add(request.NewErrParamMinLen("NextToken", 1)) 460 } 461 462 if invalidParams.Len() > 0 { 463 return invalidParams 464 } 465 return nil 466 } 467 468 // SetEndDate sets the EndDate field's value. 469 func (s *QueryForecastInput) SetEndDate(v string) *QueryForecastInput { 470 s.EndDate = &v 471 return s 472 } 473 474 // SetFilters sets the Filters field's value. 475 func (s *QueryForecastInput) SetFilters(v map[string]*string) *QueryForecastInput { 476 s.Filters = v 477 return s 478 } 479 480 // SetForecastArn sets the ForecastArn field's value. 481 func (s *QueryForecastInput) SetForecastArn(v string) *QueryForecastInput { 482 s.ForecastArn = &v 483 return s 484 } 485 486 // SetNextToken sets the NextToken field's value. 487 func (s *QueryForecastInput) SetNextToken(v string) *QueryForecastInput { 488 s.NextToken = &v 489 return s 490 } 491 492 // SetStartDate sets the StartDate field's value. 493 func (s *QueryForecastInput) SetStartDate(v string) *QueryForecastInput { 494 s.StartDate = &v 495 return s 496 } 497 498 type QueryForecastOutput struct { 499 _ struct{} `type:"structure"` 500 501 // The forecast. 502 Forecast *Forecast `type:"structure"` 503 } 504 505 // String returns the string representation. 506 // 507 // API parameter values that are decorated as "sensitive" in the API will not 508 // be included in the string output. The member name will be present, but the 509 // value will be replaced with "sensitive". 510 func (s QueryForecastOutput) String() string { 511 return awsutil.Prettify(s) 512 } 513 514 // GoString returns the string representation. 515 // 516 // API parameter values that are decorated as "sensitive" in the API will not 517 // be included in the string output. The member name will be present, but the 518 // value will be replaced with "sensitive". 519 func (s QueryForecastOutput) GoString() string { 520 return s.String() 521 } 522 523 // SetForecast sets the Forecast field's value. 524 func (s *QueryForecastOutput) SetForecast(v *Forecast) *QueryForecastOutput { 525 s.Forecast = v 526 return s 527 } 528 529 // The specified resource is in use. 530 type ResourceInUseException struct { 531 _ struct{} `type:"structure"` 532 RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` 533 534 Message_ *string `locationName:"Message" type:"string"` 535 } 536 537 // String returns the string representation. 538 // 539 // API parameter values that are decorated as "sensitive" in the API will not 540 // be included in the string output. The member name will be present, but the 541 // value will be replaced with "sensitive". 542 func (s ResourceInUseException) String() string { 543 return awsutil.Prettify(s) 544 } 545 546 // GoString returns the string representation. 547 // 548 // API parameter values that are decorated as "sensitive" in the API will not 549 // be included in the string output. The member name will be present, but the 550 // value will be replaced with "sensitive". 551 func (s ResourceInUseException) GoString() string { 552 return s.String() 553 } 554 555 func newErrorResourceInUseException(v protocol.ResponseMetadata) error { 556 return &ResourceInUseException{ 557 RespMetadata: v, 558 } 559 } 560 561 // Code returns the exception type name. 562 func (s *ResourceInUseException) Code() string { 563 return "ResourceInUseException" 564 } 565 566 // Message returns the exception's message. 567 func (s *ResourceInUseException) Message() string { 568 if s.Message_ != nil { 569 return *s.Message_ 570 } 571 return "" 572 } 573 574 // OrigErr always returns nil, satisfies awserr.Error interface. 575 func (s *ResourceInUseException) OrigErr() error { 576 return nil 577 } 578 579 func (s *ResourceInUseException) Error() string { 580 return fmt.Sprintf("%s: %s", s.Code(), s.Message()) 581 } 582 583 // Status code returns the HTTP status code for the request's response error. 584 func (s *ResourceInUseException) StatusCode() int { 585 return s.RespMetadata.StatusCode 586 } 587 588 // RequestID returns the service's response RequestID for request. 589 func (s *ResourceInUseException) RequestID() string { 590 return s.RespMetadata.RequestID 591 } 592 593 // We can't find that resource. Check the information that you've provided and 594 // try again. 595 type ResourceNotFoundException struct { 596 _ struct{} `type:"structure"` 597 RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` 598 599 Message_ *string `locationName:"Message" type:"string"` 600 } 601 602 // String returns the string representation. 603 // 604 // API parameter values that are decorated as "sensitive" in the API will not 605 // be included in the string output. The member name will be present, but the 606 // value will be replaced with "sensitive". 607 func (s ResourceNotFoundException) String() string { 608 return awsutil.Prettify(s) 609 } 610 611 // GoString returns the string representation. 612 // 613 // API parameter values that are decorated as "sensitive" in the API will not 614 // be included in the string output. The member name will be present, but the 615 // value will be replaced with "sensitive". 616 func (s ResourceNotFoundException) GoString() string { 617 return s.String() 618 } 619 620 func newErrorResourceNotFoundException(v protocol.ResponseMetadata) error { 621 return &ResourceNotFoundException{ 622 RespMetadata: v, 623 } 624 } 625 626 // Code returns the exception type name. 627 func (s *ResourceNotFoundException) Code() string { 628 return "ResourceNotFoundException" 629 } 630 631 // Message returns the exception's message. 632 func (s *ResourceNotFoundException) Message() string { 633 if s.Message_ != nil { 634 return *s.Message_ 635 } 636 return "" 637 } 638 639 // OrigErr always returns nil, satisfies awserr.Error interface. 640 func (s *ResourceNotFoundException) OrigErr() error { 641 return nil 642 } 643 644 func (s *ResourceNotFoundException) Error() string { 645 return fmt.Sprintf("%s: %s", s.Code(), s.Message()) 646 } 647 648 // Status code returns the HTTP status code for the request's response error. 649 func (s *ResourceNotFoundException) StatusCode() int { 650 return s.RespMetadata.StatusCode 651 } 652 653 // RequestID returns the service's response RequestID for request. 654 func (s *ResourceNotFoundException) RequestID() string { 655 return s.RespMetadata.RequestID 656 }