Sha256: 1b4016d565713d08886549a13c1bebb3c712c4aafb9df1be945537eec4e68541

Contents?: true

Size: 952 Bytes

Versions: 13

Compression:

Stored size: 952 Bytes

Contents

# frozen_string_literal: true

module Aws
  module S3
    module Errors
      # Hijack PermanentRedirect dynamic error to also include endpoint
      # and bucket.
      class PermanentRedirect < ServiceError
        # @param [Seahorse::Client::RequestContext] context
        # @param [String] message
        # @param [Aws::S3::Types::PermanentRedirect] data
        def initialize(context, message, _data = Aws::EmptyStructure.new)
          data = Aws::S3::Types::PermanentRedirect.new(message: 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, message, data)
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
aws-sdk-s3-1.128.0 lib/aws-sdk-s3/customizations/errors.rb
aws-sdk-s3-1.127.0 lib/aws-sdk-s3/customizations/errors.rb
aws-sdk-s3-1.126.0 lib/aws-sdk-s3/customizations/errors.rb
aws-sdk-s3-1.125.0 lib/aws-sdk-s3/customizations/errors.rb
aws-sdk-s3-1.124.0 lib/aws-sdk-s3/customizations/errors.rb
aws-sdk-s3-1.123.2 lib/aws-sdk-s3/customizations/errors.rb
aws-sdk-s3-1.123.1 lib/aws-sdk-s3/customizations/errors.rb
aws-sdk-s3-1.123.0 lib/aws-sdk-s3/customizations/errors.rb
aws-sdk-s3-1.122.0 lib/aws-sdk-s3/customizations/errors.rb
aws-sdk-s3-1.121.0 lib/aws-sdk-s3/customizations/errors.rb
aws-sdk-s3-1.120.1 lib/aws-sdk-s3/customizations/errors.rb
aws-sdk-s3-1.120.0 lib/aws-sdk-s3/customizations/errors.rb
aws-sdk-s3-1.119.2 lib/aws-sdk-s3/customizations/errors.rb