Skip to content

Commit

Permalink
Rename from is_serverless to is_aoss_serverless.
Browse files Browse the repository at this point in the history
Signed-off-by: currantw <[email protected]>
  • Loading branch information
currantw committed Nov 19, 2024
1 parent caf9d39 commit 4e55ffe
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 24 deletions.
14 changes: 7 additions & 7 deletions src/sqlodbc/dlg_specific.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void makeConnectString(char *connect_string, const ConnInfo *ci, UWORD len) {
ci->authtype,
ci->region,
ci->tunnel_host,
ci->is_serverless,
ci->is_aoss_serverless,
(int)ci->use_ssl,
(int)ci->verify_server,
(int)ci->drivers.loglevel,
Expand Down Expand Up @@ -136,7 +136,7 @@ BOOL copyConnAttributes(ConnInfo *ci, const char *attribute,
else if (stricmp(attribute, INI_TUNNEL_HOST) == 0)
STRCPY_FIXED(ci->tunnel_host, value);
else if (stricmp(attribute, INI_SERVERLESS_OVERRIDE) == 0)
STRCPY_FIXED(ci->is_serverless, value);
STRCPY_FIXED(ci->is_aoss_serverless, value);
else if (stricmp(attribute, INI_SSL_USE) == 0)
ci->use_ssl = (char)atoi(value);
else if (stricmp(attribute, INI_SSL_HOST_VERIFY) == 0)
Expand Down Expand Up @@ -175,7 +175,7 @@ static void getCiDefaults(ConnInfo *ci) {
strncpy(ci->username, DEFAULT_USERNAME, MEDIUM_REGISTRY_LEN);
strncpy(ci->region, DEFAULT_REGION, MEDIUM_REGISTRY_LEN);
strncpy(ci->tunnel_host, DEFAULT_TUNNEL_HOST, MEDIUM_REGISTRY_LEN);
strncpy(ci->is_serverless, DEFAULT_IS_SERVERLESS, SMALL_REGISTRY_LEN);
strncpy(ci->is_aoss_serverless, DEFAULT_IS_AOSS_SERVERLESS, SMALL_REGISTRY_LEN);
ci->use_ssl = DEFAULT_USE_SSL;
ci->verify_server = DEFAULT_VERIFY_SERVER;
strcpy(ci->drivers.output_dir, "C:\\");
Expand Down Expand Up @@ -287,7 +287,7 @@ void getDSNinfo(ConnInfo *ci, const char *configDrvrname) {
if (SQLGetPrivateProfileString(DSN, INI_SERVERLESS_OVERRIDE, NULL_STRING, temp,
sizeof(temp), ODBC_INI)
> 0)
STRCPY_FIXED(ci->is_serverless, temp);
STRCPY_FIXED(ci->is_aoss_serverless, temp);
if (SQLGetPrivateProfileString(DSN, INI_SSL_USE, NULL_STRING, temp,
sizeof(temp), ODBC_INI)
> 0)
Expand Down Expand Up @@ -343,7 +343,7 @@ void writeDSNinfo(const ConnInfo *ci) {
SQLWritePrivateProfileString(DSN, INI_AUTH_MODE, ci->authtype, ODBC_INI);
SQLWritePrivateProfileString(DSN, INI_REGION, ci->region, ODBC_INI);
SQLWritePrivateProfileString(DSN, INI_TUNNEL_HOST, ci->tunnel_host, ODBC_INI);
SQLWritePrivateProfileString(DSN, INI_SERVERLESS_OVERRIDE, ci->is_serverless, ODBC_INI);
SQLWritePrivateProfileString(DSN, INI_SERVERLESS_OVERRIDE, ci->is_aoss_serverless, ODBC_INI);
ITOA_FIXED(temp, ci->use_ssl);
SQLWritePrivateProfileString(DSN, INI_SSL_USE, temp, ODBC_INI);
ITOA_FIXED(temp, ci->verify_server);
Expand Down Expand Up @@ -495,7 +495,7 @@ void CC_conninfo_init(ConnInfo *conninfo, UInt4 option) {
strncpy(conninfo->username, DEFAULT_USERNAME, MEDIUM_REGISTRY_LEN);
strncpy(conninfo->region, DEFAULT_REGION, MEDIUM_REGISTRY_LEN);
strncpy(conninfo->tunnel_host, DEFAULT_TUNNEL_HOST, MEDIUM_REGISTRY_LEN);
strncpy(conninfo->is_serverless, DEFAULT_IS_SERVERLESS, SMALL_REGISTRY_LEN);
strncpy(conninfo->is_aoss_serverless, DEFAULT_IS_AOSS_SERVERLESS, SMALL_REGISTRY_LEN);
conninfo->use_ssl = DEFAULT_USE_SSL;
conninfo->verify_server = DEFAULT_VERIFY_SERVER;

Expand Down Expand Up @@ -537,7 +537,7 @@ void CC_copy_conninfo(ConnInfo *ci, const ConnInfo *sci) {
CORR_STRCPY(authtype);
CORR_STRCPY(region);
CORR_STRCPY(tunnel_host);
CORR_STRCPY(is_serverless);
CORR_STRCPY(is_aoss_serverless);
NAME_TO_NAME(ci->password, sci->password);
CORR_VALCPY(use_ssl);
CORR_VALCPY(verify_server);
Expand Down
2 changes: 1 addition & 1 deletion src/sqlodbc/dlg_specific.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ extern "C" {
#define DEFAULT_DESC ""
#define DEFAULT_DSN ""
#define DEFAULT_VERIFY_SERVER 1
#define DEFAULT_IS_SERVERLESS ""
#define DEFAULT_IS_AOSS_SERVERLESS ""

#define AUTHTYPE_NONE "NONE"
#define AUTHTYPE_BASIC "BASIC"
Expand Down
22 changes: 11 additions & 11 deletions src/sqlodbc/opensearch_communication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ static const std::string SQL_ENDPOINT_ELASTICSEARCH = "/_opendistro/_sql";
static const std::string SQL_ENDPOINT_ERROR = "Error";

static const std::string SERVICE_NAME_DEFAULT = "es";
static const std::string SERVICE_NAME_SERVERLESS = "aoss";
static const std::string SERVICE_NAME_AOSS_SERVERLESS = "aoss";

static const std::string CREDENTIALS_PROFILE = "opensearchodbc";
static const std::string CREDENTIALS_PROVIDER_ALLOCATION_TAG =
Expand Down Expand Up @@ -462,8 +462,8 @@ OpenSearchCommunication::IssueRequest(
CREDENTIALS_PROFILE.c_str());

const std::string& service_name =
is_serverless
? SERVICE_NAME_SERVERLESS
is_aoss_serverless
? SERVICE_NAME_AOSS_SERVERLESS
: SERVICE_NAME_DEFAULT;

Aws::Client::AWSAuthV4Signer signer(credential_provider,
Expand Down Expand Up @@ -577,15 +577,15 @@ bool OpenSearchCommunication::EstablishConnection() {
// Set whether the connection is to OpenSearch serverless cluster.
// This can be specified explicitly via a configuration option, or
// determined by parsing the server URL.
SetIsServerless();
SetIsAossServerless();

// Set the SQL endpoint to connect to. If this is a serverless connection,
// the SQL endpoint can be determined directly; if not, the endpoint is
// determined by sending a request to OpenSearch, which may result in an
// error.
SetSqlEndpoint();

if (is_serverless && (sql_endpoint == SQL_ENDPOINT_ERROR)) {
if (is_aoss_serverless && (sql_endpoint == SQL_ENDPOINT_ERROR)) {
LogMsg(OPENSEARCH_ERROR, m_error_message.c_str());
return false;
}
Expand Down Expand Up @@ -1084,7 +1084,7 @@ std::string OpenSearchCommunication::GetClusterName() {
void OpenSearchCommunication::SetSqlEndpoint() {

// Serverless Elasticsearch is not supported.
if (is_serverless) {
if (is_aoss_serverless) {
sql_endpoint = SQL_ENDPOINT_OPENSEARCH;
return;
}
Expand All @@ -1103,15 +1103,15 @@ void OpenSearchCommunication::SetSqlEndpoint() {
* @brief Sets flag indicating whether this is
* connecting to an OpenSearch Serverless cluster.
*/
void OpenSearchCommunication::SetIsServerless() {
void OpenSearchCommunication::SetIsAossServerless() {

// If it is not specified in the DSN configuration,
// determine whether this is connected to a serverless
// cluster by parsing the server URL.
const std::string& is_serverless_config_value = m_rt_opts.conn.is_serverless;
const std::string& is_aoss_serverless_config_value = m_rt_opts.conn.is_aoss_serverless;

is_serverless =
is_serverless_config_value.empty()
is_aoss_serverless =
is_aoss_serverless_config_value.empty()
? (m_rt_opts.conn.server.find("aoss.amazonaws.com") != std::string::npos)
: std::stoi(is_serverless_config_value);
: std::stoi(is_aoss_serverless_config_value);
}
4 changes: 2 additions & 2 deletions src/sqlodbc/opensearch_communication.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class OpenSearchCommunication {
ConnErrorType error_type);
void SetErrorDetails(ErrorDetails details);

void SetIsServerless();
void SetIsAossServerless();
void SetSqlEndpoint();

// TODO #35 - Go through and add error messages on exit conditions
Expand All @@ -91,7 +91,7 @@ class OpenSearchCommunication {
ConnStatusType m_status;
ConnErrorType m_error_type;
std::shared_ptr< ErrorDetails > m_error_details;
bool is_serverless;
bool is_aoss_serverless;
bool m_valid_connection_options;
bool m_is_retrieving;
OpenSearchResultQueue m_result_queue;
Expand Down
2 changes: 1 addition & 1 deletion src/sqlodbc/opensearch_connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ int LIBOPENSEARCH_connect(ConnectionClass *self) {
}
rt_opts.conn.port.assign(self->connInfo.port);
rt_opts.conn.timeout.assign(self->connInfo.response_timeout);
rt_opts.conn.is_serverless.assign(self->connInfo.is_serverless);
rt_opts.conn.is_aoss_serverless.assign(self->connInfo.is_aoss_serverless);

// Authentication
rt_opts.auth.auth_type.assign(self->connInfo.authtype);
Expand Down
2 changes: 1 addition & 1 deletion src/sqlodbc/opensearch_odbc.h
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ typedef struct {
char port[SMALL_REGISTRY_LEN];
char response_timeout[SMALL_REGISTRY_LEN];
char fetch_size[SMALL_REGISTRY_LEN];
char is_serverless[SMALL_REGISTRY_LEN];
char is_aoss_serverless[SMALL_REGISTRY_LEN];

// Authentication
char authtype[MEDIUM_REGISTRY_LEN];
Expand Down
2 changes: 1 addition & 1 deletion src/sqlodbc/opensearch_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ typedef struct connection_options {
std::string port;
std::string timeout;
std::string fetch_size;
std::string is_serverless;
std::string is_aoss_serverless;
} connection_options;

typedef struct runtime_options {
Expand Down

0 comments on commit 4e55ffe

Please sign in to comment.