Class: Aws::S3::Errors::PermanentRedirect
- Inherits:
-
ServiceError
- Object
- ServiceError
- Aws::S3::Errors::PermanentRedirect
- Defined in:
- lib/aws-sdk-s3/customizations/errors.rb
Overview
Hijack PermanentRedirect dynamic error to include the bucket, region, and endpoint.
Instance Method Summary collapse
-
#initialize(context, message, _data = Aws::EmptyStructure.new) ⇒ PermanentRedirect
constructor
A new instance of PermanentRedirect.
Constructor Details
#initialize(context, message, _data = Aws::EmptyStructure.new) ⇒ PermanentRedirect
Returns a new instance of PermanentRedirect.
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/aws-sdk-s3/customizations/errors.rb', line 12 def initialize(context, , _data = Aws::EmptyStructure.new) data = Aws::S3::Types::PermanentRedirect.new(message: ) body = context.http_response.body_contents if (endpoint = body.match(/<Endpoint>(.+?)<\/Endpoint>/)) data.endpoint = endpoint[1] end if (bucket = body.match(/<Bucket>(.+?)<\/Bucket>/)) data.bucket = bucket[1] end data.region = context.http_response.headers['x-amz-bucket-region'] super(context, , data) end |