-
Notifications
You must be signed in to change notification settings - Fork 110
Gg discovery #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Gg discovery #21
Changes from 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
86267ba
Data marshalling.
JonathanHenson f5b288d
Working green grass discovery sample.
JonathanHenson e67a639
GG discovery updates, samples updated to latest test branch in aws-cr…
JonathanHenson f105899
Regenerated code that was deserializing arrays and sets.
JonathanHenson ac87ef6
finished discovery client and basic-discovery sample.
JonathanHenson 85e7867
Update README.md.
JonathanHenson ae2e81e
Added format check script.
JonathanHenson d1537d0
Forgot to add an exit statement.
JonathanHenson 980e62f
Added missing newline.
JonathanHenson 670926e
Final tag for iot sdk with gg discovery support.
JonathanHenson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
cmake_minimum_required(VERSION 3.1) | ||
project(Discovery-cpp CXX) | ||
|
||
set(RUNTIME_DIRECTORY bin) | ||
|
||
if (UNIX AND NOT APPLE) | ||
include(GNUInstallDirs) | ||
elseif(NOT DEFINED CMAKE_INSTALL_LIBDIR) | ||
set(CMAKE_INSTALL_LIBDIR "lib") | ||
|
||
if (${CMAKE_INSTALL_LIBDIR} STREQUAL "lib64") | ||
set(FIND_LIBRARY_USE_LIB64_PATHS true) | ||
endif() | ||
endif() | ||
|
||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_PREFIX_PATH}/${CMAKE_INSTALL_LIBDIR}/cmake") | ||
|
||
if (NOT CMAKE_CXX_STANDARD) | ||
set(CMAKE_CXX_STANDARD 11) | ||
endif() | ||
|
||
file(GLOB AWS_DISCOVERY_HEADERS | ||
"include/aws/discovery/*.h" | ||
) | ||
|
||
file(GLOB AWS_DISCOVERY_SRC | ||
"source/*.cpp" | ||
) | ||
|
||
file(GLOB AWS_DISCOVERY_CPP_SRC | ||
${AWS_DISCOVERY_SRC} | ||
) | ||
|
||
if (WIN32) | ||
if (MSVC) | ||
source_group("Header Files\\aws\\discovery\\" FILES ${AWS_DISCOVERY_HEADERS}) | ||
|
||
source_group("Source Files" FILES ${AWS_DISCOVERY_SRC}) | ||
endif () | ||
endif() | ||
|
||
add_library(Discovery-cpp ${AWS_DISCOVERY_CPP_SRC}) | ||
|
||
set_target_properties(Discovery-cpp PROPERTIES LINKER_LANGUAGE CXX) | ||
|
||
set(CMAKE_C_FLAGS_DEBUGOPT "") | ||
|
||
#set warnings | ||
if (MSVC) | ||
target_compile_options(Discovery-cpp PRIVATE /W4 /WX) | ||
else () | ||
target_compile_options(Discovery-cpp PRIVATE -Wall -Wno-long-long -pedantic -Werror) | ||
endif () | ||
|
||
if (CMAKE_BUILD_TYPE STREQUAL "" OR CMAKE_BUILD_TYPE MATCHES Debug) | ||
target_compile_definitions(Discovery-cpp PRIVATE "-DDEBUG_BUILD") | ||
endif () | ||
|
||
if (BUILD_SHARED_LIBS) | ||
target_compile_definitions(Discovery-cpp PUBLIC "-DAWS_DISCOVERY_USE_IMPORT_EXPORT") | ||
target_compile_definitions(Discovery-cpp PRIVATE "-DAWS_DISCOVERY_EXPORTS") | ||
|
||
install(TARGETS Discovery-cpp | ||
EXPORT Discovery-cpp-targets | ||
ARCHIVE | ||
DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
COMPONENT Development | ||
LIBRARY | ||
DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
NAMELINK_SKIP | ||
COMPONENT Runtime | ||
RUNTIME | ||
DESTINATION ${RUNTIME_DIRECTORY} | ||
COMPONENT Runtime) | ||
|
||
install(TARGETS Discovery-cpp | ||
EXPORT Discovery-cpp-targets | ||
LIBRARY | ||
DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
NAMELINK_ONLY | ||
COMPONENT Development) | ||
else() | ||
install(TARGETS Discovery-cpp | ||
EXPORT Discovery-cpp-targets | ||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
COMPONENT Development) | ||
endif() | ||
|
||
target_include_directories(Discovery-cpp PUBLIC | ||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> | ||
$<INSTALL_INTERFACE:include>) | ||
|
||
if (NOT IS_SUBDIRECTORY_INCLUDE) | ||
find_package(aws-crt-cpp REQUIRED) | ||
endif() | ||
|
||
target_link_libraries(Discovery-cpp AWS::aws-crt-cpp) | ||
|
||
install(FILES ${AWS_DISCOVERY_HEADERS} DESTINATION "include/aws/discovery/" COMPONENT Development) | ||
|
||
|
||
install(EXPORT "Discovery-cpp-targets" | ||
DESTINATION "lib/Discovery-cpp/cmake/" | ||
NAMESPACE AWS::) | ||
|
||
configure_file("cmake/Discovery-cpp-config.cmake" | ||
"${CMAKE_CURRENT_BINARY_DIR}/Discovery-cpp-config.cmake" | ||
@ONLY) | ||
|
||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/Discovery-cpp-config.cmake" | ||
DESTINATION "lib/Discovery-cpp/cmake/" | ||
COMPONENT Development) | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
include(CMakeFindDependencyMacro) | ||
|
||
find_dependency(aws-crt-cpp) | ||
|
||
include(${CMAKE_CURRENT_LIST_DIR}/Discovery-cpp-targets.cmake) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#pragma once | ||
/* Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this file except in compliance with the License. | ||
* A copy of the License is located at | ||
* | ||
* http://aws.amazon.com/apache2.0 | ||
* | ||
* or in the "license" file accompanying this file. This file is distributed | ||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
* express or implied. See the License for the specific language governing | ||
* permissions and limitations under the License. | ||
|
||
* This file is generated | ||
*/ | ||
#include <aws/crt/JsonObject.h> | ||
|
||
#include <aws/discovery/Exports.h> | ||
|
||
#include <aws/crt/JsonObject.h> | ||
#include <aws/crt/StlAllocator.h> | ||
|
||
namespace Aws | ||
{ | ||
namespace Discovery | ||
{ | ||
class AWS_DISCOVERY_API ConnectivityInfo final | ||
{ | ||
public: | ||
ConnectivityInfo() = default; | ||
|
||
ConnectivityInfo(const Crt::JsonView &doc); | ||
ConnectivityInfo &operator=(const Crt::JsonView &doc); | ||
|
||
Aws::Crt::Optional<Aws::Crt::String> ID; | ||
Aws::Crt::Optional<Aws::Crt::String> HostAddress; | ||
Aws::Crt::Optional<Aws::Crt::String> Metadata; | ||
Aws::Crt::Optional<uint16_t> Port; | ||
|
||
private: | ||
static void LoadFromObject(ConnectivityInfo &obj, const Crt::JsonView &doc); | ||
}; | ||
} // namespace Discovery | ||
} // namespace Aws |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#pragma once | ||
/* Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this file except in compliance with the License. | ||
* A copy of the License is located at | ||
* | ||
* http://aws.amazon.com/apache2.0 | ||
* | ||
* or in the "license" file accompanying this file. This file is distributed | ||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
* express or implied. See the License for the specific language governing | ||
* permissions and limitations under the License. | ||
|
||
* This file is generated | ||
*/ | ||
#include <aws/discovery/GGGroup.h> | ||
|
||
namespace Aws | ||
{ | ||
namespace Discovery | ||
{ | ||
class AWS_DISCOVERY_API DiscoverResponse final | ||
{ | ||
public: | ||
DiscoverResponse() = default; | ||
|
||
DiscoverResponse(const Crt::JsonView &doc); | ||
DiscoverResponse &operator=(const Crt::JsonView &doc); | ||
|
||
Aws::Crt::Optional<Aws::Crt::Vector<GGGroup>> GGGroups; | ||
|
||
private: | ||
static void LoadFromObject(DiscoverResponse &obj, const Crt::JsonView &doc); | ||
}; | ||
} // namespace Discovery | ||
} // namespace Aws |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#pragma once | ||
/* Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this file except in compliance with the License. | ||
* A copy of the License is located at | ||
* | ||
* http://aws.amazon.com/apache2.0 | ||
* | ||
* or in the "license" file accompanying this file. This file is distributed | ||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
* express or implied. See the License for the specific language governing | ||
* permissions and limitations under the License. | ||
|
||
* This file is generated | ||
*/ | ||
#include <aws/discovery/DiscoverResponse.h> | ||
|
||
#include <aws/crt/http/HttpConnectionManager.h> | ||
|
||
namespace Aws | ||
{ | ||
namespace Discovery | ||
{ | ||
using OnDiscoverResponse = std::function<void(DiscoverResponse *, int errorCode, int httpResponseCode)>; | ||
|
||
struct DiscoveryClientConfig | ||
{ | ||
DiscoveryClientConfig() noexcept; | ||
Crt::Allocator *allocator; | ||
Crt::Io::ClientBootstrap *bootstrap; | ||
Crt::Io::TlsContext *tlsContext; | ||
Crt::Io::SocketOptions *socketOptions; | ||
Crt::String region; | ||
size_t maxConnections; | ||
// TODO: when supported add proxy configuration. | ||
}; | ||
|
||
class DiscoveryClient final | ||
{ | ||
public: | ||
DiscoveryClient(const DiscoveryClientConfig &) noexcept; | ||
|
||
bool Discover(const Crt::String &thingName, const OnDiscoverResponse &onDiscoverResponse) noexcept; | ||
|
||
private: | ||
std::shared_ptr<Crt::Http::HttpClientConnectionManager> m_connectionManager; | ||
Crt::String m_hostName; | ||
Crt::Allocator *m_allocator; | ||
}; | ||
} // namespace Discovery | ||
} // namespace Aws |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#pragma once | ||
/* Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this file except in compliance with the License. | ||
* A copy of the License is located at | ||
* | ||
* http://aws.amazon.com/apache2.0 | ||
* | ||
* or in the "license" file accompanying this file. This file is distributed | ||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
* express or implied. See the License for the specific language governing | ||
* permissions and limitations under the License. | ||
|
||
* This file is generated | ||
*/ | ||
|
||
#if defined(AWS_DISCOVERY_USE_WINDOWS_DLL_SEMANTICS) || defined(WIN32) | ||
# ifdef AWS_DISCOVERY_USE_IMPORT_EXPORT | ||
# ifdef AWS_DISCOVERY_EXPORTS | ||
# define AWS_DISCOVERY_API __declspec(dllexport) | ||
# else | ||
# define AWS_DISCOVERY_API __declspec(dllimport) | ||
# endif /* AWS_DISCOVERY_EXPORTS */ | ||
# else | ||
# define AWS_DISCOVERY_API | ||
# endif /* AWS_DISCOVERY_USE_IMPORT_EXPORT */ | ||
|
||
#else /* defined (AWS_DISCOVERY_USE_WINDOWS_DLL_SEMANTICS) || defined (WIN32) */ | ||
# define AWS_DISCOVERY_API | ||
#endif /* defined (AWS_DISCOVERY_USE_WINDOWS_DLL_SEMANTICS) || defined (WIN32) */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#pragma once | ||
/* Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this file except in compliance with the License. | ||
* A copy of the License is located at | ||
* | ||
* http://aws.amazon.com/apache2.0 | ||
* | ||
* or in the "license" file accompanying this file. This file is distributed | ||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
* express or implied. See the License for the specific language governing | ||
* permissions and limitations under the License. | ||
|
||
* This file is generated | ||
*/ | ||
#include <aws/discovery/ConnectivityInfo.h> | ||
|
||
namespace Aws | ||
{ | ||
namespace Discovery | ||
{ | ||
class AWS_DISCOVERY_API GGCore final | ||
{ | ||
public: | ||
GGCore() = default; | ||
|
||
GGCore(const Crt::JsonView &doc); | ||
GGCore &operator=(const Crt::JsonView &doc); | ||
|
||
Aws::Crt::Optional<Aws::Crt::String> ThingArn; | ||
Aws::Crt::Optional<Aws::Crt::Vector<ConnectivityInfo>> Connectivity; | ||
|
||
private: | ||
static void LoadFromObject(GGCore &obj, const Crt::JsonView &doc); | ||
}; | ||
} // namespace Discovery | ||
} // namespace Aws |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most files say
This file is generated
Is that a copy/paste error, are these being generated from somewhere?
Or are these files just something that we aspire to generate someday
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these aren't generated.