forked from awsdocs/aws-doc-sdk-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
C++:Cloudtrail legacy cleanup. (awsdocs#6377)
* Cloudtrail update
- Loading branch information
1 parent
ac774c4
commit 1a8b968
Showing
20 changed files
with
965 additions
and
156 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 |
---|---|---|
@@ -1,28 +1,67 @@ | ||
# Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
# This file is 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/ | ||
# 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. | ||
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# Set the minimum required version of CMake for this project. | ||
cmake_minimum_required(VERSION 3.13) | ||
project(cloudtrail-examples) | ||
set (CMAKE_CXX_STANDARD 11) | ||
|
||
# Locate the aws sdk for c++ package. | ||
find_package(AWSSDK REQUIRED COMPONENTS cloudtrail) | ||
|
||
set(EXAMPLES "") | ||
list(APPEND EXAMPLES "create_trail") | ||
list(APPEND EXAMPLES "delete_trail") | ||
list(APPEND EXAMPLES "describe_trails") | ||
list(APPEND EXAMPLES "lookup_events") | ||
|
||
# The executables to build. | ||
foreach(EXAMPLE IN LISTS EXAMPLES) | ||
add_executable(${EXAMPLE} ${EXAMPLE}.cpp) | ||
target_link_libraries(${EXAMPLE} ${AWSSDK_LINK_LIBRARIES}) | ||
endforeach() | ||
|
||
set(SERVICE_NAME cloudtrail) | ||
set(SERVICE_COMPONENTS cloudtrail) | ||
|
||
# Set this project's name. | ||
project("${SERVICE_NAME}-examples") | ||
|
||
# Build shared libraries by default. | ||
set(BUILD_SHARED_LIBS ON) | ||
|
||
# Set the C++ standard to use to build this target. | ||
set(CMAKE_CXX_STANDARD 11) | ||
|
||
# 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 (WINDOWS_BUILD) | ||
# Copy relevant AWS SDK for C++ libraries into the current binary directory for running and debugging. | ||
|
||
# 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. | ||
if (NOT DEFINED AWSDOC_SOURCE) | ||
file(GLOB AWSDOC_SOURCE | ||
"*.cpp" | ||
) | ||
endif () | ||
|
||
foreach (file ${AWSDOC_SOURCE}) | ||
get_filename_component(EXAMPLE ${file} NAME_WE) | ||
|
||
# Build the code example executables. | ||
set(EXAMPLE_EXE run_${EXAMPLE}) | ||
|
||
add_executable(${EXAMPLE_EXE} ${file}) | ||
|
||
target_link_libraries(${EXAMPLE_EXE} ${AWSSDK_LINK_LIBRARIES} | ||
${AWSSDK_PLATFORM_DEPS}) | ||
|
||
endforeach () | ||
|
||
|
||
if (BUILD_TESTS) | ||
add_subdirectory(tests) | ||
endif () | ||
|
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,48 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
|
||
#pragma once | ||
#ifndef CLOUDTRAIL_EXAMPLES_CLOUDTRAIL_SAMPLES_H | ||
#define CLOUDTRAIL_EXAMPLES_CLOUDTRAIL_SAMPLES_H | ||
|
||
#include <aws/core/client/ClientConfiguration.h> | ||
|
||
namespace AwsDoc { | ||
namespace CloudTrail { | ||
// Routine which creates an AWS CloudTrail trail. | ||
/*! | ||
\param trailName: The name of the CloudTrail trail. | ||
\param bucketName: The Amazon S3 bucket designate for publishing logs. | ||
\param clientConfig: Aws client configuration. | ||
\return bool: Function succeeded. | ||
*/ | ||
bool createTrail(const Aws::String trailName, const Aws::String bucketName, | ||
const Aws::Client::ClientConfiguration &clientConfig); | ||
|
||
// Routine which deletes a CloudTrail trail. | ||
/*! | ||
\param trailName: The name of the CloudTrail trail. | ||
\param clientConfig: Aws client configuration. | ||
\return bool: Function succeeded. | ||
*/ | ||
bool deleteTrail(const Aws::String trailName, | ||
const Aws::Client::ClientConfiguration &clientConfig); | ||
|
||
// Routine which describes the CloudTrail trails in an account. | ||
/*! | ||
\param clientConfig: Aws client configuration. | ||
\return bool: Function succeeded. | ||
*/ | ||
bool describeTrails(const Aws::Client::ClientConfiguration &clientConfig); | ||
|
||
// Routine which looks up events captured by CloudTrail. | ||
/*! | ||
\param clientConfig: Aws client configuration. | ||
\return bool: Function succeeded. | ||
*/ | ||
bool lookupEvents(const Aws::Client::ClientConfiguration &clientConfig); | ||
} // CloudTrail | ||
} // AwsDoc | ||
|
||
#endif //CLOUDTRAIL_EXAMPLES_CLOUDTRAIL_SAMPLES_H |
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
Oops, something went wrong.