Update Go AWS SDK to the latest version

This commit is contained in:
Andrey Smirnov
2019-07-13 00:03:55 +03:00
committed by Andrey Smirnov
parent d08be990ef
commit 94a72b23ff
2183 changed files with 885887 additions and 228114 deletions

View File

@@ -0,0 +1,394 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package personalizeruntime
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awsutil"
"github.com/aws/aws-sdk-go/aws/request"
)
const opGetPersonalizedRanking = "GetPersonalizedRanking"
// GetPersonalizedRankingRequest generates a "aws/request.Request" representing the
// client's request for the GetPersonalizedRanking operation. The "output" return
// value will be populated with the request's response once the request completes
// successfully.
//
// Use "Send" method on the returned Request to send the API call to the service.
// the "output" return value is not valid until after Send returns without error.
//
// See GetPersonalizedRanking for more information on using the GetPersonalizedRanking
// API call, and error handling.
//
// This method is useful when you want to inject custom logic or configuration
// into the SDK's request lifecycle. Such as custom headers, or retry logic.
//
//
// // Example sending a request using the GetPersonalizedRankingRequest method.
// req, resp := client.GetPersonalizedRankingRequest(params)
//
// err := req.Send()
// if err == nil { // resp is now filled
// fmt.Println(resp)
// }
//
// See also, https://docs.aws.amazon.com/goto/WebAPI/personalize-runtime-2018-05-22/GetPersonalizedRanking
func (c *PersonalizeRuntime) GetPersonalizedRankingRequest(input *GetPersonalizedRankingInput) (req *request.Request, output *GetPersonalizedRankingOutput) {
op := &request.Operation{
Name: opGetPersonalizedRanking,
HTTPMethod: "POST",
HTTPPath: "/personalize-ranking",
}
if input == nil {
input = &GetPersonalizedRankingInput{}
}
output = &GetPersonalizedRankingOutput{}
req = c.newRequest(op, input, output)
return
}
// GetPersonalizedRanking API operation for Amazon Personalize Runtime.
//
// Re-ranks a list of recommended items for the given user. The first item in
// the list is deemed the most likely item to be of interest to the user.
//
// The solution backing the campaign must have been created using a recipe of
// type PERSONALIZED_RANKING.
//
// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
// with awserr.Error's Code and Message methods to get detailed information about
// the error.
//
// See the AWS API reference guide for Amazon Personalize Runtime's
// API operation GetPersonalizedRanking for usage and error information.
//
// Returned Error Codes:
// * ErrCodeInvalidInputException "InvalidInputException"
// Provide a valid value for the field or parameter.
//
// * ErrCodeResourceNotFoundException "ResourceNotFoundException"
// The specified resource does not exist.
//
// See also, https://docs.aws.amazon.com/goto/WebAPI/personalize-runtime-2018-05-22/GetPersonalizedRanking
func (c *PersonalizeRuntime) GetPersonalizedRanking(input *GetPersonalizedRankingInput) (*GetPersonalizedRankingOutput, error) {
req, out := c.GetPersonalizedRankingRequest(input)
return out, req.Send()
}
// GetPersonalizedRankingWithContext is the same as GetPersonalizedRanking with the addition of
// the ability to pass a context and additional request options.
//
// See GetPersonalizedRanking for details on how to use this API operation.
//
// The context must be non-nil and will be used for request cancellation. If
// the context is nil a panic will occur. In the future the SDK may create
// sub-contexts for http.Requests. See https://golang.org/pkg/context/
// for more information on using Contexts.
func (c *PersonalizeRuntime) GetPersonalizedRankingWithContext(ctx aws.Context, input *GetPersonalizedRankingInput, opts ...request.Option) (*GetPersonalizedRankingOutput, error) {
req, out := c.GetPersonalizedRankingRequest(input)
req.SetContext(ctx)
req.ApplyOptions(opts...)
return out, req.Send()
}
const opGetRecommendations = "GetRecommendations"
// GetRecommendationsRequest generates a "aws/request.Request" representing the
// client's request for the GetRecommendations operation. The "output" return
// value will be populated with the request's response once the request completes
// successfully.
//
// Use "Send" method on the returned Request to send the API call to the service.
// the "output" return value is not valid until after Send returns without error.
//
// See GetRecommendations for more information on using the GetRecommendations
// API call, and error handling.
//
// This method is useful when you want to inject custom logic or configuration
// into the SDK's request lifecycle. Such as custom headers, or retry logic.
//
//
// // Example sending a request using the GetRecommendationsRequest method.
// req, resp := client.GetRecommendationsRequest(params)
//
// err := req.Send()
// if err == nil { // resp is now filled
// fmt.Println(resp)
// }
//
// See also, https://docs.aws.amazon.com/goto/WebAPI/personalize-runtime-2018-05-22/GetRecommendations
func (c *PersonalizeRuntime) GetRecommendationsRequest(input *GetRecommendationsInput) (req *request.Request, output *GetRecommendationsOutput) {
op := &request.Operation{
Name: opGetRecommendations,
HTTPMethod: "POST",
HTTPPath: "/recommendations",
}
if input == nil {
input = &GetRecommendationsInput{}
}
output = &GetRecommendationsOutput{}
req = c.newRequest(op, input, output)
return
}
// GetRecommendations API operation for Amazon Personalize Runtime.
//
// Returns a list of recommended items. The required input depends on the recipe
// type used to create the solution backing the campaign, as follows:
//
// * RELATED_ITEMS - itemId required, userId not used
//
// * USER_PERSONALIZATION - itemId optional, userId required
//
// Campaigns that are backed by a solution created using a recipe of type PERSONALIZED_RANKING
// use the API.
//
// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
// with awserr.Error's Code and Message methods to get detailed information about
// the error.
//
// See the AWS API reference guide for Amazon Personalize Runtime's
// API operation GetRecommendations for usage and error information.
//
// Returned Error Codes:
// * ErrCodeInvalidInputException "InvalidInputException"
// Provide a valid value for the field or parameter.
//
// * ErrCodeResourceNotFoundException "ResourceNotFoundException"
// The specified resource does not exist.
//
// See also, https://docs.aws.amazon.com/goto/WebAPI/personalize-runtime-2018-05-22/GetRecommendations
func (c *PersonalizeRuntime) GetRecommendations(input *GetRecommendationsInput) (*GetRecommendationsOutput, error) {
req, out := c.GetRecommendationsRequest(input)
return out, req.Send()
}
// GetRecommendationsWithContext is the same as GetRecommendations with the addition of
// the ability to pass a context and additional request options.
//
// See GetRecommendations for details on how to use this API operation.
//
// The context must be non-nil and will be used for request cancellation. If
// the context is nil a panic will occur. In the future the SDK may create
// sub-contexts for http.Requests. See https://golang.org/pkg/context/
// for more information on using Contexts.
func (c *PersonalizeRuntime) GetRecommendationsWithContext(ctx aws.Context, input *GetRecommendationsInput, opts ...request.Option) (*GetRecommendationsOutput, error) {
req, out := c.GetRecommendationsRequest(input)
req.SetContext(ctx)
req.ApplyOptions(opts...)
return out, req.Send()
}
type GetPersonalizedRankingInput struct {
_ struct{} `type:"structure"`
// The Amazon Resource Name (ARN) of the campaign to use for generating the
// personalized ranking.
//
// CampaignArn is a required field
CampaignArn *string `locationName:"campaignArn" type:"string" required:"true"`
// A list of items (itemId's) to rank. If an item was not included in the training
// dataset, the item is appended to the end of the reranked list.
//
// InputList is a required field
InputList []*string `locationName:"inputList" type:"list" required:"true"`
// The user for which you want the campaign to provide a personalized ranking.
//
// UserId is a required field
UserId *string `locationName:"userId" type:"string" required:"true"`
}
// String returns the string representation
func (s GetPersonalizedRankingInput) String() string {
return awsutil.Prettify(s)
}
// GoString returns the string representation
func (s GetPersonalizedRankingInput) GoString() string {
return s.String()
}
// Validate inspects the fields of the type to determine if they are valid.
func (s *GetPersonalizedRankingInput) Validate() error {
invalidParams := request.ErrInvalidParams{Context: "GetPersonalizedRankingInput"}
if s.CampaignArn == nil {
invalidParams.Add(request.NewErrParamRequired("CampaignArn"))
}
if s.InputList == nil {
invalidParams.Add(request.NewErrParamRequired("InputList"))
}
if s.UserId == nil {
invalidParams.Add(request.NewErrParamRequired("UserId"))
}
if invalidParams.Len() > 0 {
return invalidParams
}
return nil
}
// SetCampaignArn sets the CampaignArn field's value.
func (s *GetPersonalizedRankingInput) SetCampaignArn(v string) *GetPersonalizedRankingInput {
s.CampaignArn = &v
return s
}
// SetInputList sets the InputList field's value.
func (s *GetPersonalizedRankingInput) SetInputList(v []*string) *GetPersonalizedRankingInput {
s.InputList = v
return s
}
// SetUserId sets the UserId field's value.
func (s *GetPersonalizedRankingInput) SetUserId(v string) *GetPersonalizedRankingInput {
s.UserId = &v
return s
}
type GetPersonalizedRankingOutput struct {
_ struct{} `type:"structure"`
// A list of items in order of most likely interest to the user.
PersonalizedRanking []*PredictedItem `locationName:"personalizedRanking" type:"list"`
}
// String returns the string representation
func (s GetPersonalizedRankingOutput) String() string {
return awsutil.Prettify(s)
}
// GoString returns the string representation
func (s GetPersonalizedRankingOutput) GoString() string {
return s.String()
}
// SetPersonalizedRanking sets the PersonalizedRanking field's value.
func (s *GetPersonalizedRankingOutput) SetPersonalizedRanking(v []*PredictedItem) *GetPersonalizedRankingOutput {
s.PersonalizedRanking = v
return s
}
type GetRecommendationsInput struct {
_ struct{} `type:"structure"`
// The Amazon Resource Name (ARN) of the campaign to use for getting recommendations.
//
// CampaignArn is a required field
CampaignArn *string `locationName:"campaignArn" type:"string" required:"true"`
// The item ID to provide recommendations for.
//
// Required for RELATED_ITEMS recipe type.
ItemId *string `locationName:"itemId" type:"string"`
// The number of results to return. The default is 25. The maximum is 100.
NumResults *int64 `locationName:"numResults" type:"integer"`
// The user ID to provide recommendations for.
//
// Required for USER_PERSONALIZATION recipe type.
UserId *string `locationName:"userId" type:"string"`
}
// String returns the string representation
func (s GetRecommendationsInput) String() string {
return awsutil.Prettify(s)
}
// GoString returns the string representation
func (s GetRecommendationsInput) GoString() string {
return s.String()
}
// Validate inspects the fields of the type to determine if they are valid.
func (s *GetRecommendationsInput) Validate() error {
invalidParams := request.ErrInvalidParams{Context: "GetRecommendationsInput"}
if s.CampaignArn == nil {
invalidParams.Add(request.NewErrParamRequired("CampaignArn"))
}
if invalidParams.Len() > 0 {
return invalidParams
}
return nil
}
// SetCampaignArn sets the CampaignArn field's value.
func (s *GetRecommendationsInput) SetCampaignArn(v string) *GetRecommendationsInput {
s.CampaignArn = &v
return s
}
// SetItemId sets the ItemId field's value.
func (s *GetRecommendationsInput) SetItemId(v string) *GetRecommendationsInput {
s.ItemId = &v
return s
}
// SetNumResults sets the NumResults field's value.
func (s *GetRecommendationsInput) SetNumResults(v int64) *GetRecommendationsInput {
s.NumResults = &v
return s
}
// SetUserId sets the UserId field's value.
func (s *GetRecommendationsInput) SetUserId(v string) *GetRecommendationsInput {
s.UserId = &v
return s
}
type GetRecommendationsOutput struct {
_ struct{} `type:"structure"`
// A list of recommendations.
ItemList []*PredictedItem `locationName:"itemList" type:"list"`
}
// String returns the string representation
func (s GetRecommendationsOutput) String() string {
return awsutil.Prettify(s)
}
// GoString returns the string representation
func (s GetRecommendationsOutput) GoString() string {
return s.String()
}
// SetItemList sets the ItemList field's value.
func (s *GetRecommendationsOutput) SetItemList(v []*PredictedItem) *GetRecommendationsOutput {
s.ItemList = v
return s
}
// An object that identifies an item.
//
// The and APIs return a list of PredictedItems.
type PredictedItem struct {
_ struct{} `type:"structure"`
// The recommended item ID.
ItemId *string `locationName:"itemId" type:"string"`
}
// String returns the string representation
func (s PredictedItem) String() string {
return awsutil.Prettify(s)
}
// GoString returns the string representation
func (s PredictedItem) GoString() string {
return s.String()
}
// SetItemId sets the ItemId field's value.
func (s *PredictedItem) SetItemId(v string) *PredictedItem {
s.ItemId = &v
return s
}

View File

@@ -0,0 +1,26 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
// Package personalizeruntime provides the client and types for making API
// requests to Amazon Personalize Runtime.
//
// See https://docs.aws.amazon.com/goto/WebAPI/personalize-runtime-2018-05-22 for more information on this service.
//
// See personalizeruntime package documentation for more information.
// https://docs.aws.amazon.com/sdk-for-go/api/service/personalizeruntime/
//
// Using the Client
//
// To contact Amazon Personalize Runtime with the SDK use the New function to create
// a new service client. With that client you can make API requests to the service.
// These clients are safe to use concurrently.
//
// See the SDK's documentation for more information on how to use the SDK.
// https://docs.aws.amazon.com/sdk-for-go/api/
//
// See aws.Config documentation for more information on configuring SDK clients.
// https://docs.aws.amazon.com/sdk-for-go/api/aws/#Config
//
// See the Amazon Personalize Runtime client PersonalizeRuntime for more
// information on creating client for this service.
// https://docs.aws.amazon.com/sdk-for-go/api/service/personalizeruntime/#New
package personalizeruntime

View File

@@ -0,0 +1,18 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package personalizeruntime
const (
// ErrCodeInvalidInputException for service response error code
// "InvalidInputException".
//
// Provide a valid value for the field or parameter.
ErrCodeInvalidInputException = "InvalidInputException"
// ErrCodeResourceNotFoundException for service response error code
// "ResourceNotFoundException".
//
// The specified resource does not exist.
ErrCodeResourceNotFoundException = "ResourceNotFoundException"
)

View File

@@ -0,0 +1,72 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
// Package personalizeruntimeiface provides an interface to enable mocking the Amazon Personalize Runtime service client
// for testing your code.
//
// It is important to note that this interface will have breaking changes
// when the service model is updated and adds new API operations, paginators,
// and waiters.
package personalizeruntimeiface
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/service/personalizeruntime"
)
// PersonalizeRuntimeAPI provides an interface to enable mocking the
// personalizeruntime.PersonalizeRuntime service client's API operation,
// paginators, and waiters. This make unit testing your code that calls out
// to the SDK's service client's calls easier.
//
// The best way to use this interface is so the SDK's service client's calls
// can be stubbed out for unit testing your code with the SDK without needing
// to inject custom request handlers into the SDK's request pipeline.
//
// // myFunc uses an SDK service client to make a request to
// // Amazon Personalize Runtime.
// func myFunc(svc personalizeruntimeiface.PersonalizeRuntimeAPI) bool {
// // Make svc.GetPersonalizedRanking request
// }
//
// func main() {
// sess := session.New()
// svc := personalizeruntime.New(sess)
//
// myFunc(svc)
// }
//
// In your _test.go file:
//
// // Define a mock struct to be used in your unit tests of myFunc.
// type mockPersonalizeRuntimeClient struct {
// personalizeruntimeiface.PersonalizeRuntimeAPI
// }
// func (m *mockPersonalizeRuntimeClient) GetPersonalizedRanking(input *personalizeruntime.GetPersonalizedRankingInput) (*personalizeruntime.GetPersonalizedRankingOutput, error) {
// // mock response/functionality
// }
//
// func TestMyFunc(t *testing.T) {
// // Setup Test
// mockSvc := &mockPersonalizeRuntimeClient{}
//
// myfunc(mockSvc)
//
// // Verify myFunc's functionality
// }
//
// It is important to note that this interface will have breaking changes
// when the service model is updated and adds new API operations, paginators,
// and waiters. Its suggested to use the pattern above for testing, or using
// tooling to generate mocks to satisfy the interfaces.
type PersonalizeRuntimeAPI interface {
GetPersonalizedRanking(*personalizeruntime.GetPersonalizedRankingInput) (*personalizeruntime.GetPersonalizedRankingOutput, error)
GetPersonalizedRankingWithContext(aws.Context, *personalizeruntime.GetPersonalizedRankingInput, ...request.Option) (*personalizeruntime.GetPersonalizedRankingOutput, error)
GetPersonalizedRankingRequest(*personalizeruntime.GetPersonalizedRankingInput) (*request.Request, *personalizeruntime.GetPersonalizedRankingOutput)
GetRecommendations(*personalizeruntime.GetRecommendationsInput) (*personalizeruntime.GetRecommendationsOutput, error)
GetRecommendationsWithContext(aws.Context, *personalizeruntime.GetRecommendationsInput, ...request.Option) (*personalizeruntime.GetRecommendationsOutput, error)
GetRecommendationsRequest(*personalizeruntime.GetRecommendationsInput) (*request.Request, *personalizeruntime.GetRecommendationsOutput)
}
var _ PersonalizeRuntimeAPI = (*personalizeruntime.PersonalizeRuntime)(nil)

View File

@@ -0,0 +1,98 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package personalizeruntime
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/client"
"github.com/aws/aws-sdk-go/aws/client/metadata"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/aws/signer/v4"
"github.com/aws/aws-sdk-go/private/protocol/restjson"
)
// PersonalizeRuntime provides the API operation methods for making requests to
// Amazon Personalize Runtime. See this package's package overview docs
// for details on the service.
//
// PersonalizeRuntime methods are safe to use concurrently. It is not safe to
// modify mutate any of the struct's properties though.
type PersonalizeRuntime struct {
*client.Client
}
// Used for custom client initialization logic
var initClient func(*client.Client)
// Used for custom request initialization logic
var initRequest func(*request.Request)
// Service information constants
const (
ServiceName = "Personalize Runtime" // Name of service.
EndpointsID = "personalize-runtime" // ID to lookup a service endpoint with.
ServiceID = "Personalize Runtime" // ServiceID is a unique identifer of a specific service.
)
// New creates a new instance of the PersonalizeRuntime client with a session.
// If additional configuration is needed for the client instance use the optional
// aws.Config parameter to add your extra config.
//
// Example:
// // Create a PersonalizeRuntime client from just a session.
// svc := personalizeruntime.New(mySession)
//
// // Create a PersonalizeRuntime client with additional configuration
// svc := personalizeruntime.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
func New(p client.ConfigProvider, cfgs ...*aws.Config) *PersonalizeRuntime {
c := p.ClientConfig(EndpointsID, cfgs...)
if c.SigningNameDerived || len(c.SigningName) == 0 {
c.SigningName = "personalize"
}
return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
}
// newClient creates, initializes and returns a new service client instance.
func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *PersonalizeRuntime {
svc := &PersonalizeRuntime{
Client: client.New(
cfg,
metadata.ClientInfo{
ServiceName: ServiceName,
ServiceID: ServiceID,
SigningName: signingName,
SigningRegion: signingRegion,
Endpoint: endpoint,
APIVersion: "2018-05-22",
},
handlers,
),
}
// Handlers
svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
svc.Handlers.Build.PushBackNamed(restjson.BuildHandler)
svc.Handlers.Unmarshal.PushBackNamed(restjson.UnmarshalHandler)
svc.Handlers.UnmarshalMeta.PushBackNamed(restjson.UnmarshalMetaHandler)
svc.Handlers.UnmarshalError.PushBackNamed(restjson.UnmarshalErrorHandler)
// Run custom client initialization if present
if initClient != nil {
initClient(svc.Client)
}
return svc
}
// newRequest creates a new request for a PersonalizeRuntime operation and runs any
// custom request initialization.
func (c *PersonalizeRuntime) newRequest(op *request.Operation, params, data interface{}) *request.Request {
req := c.NewRequest(op, params, data)
// Run custom request initialization if present
if initRequest != nil {
initRequest(req)
}
return req
}