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// Creates an endpoint for an Amazon EFS file system.
15func (c *Client) CreateLocationEfs(ctx context.Context, params *CreateLocationEfsInput, optFns ...func(*Options)) (*CreateLocationEfsOutput, error) {
16	if params == nil {
17		params = &CreateLocationEfsInput{}
18	}
19
20	result, metadata, err := c.invokeOperation(ctx, "CreateLocationEfs", params, optFns, addOperationCreateLocationEfsMiddlewares)
21	if err != nil {
22		return nil, err
23	}
24
25	out := result.(*CreateLocationEfsOutput)
26	out.ResultMetadata = metadata
27	return out, nil
28}
29
30// CreateLocationEfsRequest
31type CreateLocationEfsInput struct {
32
33	// The subnet and security group that the Amazon EFS file system uses. The security
34	// group that you provide needs to be able to communicate with the security group
35	// on the mount target in the subnet specified. The exact relationship between
36	// security group M (of the mount target) and security group S (which you provide
37	// for DataSync to use at this stage) is as follows:
38	//
39	// * Security group M (which you
40	// associate with the mount target) must allow inbound access for the Transmission
41	// Control Protocol (TCP) on the NFS port (2049) from security group S. You can
42	// enable inbound connections either by IP address (CIDR range) or security
43	// group.
44	//
45	// * Security group S (provided to DataSync to access EFS) should have a
46	// rule that enables outbound connections to the NFS port on one of the file
47	// system’s mount targets. You can enable outbound connections either by IP address
48	// (CIDR range) or security group. For information about security groups and mount
49	// targets, see Security Groups for Amazon EC2 Instances and Mount Targets in the
50	// Amazon EFS User Guide.
51	//
52	// This member is required.
53	Ec2Config *types.Ec2Config
54
55	// The Amazon Resource Name (ARN) for the Amazon EFS file system.
56	//
57	// This member is required.
58	EfsFilesystemArn *string
59
60	// A subdirectory in the location’s path. This subdirectory in the EFS file system
61	// is used to read data from the EFS source location or write data to the EFS
62	// destination. By default, AWS DataSync uses the root directory. Subdirectory must
63	// be specified with forward slashes. For example, /path/to/folder.
64	Subdirectory *string
65
66	// The key-value pair that represents a tag that you want to add to the resource.
67	// The value can be an empty string. This value helps you manage, filter, and
68	// search for your resources. We recommend that you create a name tag for your
69	// location.
70	Tags []types.TagListEntry
71}
72
73// CreateLocationEfs
74type CreateLocationEfsOutput struct {
75
76	// The Amazon Resource Name (ARN) of the Amazon EFS file system location that is
77	// created.
78	LocationArn *string
79
80	// Metadata pertaining to the operation's result.
81	ResultMetadata middleware.Metadata
82}
83
84func addOperationCreateLocationEfsMiddlewares(stack *middleware.Stack, options Options) (err error) {
85	err = stack.Serialize.Add(&awsAwsjson11_serializeOpCreateLocationEfs{}, middleware.After)
86	if err != nil {
87		return err
88	}
89	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpCreateLocationEfs{}, middleware.After)
90	if err != nil {
91		return err
92	}
93	if err = addSetLoggerMiddleware(stack, options); err != nil {
94		return err
95	}
96	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
97		return err
98	}
99	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
100		return err
101	}
102	if err = addResolveEndpointMiddleware(stack, options); err != nil {
103		return err
104	}
105	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
106		return err
107	}
108	if err = addRetryMiddlewares(stack, options); err != nil {
109		return err
110	}
111	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
112		return err
113	}
114	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
115		return err
116	}
117	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
118		return err
119	}
120	if err = addClientUserAgent(stack); err != nil {
121		return err
122	}
123	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
124		return err
125	}
126	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
127		return err
128	}
129	if err = addOpCreateLocationEfsValidationMiddleware(stack); err != nil {
130		return err
131	}
132	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateLocationEfs(options.Region), middleware.Before); err != nil {
133		return err
134	}
135	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
136		return err
137	}
138	if err = addResponseErrorMiddleware(stack); err != nil {
139		return err
140	}
141	if err = addRequestResponseLogging(stack, options); err != nil {
142		return err
143	}
144	return nil
145}
146
147func newServiceMetadataMiddleware_opCreateLocationEfs(region string) *awsmiddleware.RegisterServiceMetadata {
148	return &awsmiddleware.RegisterServiceMetadata{
149		Region:        region,
150		ServiceID:     ServiceID,
151		SigningName:   "datasync",
152		OperationName: "CreateLocationEfs",
153	}
154}
155