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	// Refresh cache information.
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.
102	NotificationPolicy *string
103
104	// A value that sets the access control list (ACL) permission for objects in the S3
105	// bucket that a file gateway puts objects into. The default value is private.
106	ObjectACL types.ObjectACL
107
108	// A value that sets the write status of a file share. Set this value to true to
109	// set the write status to read-only, otherwise set to false. Valid Values: true |
110	// false
111	ReadOnly *bool
112
113	// A value that sets who pays the cost of the request and the cost associated with
114	// data download from the S3 bucket. If this value is set to true, the requester
115	// pays the costs; otherwise, the S3 bucket owner pays. However, the S3 bucket
116	// owner always pays the cost of storing data. RequesterPays is a configuration for
117	// the S3 bucket that backs the file share, so make sure that the configuration on
118	// the file share is the same as the S3 bucket configuration. Valid Values: true |
119	// false
120	RequesterPays *bool
121
122	// A value that maps a user to anonymous user. Valid values are the following:
123	//
124	// *
125	// RootSquash: Only root is mapped to anonymous user.
126	//
127	// * NoSquash: No one is mapped
128	// to anonymous user.
129	//
130	// * AllSquash: Everyone is mapped to anonymous user.
131	Squash *string
132
133	// A list of up to 50 tags that can be assigned to the NFS file share. Each tag is
134	// a key-value pair. Valid characters for key and value are letters, spaces, and
135	// numbers representable in UTF-8 format, and the following special characters: + -
136	// = . _ : / @. The maximum length of a tag's key is 128 characters, and the
137	// maximum length for a tag's value is 256.
138	Tags []types.Tag
139}
140
141// CreateNFSFileShareOutput
142type CreateNFSFileShareOutput struct {
143
144	// The Amazon Resource Name (ARN) of the newly created file share.
145	FileShareARN *string
146
147	// Metadata pertaining to the operation's result.
148	ResultMetadata middleware.Metadata
149}
150
151func addOperationCreateNFSFileShareMiddlewares(stack *middleware.Stack, options Options) (err error) {
152	err = stack.Serialize.Add(&awsAwsjson11_serializeOpCreateNFSFileShare{}, middleware.After)
153	if err != nil {
154		return err
155	}
156	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpCreateNFSFileShare{}, middleware.After)
157	if err != nil {
158		return err
159	}
160	if err = addSetLoggerMiddleware(stack, options); err != nil {
161		return err
162	}
163	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
164		return err
165	}
166	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
167		return err
168	}
169	if err = addResolveEndpointMiddleware(stack, options); err != nil {
170		return err
171	}
172	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
173		return err
174	}
175	if err = addRetryMiddlewares(stack, options); err != nil {
176		return err
177	}
178	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
179		return err
180	}
181	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
182		return err
183	}
184	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
185		return err
186	}
187	if err = addClientUserAgent(stack); err != nil {
188		return err
189	}
190	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
191		return err
192	}
193	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
194		return err
195	}
196	if err = addOpCreateNFSFileShareValidationMiddleware(stack); err != nil {
197		return err
198	}
199	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateNFSFileShare(options.Region), middleware.Before); err != nil {
200		return err
201	}
202	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
203		return err
204	}
205	if err = addResponseErrorMiddleware(stack); err != nil {
206		return err
207	}
208	if err = addRequestResponseLogging(stack, options); err != nil {
209		return err
210	}
211	return nil
212}
213
214func newServiceMetadataMiddleware_opCreateNFSFileShare(region string) *awsmiddleware.RegisterServiceMetadata {
215	return &awsmiddleware.RegisterServiceMetadata{
216		Region:        region,
217		ServiceID:     ServiceID,
218		SigningName:   "storagegateway",
219		OperationName: "CreateNFSFileShare",
220	}
221}
222