[Commits] 9dd57f0: AWS key Management plugin - add plugin variable for the region

wlad at mariadb.com wlad at mariadb.com
Fri Oct 28 21:37:37 EEST 2016


revision-id: 9dd57f0907691b9a4953dd8dcd9c415dbedf0685 (mariadb-10.1.17-25-g9dd57f0)
parent(s): 88b3b4fa6d353d1ed346bd1758c5606d328eaec7
author: Vladislav Vaintroub
committer: Vladislav Vaintroub
timestamp: 2016-10-28 20:37:18 +0200
message:

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'.

---
 plugin/aws_key_management/aws_key_management_plugin.cc | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/plugin/aws_key_management/aws_key_management_plugin.cc b/plugin/aws_key_management/aws_key_management_plugin.cc
index 20a795e..e94c551 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
 };
 


More information about the commits mailing list