diff --git a/com/api.cfc b/com/api.cfc index cda1082..d70ae4d 100644 --- a/com/api.cfc +++ b/com/api.cfc @@ -35,7 +35,8 @@ component accessors="true" { public struct function resolveRequestSettings( struct awsCredentials = { }, string region = defaultRegion, - string bucket = '' + string bucket = '', + string host = '' ) { if ( !awsCredentials.isEmpty() ) { awsCredentials = credentials.defaultCredentials( argumentCollection = awsCredentials ); @@ -44,6 +45,9 @@ component accessors="true" { if ( len( arguments.bucket ) ) { settings.bucket = arguments.bucket; } + if( len( arguments.host )){ + settings.host = arguments.host; + } return settings; } diff --git a/services/ssm.cfc b/services/ssm.cfc index 1552854..263403e 100644 --- a/services/ssm.cfc +++ b/services/ssm.cfc @@ -8,6 +8,7 @@ component { ) { variables.api = arguments.api; variables.apiVersion = arguments.settings.apiVersion; + variables.settings = arguments.settings; return this; } @@ -50,7 +51,12 @@ component { public string function getHost( required string region ) { - return variables.service & '.' & region & '.amazonaws.com'; + if ( structKeyExists( variables.settings, 'host' ) && len( variables.settings.host ) ) { + var host = variables.settings.host; + } else { + var host = variables.service & '.' & region & '.amazonaws.com'; + } + return host; } private any function apiCall( @@ -76,7 +82,12 @@ component { payloadString, requestSettings.awsCredentials ); - apiResponse[ 'data' ] = deserializeJSON( apiResponse.rawData ); + if (isJson(apiResponse.rawData)){ + apiResponse[ 'data' ] = deserializeJSON( apiResponse.rawData ); + }else{ + apiResponse[ 'data' ] = apiResponse.rawData; + } + return apiResponse; }