1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package storagegateway
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/storagegateway/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Creates a Network File System (NFS) file share on an existing S3 File Gateway.
15// In Storage Gateway, a file share is a file system mount point backed by Amazon
16// S3 cloud storage. Storage Gateway exposes file shares using an NFS interface.
17// This operation is only supported for S3 File Gateways. S3 File gateway requires
18// Security Token Service (STS) to be activated to enable you to create a file
19// share. Make sure STS is activated in the Region you are creating your S3 File
20// Gateway in. If STS is not activated in the Region, activate it. For information
21// about how to activate STS, see Activating and deactivating STS in an Region
22// (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html)
23// in the Identity and Access Management User Guide. S3 File Gateways do not
24// support creating hard or symbolic links on a file share.
25func (c *Client) CreateNFSFileShare(ctx context.Context, params *CreateNFSFileShareInput, optFns ...func(*Options)) (*CreateNFSFileShareOutput, error) {
26	if params == nil {
27		params = &CreateNFSFileShareInput{}
28	}
29
30	result, metadata, err := c.invokeOperation(ctx, "CreateNFSFileShare", params, optFns, c.addOperationCreateNFSFileShareMiddlewares)
31	if err != nil {
32		return nil, err
33	}
34
35	out := result.(*CreateNFSFileShareOutput)
36	out.ResultMetadata = metadata
37	return out, nil
38}
39
40// CreateNFSFileShareInput
41type CreateNFSFileShareInput struct {
42
43	// A unique string value that you supply that is used by S3 File Gateway to ensure
44	// idempotent file share creation.
45	//
46	// This member is required.
47	ClientToken *string
48
49	// The Amazon Resource Name (ARN) of the S3 File Gateway on which you want to
50	// create a file share.
51	//
52	// This member is required.
53	GatewayARN *string
54
55	// The ARN of the backend storage used for storing file data. A prefix name can be
56	// added to the S3 bucket name. It must end with a "/". You can specify a bucket
57	// attached to an access point using a complete ARN that includes the bucket region
58	// as shown: arn:aws:s3:region:account-id:accesspoint/access-point-name  If you
59	// specify a bucket attached to an access point, the bucket policy must be
60	// configured to delegate access control to the access point. For information, see
61	// Delegating access control to access points
62	// (https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-points-policies.html#access-points-delegating-control)
63	// in the Amazon S3 User Guide.
64	//
65	// This member is required.
66	LocationARN *string
67
68	// The ARN of the Identity and Access Management (IAM) role that an S3 File Gateway
69	// assumes when it accesses the underlying storage.
70	//
71	// This member is required.
72	Role *string
73
74	// Specifies the Region of the S3 bucket where the NFS file share stores files.
75	// This parameter is required for NFS file shares that connect to Amazon S3 through
76	// a VPC endpoint, a VPC access point, or an access point alias that points to a
77	// VPC access point.
78	BucketRegion *string
79
80	// Specifies refresh cache information for the file share.
81	CacheAttributes *types.CacheAttributes
82
83	// The list of clients that are allowed to access the S3 File Gateway. The list
84	// must contain either valid IP addresses or valid CIDR blocks.
85	ClientList []string
86
87	// The default storage class for objects put into an Amazon S3 bucket by the S3
88	// File Gateway. The default value is S3_INTELLIGENT_TIERING. Optional. Valid
89	// Values: S3_STANDARD | S3_INTELLIGENT_TIERING | S3_STANDARD_IA | S3_ONEZONE_IA
90	DefaultStorageClass *string
91
92	// The name of the file share. Optional. FileShareName must be set if an S3 prefix
93	// name is set in LocationARN.
94	FileShareName *string
95
96	// A value that enables guessing of the MIME type for uploaded objects based on
97	// file extensions. Set this value to true to enable MIME type guessing, otherwise
98	// set to false. The default value is true. Valid Values: true | false
99	GuessMIMETypeEnabled *bool
100
101	// Set to true to use Amazon S3 server-side encryption with your own KMS key, or
102	// false to use a key managed by Amazon S3. Optional. Valid Values: true | false
103	KMSEncrypted *bool
104
105	// The Amazon Resource Name (ARN) of a symmetric customer master key (CMK) used for
106	// Amazon S3 server-side encryption. Storage Gateway does not support asymmetric
107	// CMKs. This value can only be set when KMSEncrypted is true. Optional.
108	KMSKey *string
109
110	// File share default values. Optional.
111	NFSFileShareDefaults *types.NFSFileShareDefaults
112
113	// The notification policy of the file share. SettlingTimeInSeconds controls the
114	// number of seconds to wait after the last point in time a client wrote to a file
115	// before generating an ObjectUploaded notification. Because clients can make many
116	// small writes to files, it's best to set this parameter for as long as possible
117	// to avoid generating multiple notifications for the same file in a small time
118	// period. SettlingTimeInSeconds has no effect on the timing of the object
119	// uploading to Amazon S3, only the timing of the notification. The following
120	// example sets NotificationPolicy on with SettlingTimeInSeconds set to 60.
121	// {"Upload": {"SettlingTimeInSeconds": 60}} The following example sets
122	// NotificationPolicy off. {}
123	NotificationPolicy *string
124
125	// A value that sets the access control list (ACL) permission for objects in the S3
126	// bucket that a S3 File Gateway puts objects into. The default value is private.
127	ObjectACL types.ObjectACL
128
129	// A value that sets the write status of a file share. Set this value to true to
130	// set the write status to read-only, otherwise set to false. Valid Values: true |
131	// false
132	ReadOnly *bool
133
134	// A value that sets who pays the cost of the request and the cost associated with
135	// data download from the S3 bucket. If this value is set to true, the requester
136	// pays the costs; otherwise, the S3 bucket owner pays. However, the S3 bucket
137	// owner always pays the cost of storing data. RequesterPays is a configuration for
138	// the S3 bucket that backs the file share, so make sure that the configuration on
139	// the file share is the same as the S3 bucket configuration. Valid Values: true |
140	// false
141	RequesterPays *bool
142
143	// A value that maps a user to anonymous user. Valid values are the following:
144	//
145	// *
146	// RootSquash: Only root is mapped to anonymous user.
147	//
148	// * NoSquash: No one is mapped
149	// to anonymous user.
150	//
151	// * AllSquash: Everyone is mapped to anonymous user.
152	Squash *string
153
154	// A list of up to 50 tags that can be assigned to the NFS file share. Each tag is
155	// a key-value pair. Valid characters for key and value are letters, spaces, and
156	// numbers representable in UTF-8 format, and the following special characters: + -
157	// = . _ : / @. The maximum length of a tag's key is 128 characters, and the
158	// maximum length for a tag's value is 256.
159	Tags []types.Tag
160
161	// Specifies the DNS name for the VPC endpoint that the NFS file share uses to
162	// connect to Amazon S3. This parameter is required for NFS file shares that
163	// connect to Amazon S3 through a VPC endpoint, a VPC access point, or an access
164	// point alias that points to a VPC access point.
165	VPCEndpointDNSName *string
166
167	noSmithyDocumentSerde
168}
169
170// CreateNFSFileShareOutput
171type CreateNFSFileShareOutput struct {
172
173	// The Amazon Resource Name (ARN) of the newly created file share.
174	FileShareARN *string
175
176	// Metadata pertaining to the operation's result.
177	ResultMetadata middleware.Metadata
178
179	noSmithyDocumentSerde
180}
181
182func (c *Client) addOperationCreateNFSFileShareMiddlewares(stack *middleware.Stack, options Options) (err error) {
183	err = stack.Serialize.Add(&awsAwsjson11_serializeOpCreateNFSFileShare{}, middleware.After)
184	if err != nil {
185		return err
186	}
187	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpCreateNFSFileShare{}, middleware.After)
188	if err != nil {
189		return err
190	}
191	if err = addSetLoggerMiddleware(stack, options); err != nil {
192		return err
193	}
194	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
195		return err
196	}
197	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
198		return err
199	}
200	if err = addResolveEndpointMiddleware(stack, options); err != nil {
201		return err
202	}
203	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
204		return err
205	}
206	if err = addRetryMiddlewares(stack, options); err != nil {
207		return err
208	}
209	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
210		return err
211	}
212	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
213		return err
214	}
215	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
216		return err
217	}
218	if err = addClientUserAgent(stack); err != nil {
219		return err
220	}
221	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
222		return err
223	}
224	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
225		return err
226	}
227	if err = addOpCreateNFSFileShareValidationMiddleware(stack); err != nil {
228		return err
229	}
230	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateNFSFileShare(options.Region), middleware.Before); err != nil {
231		return err
232	}
233	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
234		return err
235	}
236	if err = addResponseErrorMiddleware(stack); err != nil {
237		return err
238	}
239	if err = addRequestResponseLogging(stack, options); err != nil {
240		return err
241	}
242	return nil
243}
244
245func newServiceMetadataMiddleware_opCreateNFSFileShare(region string) *awsmiddleware.RegisterServiceMetadata {
246	return &awsmiddleware.RegisterServiceMetadata{
247		Region:        region,
248		ServiceID:     ServiceID,
249		SigningName:   "storagegateway",
250		OperationName: "CreateNFSFileShare",
251	}
252}
253