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