1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package s3outposts
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/s3outposts/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Amazon S3 on Outposts Access Points simplify managing data access at scale for
15// shared datasets in S3 on Outposts. S3 on Outposts uses endpoints to connect to
16// Outposts buckets so that you can perform actions within your virtual private
17// cloud (VPC). For more information, see  Accessing S3 on Outposts using VPC only
18// access points
19// (https://docs.aws.amazon.com/AmazonS3/latest/userguide/AccessingS3Outposts.html).
20// This action creates an endpoint and associates it with the specified Outposts.
21// It can take up to 5 minutes for this action to complete. Related actions
22// include:
23//
24// * DeleteEndpoint
25// (https://docs.aws.amazon.com/AmazonS3/latest/API/API_s3outposts_DeleteEndpoint.html)
26//
27// *
28// ListEndpoints
29// (https://docs.aws.amazon.com/AmazonS3/latest/API/API_s3outposts_ListEndpoints.html)
30func (c *Client) CreateEndpoint(ctx context.Context, params *CreateEndpointInput, optFns ...func(*Options)) (*CreateEndpointOutput, error) {
31	if params == nil {
32		params = &CreateEndpointInput{}
33	}
34
35	result, metadata, err := c.invokeOperation(ctx, "CreateEndpoint", params, optFns, c.addOperationCreateEndpointMiddlewares)
36	if err != nil {
37		return nil, err
38	}
39
40	out := result.(*CreateEndpointOutput)
41	out.ResultMetadata = metadata
42	return out, nil
43}
44
45type CreateEndpointInput struct {
46
47	// The ID of the AWS Outposts.
48	//
49	// This member is required.
50	OutpostId *string
51
52	// The ID of the security group to use with the endpoint.
53	//
54	// This member is required.
55	SecurityGroupId *string
56
57	// The ID of the subnet in the selected VPC. The endpoint subnet must belong to the
58	// Outpost that has the Amazon S3 on Outposts provisioned.
59	//
60	// This member is required.
61	SubnetId *string
62
63	// The type of access for the on-premise network connectivity for the Outpost
64	// endpoint. To access the endpoint from an on-premises network, you must specify
65	// the access type and provide the customer owned IPv4 pool.
66	AccessType types.EndpointAccessType
67
68	// The ID of the customer-owned IPv4 pool for the endpoint. IP addresses will be
69	// allocated from this pool for the endpoint.
70	CustomerOwnedIpv4Pool *string
71
72	noSmithyDocumentSerde
73}
74
75type CreateEndpointOutput struct {
76
77	// The Amazon Resource Name (ARN) of the endpoint.
78	EndpointArn *string
79
80	// Metadata pertaining to the operation's result.
81	ResultMetadata middleware.Metadata
82
83	noSmithyDocumentSerde
84}
85
86func (c *Client) addOperationCreateEndpointMiddlewares(stack *middleware.Stack, options Options) (err error) {
87	err = stack.Serialize.Add(&awsRestjson1_serializeOpCreateEndpoint{}, middleware.After)
88	if err != nil {
89		return err
90	}
91	err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCreateEndpoint{}, middleware.After)
92	if err != nil {
93		return err
94	}
95	if err = addSetLoggerMiddleware(stack, options); err != nil {
96		return err
97	}
98	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
99		return err
100	}
101	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
102		return err
103	}
104	if err = addResolveEndpointMiddleware(stack, options); err != nil {
105		return err
106	}
107	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
108		return err
109	}
110	if err = addRetryMiddlewares(stack, options); err != nil {
111		return err
112	}
113	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
114		return err
115	}
116	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
117		return err
118	}
119	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
120		return err
121	}
122	if err = addClientUserAgent(stack); err != nil {
123		return err
124	}
125	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
126		return err
127	}
128	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
129		return err
130	}
131	if err = addOpCreateEndpointValidationMiddleware(stack); err != nil {
132		return err
133	}
134	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateEndpoint(options.Region), middleware.Before); err != nil {
135		return err
136	}
137	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
138		return err
139	}
140	if err = addResponseErrorMiddleware(stack); err != nil {
141		return err
142	}
143	if err = addRequestResponseLogging(stack, options); err != nil {
144		return err
145	}
146	return nil
147}
148
149func newServiceMetadataMiddleware_opCreateEndpoint(region string) *awsmiddleware.RegisterServiceMetadata {
150	return &awsmiddleware.RegisterServiceMetadata{
151		Region:        region,
152		ServiceID:     ServiceID,
153		SigningName:   "s3-outposts",
154		OperationName: "CreateEndpoint",
155	}
156}
157