/
api_op_CreateCampaign.go
126 lines (112 loc) · 4.33 KB
/
api_op_CreateCampaign.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
// Code generated by smithy-go-codegen DO NOT EDIT.
package personalize
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/awslabs/smithy-go/middleware"
smithyhttp "github.com/awslabs/smithy-go/transport/http"
)
// Creates a campaign by deploying a solution version. When a client calls the
// GetRecommendations
// (https://docs.aws.amazon.com/personalize/latest/dg/API_RS_GetRecommendations.html)
// and GetPersonalizedRanking
// (https://docs.aws.amazon.com/personalize/latest/dg/API_RS_GetPersonalizedRanking.html)
// APIs, a campaign is specified in the request. Minimum Provisioned TPS and
// Auto-Scaling A transaction is a single GetRecommendations or
// GetPersonalizedRanking call. Transactions per second (TPS) is the throughput and
// unit of billing for Amazon Personalize. The minimum provisioned TPS
// (minProvisionedTPS) specifies the baseline throughput provisioned by Amazon
// Personalize, and thus, the minimum billing charge. If your TPS increases beyond
// minProvisionedTPS, Amazon Personalize auto-scales the provisioned capacity up
// and down, but never below minProvisionedTPS, to maintain a 70% utilization.
// There's a short time delay while the capacity is increased that might cause loss
// of transactions. It's recommended to start with a low minProvisionedTPS, track
// your usage using Amazon CloudWatch metrics, and then increase the
// minProvisionedTPS as necessary. Status A campaign can be in one of the following
// states:
//
// * CREATE PENDING > CREATE IN_PROGRESS > ACTIVE -or- CREATE FAILED
//
//
// * DELETE PENDING > DELETE IN_PROGRESS
//
// To get the campaign status, call
// DescribeCampaign. Wait until the status of the campaign is ACTIVE before asking
// the campaign for recommendations. Related APIs
//
// * ListCampaigns
//
// *
// DescribeCampaign
//
// * UpdateCampaign
//
// * DeleteCampaign
func (c *Client) CreateCampaign(ctx context.Context, params *CreateCampaignInput, optFns ...func(*Options)) (*CreateCampaignOutput, error) {
if params == nil {
params = &CreateCampaignInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CreateCampaign", params, optFns, addOperationCreateCampaignMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CreateCampaignOutput)
out.ResultMetadata = metadata
return out, nil
}
type CreateCampaignInput struct {
// Specifies the requested minimum provisioned transactions (recommendations) per
// second that Amazon Personalize will support.
//
// This member is required.
MinProvisionedTPS *int32
// A name for the new campaign. The campaign name must be unique within your
// account.
//
// This member is required.
Name *string
// The Amazon Resource Name (ARN) of the solution version to deploy.
//
// This member is required.
SolutionVersionArn *string
}
type CreateCampaignOutput struct {
// The Amazon Resource Name (ARN) of the campaign.
CampaignArn *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
}
func addOperationCreateCampaignMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpCreateCampaign{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpCreateCampaign{}, middleware.After)
if err != nil {
return err
}
awsmiddleware.AddRequestInvocationIDMiddleware(stack)
smithyhttp.AddContentLengthMiddleware(stack)
addResolveEndpointMiddleware(stack, options)
v4.AddComputePayloadSHA256Middleware(stack)
addRetryMiddlewares(stack, options)
addHTTPSignerV4Middleware(stack, options)
awsmiddleware.AddAttemptClockSkewMiddleware(stack)
addClientUserAgent(stack)
smithyhttp.AddErrorCloseResponseBodyMiddleware(stack)
smithyhttp.AddCloseResponseBodyMiddleware(stack)
addOpCreateCampaignValidationMiddleware(stack)
stack.Initialize.Add(newServiceMetadataMiddleware_opCreateCampaign(options.Region), middleware.Before)
addRequestIDRetrieverMiddleware(stack)
addResponseErrorMiddleware(stack)
return nil
}
func newServiceMetadataMiddleware_opCreateCampaign(region string) awsmiddleware.RegisterServiceMetadata {
return awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "personalize",
OperationName: "CreateCampaign",
}
}