1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package datasync
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/datasync/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Defines a file system on a Network File System (NFS) server that can be read
15// from or written to.
16func (c *Client) CreateLocationNfs(ctx context.Context, params *CreateLocationNfsInput, optFns ...func(*Options)) (*CreateLocationNfsOutput, error) {
17	if params == nil {
18		params = &CreateLocationNfsInput{}
19	}
20
21	result, metadata, err := c.invokeOperation(ctx, "CreateLocationNfs", params, optFns, addOperationCreateLocationNfsMiddlewares)
22	if err != nil {
23		return nil, err
24	}
25
26	out := result.(*CreateLocationNfsOutput)
27	out.ResultMetadata = metadata
28	return out, nil
29}
30
31// CreateLocationNfsRequest
32type CreateLocationNfsInput struct {
33
34	// Contains a list of Amazon Resource Names (ARNs) of agents that are used to
35	// connect to an NFS server. If you are copying data to or from your AWS Snowcone
36	// device, see NFS Server on AWS Snowcone
37	// (https://docs.aws.amazon.com/datasync/latest/userguide/create-nfs-location.html#nfs-on-snowcone)
38	// for more information.
39	//
40	// This member is required.
41	OnPremConfig *types.OnPremConfig
42
43	// The name of the NFS server. This value is the IP address or Domain Name Service
44	// (DNS) name of the NFS server. An agent that is installed on-premises uses this
45	// host name to mount the NFS server in a network. If you are copying data to or
46	// from your AWS Snowcone device, see NFS Server on AWS Snowcone
47	// (https://docs.aws.amazon.com/datasync/latest/userguide/create-nfs-location.html#nfs-on-snowcone)
48	// for more information. This name must either be DNS-compliant or must be an IP
49	// version 4 (IPv4) address.
50	//
51	// This member is required.
52	ServerHostname *string
53
54	// The subdirectory in the NFS file system that is used to read data from the NFS
55	// source location or write data to the NFS destination. The NFS path should be a
56	// path that's exported by the NFS server, or a subdirectory of that path. The path
57	// should be such that it can be mounted by other NFS clients in your network. To
58	// see all the paths exported by your NFS server, run "showmount -e
59	// nfs-server-name" from an NFS client that has access to your server. You can
60	// specify any directory that appears in the results, and any subdirectory of that
61	// directory. Ensure that the NFS export is accessible without Kerberos
62	// authentication. To transfer all the data in the folder you specified, DataSync
63	// needs to have permissions to read all the data. To ensure this, either configure
64	// the NFS export with no_root_squash, or ensure that the permissions for all of
65	// the files that you want DataSync allow read access for all users. Doing either
66	// enables the agent to read the files. For the agent to access directories, you
67	// must additionally enable all execute access. If you are copying data to or from
68	// your AWS Snowcone device, see NFS Server on AWS Snowcone
69	// (https://docs.aws.amazon.com/datasync/latest/userguide/create-nfs-location.html#nfs-on-snowcone)
70	// for more information. For information about NFS export configuration, see 18.7.
71	// The /etc/exports Configuration File in the Red Hat Enterprise Linux
72	// documentation.
73	//
74	// This member is required.
75	Subdirectory *string
76
77	// The NFS mount options that DataSync can use to mount your NFS share.
78	MountOptions *types.NfsMountOptions
79
80	// The key-value pair that represents the tag that you want to add to the location.
81	// The value can be an empty string. We recommend using tags to name your
82	// resources.
83	Tags []types.TagListEntry
84}
85
86// CreateLocationNfsResponse
87type CreateLocationNfsOutput struct {
88
89	// The Amazon Resource Name (ARN) of the source NFS file system location that is
90	// created.
91	LocationArn *string
92
93	// Metadata pertaining to the operation's result.
94	ResultMetadata middleware.Metadata
95}
96
97func addOperationCreateLocationNfsMiddlewares(stack *middleware.Stack, options Options) (err error) {
98	err = stack.Serialize.Add(&awsAwsjson11_serializeOpCreateLocationNfs{}, middleware.After)
99	if err != nil {
100		return err
101	}
102	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpCreateLocationNfs{}, middleware.After)
103	if err != nil {
104		return err
105	}
106	if err = addSetLoggerMiddleware(stack, options); err != nil {
107		return err
108	}
109	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
110		return err
111	}
112	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
113		return err
114	}
115	if err = addResolveEndpointMiddleware(stack, options); err != nil {
116		return err
117	}
118	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
119		return err
120	}
121	if err = addRetryMiddlewares(stack, options); err != nil {
122		return err
123	}
124	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
125		return err
126	}
127	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
128		return err
129	}
130	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
131		return err
132	}
133	if err = addClientUserAgent(stack); err != nil {
134		return err
135	}
136	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
137		return err
138	}
139	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
140		return err
141	}
142	if err = addOpCreateLocationNfsValidationMiddleware(stack); err != nil {
143		return err
144	}
145	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateLocationNfs(options.Region), middleware.Before); err != nil {
146		return err
147	}
148	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
149		return err
150	}
151	if err = addResponseErrorMiddleware(stack); err != nil {
152		return err
153	}
154	if err = addRequestResponseLogging(stack, options); err != nil {
155		return err
156	}
157	return nil
158}
159
160func newServiceMetadataMiddleware_opCreateLocationNfs(region string) *awsmiddleware.RegisterServiceMetadata {
161	return &awsmiddleware.RegisterServiceMetadata{
162		Region:        region,
163		ServiceID:     ServiceID,
164		SigningName:   "datasync",
165		OperationName: "CreateLocationNfs",
166	}
167}
168