# frozen_string_literal: true # WARNING ABOUT GENERATED CODE # # This file is generated. See the contributing guide for more information: # https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md # # WARNING ABOUT GENERATED CODE require_relative 'spec_helper' module Aws::STS describe EndpointProvider do subject { Aws::STS::EndpointProvider.new } context 'For region af-south-1 with FIPS disabled and DualStack disabled' do let(:expected) do {"endpoint"=>{"url"=>"https://sts.af-south-1.amazonaws.com"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:region=>"af-south-1", :use_fips=>false, :use_dual_stack=>false}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end end context 'For region ap-east-1 with FIPS disabled and DualStack disabled' do let(:expected) do {"endpoint"=>{"url"=>"https://sts.ap-east-1.amazonaws.com"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:region=>"ap-east-1", :use_fips=>false, :use_dual_stack=>false}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end end context 'For region ap-northeast-1 with FIPS disabled and DualStack disabled' do let(:expected) do {"endpoint"=>{"url"=>"https://sts.ap-northeast-1.amazonaws.com"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:region=>"ap-northeast-1", :use_fips=>false, :use_dual_stack=>false}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end end context 'For region ap-northeast-2 with FIPS disabled and DualStack disabled' do let(:expected) do {"endpoint"=>{"url"=>"https://sts.ap-northeast-2.amazonaws.com"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:region=>"ap-northeast-2", :use_fips=>false, :use_dual_stack=>false}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end end context 'For region ap-northeast-3 with FIPS disabled and DualStack disabled' do let(:expected) do {"endpoint"=>{"url"=>"https://sts.ap-northeast-3.amazonaws.com"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:region=>"ap-northeast-3", :use_fips=>false, :use_dual_stack=>false}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end end context 'For region ap-south-1 with FIPS disabled and DualStack disabled' do let(:expected) do {"endpoint"=>{"url"=>"https://sts.ap-south-1.amazonaws.com"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:region=>"ap-south-1", :use_fips=>false, :use_dual_stack=>false}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end end context 'For region ap-southeast-1 with FIPS disabled and DualStack disabled' do let(:expected) do {"endpoint"=>{"url"=>"https://sts.ap-southeast-1.amazonaws.com"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:region=>"ap-southeast-1", :use_fips=>false, :use_dual_stack=>false}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end end context 'For region ap-southeast-2 with FIPS disabled and DualStack disabled' do let(:expected) do {"endpoint"=>{"url"=>"https://sts.ap-southeast-2.amazonaws.com"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:region=>"ap-southeast-2", :use_fips=>false, :use_dual_stack=>false}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end end context 'For region ap-southeast-3 with FIPS disabled and DualStack disabled' do let(:expected) do {"endpoint"=>{"url"=>"https://sts.ap-southeast-3.amazonaws.com"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:region=>"ap-southeast-3", :use_fips=>false, :use_dual_stack=>false}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end end context 'For region aws-global with FIPS disabled and DualStack disabled' do let(:expected) do {"endpoint"=>{"properties"=>{"authSchemes"=>[{"name"=>"sigv4", "signingName"=>"sts", "signingRegion"=>"us-east-1"}]}, "url"=>"https://sts.amazonaws.com"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:region=>"aws-global", :use_fips=>false, :use_dual_stack=>false}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end end context 'For region ca-central-1 with FIPS disabled and DualStack disabled' do let(:expected) do {"endpoint"=>{"url"=>"https://sts.ca-central-1.amazonaws.com"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:region=>"ca-central-1", :use_fips=>false, :use_dual_stack=>false}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end end context 'For region eu-central-1 with FIPS disabled and DualStack disabled' do let(:expected) do {"endpoint"=>{"url"=>"https://sts.eu-central-1.amazonaws.com"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:region=>"eu-central-1", :use_fips=>false, :use_dual_stack=>false}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end end context 'For region eu-north-1 with FIPS disabled and DualStack disabled' do let(:expected) do {"endpoint"=>{"url"=>"https://sts.eu-north-1.amazonaws.com"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:region=>"eu-north-1", :use_fips=>false, :use_dual_stack=>false}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end end context 'For region eu-south-1 with FIPS disabled and DualStack disabled' do let(:expected) do {"endpoint"=>{"url"=>"https://sts.eu-south-1.amazonaws.com"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:region=>"eu-south-1", :use_fips=>false, :use_dual_stack=>false}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end end context 'For region eu-west-1 with FIPS disabled and DualStack disabled' do let(:expected) do {"endpoint"=>{"url"=>"https://sts.eu-west-1.amazonaws.com"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:region=>"eu-west-1", :use_fips=>false, :use_dual_stack=>false}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end end context 'For region eu-west-2 with FIPS disabled and DualStack disabled' do let(:expected) do {"endpoint"=>{"url"=>"https://sts.eu-west-2.amazonaws.com"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:region=>"eu-west-2", :use_fips=>false, :use_dual_stack=>false}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end end context 'For region eu-west-3 with FIPS disabled and DualStack disabled' do let(:expected) do {"endpoint"=>{"url"=>"https://sts.eu-west-3.amazonaws.com"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:region=>"eu-west-3", :use_fips=>false, :use_dual_stack=>false}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end end context 'For region me-south-1 with FIPS disabled and DualStack disabled' do let(:expected) do {"endpoint"=>{"url"=>"https://sts.me-south-1.amazonaws.com"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:region=>"me-south-1", :use_fips=>false, :use_dual_stack=>false}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end end context 'For region sa-east-1 with FIPS disabled and DualStack disabled' do let(:expected) do {"endpoint"=>{"url"=>"https://sts.sa-east-1.amazonaws.com"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:region=>"sa-east-1", :use_fips=>false, :use_dual_stack=>false}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end end context 'For region us-east-1 with FIPS disabled and DualStack disabled' do let(:expected) do {"endpoint"=>{"url"=>"https://sts.us-east-1.amazonaws.com"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:region=>"us-east-1", :use_fips=>false, :use_dual_stack=>false}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end end context 'For region us-east-1 with FIPS enabled and DualStack disabled' do let(:expected) do {"endpoint"=>{"url"=>"https://sts-fips.us-east-1.amazonaws.com"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:region=>"us-east-1", :use_fips=>true, :use_dual_stack=>false}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end end context 'For region us-east-2 with FIPS disabled and DualStack disabled' do let(:expected) do {"endpoint"=>{"url"=>"https://sts.us-east-2.amazonaws.com"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:region=>"us-east-2", :use_fips=>false, :use_dual_stack=>false}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end end context 'For region us-east-2 with FIPS enabled and DualStack disabled' do let(:expected) do {"endpoint"=>{"url"=>"https://sts-fips.us-east-2.amazonaws.com"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:region=>"us-east-2", :use_fips=>true, :use_dual_stack=>false}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end end context 'For region us-west-1 with FIPS disabled and DualStack disabled' do let(:expected) do {"endpoint"=>{"url"=>"https://sts.us-west-1.amazonaws.com"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:region=>"us-west-1", :use_fips=>false, :use_dual_stack=>false}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end end context 'For region us-west-1 with FIPS enabled and DualStack disabled' do let(:expected) do {"endpoint"=>{"url"=>"https://sts-fips.us-west-1.amazonaws.com"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:region=>"us-west-1", :use_fips=>true, :use_dual_stack=>false}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end end context 'For region us-west-2 with FIPS disabled and DualStack disabled' do let(:expected) do {"endpoint"=>{"url"=>"https://sts.us-west-2.amazonaws.com"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:region=>"us-west-2", :use_fips=>false, :use_dual_stack=>false}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end end context 'For region us-west-2 with FIPS enabled and DualStack disabled' do let(:expected) do {"endpoint"=>{"url"=>"https://sts-fips.us-west-2.amazonaws.com"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:region=>"us-west-2", :use_fips=>true, :use_dual_stack=>false}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end end context 'For region us-east-1 with FIPS enabled and DualStack enabled' do let(:expected) do {"endpoint"=>{"url"=>"https://sts-fips.us-east-1.api.aws"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:region=>"us-east-1", :use_fips=>true, :use_dual_stack=>true}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end end context 'For region us-east-1 with FIPS disabled and DualStack enabled' do let(:expected) do {"endpoint"=>{"url"=>"https://sts.us-east-1.api.aws"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:region=>"us-east-1", :use_fips=>false, :use_dual_stack=>true}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end end context 'For region cn-north-1 with FIPS disabled and DualStack disabled' do let(:expected) do {"endpoint"=>{"url"=>"https://sts.cn-north-1.amazonaws.com.cn"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:region=>"cn-north-1", :use_fips=>false, :use_dual_stack=>false}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end end context 'For region cn-northwest-1 with FIPS disabled and DualStack disabled' do let(:expected) do {"endpoint"=>{"url"=>"https://sts.cn-northwest-1.amazonaws.com.cn"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:region=>"cn-northwest-1", :use_fips=>false, :use_dual_stack=>false}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end end context 'For region cn-north-1 with FIPS enabled and DualStack enabled' do let(:expected) do {"endpoint"=>{"url"=>"https://sts-fips.cn-north-1.api.amazonwebservices.com.cn"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:region=>"cn-north-1", :use_fips=>true, :use_dual_stack=>true}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end end context 'For region cn-north-1 with FIPS enabled and DualStack disabled' do let(:expected) do {"endpoint"=>{"url"=>"https://sts-fips.cn-north-1.amazonaws.com.cn"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:region=>"cn-north-1", :use_fips=>true, :use_dual_stack=>false}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end end context 'For region cn-north-1 with FIPS disabled and DualStack enabled' do let(:expected) do {"endpoint"=>{"url"=>"https://sts.cn-north-1.api.amazonwebservices.com.cn"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:region=>"cn-north-1", :use_fips=>false, :use_dual_stack=>true}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end end context 'For region us-gov-east-1 with FIPS disabled and DualStack disabled' do let(:expected) do {"endpoint"=>{"url"=>"https://sts.us-gov-east-1.amazonaws.com"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:region=>"us-gov-east-1", :use_fips=>false, :use_dual_stack=>false}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end end context 'For region us-gov-east-1 with FIPS enabled and DualStack disabled' do let(:expected) do {"endpoint"=>{"url"=>"https://sts.us-gov-east-1.amazonaws.com"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:region=>"us-gov-east-1", :use_fips=>true, :use_dual_stack=>false}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end end context 'For region us-gov-west-1 with FIPS disabled and DualStack disabled' do let(:expected) do {"endpoint"=>{"url"=>"https://sts.us-gov-west-1.amazonaws.com"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:region=>"us-gov-west-1", :use_fips=>false, :use_dual_stack=>false}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end end context 'For region us-gov-west-1 with FIPS enabled and DualStack disabled' do let(:expected) do {"endpoint"=>{"url"=>"https://sts.us-gov-west-1.amazonaws.com"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:region=>"us-gov-west-1", :use_fips=>true, :use_dual_stack=>false}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end end context 'For region us-gov-east-1 with FIPS enabled and DualStack enabled' do let(:expected) do {"endpoint"=>{"url"=>"https://sts-fips.us-gov-east-1.api.aws"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:region=>"us-gov-east-1", :use_fips=>true, :use_dual_stack=>true}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end end context 'For region us-gov-east-1 with FIPS disabled and DualStack enabled' do let(:expected) do {"endpoint"=>{"url"=>"https://sts.us-gov-east-1.api.aws"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:region=>"us-gov-east-1", :use_fips=>false, :use_dual_stack=>true}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end end context 'For region us-iso-east-1 with FIPS disabled and DualStack disabled' do let(:expected) do {"endpoint"=>{"url"=>"https://sts.us-iso-east-1.c2s.ic.gov"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:region=>"us-iso-east-1", :use_fips=>false, :use_dual_stack=>false}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end end context 'For region us-iso-west-1 with FIPS disabled and DualStack disabled' do let(:expected) do {"endpoint"=>{"url"=>"https://sts.us-iso-west-1.c2s.ic.gov"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:region=>"us-iso-west-1", :use_fips=>false, :use_dual_stack=>false}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end end context 'For region us-iso-east-1 with FIPS enabled and DualStack enabled' do let(:expected) do {"error"=>"FIPS and DualStack are enabled, but this partition does not support one or both"} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:region=>"us-iso-east-1", :use_fips=>true, :use_dual_stack=>true}) expect do subject.resolve_endpoint(params) end.to raise_error(ArgumentError, expected['error']) end end context 'For region us-iso-east-1 with FIPS enabled and DualStack disabled' do let(:expected) do {"endpoint"=>{"url"=>"https://sts-fips.us-iso-east-1.c2s.ic.gov"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:region=>"us-iso-east-1", :use_fips=>true, :use_dual_stack=>false}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end end context 'For region us-iso-east-1 with FIPS disabled and DualStack enabled' do let(:expected) do {"error"=>"DualStack is enabled but this partition does not support DualStack"} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:region=>"us-iso-east-1", :use_fips=>false, :use_dual_stack=>true}) expect do subject.resolve_endpoint(params) end.to raise_error(ArgumentError, expected['error']) end end context 'For region us-isob-east-1 with FIPS disabled and DualStack disabled' do let(:expected) do {"endpoint"=>{"url"=>"https://sts.us-isob-east-1.sc2s.sgov.gov"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:region=>"us-isob-east-1", :use_fips=>false, :use_dual_stack=>false}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end end context 'For region us-isob-east-1 with FIPS enabled and DualStack enabled' do let(:expected) do {"error"=>"FIPS and DualStack are enabled, but this partition does not support one or both"} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:region=>"us-isob-east-1", :use_fips=>true, :use_dual_stack=>true}) expect do subject.resolve_endpoint(params) end.to raise_error(ArgumentError, expected['error']) end end context 'For region us-isob-east-1 with FIPS enabled and DualStack disabled' do let(:expected) do {"endpoint"=>{"url"=>"https://sts-fips.us-isob-east-1.sc2s.sgov.gov"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:region=>"us-isob-east-1", :use_fips=>true, :use_dual_stack=>false}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end end context 'For region us-isob-east-1 with FIPS disabled and DualStack enabled' do let(:expected) do {"error"=>"DualStack is enabled but this partition does not support DualStack"} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:region=>"us-isob-east-1", :use_fips=>false, :use_dual_stack=>true}) expect do subject.resolve_endpoint(params) end.to raise_error(ArgumentError, expected['error']) end end context 'For custom endpoint with region set and fips disabled and dualstack disabled' do let(:expected) do {"endpoint"=>{"url"=>"https://example.com"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:region=>"us-east-1", :use_fips=>false, :use_dual_stack=>false, :endpoint=>"https://example.com"}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end end context 'For custom endpoint with region not set and fips disabled and dualstack disabled' do let(:expected) do {"endpoint"=>{"url"=>"https://example.com"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:use_fips=>false, :use_dual_stack=>false, :endpoint=>"https://example.com"}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end end context 'For custom endpoint with fips enabled and dualstack disabled' do let(:expected) do {"error"=>"Invalid Configuration: FIPS and custom endpoint are not supported"} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:region=>"us-east-1", :use_fips=>true, :use_dual_stack=>false, :endpoint=>"https://example.com"}) expect do subject.resolve_endpoint(params) end.to raise_error(ArgumentError, expected['error']) end end context 'For custom endpoint with fips disabled and dualstack enabled' do let(:expected) do {"error"=>"Invalid Configuration: Dualstack and custom endpoint are not supported"} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:region=>"us-east-1", :use_fips=>false, :use_dual_stack=>true, :endpoint=>"https://example.com"}) expect do subject.resolve_endpoint(params) end.to raise_error(ArgumentError, expected['error']) end end context 'Missing region' do let(:expected) do {"error"=>"Invalid Configuration: Missing Region"} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{}) expect do subject.resolve_endpoint(params) end.to raise_error(ArgumentError, expected['error']) end end context 'UseGlobalEndpoint with legacy region `ap-northeast-1`' do let(:expected) do {"endpoint"=>{"properties"=>{"authSchemes"=>[{"signingName"=>"sts", "name"=>"sigv4", "signingRegion"=>"us-east-1"}]}, "url"=>"https://sts.amazonaws.com"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:use_global_endpoint=>true, :use_dual_stack=>false, :use_fips=>false, :region=>"ap-northeast-1"}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end it 'produces the correct output from the client when calling get_caller_identity' do client = Client.new( region: 'ap-northeast-1', sts_regional_endpoints: 'legacy', stub_responses: true ) expect_auth({"signingName"=>"sts", "name"=>"sigv4", "signingRegion"=>"us-east-1"}) resp = client.get_caller_identity( ) expected_uri = URI.parse(expected['endpoint']['url']) expect(resp.context.http_request.endpoint.to_s).to include(expected_uri.host) expect(resp.context.http_request.endpoint.to_s).to include(expected_uri.scheme) expect(resp.context.http_request.endpoint.to_s).to include(expected_uri.path) end end context 'UseGlobalEndpoint with legacy region `ap-south-1`' do let(:expected) do {"endpoint"=>{"properties"=>{"authSchemes"=>[{"signingName"=>"sts", "name"=>"sigv4", "signingRegion"=>"us-east-1"}]}, "url"=>"https://sts.amazonaws.com"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:use_global_endpoint=>true, :use_dual_stack=>false, :use_fips=>false, :region=>"ap-south-1"}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end it 'produces the correct output from the client when calling get_caller_identity' do client = Client.new( region: 'ap-south-1', sts_regional_endpoints: 'legacy', stub_responses: true ) expect_auth({"signingName"=>"sts", "name"=>"sigv4", "signingRegion"=>"us-east-1"}) resp = client.get_caller_identity( ) expected_uri = URI.parse(expected['endpoint']['url']) expect(resp.context.http_request.endpoint.to_s).to include(expected_uri.host) expect(resp.context.http_request.endpoint.to_s).to include(expected_uri.scheme) expect(resp.context.http_request.endpoint.to_s).to include(expected_uri.path) end end context 'UseGlobalEndpoint with legacy region `ap-southeast-1`' do let(:expected) do {"endpoint"=>{"properties"=>{"authSchemes"=>[{"signingName"=>"sts", "name"=>"sigv4", "signingRegion"=>"us-east-1"}]}, "url"=>"https://sts.amazonaws.com"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:use_global_endpoint=>true, :use_dual_stack=>false, :use_fips=>false, :region=>"ap-southeast-1"}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end it 'produces the correct output from the client when calling get_caller_identity' do client = Client.new( region: 'ap-southeast-1', sts_regional_endpoints: 'legacy', stub_responses: true ) expect_auth({"signingName"=>"sts", "name"=>"sigv4", "signingRegion"=>"us-east-1"}) resp = client.get_caller_identity( ) expected_uri = URI.parse(expected['endpoint']['url']) expect(resp.context.http_request.endpoint.to_s).to include(expected_uri.host) expect(resp.context.http_request.endpoint.to_s).to include(expected_uri.scheme) expect(resp.context.http_request.endpoint.to_s).to include(expected_uri.path) end end context 'UseGlobalEndpoint with legacy region `ap-southeast-2`' do let(:expected) do {"endpoint"=>{"properties"=>{"authSchemes"=>[{"signingName"=>"sts", "name"=>"sigv4", "signingRegion"=>"us-east-1"}]}, "url"=>"https://sts.amazonaws.com"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:use_global_endpoint=>true, :use_dual_stack=>false, :use_fips=>false, :region=>"ap-southeast-2"}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end it 'produces the correct output from the client when calling get_caller_identity' do client = Client.new( region: 'ap-southeast-2', sts_regional_endpoints: 'legacy', stub_responses: true ) expect_auth({"signingName"=>"sts", "name"=>"sigv4", "signingRegion"=>"us-east-1"}) resp = client.get_caller_identity( ) expected_uri = URI.parse(expected['endpoint']['url']) expect(resp.context.http_request.endpoint.to_s).to include(expected_uri.host) expect(resp.context.http_request.endpoint.to_s).to include(expected_uri.scheme) expect(resp.context.http_request.endpoint.to_s).to include(expected_uri.path) end end context 'UseGlobalEndpoint with legacy region `aws-global`' do let(:expected) do {"endpoint"=>{"properties"=>{"authSchemes"=>[{"signingName"=>"sts", "name"=>"sigv4", "signingRegion"=>"us-east-1"}]}, "url"=>"https://sts.amazonaws.com"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:use_global_endpoint=>true, :use_dual_stack=>false, :use_fips=>false, :region=>"aws-global"}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end it 'produces the correct output from the client when calling get_caller_identity' do client = Client.new( region: 'aws-global', sts_regional_endpoints: 'legacy', stub_responses: true ) expect_auth({"signingName"=>"sts", "name"=>"sigv4", "signingRegion"=>"us-east-1"}) resp = client.get_caller_identity( ) expected_uri = URI.parse(expected['endpoint']['url']) expect(resp.context.http_request.endpoint.to_s).to include(expected_uri.host) expect(resp.context.http_request.endpoint.to_s).to include(expected_uri.scheme) expect(resp.context.http_request.endpoint.to_s).to include(expected_uri.path) end end context 'UseGlobalEndpoint with legacy region `ca-central-1`' do let(:expected) do {"endpoint"=>{"properties"=>{"authSchemes"=>[{"signingName"=>"sts", "name"=>"sigv4", "signingRegion"=>"us-east-1"}]}, "url"=>"https://sts.amazonaws.com"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:use_global_endpoint=>true, :use_dual_stack=>false, :use_fips=>false, :region=>"ca-central-1"}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end it 'produces the correct output from the client when calling get_caller_identity' do client = Client.new( region: 'ca-central-1', sts_regional_endpoints: 'legacy', stub_responses: true ) expect_auth({"signingName"=>"sts", "name"=>"sigv4", "signingRegion"=>"us-east-1"}) resp = client.get_caller_identity( ) expected_uri = URI.parse(expected['endpoint']['url']) expect(resp.context.http_request.endpoint.to_s).to include(expected_uri.host) expect(resp.context.http_request.endpoint.to_s).to include(expected_uri.scheme) expect(resp.context.http_request.endpoint.to_s).to include(expected_uri.path) end end context 'UseGlobalEndpoint with legacy region `eu-central-1`' do let(:expected) do {"endpoint"=>{"properties"=>{"authSchemes"=>[{"signingName"=>"sts", "name"=>"sigv4", "signingRegion"=>"us-east-1"}]}, "url"=>"https://sts.amazonaws.com"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:use_global_endpoint=>true, :use_dual_stack=>false, :use_fips=>false, :region=>"eu-central-1"}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end it 'produces the correct output from the client when calling get_caller_identity' do client = Client.new( region: 'eu-central-1', sts_regional_endpoints: 'legacy', stub_responses: true ) expect_auth({"signingName"=>"sts", "name"=>"sigv4", "signingRegion"=>"us-east-1"}) resp = client.get_caller_identity( ) expected_uri = URI.parse(expected['endpoint']['url']) expect(resp.context.http_request.endpoint.to_s).to include(expected_uri.host) expect(resp.context.http_request.endpoint.to_s).to include(expected_uri.scheme) expect(resp.context.http_request.endpoint.to_s).to include(expected_uri.path) end end context 'UseGlobalEndpoint with legacy region `eu-north-1`' do let(:expected) do {"endpoint"=>{"properties"=>{"authSchemes"=>[{"signingName"=>"sts", "name"=>"sigv4", "signingRegion"=>"us-east-1"}]}, "url"=>"https://sts.amazonaws.com"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:use_global_endpoint=>true, :use_dual_stack=>false, :use_fips=>false, :region=>"eu-north-1"}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end it 'produces the correct output from the client when calling get_caller_identity' do client = Client.new( region: 'eu-north-1', sts_regional_endpoints: 'legacy', stub_responses: true ) expect_auth({"signingName"=>"sts", "name"=>"sigv4", "signingRegion"=>"us-east-1"}) resp = client.get_caller_identity( ) expected_uri = URI.parse(expected['endpoint']['url']) expect(resp.context.http_request.endpoint.to_s).to include(expected_uri.host) expect(resp.context.http_request.endpoint.to_s).to include(expected_uri.scheme) expect(resp.context.http_request.endpoint.to_s).to include(expected_uri.path) end end context 'UseGlobalEndpoint with legacy region `eu-west-1`' do let(:expected) do {"endpoint"=>{"properties"=>{"authSchemes"=>[{"signingName"=>"sts", "name"=>"sigv4", "signingRegion"=>"us-east-1"}]}, "url"=>"https://sts.amazonaws.com"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:use_global_endpoint=>true, :use_dual_stack=>false, :use_fips=>false, :region=>"eu-west-1"}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end it 'produces the correct output from the client when calling get_caller_identity' do client = Client.new( region: 'eu-west-1', sts_regional_endpoints: 'legacy', stub_responses: true ) expect_auth({"signingName"=>"sts", "name"=>"sigv4", "signingRegion"=>"us-east-1"}) resp = client.get_caller_identity( ) expected_uri = URI.parse(expected['endpoint']['url']) expect(resp.context.http_request.endpoint.to_s).to include(expected_uri.host) expect(resp.context.http_request.endpoint.to_s).to include(expected_uri.scheme) expect(resp.context.http_request.endpoint.to_s).to include(expected_uri.path) end end context 'UseGlobalEndpoint with legacy region `eu-west-2`' do let(:expected) do {"endpoint"=>{"properties"=>{"authSchemes"=>[{"signingName"=>"sts", "name"=>"sigv4", "signingRegion"=>"us-east-1"}]}, "url"=>"https://sts.amazonaws.com"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:use_global_endpoint=>true, :use_dual_stack=>false, :use_fips=>false, :region=>"eu-west-2"}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end it 'produces the correct output from the client when calling get_caller_identity' do client = Client.new( region: 'eu-west-2', sts_regional_endpoints: 'legacy', stub_responses: true ) expect_auth({"signingName"=>"sts", "name"=>"sigv4", "signingRegion"=>"us-east-1"}) resp = client.get_caller_identity( ) expected_uri = URI.parse(expected['endpoint']['url']) expect(resp.context.http_request.endpoint.to_s).to include(expected_uri.host) expect(resp.context.http_request.endpoint.to_s).to include(expected_uri.scheme) expect(resp.context.http_request.endpoint.to_s).to include(expected_uri.path) end end context 'UseGlobalEndpoint with legacy region `eu-west-3`' do let(:expected) do {"endpoint"=>{"properties"=>{"authSchemes"=>[{"signingName"=>"sts", "name"=>"sigv4", "signingRegion"=>"us-east-1"}]}, "url"=>"https://sts.amazonaws.com"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:use_global_endpoint=>true, :use_dual_stack=>false, :use_fips=>false, :region=>"eu-west-3"}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end it 'produces the correct output from the client when calling get_caller_identity' do client = Client.new( region: 'eu-west-3', sts_regional_endpoints: 'legacy', stub_responses: true ) expect_auth({"signingName"=>"sts", "name"=>"sigv4", "signingRegion"=>"us-east-1"}) resp = client.get_caller_identity( ) expected_uri = URI.parse(expected['endpoint']['url']) expect(resp.context.http_request.endpoint.to_s).to include(expected_uri.host) expect(resp.context.http_request.endpoint.to_s).to include(expected_uri.scheme) expect(resp.context.http_request.endpoint.to_s).to include(expected_uri.path) end end context 'UseGlobalEndpoint with legacy region `sa-east-1`' do let(:expected) do {"endpoint"=>{"properties"=>{"authSchemes"=>[{"signingName"=>"sts", "name"=>"sigv4", "signingRegion"=>"us-east-1"}]}, "url"=>"https://sts.amazonaws.com"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:use_global_endpoint=>true, :use_dual_stack=>false, :use_fips=>false, :region=>"sa-east-1"}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end it 'produces the correct output from the client when calling get_caller_identity' do client = Client.new( region: 'sa-east-1', sts_regional_endpoints: 'legacy', stub_responses: true ) expect_auth({"signingName"=>"sts", "name"=>"sigv4", "signingRegion"=>"us-east-1"}) resp = client.get_caller_identity( ) expected_uri = URI.parse(expected['endpoint']['url']) expect(resp.context.http_request.endpoint.to_s).to include(expected_uri.host) expect(resp.context.http_request.endpoint.to_s).to include(expected_uri.scheme) expect(resp.context.http_request.endpoint.to_s).to include(expected_uri.path) end end context 'UseGlobalEndpoint with legacy region `us-east-1`' do let(:expected) do {"endpoint"=>{"properties"=>{"authSchemes"=>[{"signingName"=>"sts", "name"=>"sigv4", "signingRegion"=>"us-east-1"}]}, "url"=>"https://sts.amazonaws.com"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:use_global_endpoint=>true, :use_dual_stack=>false, :use_fips=>false, :region=>"us-east-1"}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end it 'produces the correct output from the client when calling get_caller_identity' do client = Client.new( region: 'us-east-1', sts_regional_endpoints: 'legacy', stub_responses: true ) expect_auth({"signingName"=>"sts", "name"=>"sigv4", "signingRegion"=>"us-east-1"}) resp = client.get_caller_identity( ) expected_uri = URI.parse(expected['endpoint']['url']) expect(resp.context.http_request.endpoint.to_s).to include(expected_uri.host) expect(resp.context.http_request.endpoint.to_s).to include(expected_uri.scheme) expect(resp.context.http_request.endpoint.to_s).to include(expected_uri.path) end end context 'UseGlobalEndpoint with legacy region `us-east-2`' do let(:expected) do {"endpoint"=>{"properties"=>{"authSchemes"=>[{"signingName"=>"sts", "name"=>"sigv4", "signingRegion"=>"us-east-1"}]}, "url"=>"https://sts.amazonaws.com"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:use_global_endpoint=>true, :use_dual_stack=>false, :use_fips=>false, :region=>"us-east-2"}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end it 'produces the correct output from the client when calling get_caller_identity' do client = Client.new( region: 'us-east-2', sts_regional_endpoints: 'legacy', stub_responses: true ) expect_auth({"signingName"=>"sts", "name"=>"sigv4", "signingRegion"=>"us-east-1"}) resp = client.get_caller_identity( ) expected_uri = URI.parse(expected['endpoint']['url']) expect(resp.context.http_request.endpoint.to_s).to include(expected_uri.host) expect(resp.context.http_request.endpoint.to_s).to include(expected_uri.scheme) expect(resp.context.http_request.endpoint.to_s).to include(expected_uri.path) end end context 'UseGlobalEndpoint with legacy region `us-west-1`' do let(:expected) do {"endpoint"=>{"properties"=>{"authSchemes"=>[{"signingName"=>"sts", "name"=>"sigv4", "signingRegion"=>"us-east-1"}]}, "url"=>"https://sts.amazonaws.com"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:use_global_endpoint=>true, :use_dual_stack=>false, :use_fips=>false, :region=>"us-west-1"}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end it 'produces the correct output from the client when calling get_caller_identity' do client = Client.new( region: 'us-west-1', sts_regional_endpoints: 'legacy', stub_responses: true ) expect_auth({"signingName"=>"sts", "name"=>"sigv4", "signingRegion"=>"us-east-1"}) resp = client.get_caller_identity( ) expected_uri = URI.parse(expected['endpoint']['url']) expect(resp.context.http_request.endpoint.to_s).to include(expected_uri.host) expect(resp.context.http_request.endpoint.to_s).to include(expected_uri.scheme) expect(resp.context.http_request.endpoint.to_s).to include(expected_uri.path) end end context 'UseGlobalEndpoint with legacy region `us-west-2`' do let(:expected) do {"endpoint"=>{"properties"=>{"authSchemes"=>[{"signingName"=>"sts", "name"=>"sigv4", "signingRegion"=>"us-east-1"}]}, "url"=>"https://sts.amazonaws.com"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:use_global_endpoint=>true, :use_dual_stack=>false, :use_fips=>false, :region=>"us-west-2"}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end it 'produces the correct output from the client when calling get_caller_identity' do client = Client.new( region: 'us-west-2', sts_regional_endpoints: 'legacy', stub_responses: true ) expect_auth({"signingName"=>"sts", "name"=>"sigv4", "signingRegion"=>"us-east-1"}) resp = client.get_caller_identity( ) expected_uri = URI.parse(expected['endpoint']['url']) expect(resp.context.http_request.endpoint.to_s).to include(expected_uri.host) expect(resp.context.http_request.endpoint.to_s).to include(expected_uri.scheme) expect(resp.context.http_request.endpoint.to_s).to include(expected_uri.path) end end context 'UseGlobalEndpoint with Non-legacy region `us-east-3`' do let(:expected) do {"endpoint"=>{"properties"=>{"authSchemes"=>[{"signingName"=>"sts", "name"=>"sigv4", "signingRegion"=>"us-east-3"}]}, "url"=>"https://sts.us-east-3.amazonaws.com"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:use_global_endpoint=>true, :use_dual_stack=>false, :use_fips=>false, :region=>"us-east-3"}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end it 'produces the correct output from the client when calling get_caller_identity' do client = Client.new( region: 'us-east-3', sts_regional_endpoints: 'legacy', stub_responses: true ) expect_auth({"signingName"=>"sts", "name"=>"sigv4", "signingRegion"=>"us-east-3"}) resp = client.get_caller_identity( ) expected_uri = URI.parse(expected['endpoint']['url']) expect(resp.context.http_request.endpoint.to_s).to include(expected_uri.host) expect(resp.context.http_request.endpoint.to_s).to include(expected_uri.scheme) expect(resp.context.http_request.endpoint.to_s).to include(expected_uri.path) end end context 'UseGlobalEndpoint with legacy region and custom endpoint' do let(:expected) do {"endpoint"=>{"url"=>"https://example.com"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:use_global_endpoint=>true, :use_dual_stack=>false, :use_fips=>false, :region=>"us-west-1", :endpoint=>"https://example.com"}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end it 'produces the correct output from the client when calling get_caller_identity' do client = Client.new( region: 'us-west-1', sts_regional_endpoints: 'legacy', endpoint: 'https://example.com', stub_responses: true ) resp = client.get_caller_identity( ) expected_uri = URI.parse(expected['endpoint']['url']) expect(resp.context.http_request.endpoint.to_s).to include(expected_uri.host) expect(resp.context.http_request.endpoint.to_s).to include(expected_uri.scheme) expect(resp.context.http_request.endpoint.to_s).to include(expected_uri.path) end end context 'UseGlobalEndpoint with unset region and custom endpoint' do let(:expected) do {"endpoint"=>{"url"=>"https://example.com"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:endpoint=>"https://example.com", :use_global_endpoint=>false, :use_dual_stack=>false, :use_fips=>false}) endpoint = subject.resolve_endpoint(params) expect(endpoint.url).to eq(expected['endpoint']['url']) expect(endpoint.headers).to eq(expected['endpoint']['headers'] || {}) expect(endpoint.properties).to eq(expected['endpoint']['properties'] || {}) end end end end