diff --git a/lib/aws_codegen.ex b/lib/aws_codegen.ex index 858dccf..8fc0483 100644 --- a/lib/aws_codegen.ex +++ b/lib/aws_codegen.ex @@ -27,6 +27,7 @@ defmodule AWS.CodeGen do encode: nil, endpoint_prefix: nil, is_global: false, + hostname: nil, json_version: nil, language: nil, module_name: nil, diff --git a/lib/aws_codegen/post_service.ex b/lib/aws_codegen/post_service.ex index 576ea3e..bcdf314 100644 --- a/lib/aws_codegen/post_service.ex +++ b/lib/aws_codegen/post_service.ex @@ -74,6 +74,11 @@ defmodule AWS.CodeGen.PostService do endpoint_info["endpoints"]["aws-global"]["credentialScope"]["region"] end + hostname = + if is_global do + endpoint_info["endpoints"]["aws-global"]["hostname"] + end + json_version = AWS.CodeGen.Util.get_json_version(service) protocol = spec.protocol |> to_string() content_type = @configuration[protocol][:content_type] @@ -96,6 +101,7 @@ defmodule AWS.CodeGen.PostService do encode: Map.fetch!(@configuration[protocol][language], :encode), endpoint_prefix: endpoint_prefix, is_global: is_global, + hostname: hostname, json_version: json_version, language: language, module_name: spec.module_name, diff --git a/lib/aws_codegen/rest_service.ex b/lib/aws_codegen/rest_service.ex index cfe723e..02d2e50 100644 --- a/lib/aws_codegen/rest_service.ex +++ b/lib/aws_codegen/rest_service.ex @@ -132,6 +132,11 @@ defmodule AWS.CodeGen.RestService do endpoint_info["endpoints"]["aws-global"]["credentialScope"]["region"] end + hostname = + if is_global do + endpoint_info["endpoints"]["aws-global"]["hostname"] + end + signing_name = traits["aws.auth#sigv4"]["name"] || endpoint_prefix %Service{ @@ -144,6 +149,7 @@ defmodule AWS.CodeGen.RestService do encode: Map.fetch!(@configuration[protocol][language], :encode), endpoint_prefix: endpoint_prefix, is_global: is_global, + hostname: hostname, json_version: AWS.CodeGen.Util.get_json_version(service), language: language, module_name: spec.module_name, diff --git a/priv/post.ex.eex b/priv/post.ex.eex index 7d284a7..f839641 100644 --- a/priv/post.ex.eex +++ b/priv/post.ex.eex @@ -58,6 +58,7 @@ defmodule <%= context.module_name %> do credential_scope: <%= inspect(context.credential_scope) %>, endpoint_prefix: <%= inspect(context.endpoint_prefix) %>, global?: <%= inspect(context.is_global) %>, + hostname: <%= inspect(context.hostname) %>, protocol: <%= inspect(context.protocol) %>, service_id: <%= inspect(context.service_id) %>, signature_version: <%= inspect(context.signature_version) %>, diff --git a/priv/rest.ex.eex b/priv/rest.ex.eex index ed83d03..0bf88e3 100644 --- a/priv/rest.ex.eex +++ b/priv/rest.ex.eex @@ -58,6 +58,7 @@ defmodule <%= context.module_name %> do credential_scope: <%= inspect(context.credential_scope) %>, endpoint_prefix: <%= inspect(context.endpoint_prefix) %>, global?: <%= inspect(context.is_global) %>, + hostname: <%= inspect(context.hostname) %>, protocol: <%= inspect(context.protocol) %>, service_id: <%= inspect(context.service_id) %>, signature_version: <%= inspect(context.signature_version) %>, diff --git a/test/aws_codegen_test.exs b/test/aws_codegen_test.exs index 5504e39..bd120e0 100644 --- a/test/aws_codegen_test.exs +++ b/test/aws_codegen_test.exs @@ -213,6 +213,7 @@ defmodule AWS.CodeGenTest do credential_scope: nil, endpoint_prefix: \"cloudtrail-data\", global?: false, + hostname: nil, protocol: \"rest-json\", service_id: \"CloudTrail Data\", signature_version: \"v4\", @@ -448,6 +449,7 @@ defmodule AWS.CodeGenTest do credential_scope: nil, endpoint_prefix: \"cloudtrail-data\", global?: false, + hostname: nil, protocol: \"rest-json\", service_id: \"CloudTrail Data\", signature_version: \"v4\", @@ -690,6 +692,7 @@ defmodule AWS.CodeGenTest do credential_scope: nil, endpoint_prefix: \"cloudtrail-data\", global?: false, + hostname: nil, protocol: \"rest-json\", service_id: \"CloudTrail Data\", signature_version: \"v4\",