1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package sms
4
5import (
6	"context"
7	awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
8	"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
9	"github.com/aws/aws-sdk-go-v2/service/sms/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12	"time"
13)
14
15// Creates a replication job. The replication job schedules periodic replication
16// runs to replicate your server to AWS. Each replication run creates an Amazon
17// Machine Image (AMI).
18func (c *Client) CreateReplicationJob(ctx context.Context, params *CreateReplicationJobInput, optFns ...func(*Options)) (*CreateReplicationJobOutput, error) {
19	if params == nil {
20		params = &CreateReplicationJobInput{}
21	}
22
23	result, metadata, err := c.invokeOperation(ctx, "CreateReplicationJob", params, optFns, addOperationCreateReplicationJobMiddlewares)
24	if err != nil {
25		return nil, err
26	}
27
28	out := result.(*CreateReplicationJobOutput)
29	out.ResultMetadata = metadata
30	return out, nil
31}
32
33type CreateReplicationJobInput struct {
34
35	// The seed replication time.
36	//
37	// This member is required.
38	SeedReplicationTime *time.Time
39
40	// The ID of the server.
41	//
42	// This member is required.
43	ServerId *string
44
45	// The description of the replication job.
46	Description *string
47
48	// Indicates whether the replication job produces encrypted AMIs.
49	Encrypted *bool
50
51	// The time between consecutive replication runs, in hours.
52	Frequency *int32
53
54	// The ID of the KMS key for replication jobs that produce encrypted AMIs. This
55	// value can be any of the following:
56	//
57	// * KMS key ID
58	//
59	// * KMS key alias
60	//
61	// * ARN
62	// referring to the KMS key ID
63	//
64	// * ARN referring to the KMS key alias
65	//
66	// If encrypted
67	// is true but a KMS key ID is not specified, the customer's default KMS key for
68	// Amazon EBS is used.
69	KmsKeyId *string
70
71	// The license type to be used for the AMI created by a successful replication run.
72	LicenseType types.LicenseType
73
74	// The maximum number of SMS-created AMIs to retain. The oldest is deleted after
75	// the maximum number is reached and a new AMI is created.
76	NumberOfRecentAmisToKeep *int32
77
78	// The name of the IAM role to be used by the AWS SMS.
79	RoleName *string
80
81	// Indicates whether to run the replication job one time.
82	RunOnce *bool
83}
84
85type CreateReplicationJobOutput struct {
86
87	// The unique identifier of the replication job.
88	ReplicationJobId *string
89
90	// Metadata pertaining to the operation's result.
91	ResultMetadata middleware.Metadata
92}
93
94func addOperationCreateReplicationJobMiddlewares(stack *middleware.Stack, options Options) (err error) {
95	err = stack.Serialize.Add(&awsAwsjson11_serializeOpCreateReplicationJob{}, middleware.After)
96	if err != nil {
97		return err
98	}
99	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpCreateReplicationJob{}, middleware.After)
100	if err != nil {
101		return err
102	}
103	if err = addSetLoggerMiddleware(stack, options); err != nil {
104		return err
105	}
106	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
107		return err
108	}
109	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
110		return err
111	}
112	if err = addResolveEndpointMiddleware(stack, options); err != nil {
113		return err
114	}
115	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
116		return err
117	}
118	if err = addRetryMiddlewares(stack, options); err != nil {
119		return err
120	}
121	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
122		return err
123	}
124	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
125		return err
126	}
127	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
128		return err
129	}
130	if err = addClientUserAgent(stack); err != nil {
131		return err
132	}
133	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
134		return err
135	}
136	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
137		return err
138	}
139	if err = addOpCreateReplicationJobValidationMiddleware(stack); err != nil {
140		return err
141	}
142	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateReplicationJob(options.Region), middleware.Before); err != nil {
143		return err
144	}
145	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
146		return err
147	}
148	if err = addResponseErrorMiddleware(stack); err != nil {
149		return err
150	}
151	if err = addRequestResponseLogging(stack, options); err != nil {
152		return err
153	}
154	return nil
155}
156
157func newServiceMetadataMiddleware_opCreateReplicationJob(region string) *awsmiddleware.RegisterServiceMetadata {
158	return &awsmiddleware.RegisterServiceMetadata{
159		Region:        region,
160		ServiceID:     ServiceID,
161		SigningName:   "sms",
162		OperationName: "CreateReplicationJob",
163	}
164}
165