# 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::VerifiedPermissions describe EndpointProvider do subject { Aws::VerifiedPermissions::EndpointProvider.new } context 'For region us-gov-east-1 with FIPS enabled and DualStack enabled' do let(:expected) do {"endpoint"=>{"url"=>"https://verifiedpermissions-fips.us-gov-east-1.api.aws"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:use_fips=>true, :use_dual_stack=>true, :region=>"us-gov-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 end context 'For region us-gov-east-1 with FIPS enabled and DualStack disabled' do let(:expected) do {"endpoint"=>{"url"=>"https://verifiedpermissions-fips.us-gov-east-1.amazonaws.com"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:use_fips=>true, :use_dual_stack=>false, :region=>"us-gov-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 end context 'For region us-gov-east-1 with FIPS disabled and DualStack enabled' do let(:expected) do {"endpoint"=>{"url"=>"https://verifiedpermissions.us-gov-east-1.api.aws"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:use_fips=>false, :use_dual_stack=>true, :region=>"us-gov-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 end context 'For region us-gov-east-1 with FIPS disabled and DualStack disabled' do let(:expected) do {"endpoint"=>{"url"=>"https://verifiedpermissions.us-gov-east-1.amazonaws.com"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:use_fips=>false, :use_dual_stack=>false, :region=>"us-gov-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 end context 'For region cn-north-1 with FIPS enabled and DualStack enabled' do let(:expected) do {"endpoint"=>{"url"=>"https://verifiedpermissions-fips.cn-north-1.api.amazonwebservices.com.cn"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:use_fips=>true, :use_dual_stack=>true, :region=>"cn-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 end context 'For region cn-north-1 with FIPS enabled and DualStack disabled' do let(:expected) do {"endpoint"=>{"url"=>"https://verifiedpermissions-fips.cn-north-1.amazonaws.com.cn"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:use_fips=>true, :use_dual_stack=>false, :region=>"cn-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 end context 'For region cn-north-1 with FIPS disabled and DualStack enabled' do let(:expected) do {"endpoint"=>{"url"=>"https://verifiedpermissions.cn-north-1.api.amazonwebservices.com.cn"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:use_fips=>false, :use_dual_stack=>true, :region=>"cn-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 end context 'For region cn-north-1 with FIPS disabled and DualStack disabled' do let(:expected) do {"endpoint"=>{"url"=>"https://verifiedpermissions.cn-north-1.amazonaws.com.cn"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:use_fips=>false, :use_dual_stack=>false, :region=>"cn-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 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(**{:use_fips=>true, :use_dual_stack=>true, :region=>"us-iso-east-1"}) 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://verifiedpermissions-fips.us-iso-east-1.c2s.ic.gov"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:use_fips=>true, :use_dual_stack=>false, :region=>"us-iso-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 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(**{:use_fips=>false, :use_dual_stack=>true, :region=>"us-iso-east-1"}) expect do subject.resolve_endpoint(params) end.to raise_error(ArgumentError, expected['error']) end end context 'For region us-iso-east-1 with FIPS disabled and DualStack disabled' do let(:expected) do {"endpoint"=>{"url"=>"https://verifiedpermissions.us-iso-east-1.c2s.ic.gov"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:use_fips=>false, :use_dual_stack=>false, :region=>"us-iso-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 end context 'For region us-east-1 with FIPS enabled and DualStack enabled' do let(:expected) do {"endpoint"=>{"url"=>"https://verifiedpermissions-fips.us-east-1.api.aws"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:use_fips=>true, :use_dual_stack=>true, :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 end context 'For region us-east-1 with FIPS enabled and DualStack disabled' do let(:expected) do {"endpoint"=>{"url"=>"https://verifiedpermissions-fips.us-east-1.amazonaws.com"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:use_fips=>true, :use_dual_stack=>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 end context 'For region us-east-1 with FIPS disabled and DualStack enabled' do let(:expected) do {"endpoint"=>{"url"=>"https://verifiedpermissions.us-east-1.api.aws"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:use_fips=>false, :use_dual_stack=>true, :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 end context 'For region us-east-1 with FIPS disabled and DualStack disabled' do let(:expected) do {"endpoint"=>{"url"=>"https://verifiedpermissions.us-east-1.amazonaws.com"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:use_fips=>false, :use_dual_stack=>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 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(**{:use_fips=>true, :use_dual_stack=>true, :region=>"us-isob-east-1"}) 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://verifiedpermissions-fips.us-isob-east-1.sc2s.sgov.gov"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:use_fips=>true, :use_dual_stack=>false, :region=>"us-isob-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 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(**{:use_fips=>false, :use_dual_stack=>true, :region=>"us-isob-east-1"}) 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://verifiedpermissions.us-isob-east-1.sc2s.sgov.gov"}} end it 'produces the expected output from the EndpointProvider' do params = EndpointParameters.new(**{:use_fips=>false, :use_dual_stack=>false, :region=>"us-isob-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 end context 'For custom endpoint with 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, :region=>"us-east-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 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(**{:use_fips=>true, :use_dual_stack=>false, :region=>"us-east-1", :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(**{:use_fips=>false, :use_dual_stack=>true, :region=>"us-east-1", :endpoint=>"https://example.com"}) expect do subject.resolve_endpoint(params) end.to raise_error(ArgumentError, expected['error']) end end end end