Setup secrets boilerplate code from templates (#2650)
* Progress stream reader * format * Update sdk/core/azure-core/src/io/body_stream.cpp Co-authored-by: JinmingHu <jinmhu@microsoft.com> * PR comments * fix doc warnings * remove * one more comment * replaced if null with azure_assert * moved from pointer to reference * first pass * src builds * new line * huzaaaaa * readme * formatting * build break url * put proper link * darn link * comments from PR * update to use gtest_main Co-authored-by: JinmingHu <jinmhu@microsoft.com>
This commit is contained in:
parent
7af67c509d
commit
7da78d4cc9
@ -13,3 +13,4 @@ if(BUILD_TESTING)
|
||||
endif()
|
||||
|
||||
add_subdirectory(azure-security-keyvault-keys)
|
||||
add_subdirectory(azure-security-keyvault-secrets)
|
||||
|
||||
@ -467,7 +467,6 @@ For more information see the [Code of Conduct FAQ][coc_faq] or contact opencode@
|
||||
|
||||
<!-- [secrets_client_library]: https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/keyvault/Azure.Security.KeyVault.Secrets -->
|
||||
|
||||
[soft_delete]: https://docs.microsoft.com/azure/key-vault/general/soft-delete-overview
|
||||
[defaultazurecredential]: https://github.com/Azure/azure-sdk-for-cpp/tree/main/sdk/identity/azure-identity#credentials
|
||||
[contributing]: https://github.com/Azure/azure-sdk-for-cpp/blob/main/CONTRIBUTING.md
|
||||
[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/
|
||||
|
||||
@ -0,0 +1,5 @@
|
||||
# Release History
|
||||
|
||||
## 1.0.0-beta.1 (Unreleased)
|
||||
|
||||
* initial preview
|
||||
81
sdk/keyvault/azure-security-keyvault-secrets/CMakeLists.txt
Normal file
81
sdk/keyvault/azure-security-keyvault-secrets/CMakeLists.txt
Normal file
@ -0,0 +1,81 @@
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
cmake_minimum_required (VERSION 3.13)
|
||||
project(azure-security-keyvault-secrets LANGUAGES CXX)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../../cmake-modules")
|
||||
|
||||
include(AzureVcpkg)
|
||||
include(AzureVersion)
|
||||
include(AzureCodeCoverage)
|
||||
include(AzureTransportAdapters)
|
||||
include(AzureDoxygen)
|
||||
include(AzureGlobalCompileOptions)
|
||||
|
||||
az_vcpkg_integrate()
|
||||
|
||||
if(NOT AZ_ALL_LIBRARIES)
|
||||
find_package(azure-core-cpp "1.0.0" CONFIG QUIET)
|
||||
if(NOT azure-core-cpp_FOUND)
|
||||
find_package(azure-core-cpp "1.0.0" REQUIRED)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(
|
||||
AZURE_SECURITY_KEYVAULT_SECRETS_HEADER
|
||||
inc/azure/keyvault/secrets/dll_import_export.hpp
|
||||
inc/azure/keyvault/secrets/secret_client.hpp
|
||||
inc/azure/keyvault/keyvault_secrets.hpp
|
||||
)
|
||||
|
||||
set(
|
||||
AZURE_SECURITY_KEYVAULT_SECRETS_SOURCE
|
||||
src/private/package_version.hpp
|
||||
src/secret_client.cpp
|
||||
)
|
||||
|
||||
add_library(azure-security-keyvault-secrets ${AZURE_SECURITY_KEYVAULT_SECRETS_HEADER} ${AZURE_SECURITY_KEYVAULT_SECRETS_SOURCE})
|
||||
add_library(Azure::azure-security-keyvault-secrets ALIAS azure-security-keyvault-secrets)
|
||||
|
||||
target_include_directories(
|
||||
azure-security-keyvault-secrets
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/inc>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
)
|
||||
|
||||
#target_link_libraries(azure-security-keyvault-secrets PUBLIC Azure::azure-security-keyvault-secrets)
|
||||
|
||||
# coverage. Has no effect if BUILD_CODE_COVERAGE is OFF
|
||||
create_code_coverage(keyvault-secrets azure-security-keyvault-secrets azure-security-keyvault-secrets-test)
|
||||
|
||||
get_az_version("${CMAKE_CURRENT_SOURCE_DIR}/src/private/package_version.hpp")
|
||||
generate_documentation(azure-security-keyvault-secrets ${AZ_LIBRARY_VERSION})
|
||||
if(BUILD_TESTING)
|
||||
|
||||
if (NOT AZ_ALL_LIBRARIES)
|
||||
include(AddGoogleTest)
|
||||
enable_testing ()
|
||||
endif()
|
||||
|
||||
add_subdirectory(test/ut)
|
||||
endif()
|
||||
|
||||
if (BUILD_PERFORMANCE_TESTS)
|
||||
#add_subdirectory(test/perf)
|
||||
endif()
|
||||
|
||||
if(BUILD_SAMPLES)
|
||||
#add_subdirectory(test/samples)
|
||||
endif()
|
||||
|
||||
az_vcpkg_export(
|
||||
azure-security-keyvault-secrets
|
||||
SECURITY_KEYVAULT_KEYS
|
||||
"azure/keyvault/secrets/dll_import_export.hpp"
|
||||
)
|
||||
21
sdk/keyvault/azure-security-keyvault-secrets/LICENSE
Normal file
21
sdk/keyvault/azure-security-keyvault-secrets/LICENSE
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
32
sdk/keyvault/azure-security-keyvault-secrets/NOTICE.txt
Normal file
32
sdk/keyvault/azure-security-keyvault-secrets/NOTICE.txt
Normal file
@ -0,0 +1,32 @@
|
||||
azure-template
|
||||
|
||||
NOTICES AND INFORMATION
|
||||
Do Not Translate or Localize
|
||||
|
||||
This software incorporates material from third parties. Microsoft makes certain
|
||||
open source code available at https://3rdpartysource.microsoft.com, or you may
|
||||
send a check or money order for US $5.00, including the product name, the open
|
||||
source component name, and version number, to:
|
||||
|
||||
Source Code Compliance Team
|
||||
Microsoft Corporation
|
||||
One Microsoft Way
|
||||
Redmond, WA 98052
|
||||
USA
|
||||
|
||||
Notwithstanding any other terms, you may reverse engineer this software to the
|
||||
extent required to debug changes to any libraries licensed under the GNU Lesser
|
||||
General Public License.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
Azure SDK for C++ uses third-party libraries or other resources that may be
|
||||
distributed under licenses different than the Azure SDK for C++ software.
|
||||
|
||||
In the event that we accidentally failed to list a required notice, please
|
||||
bring it to our attention. Post an issue or email us:
|
||||
|
||||
azcppsdkhelp@microsoft.com
|
||||
|
||||
The attached notices are provided for information only.
|
||||
|
||||
71
sdk/keyvault/azure-security-keyvault-secrets/README.md
Normal file
71
sdk/keyvault/azure-security-keyvault-secrets/README.md
Normal file
@ -0,0 +1,71 @@
|
||||
#to be edited to something more useful before first release
|
||||
# Azure Security Keyvault Secrets Package client library for C++
|
||||
|
||||
Azure Security Keyvault Secrets Package client library for C++ (`azure-security-keyvault-secrets`) matches necessary patterns that the development team has established to create a unified SDK written in the C++ programming language. These libraries follow the Azure SDK Design Guidelines for C++.
|
||||
|
||||
The library allows client libraries to expose common functionality in a consistent fashion. Once you learn how to use these APIs in one client library, you will know how to use them in other client libraries.
|
||||
|
||||
## Getting started
|
||||
|
||||
For a rich example of a well formatted readme, please check [here.](https://github.com/Azure/azure-sdk/blob/main/docs/policies/README-TEMPLATE.md) In addition, this is an [example readme](https://github.com/Azure/azure-sdk/blob/main/docs/policies/README-EXAMPLE.md) that should be emulated. Note that the top-level sections in this template align with that of the [template.](https://github.com/Azure/azure-sdk/blob/main/docs/policies/README-TEMPLATE.md)
|
||||
|
||||
# Key concepts
|
||||
|
||||
Bullet point list of your library's main concepts.
|
||||
|
||||
# Examples
|
||||
|
||||
Examples of some of the key concepts for your library.
|
||||
|
||||
# Troubleshooting
|
||||
|
||||
Running into issues? This section should contain details as to what to do there.
|
||||
|
||||
# Next steps
|
||||
|
||||
More sample code should go here, along with links out to the appropriate example tests.
|
||||
|
||||
## Contributing
|
||||
For details on contributing to this repository, see the [contributing guide][azure_sdk_for_cpp_contributing].
|
||||
|
||||
This project welcomes contributions and suggestions. Most contributions require you to agree to a
|
||||
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
|
||||
the rights to use your contribution. For details, visit https://cla.microsoft.com.
|
||||
|
||||
When you submit a pull request, a CLA-bot will automatically determine whether you need to provide
|
||||
a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions
|
||||
provided by the bot. You will only need to do this once across all repos using our CLA.
|
||||
|
||||
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
|
||||
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
|
||||
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
|
||||
|
||||
### Additional Helpful Links for Contributors
|
||||
Many people all over the world have helped make this project better. You'll want to check out:
|
||||
|
||||
* [What are some good first issues for new contributors to the repo?](https://github.com/azure/azure-sdk-for-cpp/issues?q=is%3Aopen+is%3Aissue+label%3A%22up+for+grabs%22)
|
||||
* [How to build and test your change][azure_sdk_for_cpp_contributing_developer_guide]
|
||||
* [How you can make a change happen!][azure_sdk_for_cpp_contributing_pull_requests]
|
||||
* Frequently Asked Questions (FAQ) and Conceptual Topics in the detailed [Azure SDK for C++ wiki](https://github.com/azure/azure-sdk-for-cpp/wiki).
|
||||
|
||||
<!-- ### Community-->
|
||||
### Reporting security issues and security bugs
|
||||
|
||||
Security issues and bugs should be reported privately, via email, to the Microsoft Security Response Center (MSRC) <secure@microsoft.com>. You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Further information, including the MSRC PGP key, can be found in the [Security TechCenter](https://www.microsoft.com/msrc/faqs-report-an-issue).
|
||||
|
||||
### License
|
||||
|
||||
Azure SDK for C++ is licensed under the [MIT](https://github.com/Azure/azure-sdk-for-cpp/blob/main/sdk/template/azure-template/LICENSE) license.
|
||||
|
||||
<!-- LINKS -->
|
||||
[azure_sdk_for_cpp_contributing]: https://github.com/Azure/azure-sdk-for-cpp/blob/main/CONTRIBUTING.md
|
||||
[azure_sdk_for_cpp_contributing_developer_guide]: https://github.com/Azure/azure-sdk-for-cpp/blob/main/CONTRIBUTING.md#developer-guide
|
||||
[azure_sdk_for_cpp_contributing_pull_requests]: https://github.com/Azure/azure-sdk-for-cpp/blob/main/CONTRIBUTING.md#pull-requests
|
||||
[azure_cli]: https://docs.microsoft.com/cli/azure
|
||||
[azure_pattern_circuit_breaker]: https://docs.microsoft.com/azure/architecture/patterns/circuit-breaker
|
||||
[azure_pattern_retry]: https://docs.microsoft.com/azure/architecture/patterns/retry
|
||||
[azure_portal]: https://portal.azure.com
|
||||
[azure_sub]: https://azure.microsoft.com/free/
|
||||
[c_compiler]: https://visualstudio.microsoft.com/vs/features/cplusplus/
|
||||
[cloud_shell]: https://docs.microsoft.com/azure/cloud-shell/overview
|
||||
[cloud_shell_bash]: https://shell.azure.com/bash
|
||||
36
sdk/keyvault/azure-security-keyvault-secrets/cgmanifest.json
Normal file
36
sdk/keyvault/azure-security-keyvault-secrets/cgmanifest.json
Normal file
@ -0,0 +1,36 @@
|
||||
{
|
||||
"Registrations": [
|
||||
{
|
||||
"Component": {
|
||||
"Type": "git",
|
||||
"git": {
|
||||
"RepositoryUrl": "https://github.com/google/googletest",
|
||||
"CommitHash": "703bd9caab50b139428cea1aaff9974ebee5742e"
|
||||
}
|
||||
},
|
||||
"DevelopmentDependency": true
|
||||
},
|
||||
{
|
||||
"Component": {
|
||||
"Type": "other",
|
||||
"Other": {
|
||||
"Name": "clang-format",
|
||||
"Version": "9.0.0-2",
|
||||
"DownloadUrl": "https://ubuntu.pkgs.org/18.04/ubuntu-updates-universe-amd64/clang-format-9_9-2~ubuntu18.04.2_amd64.deb.html"
|
||||
}
|
||||
},
|
||||
"DevelopmentDependency": true
|
||||
},
|
||||
{
|
||||
"Component": {
|
||||
"Type": "other",
|
||||
"Other": {
|
||||
"Name": "doxygen",
|
||||
"Version": "1.8.20",
|
||||
"DownloadUrl": "http://doxygen.nl/files/doxygen-1.8.20-setup.exe"
|
||||
}
|
||||
},
|
||||
"DevelopmentDependency": true
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
/**
|
||||
* @brief Includes all public headers from Azure Template SDK library.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "azure/keyvault/secrets/dll_import_export.hpp"
|
||||
#include "azure/keyvault/secrets/secret_client.hpp"
|
||||
@ -0,0 +1,54 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief DLL export macro.
|
||||
*/
|
||||
|
||||
// For explanation, see the comment in azure/core/dll_import_export.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* @def AZURE_SECURITY_KEYVAULT_SECRETS_DLLEXPORT
|
||||
* @brief Applies DLL export attribute, when applicable.
|
||||
* @note See https://docs.microsoft.com/cpp/cpp/dllexport-dllimport?view=msvc-160.
|
||||
*/
|
||||
|
||||
#if defined(AZURE_SECURITY_KEYVAULT_SECRETS_DLL) \
|
||||
|| (0 /*@AZURE_SECURITY_KEYVAULT_SECRETS_DLL_INSTALLED_AS_PACKAGE@*/)
|
||||
#define AZURE_SECURITY_KEYVAULT_SECRETS_BUILT_AS_DLL 1
|
||||
#else
|
||||
#define AZURE_SECURITY_KEYVAULT_SECRETS_BUILT_AS_DLL 0
|
||||
#endif
|
||||
|
||||
#if AZURE_SECURITY_KEYVAULT_SECRETS_BUILT_AS_DLL
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(AZURE_SECURITY_KEYVAULT_SECRETS_BEING_BUILT)
|
||||
#define AZURE_SECURITY_KEYVAULT_SECRETS_DLLEXPORT __declspec(dllexport)
|
||||
#else // !defined(AZURE_SECURITY_KEYVAULT_SECRETS_BEING_BUILT)
|
||||
#define AZURE_SECURITY_KEYVAULT_SECRETS_DLLEXPORT __declspec(dllimport)
|
||||
#endif // AZURE_SECURITY_KEYVAULT_SECRETS_BEING_BUILT
|
||||
#else // !defined(_MSC_VER)
|
||||
#define AZURE_SECURITY_KEYVAULT_SECRETS_DLLEXPORT
|
||||
#endif // _MSC_VER
|
||||
#else // !AZURE_SECURITY_KEYVAULT_SECRETS_BUILT_AS_DLL
|
||||
#define AZURE_SECURITY_KEYVAULT_SECRETS_DLLEXPORT
|
||||
#endif // AZURE_SECURITY_KEYVAULT_SECRETS_BUILT_AS_DLL
|
||||
|
||||
#undef AZURE_SECURITY_KEYVAULT_SECRETS_BUILT_AS_DLL
|
||||
|
||||
/**
|
||||
* @brief Azure SDK abstractions.
|
||||
*
|
||||
*/
|
||||
namespace Azure {
|
||||
|
||||
/**
|
||||
* @brief Azure Template SDK abstractions.
|
||||
*
|
||||
*/
|
||||
namespace Template {
|
||||
}
|
||||
} // namespace Azure
|
||||
@ -0,0 +1,14 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
namespace Azure { namespace Security { namespace KeyVault { namespace Secrets {
|
||||
|
||||
class SecretClient final {
|
||||
public:
|
||||
std::string ClientVersion() const;
|
||||
};
|
||||
|
||||
}}}} // namespace Azure::Security::KeyVault::Secrets
|
||||
@ -0,0 +1,63 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Provides version information.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#define AZURE_SECURITY_KEYVAULT_SECRETS_VERSION_MAJOR 1
|
||||
#define AZURE_SECURITY_KEYVAULT_SECRETS_VERSION_MINOR 0
|
||||
#define AZURE_SECURITY_KEYVAULT_SECRETS_VERSION_PATCH 0
|
||||
#define AZURE_SECURITY_KEYVAULT_SECRETS_VERSION_PRERELEASE "beta.1"
|
||||
|
||||
#define AZURE_SECURITY_KEYVAULT_SECRETS_VERSION_ITOA_HELPER(i) #i
|
||||
#define AZURE_SECURITY_KEYVAULT_SECRETS_VERSION_ITOA(i) \
|
||||
AZURE_SECURITY_KEYVAULT_SECRETS_VERSION_ITOA_HELPER(i)
|
||||
|
||||
namespace Azure { namespace Security { namespace KeyVault { namespace Secrets { namespace _detail {
|
||||
/**
|
||||
* @brief Provides version information.
|
||||
*
|
||||
*/
|
||||
class PackageVersion final {
|
||||
public:
|
||||
/// Major numeric identifier.
|
||||
static constexpr int32_t Major = AZURE_SECURITY_KEYVAULT_SECRETS_VERSION_MAJOR;
|
||||
|
||||
/// Minor numeric identifier.
|
||||
static constexpr int32_t Minor = AZURE_SECURITY_KEYVAULT_SECRETS_VERSION_MINOR;
|
||||
|
||||
/// Patch numeric identifier.
|
||||
static constexpr int32_t Patch = AZURE_SECURITY_KEYVAULT_SECRETS_VERSION_PATCH;
|
||||
|
||||
/// Indicates whether the SDK is in a pre-release state.
|
||||
static constexpr bool IsPreRelease
|
||||
= sizeof(AZURE_SECURITY_KEYVAULT_SECRETS_VERSION_PRERELEASE) != sizeof("");
|
||||
|
||||
/**
|
||||
* @brief The version in string format used for telemetry following the `semver.org` standard
|
||||
* (https://semver.org).
|
||||
*/
|
||||
static constexpr const char* ToString()
|
||||
{
|
||||
return IsPreRelease
|
||||
? AZURE_SECURITY_KEYVAULT_SECRETS_VERSION_ITOA(AZURE_SECURITY_KEYVAULT_SECRETS_VERSION_MAJOR) "." AZURE_SECURITY_KEYVAULT_SECRETS_VERSION_ITOA(
|
||||
AZURE_SECURITY_KEYVAULT_SECRETS_VERSION_MINOR) "." AZURE_SECURITY_KEYVAULT_SECRETS_VERSION_ITOA(AZURE_SECURITY_KEYVAULT_SECRETS_VERSION_PATCH) "-" AZURE_SECURITY_KEYVAULT_SECRETS_VERSION_PRERELEASE
|
||||
: AZURE_SECURITY_KEYVAULT_SECRETS_VERSION_ITOA(AZURE_SECURITY_KEYVAULT_SECRETS_VERSION_MAJOR) "." AZURE_SECURITY_KEYVAULT_SECRETS_VERSION_ITOA(
|
||||
AZURE_SECURITY_KEYVAULT_SECRETS_VERSION_MINOR) "." AZURE_SECURITY_KEYVAULT_SECRETS_VERSION_ITOA(AZURE_SECURITY_KEYVAULT_SECRETS_VERSION_PATCH);
|
||||
}
|
||||
};
|
||||
}}}}} // namespace Azure::Security::KeyVault::Secrets::_detail
|
||||
|
||||
#undef AZURE_SECURITY_KEYVAULT_SECRETS_VERSION_ITOA_HELPER
|
||||
#undef AZURE_SECURITY_KEYVAULT_SECRETS_VERSION_ITOA
|
||||
|
||||
#undef AZURE_SECURITY_KEYVAULT_SECRETS_VERSION_MAJOR
|
||||
#undef AZURE_SECURITY_KEYVAULT_SECRETS_VERSION_MINOR
|
||||
#undef AZURE_SECURITY_KEYVAULT_SECRETS_VERSION_PATCH
|
||||
#undef AZURE_SECURITY_KEYVAULT_SECRETS_VERSION_PRERELEASE
|
||||
@ -0,0 +1,17 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
/**
|
||||
* @brief Keyvault Secrets Client definition.
|
||||
*
|
||||
*/
|
||||
#include "azure/keyvault/secrets/secret_client.hpp"
|
||||
|
||||
#include "private/package_version.hpp"
|
||||
|
||||
#include <string>
|
||||
|
||||
using namespace Azure::Security::KeyVault::Secrets;
|
||||
using namespace Azure::Security::KeyVault::Secrets::_detail;
|
||||
|
||||
std::string SecretClient::ClientVersion() const { return PackageVersion::ToString(); }
|
||||
@ -0,0 +1,33 @@
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
cmake_minimum_required (VERSION 3.13)
|
||||
|
||||
project (azure-security-keyvault-secrets-test LANGUAGES CXX)
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||
|
||||
include(GoogleTest)
|
||||
|
||||
add_executable (
|
||||
azure-security-keyvault-secrets-test
|
||||
macro_guard.cpp
|
||||
secret_client_test.cpp
|
||||
)
|
||||
|
||||
if (MSVC)
|
||||
target_compile_options(azure-security-keyvault-secrets-test PUBLIC /wd6326 /wd26495 /wd26812)
|
||||
endif()
|
||||
|
||||
target_link_libraries(azure-security-keyvault-secrets-test PRIVATE azure-security-keyvault-secrets azure-identity gtest gtest_main gmock)
|
||||
|
||||
# Adding private headers so we can test the private APIs with no relative paths include.
|
||||
target_include_directories (azure-security-keyvault-secrets-test PRIVATE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../../src>)
|
||||
|
||||
# gtest_add_tests will scan the test from azure-core-test and call add_test
|
||||
# for each test to ctest. This enables `ctest -r` to run specific tests directly.
|
||||
gtest_discover_tests(azure-security-keyvault-secrets-test
|
||||
TEST_PREFIX azure-security-keyvault-secrets-unittest.
|
||||
NO_PRETTY_TYPES
|
||||
NO_PRETTY_VALUES
|
||||
)
|
||||
@ -0,0 +1,15 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
// Define `min` and `max` as function-like macros before including all public
|
||||
// headers to ensure that uses of those identifiers are defended against
|
||||
// expansion as function-like macros. Define `small` as an object-like macro to
|
||||
// ensure that identifier isn't used at all. Windows.h is badly behaved and
|
||||
// defines similar macros with these names and we want to ensure the SDK headers
|
||||
// function even when a naive user includes Windows.h first.
|
||||
//
|
||||
#define small FAIL><TO][COMPILE)(VERY{{{LOUDLY!!!
|
||||
#define max(x, y) small
|
||||
#define min(x, y) small
|
||||
|
||||
#include "azure/keyvault/keyvault_secrets.hpp"
|
||||
@ -0,0 +1,15 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <azure/keyvault/secrets/secret_client.hpp>
|
||||
|
||||
using namespace Azure::Security::KeyVault::Secrets;
|
||||
|
||||
TEST(SecretClient, Basic)
|
||||
{
|
||||
SecretClient secretClient;
|
||||
|
||||
EXPECT_FALSE(secretClient.ClientVersion().empty());
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
@PACKAGE_INIT@
|
||||
|
||||
include(CMakeFindDependencyMacro)
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/azure-security-keyvault-secrets-cppTargets.cmake")
|
||||
|
||||
check_required_components("azure-security-keyvault-secrets-cpp")
|
||||
@ -0,0 +1,22 @@
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO Azure/azure-sdk-for-cpp
|
||||
REF azure-security-keyvault-secrets_@AZ_LIBRARY_VERSION@
|
||||
SHA512 0
|
||||
)
|
||||
|
||||
vcpkg_cmake_configure(
|
||||
SOURCE_PATH ${SOURCE_PATH}/sdk/keyvault/azure-security-keyvault-secrets/
|
||||
PREFER_NINJA
|
||||
OPTIONS
|
||||
-DWARNINGS_AS_ERRORS=OFF
|
||||
)
|
||||
|
||||
vcpkg_cmake_install()
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
|
||||
vcpkg_cmake_config_fixup()
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
|
||||
vcpkg_copy_pdbs()
|
||||
@ -0,0 +1,22 @@
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: MIT {
|
||||
"name": "azure-security-keyvault-secrets-cpp",
|
||||
"version-semver": "@AZ_LIBRARY_VERSION@",
|
||||
"description": [
|
||||
"Microsoft Azure Key Vault Secrets SDK for C++",
|
||||
"This library provides Azure Key Vault Secrets SDK."
|
||||
],
|
||||
"homepage": "https://github.com/Azure/azure-sdk-for-cpp/tree/main/sdk/keyvault/azure-security-keyvault-secrets",
|
||||
"license": "MIT",
|
||||
"builtin-baseline": "14c54c49b56a964ac7f2f701a6857adb02ae1bec",
|
||||
"dependencies": [
|
||||
{
|
||||
"name": "vcpkg-cmake",
|
||||
"host": true
|
||||
},
|
||||
{
|
||||
"name": "vcpkg-cmake-config",
|
||||
"host": true
|
||||
}
|
||||
]
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user