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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
# File 'gems/aws-sdk-cloudfrontkeyvaluestore/lib/aws-sdk-cloudfrontkeyvaluestore/endpoint_provider.rb', line 12
def resolve_endpoint(parameters)
if Aws::Endpoints::Matchers.set?(parameters.kvs_arn)
if (parsed_arn = Aws::Endpoints::Matchers.aws_parse_arn(parameters.kvs_arn))
if Aws::Endpoints::Matchers.string_equals?(Aws::Endpoints::Matchers.attr(parsed_arn, "service"), "cloudfront")
if Aws::Endpoints::Matchers.string_equals?(Aws::Endpoints::Matchers.attr(parsed_arn, "region"), "")
if (arn_type = Aws::Endpoints::Matchers.attr(parsed_arn, "resourceId[0]"))
if Aws::Endpoints::Matchers.not(Aws::Endpoints::Matchers.string_equals?(arn_type, ""))
if Aws::Endpoints::Matchers.string_equals?(arn_type, "key-value-store")
if Aws::Endpoints::Matchers.string_equals?(Aws::Endpoints::Matchers.attr(parsed_arn, "partition"), "aws")
if Aws::Endpoints::Matchers.set?(parameters.region)
if (partition_result = Aws::Endpoints::Matchers.aws_partition(parameters.region))
if Aws::Endpoints::Matchers.string_equals?(Aws::Endpoints::Matchers.attr(partition_result, "name"), "#{parsed_arn['partition']}")
if Aws::Endpoints::Matchers.set?(parameters.endpoint)
if Aws::Endpoints::Matchers.boolean_equals?(parameters.use_fips, false)
if (url = Aws::Endpoints::Matchers.parse_url(parameters.endpoint))
return Aws::Endpoints::Endpoint.new(url: "#{url['scheme']}://#{parsed_arn['accountId']}.#{url['authority']}#{url['path']}", headers: {}, properties: {"authSchemes" => [{"name" => "sigv4a", "signingName" => "cloudfront-keyvaluestore", "signingRegionSet" => ["*"]}]})
end
raise ArgumentError, "Provided endpoint is not a valid URL"
end
raise ArgumentError, "Invalid Configuration: FIPS and custom endpoint are not supported"
end
return Aws::Endpoints::Endpoint.new(url: "https://#{parsed_arn['accountId']}.cloudfront-kvs.global.api.aws", headers: {}, properties: {"authSchemes" => [{"name" => "sigv4a", "signingName" => "cloudfront-keyvaluestore", "signingRegionSet" => ["*"]}]})
end
raise ArgumentError, "Client was configured for partition `#{partition_result['name']}` but Kvs ARN has `#{parsed_arn['partition']}`"
end
raise ArgumentError, "A valid partition could not be determined"
end
if Aws::Endpoints::Matchers.set?(parameters.endpoint)
if Aws::Endpoints::Matchers.boolean_equals?(parameters.use_fips, false)
if (url = Aws::Endpoints::Matchers.parse_url(parameters.endpoint))
return Aws::Endpoints::Endpoint.new(url: "#{url['scheme']}://#{parsed_arn['accountId']}.#{url['authority']}#{url['path']}", headers: {}, properties: {"authSchemes" => [{"name" => "sigv4a", "signingName" => "cloudfront-keyvaluestore", "signingRegionSet" => ["*"]}]})
end
raise ArgumentError, "Provided endpoint is not a valid URL"
end
raise ArgumentError, "Invalid Configuration: FIPS and custom endpoint are not supported"
end
return Aws::Endpoints::Endpoint.new(url: "https://#{parsed_arn['accountId']}.cloudfront-kvs.global.api.aws", headers: {}, properties: {"authSchemes" => [{"name" => "sigv4a", "signingName" => "cloudfront-keyvaluestore", "signingRegionSet" => ["*"]}]})
end
if Aws::Endpoints::Matchers.string_equals?(Aws::Endpoints::Matchers.attr(parsed_arn, "partition"), "aws-eusc")
if Aws::Endpoints::Matchers.boolean_equals?(parameters.use_fips, false)
if Aws::Endpoints::Matchers.set?(parameters.region)
if (partition_result = Aws::Endpoints::Matchers.aws_partition(parameters.region))
if Aws::Endpoints::Matchers.string_equals?(Aws::Endpoints::Matchers.attr(partition_result, "name"), "#{parsed_arn['partition']}")
if Aws::Endpoints::Matchers.set?(parameters.endpoint)
if (url = Aws::Endpoints::Matchers.parse_url(parameters.endpoint))
return Aws::Endpoints::Endpoint.new(url: "#{url['scheme']}://#{parsed_arn['accountId']}.#{url['authority']}#{url['path']}", headers: {}, properties: {"authSchemes" => [{"name" => "sigv4a", "signingName" => "cloudfront-keyvaluestore", "signingRegionSet" => ["*"]}]})
end
raise ArgumentError, "Provided endpoint is not a valid URL"
end
return Aws::Endpoints::Endpoint.new(url: "https://#{parsed_arn['accountId']}.cloudfront-kvs.global.api.amazonwebservices.eu", headers: {}, properties: {"authSchemes" => [{"name" => "sigv4a", "signingName" => "cloudfront-keyvaluestore", "signingRegionSet" => ["*"]}]})
end
raise ArgumentError, "Client was configured for partition `#{partition_result['name']}` but Kvs ARN has `#{parsed_arn['partition']}`"
end
raise ArgumentError, "A valid partition could not be determined"
end
if Aws::Endpoints::Matchers.set?(parameters.endpoint)
if (url = Aws::Endpoints::Matchers.parse_url(parameters.endpoint))
return Aws::Endpoints::Endpoint.new(url: "#{url['scheme']}://#{parsed_arn['accountId']}.#{url['authority']}#{url['path']}", headers: {}, properties: {"authSchemes" => [{"name" => "sigv4a", "signingName" => "cloudfront-keyvaluestore", "signingRegionSet" => ["*"]}]})
end
raise ArgumentError, "Provided endpoint is not a valid URL"
end
return Aws::Endpoints::Endpoint.new(url: "https://#{parsed_arn['accountId']}.cloudfront-kvs.global.api.amazonwebservices.eu", headers: {}, properties: {"authSchemes" => [{"name" => "sigv4a", "signingName" => "cloudfront-keyvaluestore", "signingRegionSet" => ["*"]}]})
end
raise ArgumentError, "Invalid Configuration: FIPS is not supported with CloudFront-KeyValueStore."
end
raise ArgumentError, "CloudFront-KeyValueStore is not supported in partition `#{parsed_arn['partition']}`"
end
raise ArgumentError, "ARN resource type is invalid. Expected `key-value-store`, found: `#{arn_type}`"
end
raise ArgumentError, "No resource type found in the KVS ARN. Resource type must be `key-value-store`."
end
raise ArgumentError, "No resource type found in the KVS ARN. Resource type must be `key-value-store`."
end
raise ArgumentError, "Provided ARN must be a global resource ARN. Found: `#{parsed_arn['region']}`"
end
raise ArgumentError, "Provided ARN is not a valid CloudFront Service ARN. Found: `#{parsed_arn['service']}`"
end
raise ArgumentError, "KVS ARN must be a valid ARN"
end
raise ArgumentError, "KVS ARN must be provided to use this service"
raise ArgumentError, 'No endpoint could be resolved'
end
|