1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package s3control 4 5import ( 6 "context" 7 "fmt" 8 awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" 9 "github.com/aws/aws-sdk-go-v2/aws/signer/v4" 10 s3controlcust "github.com/aws/aws-sdk-go-v2/service/s3control/internal/customizations" 11 "github.com/aws/aws-sdk-go-v2/service/s3control/types" 12 smithy "github.com/aws/smithy-go" 13 "github.com/aws/smithy-go/middleware" 14 smithyhttp "github.com/aws/smithy-go/transport/http" 15 "strings" 16 "time" 17) 18 19// Returns configuration information about the specified access point. All Amazon 20// S3 on Outposts REST API requests for this action require an additional parameter 21// of x-amz-outpost-id to be passed with the request and an S3 on Outposts endpoint 22// hostname prefix instead of s3-control. For an example of the request syntax for 23// Amazon S3 on Outposts that uses the S3 on Outposts endpoint hostname prefix and 24// the x-amz-outpost-id derived using the access point ARN, see the Examples 25// (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_GetAccessPoint.html#API_control_GetAccessPoint_Examples) 26// section. The following actions are related to GetAccessPoint: 27// 28// * 29// CreateAccessPoint 30// (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_CreateAccessPoint.html) 31// 32// * 33// DeleteAccessPoint 34// (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_DeleteAccessPoint.html) 35// 36// * 37// ListAccessPoints 38// (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_ListAccessPoints.html) 39func (c *Client) GetAccessPoint(ctx context.Context, params *GetAccessPointInput, optFns ...func(*Options)) (*GetAccessPointOutput, error) { 40 if params == nil { 41 params = &GetAccessPointInput{} 42 } 43 44 result, metadata, err := c.invokeOperation(ctx, "GetAccessPoint", params, optFns, addOperationGetAccessPointMiddlewares) 45 if err != nil { 46 return nil, err 47 } 48 49 out := result.(*GetAccessPointOutput) 50 out.ResultMetadata = metadata 51 return out, nil 52} 53 54type GetAccessPointInput struct { 55 56 // The account ID for the account that owns the specified access point. 57 // 58 // This member is required. 59 AccountId *string 60 61 // The name of the access point whose configuration information you want to 62 // retrieve. For using this parameter with Amazon S3 on Outposts with the REST API, 63 // you must specify the name and the x-amz-outpost-id as well. For using this 64 // parameter with S3 on Outposts with the AWS SDK and CLI, you must specify the ARN 65 // of the access point accessed in the format 66 // arn:aws:s3-outposts:::outpost//accesspoint/. For example, to access the access 67 // point reports-ap through outpost my-outpost owned by account 123456789012 in 68 // Region us-west-2, use the URL encoding of 69 // arn:aws:s3-outposts:us-west-2:123456789012:outpost/my-outpost/accesspoint/reports-ap. 70 // The value must be URL encoded. 71 // 72 // This member is required. 73 Name *string 74} 75 76type GetAccessPointOutput struct { 77 78 // The name of the bucket associated with the specified access point. 79 Bucket *string 80 81 // The date and time when the specified access point was created. 82 CreationDate *time.Time 83 84 // The name of the specified access point. 85 Name *string 86 87 // Indicates whether this access point allows access from the public internet. If 88 // VpcConfiguration is specified for this access point, then NetworkOrigin is VPC, 89 // and the access point doesn't allow access from the public internet. Otherwise, 90 // NetworkOrigin is Internet, and the access point allows access from the public 91 // internet, subject to the access point and bucket access policies. This will 92 // always be true for an Amazon S3 on Outposts access point 93 NetworkOrigin types.NetworkOrigin 94 95 // The PublicAccessBlock configuration that you want to apply to this Amazon S3 96 // account. You can enable the configuration options in any combination. For more 97 // information about when Amazon S3 considers a bucket or object public, see The 98 // Meaning of "Public" 99 // (https://docs.aws.amazon.com/AmazonS3/latest/dev/access-control-block-public-access.html#access-control-block-public-access-policy-status) 100 // in the Amazon Simple Storage Service Developer Guide. This is not supported for 101 // Amazon S3 on Outposts. 102 PublicAccessBlockConfiguration *types.PublicAccessBlockConfiguration 103 104 // Contains the virtual private cloud (VPC) configuration for the specified access 105 // point. 106 VpcConfiguration *types.VpcConfiguration 107 108 // Metadata pertaining to the operation's result. 109 ResultMetadata middleware.Metadata 110} 111 112func addOperationGetAccessPointMiddlewares(stack *middleware.Stack, options Options) (err error) { 113 err = stack.Serialize.Add(&awsRestxml_serializeOpGetAccessPoint{}, middleware.After) 114 if err != nil { 115 return err 116 } 117 err = stack.Deserialize.Add(&awsRestxml_deserializeOpGetAccessPoint{}, middleware.After) 118 if err != nil { 119 return err 120 } 121 if err = addSetLoggerMiddleware(stack, options); err != nil { 122 return err 123 } 124 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 125 return err 126 } 127 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 128 return err 129 } 130 if err = addResolveEndpointMiddleware(stack, options); err != nil { 131 return err 132 } 133 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 134 return err 135 } 136 if err = addRetryMiddlewares(stack, options); err != nil { 137 return err 138 } 139 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 140 return err 141 } 142 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 143 return err 144 } 145 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 146 return err 147 } 148 if err = addClientUserAgent(stack); err != nil { 149 return err 150 } 151 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 152 return err 153 } 154 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 155 return err 156 } 157 if err = addEndpointPrefix_opGetAccessPointMiddleware(stack); err != nil { 158 return err 159 } 160 if err = addOpGetAccessPointValidationMiddleware(stack); err != nil { 161 return err 162 } 163 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetAccessPoint(options.Region), middleware.Before); err != nil { 164 return err 165 } 166 if err = addMetadataRetrieverMiddleware(stack); err != nil { 167 return err 168 } 169 if err = addGetAccessPointUpdateEndpoint(stack, options); err != nil { 170 return err 171 } 172 if err = addResponseErrorMiddleware(stack); err != nil { 173 return err 174 } 175 if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { 176 return err 177 } 178 if err = addRequestResponseLogging(stack, options); err != nil { 179 return err 180 } 181 return nil 182} 183 184type endpointPrefix_opGetAccessPointMiddleware struct { 185} 186 187func (*endpointPrefix_opGetAccessPointMiddleware) ID() string { 188 return "EndpointHostPrefix" 189} 190 191func (m *endpointPrefix_opGetAccessPointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 192 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 193) { 194 if smithyhttp.GetHostnameImmutable(ctx) || smithyhttp.IsEndpointHostPrefixDisabled(ctx) { 195 return next.HandleSerialize(ctx, in) 196 } 197 198 req, ok := in.Request.(*smithyhttp.Request) 199 if !ok { 200 return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) 201 } 202 203 input, ok := in.Parameters.(*GetAccessPointInput) 204 if !ok { 205 return out, metadata, fmt.Errorf("unknown input type %T", in.Parameters) 206 } 207 208 var prefix strings.Builder 209 if input.AccountId == nil { 210 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so may not be nil")} 211 } else if !smithyhttp.ValidHostLabel(*input.AccountId) { 212 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so must match \"[a-zA-Z0-9-]{1,63}\", but was \"%s\"", *input.AccountId)} 213 } else { 214 prefix.WriteString(*input.AccountId) 215 } 216 prefix.WriteString(".") 217 req.URL.Host = prefix.String() + req.URL.Host 218 219 return next.HandleSerialize(ctx, in) 220} 221func addEndpointPrefix_opGetAccessPointMiddleware(stack *middleware.Stack) error { 222 return stack.Serialize.Insert(&endpointPrefix_opGetAccessPointMiddleware{}, `OperationSerializer`, middleware.After) 223} 224 225func newServiceMetadataMiddleware_opGetAccessPoint(region string) *awsmiddleware.RegisterServiceMetadata { 226 return &awsmiddleware.RegisterServiceMetadata{ 227 Region: region, 228 ServiceID: ServiceID, 229 SigningName: "s3", 230 OperationName: "GetAccessPoint", 231 } 232} 233 234func copyGetAccessPointInputForUpdateEndpoint(params interface{}) (interface{}, error) { 235 input, ok := params.(*GetAccessPointInput) 236 if !ok { 237 return nil, fmt.Errorf("expect *GetAccessPointInput type, got %T", params) 238 } 239 cpy := *input 240 return &cpy, nil 241} 242func getGetAccessPointARNMember(input interface{}) (*string, bool) { 243 in := input.(*GetAccessPointInput) 244 if in.Name == nil { 245 return nil, false 246 } 247 return in.Name, true 248} 249func setGetAccessPointARNMember(input interface{}, v string) error { 250 in := input.(*GetAccessPointInput) 251 in.Name = &v 252 return nil 253} 254func backFillGetAccessPointAccountID(input interface{}, v string) error { 255 in := input.(*GetAccessPointInput) 256 if in.AccountId != nil { 257 if !strings.EqualFold(*in.AccountId, v) { 258 return fmt.Errorf("error backfilling account id") 259 } 260 return nil 261 } 262 in.AccountId = &v 263 return nil 264} 265func addGetAccessPointUpdateEndpoint(stack *middleware.Stack, options Options) error { 266 return s3controlcust.UpdateEndpoint(stack, s3controlcust.UpdateEndpointOptions{ 267 Accessor: s3controlcust.UpdateEndpointParameterAccessor{GetARNInput: getGetAccessPointARNMember, 268 BackfillAccountID: backFillGetAccessPointAccountID, 269 GetOutpostIDInput: nopGetOutpostIDFromInput, 270 UpdateARNField: setGetAccessPointARNMember, 271 CopyInput: copyGetAccessPointInputForUpdateEndpoint, 272 }, 273 EndpointResolver: options.EndpointResolver, 274 EndpointResolverOptions: options.EndpointOptions, 275 UseDualstack: options.UseDualstack, 276 UseARNRegion: options.UseARNRegion, 277 }) 278} 279