summaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@mariadb.com>2016-10-28 20:37:18 +0200
committerVladislav Vaintroub <wlad@mariadb.com>2016-10-28 20:43:32 +0200
commitc1bbedbd4a20a8bd9354296244b6ec6263b29c6b (patch)
treee5c20d01ed47313050df9e5f0d803bdc375be5cb /plugin
parentea0ae42d8324f6210b95a38bcf76014ce062d1f3 (diff)
downloadmariadb-git-c1bbedbd4a20a8bd9354296244b6ec6263b29c6b.tar.gz
AWS key Management plugin - add plugin variable for the region
AWS C++ SDK always defaults region to us-east-1 for clientConfiguration (ignoring config file or env.variable) This patch introduces a plugin variable 'region' to make it usable for master keys created in regions other than 'us-east-1'.
Diffstat (limited to 'plugin')
-rw-r--r--plugin/aws_key_management/aws_key_management_plugin.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/plugin/aws_key_management/aws_key_management_plugin.cc b/plugin/aws_key_management/aws_key_management_plugin.cc
index 20a795eb437..e94c551bebe 100644
--- a/plugin/aws_key_management/aws_key_management_plugin.cc
+++ b/plugin/aws_key_management/aws_key_management_plugin.cc
@@ -77,6 +77,7 @@ static const char *key_spec_names[]={ "AES_128", "AES_256", 0 };
/* Plugin variables */
static char* master_key_id;
+static char* region;
static unsigned long key_spec;
static unsigned long log_level;
static int rotate_key;
@@ -163,6 +164,10 @@ static int plugin_init(void *p)
InitializeAWSLogging(Aws::MakeShared<MySQLLogSystem>("aws_key_management_plugin", (Aws::Utils::Logging::LogLevel) log_level));
Aws::Client::ClientConfiguration clientConfiguration;
+ if (region && region[0])
+ {
+ clientConfiguration.region = region;
+ }
if (request_timeout)
{
clientConfiguration.requestTimeoutMs= request_timeout;
@@ -585,6 +590,10 @@ static MYSQL_SYSVAR_INT(request_timeout, request_timeout,
"Timeout in milliseconds for create HTTPS connection or execute AWS request. Specify 0 to use SDK default.",
NULL, NULL, 0, 0, INT_MAX, 1);
+static MYSQL_SYSVAR_STR(region, region,
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
+ "AWS region. For example us-east-1, or eu-central-1. If no value provided, SDK default is used.",
+ NULL, NULL, "");
static struct st_mysql_sys_var* settings[]= {
MYSQL_SYSVAR(master_key_id),
@@ -592,6 +601,7 @@ static struct st_mysql_sys_var* settings[]= {
MYSQL_SYSVAR(rotate_key),
MYSQL_SYSVAR(log_level),
MYSQL_SYSVAR(request_timeout),
+ MYSQL_SYSVAR(region),
NULL
};