/
api_op_CreateFileSystem.go
266 lines (240 loc) · 9.88 KB
/
api_op_CreateFileSystem.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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
// Code generated by smithy-go-codegen DO NOT EDIT.
package fsx
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/fsx/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Creates a new, empty Amazon FSx file system. If a file system with the specified
// client request token exists and the parameters match, CreateFileSystem returns
// the description of the existing file system. If a file system specified client
// request token exists and the parameters don't match, this call returns
// IncompatibleParameterError. If a file system with the specified client request
// token doesn't exist, CreateFileSystem does the following:
//
// * Creates a new,
// empty Amazon FSx file system with an assigned ID, and an initial lifecycle state
// of CREATING.
//
// * Returns the description of the file system.
//
// This operation
// requires a client request token in the request that Amazon FSx uses to ensure
// idempotent creation. This means that calling the operation multiple times with
// the same client request token has no effect. By using the idempotent operation,
// you can retry a CreateFileSystem operation without the risk of creating an extra
// file system. This approach can be useful when an initial call fails in a way
// that makes it unclear whether a file system was created. Examples are if a
// transport level timeout occurred, or your connection was reset. If you use the
// same client request token and the initial call created a file system, the client
// receives success as long as the parameters are the same. The CreateFileSystem
// call returns while the file system's lifecycle state is still CREATING. You can
// check the file-system creation status by calling the DescribeFileSystems
// operation, which returns the file system state along with other information.
func (c *Client) CreateFileSystem(ctx context.Context, params *CreateFileSystemInput, optFns ...func(*Options)) (*CreateFileSystemOutput, error) {
if params == nil {
params = &CreateFileSystemInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CreateFileSystem", params, optFns, addOperationCreateFileSystemMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CreateFileSystemOutput)
out.ResultMetadata = metadata
return out, nil
}
// The request object used to create a new Amazon FSx file system.
type CreateFileSystemInput struct {
// The type of Amazon FSx file system to create, either WINDOWS or LUSTRE.
//
// This member is required.
FileSystemType types.FileSystemType
// Sets the storage capacity of the file system that you're creating. For Lustre
// file systems:
//
// * For SCRATCH_2 and PERSISTENT_1 SSD deployment types, valid
// values are 1200 GiB, 2400 GiB, and increments of 2400 GiB.
//
// * For PERSISTENT HDD
// file systems, valid values are increments of 6000 GiB for 12 MB/s/TiB file
// systems and increments of 1800 GiB for 40 MB/s/TiB file systems.
//
// * For
// SCRATCH_1 deployment type, valid values are 1200 GiB, 2400 GiB, and increments
// of 3600 GiB.
//
// For Windows file systems:
//
// * If StorageType=SSD, valid values are
// 32 GiB - 65,536 GiB (64 TiB).
//
// * If StorageType=HDD, valid values are 2000 GiB -
// 65,536 GiB (64 TiB).
//
// This member is required.
StorageCapacity *int32
// Specifies the IDs of the subnets that the file system will be accessible from.
// For Windows MULTI_AZ_1 file system deployment types, provide exactly two subnet
// IDs, one for the preferred file server and one for the standby file server. You
// specify one of these subnets as the preferred subnet using the
// WindowsConfiguration > PreferredSubnetID property. For Windows SINGLE_AZ_1 and
// SINGLE_AZ_2 file system deployment types and Lustre file systems, provide
// exactly one subnet ID. The file server is launched in that subnet's Availability
// Zone.
//
// This member is required.
SubnetIds []string
// A string of up to 64 ASCII characters that Amazon FSx uses to ensure idempotent
// creation. This string is automatically filled on your behalf when you use the
// AWS Command Line Interface (AWS CLI) or an AWS SDK.
ClientRequestToken *string
// The ID of the AWS Key Management Service (AWS KMS) key used to encrypt the file
// system's data for Amazon FSx for Windows File Server file systems and Amazon FSx
// for Lustre PERSISTENT_1 file systems at rest. In either case, if not specified,
// the Amazon FSx managed key is used. The Amazon FSx for Lustre SCRATCH_1 and
// SCRATCH_2 file systems are always encrypted at rest using Amazon FSx managed
// keys. For more information, see Encrypt
// (https://docs.aws.amazon.com/kms/latest/APIReference/API_Encrypt.html) in the
// AWS Key Management Service API Reference.
KmsKeyId *string
// The Lustre configuration for the file system being created.
LustreConfiguration *types.CreateFileSystemLustreConfiguration
// A list of IDs specifying the security groups to apply to all network interfaces
// created for file system access. This list isn't returned in later requests to
// describe the file system.
SecurityGroupIds []string
// Sets the storage type for the file system you're creating. Valid values are SSD
// and HDD.
//
// * Set to SSD to use solid state drive storage. SSD is supported on all
// Windows and Lustre deployment types.
//
// * Set to HDD to use hard disk drive
// storage. HDD is supported on SINGLE_AZ_2 and MULTI_AZ_1 Windows file system
// deployment types, and on PERSISTENT Lustre file system deployment
// types.
//
// Default value is SSD. For more information, see Storage Type Options
// (https://docs.aws.amazon.com/fsx/latest/WindowsGuide/optimize-fsx-costs.html#storage-type-options)
// in the Amazon FSx for Windows User Guide and Multiple Storage Options
// (https://docs.aws.amazon.com/fsx/latest/LustreGuide/what-is.html#storage-options)
// in the Amazon FSx for Lustre User Guide.
StorageType types.StorageType
// The tags to apply to the file system being created. The key value of the Name
// tag appears in the console as the file system name.
Tags []types.Tag
// The Microsoft Windows configuration for the file system being created.
WindowsConfiguration *types.CreateFileSystemWindowsConfiguration
}
// The response object returned after the file system is created.
type CreateFileSystemOutput struct {
// The configuration of the file system that was created.
FileSystem *types.FileSystem
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
}
func addOperationCreateFileSystemMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpCreateFileSystem{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpCreateFileSystem{}, middleware.After)
if err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addIdempotencyToken_opCreateFileSystemMiddleware(stack, options); err != nil {
return err
}
if err = addOpCreateFileSystemValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateFileSystem(options.Region), middleware.Before); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
type idempotencyToken_initializeOpCreateFileSystem struct {
tokenProvider IdempotencyTokenProvider
}
func (*idempotencyToken_initializeOpCreateFileSystem) ID() string {
return "OperationIdempotencyTokenAutoFill"
}
func (m *idempotencyToken_initializeOpCreateFileSystem) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
if m.tokenProvider == nil {
return next.HandleInitialize(ctx, in)
}
input, ok := in.Parameters.(*CreateFileSystemInput)
if !ok {
return out, metadata, fmt.Errorf("expected middleware input to be of type *CreateFileSystemInput ")
}
if input.ClientRequestToken == nil {
t, err := m.tokenProvider.GetIdempotencyToken()
if err != nil {
return out, metadata, err
}
input.ClientRequestToken = &t
}
return next.HandleInitialize(ctx, in)
}
func addIdempotencyToken_opCreateFileSystemMiddleware(stack *middleware.Stack, cfg Options) error {
return stack.Initialize.Add(&idempotencyToken_initializeOpCreateFileSystem{tokenProvider: cfg.IdempotencyTokenProvider}, middleware.Before)
}
func newServiceMetadataMiddleware_opCreateFileSystem(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "fsx",
OperationName: "CreateFileSystem",
}
}