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 smithy "github.com/aws/smithy-go" 12 "github.com/aws/smithy-go/middleware" 13 smithyhttp "github.com/aws/smithy-go/transport/http" 14 "strings" 15) 16 17// Deletes the specified access point. All Amazon S3 on Outposts REST API requests 18// for this action require an additional parameter of x-amz-outpost-id to be passed 19// with the request and an S3 on Outposts endpoint hostname prefix instead of 20// s3-control. For an example of the request syntax for Amazon S3 on Outposts that 21// uses the S3 on Outposts endpoint hostname prefix and the x-amz-outpost-id 22// derived using the access point ARN, see the Examples 23// (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_DeleteAccessPoint.html#API_control_DeleteAccessPoint_Examples) 24// section. The following actions are related to DeleteAccessPoint: 25// 26// * 27// CreateAccessPoint 28// (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_CreateAccessPoint.html) 29// 30// * 31// GetAccessPoint 32// (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_GetAccessPoint.html) 33// 34// * 35// ListAccessPoints 36// (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_ListAccessPoints.html) 37func (c *Client) DeleteAccessPoint(ctx context.Context, params *DeleteAccessPointInput, optFns ...func(*Options)) (*DeleteAccessPointOutput, error) { 38 if params == nil { 39 params = &DeleteAccessPointInput{} 40 } 41 42 result, metadata, err := c.invokeOperation(ctx, "DeleteAccessPoint", params, optFns, c.addOperationDeleteAccessPointMiddlewares) 43 if err != nil { 44 return nil, err 45 } 46 47 out := result.(*DeleteAccessPointOutput) 48 out.ResultMetadata = metadata 49 return out, nil 50} 51 52type DeleteAccessPointInput struct { 53 54 // The account ID for the account that owns the specified access point. 55 // 56 // This member is required. 57 AccountId *string 58 59 // The name of the access point you want to delete. For using this parameter with 60 // Amazon S3 on Outposts with the REST API, you must specify the name and the 61 // x-amz-outpost-id as well. For using this parameter with S3 on Outposts with the 62 // Amazon Web Services SDK and CLI, you must specify the ARN of the access point 63 // accessed in the format arn:aws:s3-outposts:::outpost//accesspoint/. For example, 64 // to access the access point reports-ap through outpost my-outpost owned by 65 // account 123456789012 in Region us-west-2, use the URL encoding of 66 // arn:aws:s3-outposts:us-west-2:123456789012:outpost/my-outpost/accesspoint/reports-ap. 67 // The value must be URL encoded. 68 // 69 // This member is required. 70 Name *string 71 72 noSmithyDocumentSerde 73} 74 75type DeleteAccessPointOutput struct { 76 // Metadata pertaining to the operation's result. 77 ResultMetadata middleware.Metadata 78 79 noSmithyDocumentSerde 80} 81 82func (c *Client) addOperationDeleteAccessPointMiddlewares(stack *middleware.Stack, options Options) (err error) { 83 err = stack.Serialize.Add(&awsRestxml_serializeOpDeleteAccessPoint{}, middleware.After) 84 if err != nil { 85 return err 86 } 87 err = stack.Deserialize.Add(&awsRestxml_deserializeOpDeleteAccessPoint{}, middleware.After) 88 if err != nil { 89 return err 90 } 91 if err = addSetLoggerMiddleware(stack, options); err != nil { 92 return err 93 } 94 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 95 return err 96 } 97 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 98 return err 99 } 100 if err = addResolveEndpointMiddleware(stack, options); err != nil { 101 return err 102 } 103 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 104 return err 105 } 106 if err = addRetryMiddlewares(stack, options); err != nil { 107 return err 108 } 109 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 110 return err 111 } 112 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 113 return err 114 } 115 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 116 return err 117 } 118 if err = addClientUserAgent(stack); err != nil { 119 return err 120 } 121 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 122 return err 123 } 124 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 125 return err 126 } 127 if err = addEndpointPrefix_opDeleteAccessPointMiddleware(stack); err != nil { 128 return err 129 } 130 if err = addOpDeleteAccessPointValidationMiddleware(stack); err != nil { 131 return err 132 } 133 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteAccessPoint(options.Region), middleware.Before); err != nil { 134 return err 135 } 136 if err = addMetadataRetrieverMiddleware(stack); err != nil { 137 return err 138 } 139 if err = addDeleteAccessPointUpdateEndpoint(stack, options); err != nil { 140 return err 141 } 142 if err = addResponseErrorMiddleware(stack); err != nil { 143 return err 144 } 145 if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { 146 return err 147 } 148 if err = addRequestResponseLogging(stack, options); err != nil { 149 return err 150 } 151 return nil 152} 153 154type endpointPrefix_opDeleteAccessPointMiddleware struct { 155} 156 157func (*endpointPrefix_opDeleteAccessPointMiddleware) ID() string { 158 return "EndpointHostPrefix" 159} 160 161func (m *endpointPrefix_opDeleteAccessPointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 162 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 163) { 164 if smithyhttp.GetHostnameImmutable(ctx) || smithyhttp.IsEndpointHostPrefixDisabled(ctx) { 165 return next.HandleSerialize(ctx, in) 166 } 167 168 req, ok := in.Request.(*smithyhttp.Request) 169 if !ok { 170 return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) 171 } 172 173 input, ok := in.Parameters.(*DeleteAccessPointInput) 174 if !ok { 175 return out, metadata, fmt.Errorf("unknown input type %T", in.Parameters) 176 } 177 178 var prefix strings.Builder 179 if input.AccountId == nil { 180 return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so may not be nil")} 181 } else if !smithyhttp.ValidHostLabel(*input.AccountId) { 182 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)} 183 } else { 184 prefix.WriteString(*input.AccountId) 185 } 186 prefix.WriteString(".") 187 req.URL.Host = prefix.String() + req.URL.Host 188 189 return next.HandleSerialize(ctx, in) 190} 191func addEndpointPrefix_opDeleteAccessPointMiddleware(stack *middleware.Stack) error { 192 return stack.Serialize.Insert(&endpointPrefix_opDeleteAccessPointMiddleware{}, `OperationSerializer`, middleware.After) 193} 194 195func newServiceMetadataMiddleware_opDeleteAccessPoint(region string) *awsmiddleware.RegisterServiceMetadata { 196 return &awsmiddleware.RegisterServiceMetadata{ 197 Region: region, 198 ServiceID: ServiceID, 199 SigningName: "s3", 200 OperationName: "DeleteAccessPoint", 201 } 202} 203 204func copyDeleteAccessPointInputForUpdateEndpoint(params interface{}) (interface{}, error) { 205 input, ok := params.(*DeleteAccessPointInput) 206 if !ok { 207 return nil, fmt.Errorf("expect *DeleteAccessPointInput type, got %T", params) 208 } 209 cpy := *input 210 return &cpy, nil 211} 212func getDeleteAccessPointARNMember(input interface{}) (*string, bool) { 213 in := input.(*DeleteAccessPointInput) 214 if in.Name == nil { 215 return nil, false 216 } 217 return in.Name, true 218} 219func setDeleteAccessPointARNMember(input interface{}, v string) error { 220 in := input.(*DeleteAccessPointInput) 221 in.Name = &v 222 return nil 223} 224func backFillDeleteAccessPointAccountID(input interface{}, v string) error { 225 in := input.(*DeleteAccessPointInput) 226 if in.AccountId != nil { 227 if !strings.EqualFold(*in.AccountId, v) { 228 return fmt.Errorf("error backfilling account id") 229 } 230 return nil 231 } 232 in.AccountId = &v 233 return nil 234} 235func addDeleteAccessPointUpdateEndpoint(stack *middleware.Stack, options Options) error { 236 return s3controlcust.UpdateEndpoint(stack, s3controlcust.UpdateEndpointOptions{ 237 Accessor: s3controlcust.UpdateEndpointParameterAccessor{GetARNInput: getDeleteAccessPointARNMember, 238 BackfillAccountID: backFillDeleteAccessPointAccountID, 239 GetOutpostIDInput: nopGetOutpostIDFromInput, 240 UpdateARNField: setDeleteAccessPointARNMember, 241 CopyInput: copyDeleteAccessPointInputForUpdateEndpoint, 242 }, 243 EndpointResolver: options.EndpointResolver, 244 EndpointResolverOptions: options.EndpointOptions, 245 UseDualstack: options.UseDualstack, 246 UseARNRegion: options.UseARNRegion, 247 }) 248} 249