Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added C++ subscriber sample to list entitled DataSets.
- Loading branch information
Showing
5 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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 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 @@ | ||
build |
This file contains 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,10 @@ | ||
cmake_minimum_required(VERSION 3.2) | ||
project(all-entitled-datasets) | ||
|
||
option(BUILD_SHARED_LIBS "Build shared libraries" ON) | ||
|
||
find_package(AWSSDK REQUIRED COMPONENTS dataexchange) | ||
add_executable(all-entitled-datasets main.cpp) | ||
|
||
target_compile_features(all-entitled-datasets PUBLIC cxx_std_11) | ||
target_link_libraries(all-entitled-datasets ${AWSSDK_LINK_LIBRARIES}) |
This file contains 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,29 @@ | ||
# All Entitled Data Sets | ||
|
||
This sample retrieves a list of all subscriber's entitled data sets. | ||
|
||
To build the sample, install the [AWS SDK for C++](https://github.com/aws/aws-sdk-cpp#building-the-sdk) and use [CMake](https://cmake.org/). | ||
|
||
``` | ||
cpp/all-entitled-datasets $ mkdir build | ||
cpp/all-entitled-datasets $ cd build | ||
cpp/all-entitled-datasets/build $ cmake .. | ||
cpp/all-entitled-datasets/build $ make | ||
``` | ||
|
||
To run the sample, set `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `AWS_SESSION_TOKEN` and `AWS_REGION`. | ||
|
||
``` | ||
$ ./all-entitled-datasets | ||
prod-zg4u6tpyxud5i/7ae12084f47ea658ab62ee90edd513dd: NYC Property Sales 2014 | ||
Over 80,000 property sales in New York City in 2014 | ||
prod-zg4u6tpyxud5i/05964b659bbcb607d43c0d5845838e7f: NYC Property Sales 2015 | ||
Over 80,000 property sales in New York City in 2015 | ||
prod-zg4u6tpyxud5i/fc19d00c8780199e4fccd21f4834c905: NYC Property Sales 2018 | ||
A table of 80,000+ New York City property sales occurring in 2018, organized by borough, including sale price and sale date. | ||
prod-zg4u6tpyxud5i/7d8f73e3c5acdde79fd2874dd98afdcd: NYC Property Sales 2016 | ||
Over 80,000 property sales in New York City in 2016 | ||
prod-zg4u6tpyxud5i/50782dc315b94e46fdbd4a12cec6820e: NYC Property Sales 2017 | ||
Records of over 80,000 property sales transactions. | ||
``` |
This file contains 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,39 @@ | ||
#include <iostream> | ||
#include <aws/core/Aws.h> | ||
#include <aws/core/utils/Outcome.h> | ||
#include <aws/dataexchange/DataExchangeClient.h> | ||
#include <aws/dataexchange/model/ListDataSetsRequest.h> | ||
|
||
int main(int argc, char** argv) | ||
{ | ||
Aws::SDKOptions options; | ||
Aws::InitAPI(options); | ||
|
||
{ | ||
Aws::DataExchange::DataExchangeClient client; | ||
|
||
Aws::DataExchange::Model::ListDataSetsRequest list_data_sets_options; | ||
list_data_sets_options.SetOrigin("ENTITLED"); | ||
|
||
auto outcome = client.ListDataSets(list_data_sets_options); | ||
|
||
if (outcome.IsSuccess()) { | ||
Aws::Vector<Aws::DataExchange::Model::DataSetEntry> data_sets_list = outcome.GetResult().GetDataSets(); | ||
|
||
for (auto const &data_set: data_sets_list) { | ||
std::cout | ||
<< data_set.GetOriginDetails().GetProductId() << "/" | ||
<< data_set.GetId() << ": " | ||
<< data_set.GetName() << std::endl | ||
<< " " << data_set.GetDescription() | ||
<< std::endl; | ||
} | ||
} else { | ||
std::cerr << "ListDataSets error: " | ||
<< outcome.GetError().GetExceptionName() << " - " | ||
<< outcome.GetError().GetMessage() << std::endl; | ||
} | ||
} | ||
|
||
Aws::ShutdownAPI(options); | ||
} |