Skip to content

Commit

Permalink
Merge branch 'python-link-updates' of github.com:rlhagerm/aws-doc-sdk…
Browse files Browse the repository at this point in the history
…-examples into python-link-updates
  • Loading branch information
rlhagerm committed Aug 17, 2023
2 parents 80e4e75 + ee689ce commit 3685d79
Show file tree
Hide file tree
Showing 95 changed files with 165 additions and 134 deletions.
3 changes: 2 additions & 1 deletion cpp/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
build/
cmake-build*/
.vs/
build_tests
build_tests
CMakeSettings.json
5 changes: 4 additions & 1 deletion cpp/build_all_examples.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@


CMAKE_FILES=$(ls example_code/*/CMakeLists.txt)
HELLO_CMAKE_FILES=$(ls example_code/*/hello_*/CMakeLists.txt)
CMAKE_FILES="$CMAKE_FILES $HELLO_CMAKE_FILES"

CMAKE_FILES=($CMAKE_FILES)
echo "CMAKE_FILES ${CMAKE_FILES}"
echo "CMAKE_FILES ${CMAKE_FILES[@]}"

len=${#CMAKE_FILES[@]}
echo "len ${len}"
Expand Down
2 changes: 1 addition & 1 deletion cpp/example_code/acm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# SPDX-License-Identifier: Apache-2.0

# Set the minimum required version of CMake for this project.
cmake_minimum_required(VERSION 3.8)
cmake_minimum_required(VERSION 3.13)

# Set this project's name.
project("acm-examples")
Expand Down
2 changes: 1 addition & 1 deletion cpp/example_code/aurora/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# SPDX-License-Identifier: Apache-2.0

# Set the minimum required version of CMake for this project.
cmake_minimum_required(VERSION 3.11)
cmake_minimum_required(VERSION 3.13)

set(SERVICE_NAME aurora)
set(SERVICE_COMPONENTS rds)
Expand Down
14 changes: 10 additions & 4 deletions cpp/example_code/aurora/getting_started_with_db_clusters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -767,15 +767,18 @@ bool AwsDoc::Aurora::describeDBCluster(const Aws::String &dbClusterIdentifier,
if (outcome.IsSuccess()) {
clusterResult = outcome.GetResult().GetDBClusters()[0];
}
// This example does not log an error if the DB cluster does not exist.
// Instead, it returns false.
else if (outcome.GetError().GetErrorType() !=
Aws::RDS::RDSErrors::D_B_CLUSTER_NOT_FOUND_FAULT) {
result = false;
std::cerr << "Error with Aurora::GDescribeDBClusters. "
<< outcome.GetError().GetMessage()
<< std::endl;
}
// This example does not log an error if the DB cluster does not exist.
// Instead, clusterResult is set to empty.
else {
clusterResult = Aws::RDS::Model::DBCluster();
}

return result;

Expand Down Expand Up @@ -902,15 +905,18 @@ bool AwsDoc::Aurora::describeDBInstance(const Aws::String &dbInstanceIdentifier,
if (outcome.IsSuccess()) {
instanceResult = outcome.GetResult().GetDBInstances()[0];
}
// This example does not log an error if the DB instance does not exist.
// Instead, it returns false.
else if (outcome.GetError().GetErrorType() !=
Aws::RDS::RDSErrors::D_B_INSTANCE_NOT_FOUND_FAULT) {
result = false;
std::cerr << "Error with Aurora::DescribeDBInstances. "
<< outcome.GetError().GetMessage()
<< std::endl;
}
// This example does not log an error if the DB instance does not exist.
// Instead, instanceResult is set to empty.
else {
instanceResult = Aws::RDS::Model::DBInstance();
}

return result;
}
Expand Down
2 changes: 1 addition & 1 deletion cpp/example_code/aurora/hello_aurora/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# snippet-start:[cpp.example_code.aurora.hello_aurora.cmake]
# Set the minimum required version of CMake for this project.
cmake_minimum_required(VERSION 3.8)
cmake_minimum_required(VERSION 3.13)

# Set the AWS service components used by this project.
set(SERVICE_COMPONENTS rds)
Expand Down
2 changes: 1 addition & 1 deletion cpp/example_code/autoscaling/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# SPDX-License-Identifier: Apache-2.0

# Set the minimum required version of CMake for this project.
cmake_minimum_required(VERSION 3.8)
cmake_minimum_required(VERSION 3.13)

set(SERVICE_NAME auto_scaling)
set(SERVICE_COMPONENTS autoscaling ec2 monitoring)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# snippet-start:[cpp.example_code.autoscaling.hello_autoscaling.cmake]
# Set the minimum required version of CMake for this project.
cmake_minimum_required(VERSION 3.8)
cmake_minimum_required(VERSION 3.13)

# Set the AWS service components used by this project.
set(SERVICE_COMPONENTS autoscaling)
Expand Down
2 changes: 1 addition & 1 deletion cpp/example_code/cloudtrail/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# CONDITIONS OF ANY KIND, either express or implied. See the License for the
# specific language governing permissions and limitations under the License.

cmake_minimum_required(VERSION 3.2)
cmake_minimum_required(VERSION 3.13)
project(cloudtrail-examples)
set (CMAKE_CXX_STANDARD 11)

Expand Down
2 changes: 1 addition & 1 deletion cpp/example_code/cloudwatch/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# SPDX-License-Identifier: Apache-2.0

# Set the minimum required version of CMake for this project.
cmake_minimum_required(VERSION 3.8)
cmake_minimum_required(VERSION 3.13)

set(SERVICE_NAME cloudwatch)
set(SERVICE_COMPONENTS monitoring events logs)
Expand Down
2 changes: 1 addition & 1 deletion cpp/example_code/codebuild/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# CONDITIONS OF ANY KIND, either express or implied. See the License for the
# specific language governing permissions and limitations under the License.

cmake_minimum_required(VERSION 3.2)
cmake_minimum_required(VERSION 3.13)
project(codebuild-examples)
set (CMAKE_CXX_STANDARD 11)

Expand Down
2 changes: 1 addition & 1 deletion cpp/example_code/codecommit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# CONDITIONS OF ANY KIND, either express or implied. See the License for the
# specific language governing permissions and limitations under the License.

cmake_minimum_required(VERSION 3.2)
cmake_minimum_required(VERSION 3.13)
project(codecommit-examples)
set (CMAKE_CXX_STANDARD 11)

Expand Down
2 changes: 1 addition & 1 deletion cpp/example_code/cognito/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# SPDX-License-Identifier: Apache-2.0

# Set the minimum required version of CMake for this project.
cmake_minimum_required(VERSION 3.8)
cmake_minimum_required(VERSION 3.13)

set(SERVICE_NAME cognito)
set(SERVICE_COMPONENTS cognito-idp)
Expand Down
2 changes: 1 addition & 1 deletion cpp/example_code/cognito/hello_cognito/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# snippet-start:[cpp.example_code.cognito.hello_cognito.cmake]
# Set the minimum required version of CMake for this project.
cmake_minimum_required(VERSION 3.8)
cmake_minimum_required(VERSION 3.13)

# Set the AWS service components used by this project.
set(SERVICE_COMPONENTS cognito-idp)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.12)
cmake_minimum_required(VERSION 3.13)
set(CMAKE_CXX_STANDARD 11)
project(cpp_pam_lambdas LANGUAGES CXX)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# SPDX-License-Identifier: Apache-2.0

# Set the minimum required version of CMake for this project.
cmake_minimum_required(VERSION 3.9)
cmake_minimum_required(VERSION 3.13)

set(SERVICE_COMPONENTS sesv2 rds-data)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# SPDX-License-Identifier: Apache-2.0

# Set the minimum required version of CMake for this project.
cmake_minimum_required(VERSION 3.8)
cmake_minimum_required(VERSION 3.13)

set(SERVICE_COMPONENTS sns sqs)

Expand Down
2 changes: 1 addition & 1 deletion cpp/example_code/dynamodb/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# SPDX-License-Identifier: Apache-2.0

# Set the minimum required version of CMake for this project.
cmake_minimum_required(VERSION 3.8)
cmake_minimum_required(VERSION 3.13)

set(SERVICE_NAME dynamodb)
set(SERVICE_COMPONENTS dynamodb s3) # s3 is required for tests, and it must be included here because of caching.
Expand Down
2 changes: 1 addition & 1 deletion cpp/example_code/dynamodb/hello_dynamodb/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# snippet-start:[cpp.example_code.dynamodb.hello_dynamodb.cmake]
# Set the minimum required version of CMake for this project.
cmake_minimum_required(VERSION 3.8)
cmake_minimum_required(VERSION 3.13)

# Set the AWS service components used by this project.
set(SERVICE_COMPONENTS dynamodb)
Expand Down
2 changes: 1 addition & 1 deletion cpp/example_code/ebs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# CONDITIONS OF ANY KIND, either express or implied. See the License for the
# specific language governing permissions and limitations under the License.

cmake_minimum_required(VERSION 3.2)
cmake_minimum_required(VERSION 3.13)
project(ebs-examples)
set (CMAKE_CXX_STANDARD 11)

Expand Down
2 changes: 1 addition & 1 deletion cpp/example_code/ec2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# SPDX-License-Identifier: Apache-2.0

# Set the minimum required version of CMake for this project.
cmake_minimum_required(VERSION 3.8)
cmake_minimum_required(VERSION 3.13)

set(SERVICE_NAME ec2)
set(SERVICE_COMPONENTS ec2)
Expand Down
2 changes: 1 addition & 1 deletion cpp/example_code/ec2/hello_ec2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# snippet-start:[cpp.example_code.ec2.hello_ec2.cmake]
# Set the minimum required version of CMake for this project.
cmake_minimum_required(VERSION 3.8)
cmake_minimum_required(VERSION 3.13)

# Set the AWS service components used by this project.
set(SERVICE_COMPONENTS ec2)
Expand Down
2 changes: 1 addition & 1 deletion cpp/example_code/efs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# CONDITIONS OF ANY KIND, either express or implied. See the License for the
# specific language governing permissions and limitations under the License.

cmake_minimum_required(VERSION 3.2)
cmake_minimum_required(VERSION 3.13)
project(efs-examples)
set (CMAKE_CXX_STANDARD 11)

Expand Down
2 changes: 1 addition & 1 deletion cpp/example_code/elasticache/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# CONDITIONS OF ANY KIND, either express or implied. See the License for the
# specific language governing permissions and limitations under the License.

cmake_minimum_required(VERSION 3.2)
cmake_minimum_required(VERSION 3.13)
project(elasticache-examples)
set (CMAKE_CXX_STANDARD 11)

Expand Down
2 changes: 1 addition & 1 deletion cpp/example_code/elasticfilesystem/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# CONDITIONS OF ANY KIND, either express or implied. See the License for the
# specific language governing permissions and limitations under the License.

cmake_minimum_required(VERSION 3.2)
cmake_minimum_required(VERSION 3.13)
project(elasticfilesystem-examples)
set (CMAKE_CXX_STANDARD 11)

Expand Down
2 changes: 1 addition & 1 deletion cpp/example_code/general/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# snippet-start:[general.cpp.starter.cmakelists]

cmake_minimum_required(VERSION 3.3)
cmake_minimum_required(VERSION 3.13)
set(CMAKE_CXX_STANDARD 11)
project(app LANGUAGES CXX)

Expand Down
2 changes: 1 addition & 1 deletion cpp/example_code/glacier/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# CONDITIONS OF ANY KIND, either express or implied. See the License for the
# specific language governing permissions and limitations under the License.

cmake_minimum_required(VERSION 3.2)
cmake_minimum_required(VERSION 3.13)
project(glacier-examples)
set (CMAKE_CXX_STANDARD 11)

Expand Down
2 changes: 1 addition & 1 deletion cpp/example_code/glue/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# SPDX-License-Identifier: Apache-2.0

# Set the minimum required version of CMake for this project.
cmake_minimum_required(VERSION 3.8)
cmake_minimum_required(VERSION 3.13)

set(SERVICE_NAME glue)
set(SERVICE_COMPONENTS glue s3 iam)
Expand Down
2 changes: 1 addition & 1 deletion cpp/example_code/glue/hello_glue/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# snippet-start:[cpp.example_code.glue.hello_glue.cmake]
# Set the minimum required version of CMake for this project.
cmake_minimum_required(VERSION 3.8)
cmake_minimum_required(VERSION 3.13)

# Set the AWS service components used by this project.
set(SERVICE_COMPONENTS glue)
Expand Down
2 changes: 1 addition & 1 deletion cpp/example_code/guardduty/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# CONDITIONS OF ANY KIND, either express or implied. See the License for the
# specific language governing permissions and limitations under the License.

cmake_minimum_required(VERSION 3.2)
cmake_minimum_required(VERSION 3.13)
project(guardduty-examples)
set (CMAKE_CXX_STANDARD 11)

Expand Down
42 changes: 17 additions & 25 deletions cpp/example_code/iam/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,49 +2,41 @@
# SPDX-License-Identifier: Apache-2.0

# Set the minimum required version of CMake for this project.
cmake_minimum_required(VERSION 3.8)
cmake_minimum_required(VERSION 3.13)

set(SERVICE_NAME iam)
set(SERVICE_COMPONENTS iam s3 sts)

# Set this project's name.
project("${SERVICE_NAME}-examples")

# Set the location of where Windows can find the installed libraries of the SDK.
if(MSVC)
string(REPLACE ";" "/aws-cpp-sdk-all;" SYSTEM_MODULE_PATH "${CMAKE_SYSTEM_PREFIX_PATH}/aws-cpp-sdk-all")
list(APPEND CMAKE_PREFIX_PATH ${SYSTEM_MODULE_PATH})
endif()

# Set the C++ standard to use to build this target.
set(CMAKE_CXX_STANDARD 11)

# Enable CTest for testing these code examples.
if(BUILD_TESTS)
include(CTest)
endif()

# Build shared libraries by default.
if(NOT DEFINED BUILD_SHARED_LIBS)
set(BUILD_SHARED_LIBS ON)
set(BUILD_SHARED_LIBS ON)

# Use the MSVC variable to determine if this is a Windows build.
set(WINDOWS_BUILD ${MSVC})

# Set the location of where Windows can find the installed libraries of the SDK.
if(WINDOWS_BUILD)
string(REPLACE ";" "/aws-cpp-sdk-all;" SYSTEM_MODULE_PATH "${CMAKE_SYSTEM_PREFIX_PATH}/aws-cpp-sdk-all")
list(APPEND CMAKE_PREFIX_PATH ${SYSTEM_MODULE_PATH})
endif()

# Find the AWS SDK for C++ package.
find_package(AWSSDK REQUIRED COMPONENTS ${SERVICE_COMPONENTS})

# If the compiler is some version of Microsoft Visual C++, or another compiler simulating C++,
# and building as shared libraries, then dynamically link to those shared libraries.
if(MSVC AND BUILD_SHARED_LIBS)
add_definitions(-DUSE_IMPORT_EXPORT)
# Copy relevant AWS SDK for C++ libraries into the current binary directory for running and debugging.

set(CMAKE_BUILD_TYPE Debug) # Explicitly setting CMAKE_BUILD_TYPE is necessary in windows to copy dlls.

list(APPEND SERVICE_LIST ${SERVICE_COMPONENTS})
if(WINDOWS_BUILD)
# Copy relevant AWS SDK for C++ libraries into the current binary directory for running and debugging.

AWSSDK_CPY_DYN_LIBS(SERVICE_LIST "" ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE})
endif()
# set(BIN_SUB_DIR "/Debug") # if you are building from the command line you may need to uncomment this
# and set the proper subdirectory to the executables' location.

AWSSDK_CPY_DYN_LIBS(SERVICE_COMPONENTS "" ${CMAKE_CURRENT_BINARY_DIR}${BIN_SUB_DIR})
endif()

# AWSDOC_SOURCE can be defined in the command line to limit the files in a build. For example,
# you can limit files to one action.
Expand Down Expand Up @@ -79,6 +71,6 @@ endforeach()


if(BUILD_TESTS)
add_subdirectory(gtests)
add_subdirectory(tests)
endif()

2 changes: 1 addition & 1 deletion cpp/example_code/iam/hello_iam/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# snippet-start:[cpp.example_code.iam.hello_iam.cmake]
# Set the minimum required version of CMake for this project.
cmake_minimum_required(VERSION 3.8)
cmake_minimum_required(VERSION 3.13)

# Set the AWS service components used by this project.
set(SERVICE_COMPONENTS iam)
Expand Down
Loading

0 comments on commit 3685d79

Please sign in to comment.