12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'gems/aws-sdk-agentdiscovery/lib/aws-sdk-agentdiscovery/endpoint_provider.rb', line 12
def resolve_endpoint(parameters)
if Aws::Endpoints::Matchers.set?(parameters.endpoint)
if Aws::Endpoints::Matchers.boolean_equals?(parameters.use_fips, true)
raise ArgumentError, "Invalid Configuration: FIPS and custom endpoint are not supported"
end
if Aws::Endpoints::Matchers.boolean_equals?(parameters.use_dual_stack, true)
raise ArgumentError, "Invalid Configuration: Dualstack and custom endpoint are not supported"
end
return Aws::Endpoints::Endpoint.new(url: parameters.endpoint)
end
if Aws::Endpoints::Matchers.set?(parameters.region) && (partition_result = Aws::Endpoints::Matchers.aws_partition(parameters.region))
if Aws::Endpoints::Matchers.boolean_equals?(parameters.use_fips, true)
raise ArgumentError, "FIPS is enabled but Agent Discovery does not have a FIPS endpoint"
end
if Aws::Endpoints::Matchers.string_equals?(parameters.region, "us-east-1")
return Aws::Endpoints::Endpoint.new(url: "https://agent-discovery.us-east-1.api.aws", properties: {"authSchemes" => [{"name" => "sigv4", "signingName" => "agent-discovery", "signingRegion" => "us-east-1"}]})
end
if Aws::Endpoints::Matchers.string_equals?(parameters.region, "eu-west-1")
return Aws::Endpoints::Endpoint.new(url: "https://agent-discovery.eu-west-1.api.aws", properties: {"authSchemes" => [{"name" => "sigv4", "signingName" => "agent-discovery", "signingRegion" => "eu-west-1"}]})
end
if Aws::Endpoints::Matchers.string_equals?(parameters.region, "ap-northeast-1")
return Aws::Endpoints::Endpoint.new(url: "https://agent-discovery.ap-northeast-1.api.aws", properties: {"authSchemes" => [{"name" => "sigv4", "signingName" => "agent-discovery", "signingRegion" => "ap-northeast-1"}]})
end
if Aws::Endpoints::Matchers.boolean_equals?(parameters.use_dual_stack, true)
return Aws::Endpoints::Endpoint.new(url: "https://agent-discovery.#{parameters.region}.#{partition_result['dualStackDnsSuffix']}")
end
return Aws::Endpoints::Endpoint.new(url: "https://agent-discovery.#{parameters.region}.#{partition_result['dnsSuffix']}")
end
raise ArgumentError, "Invalid Configuration: Missing Region"
raise ArgumentError, 'No endpoint could be resolved'
end
|