Skip to content

Commit

Permalink
Garya/ad 439/remove timestream from tscommunication class (#10)
Browse files Browse the repository at this point in the history
* [AD-451] Replace AWS ColumnInfo and Row Type with User Types
https:/bitquill.atlassian.net/browse/AD-451

* [AD-451] Replace AWS ColumnInfo and Row Type with User Types
https:/bitquill.atlassian.net/browse/AD-451

* [AD-451] Correct pedantic syntax
https:/bitquill.atlassian.net/browse/AD-451

* [AD-451] Correct pedantic syntax
https:/bitquill.atlassian.net/browse/AD-451

* remove datum and timeseries datatype parser

* removing extra include

* Remove 'TimestreamQuery_EXPORTS.h'.

* Remove timeseries related data members and methods.

* Add new file QueryStatus.(h,cpp).

* Add new file Endpoint.(h,cpp).

* Add new file DescribeEndpointsResult.(h,cpp).

* Add new file DescribeEndpointsResult.(h,cpp).

* Add QueryRequest files.

* Add new file DatabaseQueryErrors.(c,cpp).

* Add new file DatabaseQueryErrorMarshaller.(h,cpp)

* Add new file DatabaseQueryEndpoint.(h,cpp).

* Add new file QueryResult.(h,cpp).

* Add new file DescribeEndpointsRequest.(h,cpp).

* Add new files CancelQueryResult.(h,cpp) and DatabaseQueryClient.(h,cpp).

* Fix namespace bug.

* Fix error with Endpoint class.

* Fix comments in CancelQueryRequest.h.

* Fix comments in CancelQueryResult.h.

* Remove dependency on aws/timestream-query/... and replace user-defined classes.

* Remove word 'Amazon Timestream', add 'TODO' comments.

* Remove word 'timestream', add 'TODO' comments.

* Remove region authentication field.

* Replace 'TSCommunication' with 'DBCommunication'.

* Revert "Replace 'TSCommunication' with 'DBCommunication'."

This reverts commit 0cc632469fd3da69b9538ad0df10d9903a5dd30f.

* Revert "Remove region authentication field."

This reverts commit 701e5876af7fb8746742de0519d1a83949f61cce.

* Revert "Remove word 'timestream', add 'TODO' comments."

This reverts commit 10fb0206b48f39a57c64cb69398b21e97ed1e75e.

* Revert "Remove word 'Amazon Timestream', add 'TODO' comments."

This reverts commit eb300dfb810bd62ebc1f18d12da9b1a2c9e98072.

* Remove IT_REGION.

* Replace 'TSCommunication' with 'DBCommunication'.

* Change 'Timestream_' to 'Database_'.

Co-authored-by: Bruce Irschick <[email protected]>
Co-authored-by: affonsov <[email protected]>
  • Loading branch information
3 people authored Nov 9, 2021
1 parent 9262bb2 commit 813ff29
Show file tree
Hide file tree
Showing 44 changed files with 2,593 additions and 189 deletions.
2 changes: 0 additions & 2 deletions src/Tests/ITODBCHelper/it_odbc_helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,6 @@ void CompareStrNumChar(const test_string& expected, const SQLINTEGER num_chars,
test_string conn_string() {
std::vector< std::pair< test_string, test_string > > conn_str_pair = {
{IT_DRIVER, CREATE_STRING("timestreamodbc")},
{IT_REGION, CREATE_STRING("us-east-1")},
{IT_AUTH, CREATE_STRING("AWS_PROFILE")},
{IT_LOGLEVEL, CREATE_STRING("5")}}; // DEBUG level logging

Expand All @@ -301,7 +300,6 @@ test_string conn_string() {
test_string perf_conn_string() {
std::vector< std::pair< test_string, test_string > > conn_str_pair = {
{IT_DRIVER, CREATE_STRING("timestreamodbc")},
{IT_REGION, CREATE_STRING("us-east-2")},
{IT_AUTH, CREATE_STRING("AWS_PROFILE")},
{IT_LOGLEVEL, CREATE_STRING("0")}};

Expand Down
1 change: 0 additions & 1 deletion src/Tests/ITODBCHelper/it_odbc_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ test_string to_test_string(const std::string& src);
#define IT_DRIVER CREATE_STRING("Driver")
#define IT_ACCESSKEYID CREATE_STRING("AccessKeyId")
#define IT_SECRETACCESSKEY CREATE_STRING"SecretAccessKey")
#define IT_REGION CREATE_STRING("Region")
#define IT_AUTH CREATE_STRING("Auth")
#define IT_LOGLEVEL CREATE_STRING("LogLevel")
#define IT_LOGOUTPUT CREATE_STRING("LogOutput")
Expand Down
12 changes: 6 additions & 6 deletions src/Tests/Tests/test_conn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ TEST(TestConnectionOptions, Good) {
options.auth.uid = "UID";
options.auth.pwd = "PWD";
options.auth.auth_type = AUTHTYPE_DEFAULT;
TSCommunication conn;
DBCommunication conn;
EXPECT_NO_THROW(conn.Validate(options));
EXPECT_TRUE(conn.Validate(options));
}
Expand All @@ -41,7 +41,7 @@ TEST(TestConnectionOptions, UID_is_empty) {
options.auth.uid = "";
options.auth.pwd = "PWD";
options.auth.auth_type = AUTHTYPE_DEFAULT;
TSCommunication conn;
DBCommunication conn;
EXPECT_THROW(conn.Validate(options), std::invalid_argument);
}

Expand All @@ -50,7 +50,7 @@ TEST(TestConnectionOptions, PWD_is_empty) {
options.auth.uid = "UID";
options.auth.pwd = "";
options.auth.auth_type = AUTHTYPE_DEFAULT;
TSCommunication conn;
DBCommunication conn;
EXPECT_THROW(conn.Validate(options), std::invalid_argument);
}

Expand All @@ -59,7 +59,7 @@ TEST(TestConnectionOptions, Auth_type_is_empty) {
options.auth.uid = "UID";
options.auth.pwd = "PWD";
options.auth.auth_type = "";
TSCommunication conn;
DBCommunication conn;
EXPECT_THROW(conn.Validate(options), std::invalid_argument);
}

Expand All @@ -69,12 +69,12 @@ TEST(TestConnectionOptions, Timeout_is_alpha) {
options.auth.pwd = "PWD";
options.auth.auth_type = "";
options.conn.timeout = "timeout";
TSCommunication conn;
DBCommunication conn;
EXPECT_THROW(conn.Validate(options), std::invalid_argument);
}

TEST(TestGetUserAgent, Success) {
TSCommunication conn;
DBCommunication conn;
std::string expected = "ts-odbc." TIMESTREAMDRIVERVERSION " [tests]";
EXPECT_EQ(expected, conn.GetUserAgent());
}
25 changes: 25 additions & 0 deletions src/odbcdriver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,19 @@ set(CPP_SOURCE_FILES communication.cpp
utility.cpp
odbc_communication.cpp
prefetch_queue.cpp
CancelQueryRequest.cpp
CancelQueryResult.cpp
ColumnInfo.cpp
DatabaseQueryClient.cpp
DatabaseQueryEndpoint.cpp
DatabaseQueryErrors.cpp
DatabaseQueryErrorMarshaller.cpp
DescribeEndpointsRequest.cpp
DescribeEndpointsResult.cpp
Endpoint.cpp
QueryRequest.cpp
QueryResult.cpp
QueryStatus.cpp
Row.cpp
ScalarType.cpp
Type.cpp
Expand Down Expand Up @@ -100,7 +112,20 @@ set(CPP_HEADER_FILES communication.h
odbc_communication.h
prefetch_queue.h
version.h
CancelQueryRequest.h
CancelQueryResult.h
ColumnInfo.h
DatabaseQueryClient.h
DatabaseQueryEndpoint.h
DatabaseQueryErrors.h
DatabaseQueryErrorMarshaller.h
DatabaseQueryRequest.h
DescribeEndpointsRequest.h
DescribeEndpointsResult.h
Endpoint.h
QueryRequest.h
QueryResult.h
QueryStatus.h
Row.h
ScalarType.h
Type.h
Expand Down
33 changes: 33 additions & 0 deletions src/odbcdriver/CancelQueryRequest.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/

#include <aws/core/utils/json/JsonSerializer.h>
#include "CancelQueryRequest.h"

#include <utility>

using namespace Aws::Utils::Json;
using namespace Aws::Utils;

CancelQueryRequest::CancelQueryRequest() : m_queryIdHasBeenSet(false) {
}

Aws::String CancelQueryRequest::SerializePayload() const {
JsonValue payload;

if (m_queryIdHasBeenSet) {
payload.WithString("QueryId", m_queryId);
}

return payload.View().WriteReadable();
}

Aws::Http::HeaderValueCollection CancelQueryRequest::GetRequestSpecificHeaders()
const {
Aws::Http::HeaderValueCollection headers;
headers.insert(Aws::Http::HeaderValuePair(
"X-Amz-Target", "Timestream_20181101.CancelQuery"));
return headers;
}
103 changes: 103 additions & 0 deletions src/odbcdriver/CancelQueryRequest.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/

#pragma once
#include <aws/core/utils/memory/stl/AWSString.h>

#include "DatabaseQueryRequest.h"

#include <utility>

class CancelQueryRequest : public DatabaseQueryRequest {
public:
CancelQueryRequest();

// Service request name is the Operation name which will send this request
// out, each operation should has unique request name, so that we can get
// operation's name from this request. Note: this is not true for response,
// multiple operations may have the same response name, so we can not get
// operation's name from response.
inline virtual const char* GetServiceRequestName() const override {
return "CancelQuery";
}

Aws::String SerializePayload() const override;

Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override;

/**
* <p> The id of the query that needs to be cancelled. <code>QueryID</code>
* is returned as part of QueryResult. </p>
*/
inline const Aws::String& GetQueryId() const {
return m_queryId;
}

/**
* <p> The id of the query that needs to be cancelled. <code>QueryID</code>
* is returned as part of QueryResult. </p>
*/
inline bool QueryIdHasBeenSet() const {
return m_queryIdHasBeenSet;
}

/**
* <p> The id of the query that needs to be cancelled. <code>QueryID</code>
* is returned as part of QueryResult. </p>
*/
inline void SetQueryId(const Aws::String& value) {
m_queryIdHasBeenSet = true;
m_queryId = value;
}

/**
* <p> The id of the query that needs to be cancelled. <code>QueryID</code>
* is returned as part of QueryResult. </p>
*/
inline void SetQueryId(Aws::String&& value) {
m_queryIdHasBeenSet = true;
m_queryId = std::move(value);
}

/**
* <p> The id of the query that needs to be cancelled. <code>QueryID</code>
* is returned as part of QueryResult. </p>
*/
inline void SetQueryId(const char* value) {
m_queryIdHasBeenSet = true;
m_queryId.assign(value);
}

/**
* <p> The id of the query that needs to be cancelled. <code>QueryID</code>
* is returned as part of QueryResult. </p>
*/
inline CancelQueryRequest& WithQueryId(const Aws::String& value) {
SetQueryId(value);
return *this;
}

/**
* <p> The id of the query that needs to be cancelled. <code>QueryID</code>
* is returned as part of QueryResult. </p>
*/
inline CancelQueryRequest& WithQueryId(Aws::String&& value) {
SetQueryId(std::move(value));
return *this;
}

/**
* <p> The id of the query that needs to be cancelled. <code>QueryID</code>
* is returned as part of QueryResult. </p>
*/
inline CancelQueryRequest& WithQueryId(const char* value) {
SetQueryId(value);
return *this;
}

private:
Aws::String m_queryId;
bool m_queryIdHasBeenSet;
};
34 changes: 34 additions & 0 deletions src/odbcdriver/CancelQueryResult.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/

#include <aws/core/AmazonWebServiceResult.h>
#include <aws/core/utils/StringUtils.h>
#include <aws/core/utils/UnreferencedParam.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include "CancelQueryResult.h"

#include <utility>

using namespace Aws::Utils::Json;
using namespace Aws::Utils;
using namespace Aws;

CancelQueryResult::CancelQueryResult() {
}

CancelQueryResult::CancelQueryResult(
const Aws::AmazonWebServiceResult< JsonValue >& result) {
*this = result;
}

CancelQueryResult& CancelQueryResult::operator=(
const Aws::AmazonWebServiceResult< JsonValue >& result) {
JsonView jsonValue = result.GetPayload().View();
if (jsonValue.ValueExists("CancellationMessage")) {
m_cancellationMessage = jsonValue.GetString("CancellationMessage");
}

return *this;
}
101 changes: 101 additions & 0 deletions src/odbcdriver/CancelQueryResult.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/

#pragma once
#include <aws/core/utils/memory/stl/AWSString.h>

#include <utility>

namespace Aws {
template < typename RESULT_TYPE >
class AmazonWebServiceResult;

namespace Utils {
namespace Json {
class JsonValue;
} // namespace Json
} // namespace Utils
} // namespace Aws

class CancelQueryResult {
public:
CancelQueryResult();
CancelQueryResult(
const Aws::AmazonWebServiceResult< Aws::Utils::Json::JsonValue >&
result);
CancelQueryResult& operator=(
const Aws::AmazonWebServiceResult< Aws::Utils::Json::JsonValue >&
result);

/**
* <p> A <code>CancellationMessage</code> is returned when a
* <code>CancelQuery</code> request for the query specified by
* <code>QueryId</code> has already been issued. </p>
*/
inline const Aws::String& GetCancellationMessage() const {
return m_cancellationMessage;
}

/**
* <p> A <code>CancellationMessage</code> is returned when a
* <code>CancelQuery</code> request for the query specified by
* <code>QueryId</code> has already been issued. </p>
*/
inline void SetCancellationMessage(const Aws::String& value) {
m_cancellationMessage = value;
}

/**
* <p> A <code>CancellationMessage</code> is returned when a
* <code>CancelQuery</code> request for the query specified by
* <code>QueryId</code> has already been issued. </p>
*/
inline void SetCancellationMessage(Aws::String&& value) {
m_cancellationMessage = std::move(value);
}

/**
* <p> A <code>CancellationMessage</code> is returned when a
* <code>CancelQuery</code> request for the query specified by
* <code>QueryId</code> has already been issued. </p>
*/
inline void SetCancellationMessage(const char* value) {
m_cancellationMessage.assign(value);
}

/**
* <p> A <code>CancellationMessage</code> is returned when a
* <code>CancelQuery</code> request for the query specified by
* <code>QueryId</code> has already been issued. </p>
*/
inline CancelQueryResult& WithCancellationMessage(
const Aws::String& value) {
SetCancellationMessage(value);
return *this;
}

/**
* <p> A <code>CancellationMessage</code> is returned when a
* <code>CancelQuery</code> request for the query specified by
* <code>QueryId</code> has already been issued. </p>
*/
inline CancelQueryResult& WithCancellationMessage(Aws::String&& value) {
SetCancellationMessage(std::move(value));
return *this;
}

/**
* <p> A <code>CancellationMessage</code> is returned when a
* <code>CancelQuery</code> request for the query specified by
* <code>QueryId</code> has already been issued. </p>
*/
inline CancelQueryResult& WithCancellationMessage(const char* value) {
SetCancellationMessage(value);
return *this;
}

private:
Aws::String m_cancellationMessage;
};
Loading

0 comments on commit 813ff29

Please sign in to comment.