* initial setup

* smoke sample

* cleanup

* typo

* typo 2

* typo 3

* daniel's feedback

* add sotrage sdks

* added storage

* more test

* cleanup

* remove attestetion from samples for the moment

* PR comments

* typo

* remove finds

* vcpkg maybe

* REQUIRED

* try try again

* noidea

* fff
This commit is contained in:
George Arama 2022-03-21 19:49:29 -07:00 committed by GitHub
parent feaaf0b414
commit 183db457fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 57 additions and 22 deletions

View File

@ -12,23 +12,28 @@ endif()
# Project set up
cmake_minimum_required(VERSION 3.13)
project(smoketest-vcpkg LANGUAGES CXX)
project(vcpkg-all-smoke LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED True)
add_executable (
smoketest-vcpkg
vcpkg-all-smoke
src/main
)
# Link to Azure SDK
target_link_libraries(smoketest-vcpkg
target_link_libraries(vcpkg-all-smoke
PRIVATE
Azure::azure-core
Azure::azure-identity
Azure::azure-storage-blobs
Azure::azure-storage-files-datalake
Azure::azure-storage-files-shares
Azure::azure-storage-queues
Azure::azure-security-keyvault-keys
Azure::azure-security-keyvault-certificates
Azure::azure-security-keyvault-secrets
Azure::azure-identity
get-env-helper
)
create_per_service_target_build_for_sample(keyvault smoketest-vcpkg)
create_per_service_target_build_for_sample(keyvault vcpkg-all-smoke)

View File

@ -4,43 +4,73 @@
/**
* @brief This sample provides smoke test for the sdks to ensure side by side works properly
*
* @remark The following environment variables must be set before running the sample.
* - AZURE_KEYVAULT_URL: To the Key Vault account URL.
* - AZURE_TENANT_ID: Tenant ID for the Azure account.
* - AZURE_CLIENT_ID: The Client ID to authenticate the request.
* - AZURE_CLIENT_SECRET: The client secret.
*
*/
#include "get_env.hpp"
#include <azure/core.hpp>
#include <azure/identity.hpp>
#include <azure/keyvault/keyvault_certificates.hpp>
#include <azure/keyvault/keyvault_keys.hpp>
#include <azure/keyvault/keyvault_secrets.hpp>
#include <chrono>
#include <azure/storage/blobs.hpp>
#include <azure/storage/files/datalake.hpp>
#include <azure/storage/files/shares.hpp>
#include <azure/storage/queues.hpp>
#include <iostream>
#include <memory>
#include <thread>
using namespace Azure::Security::KeyVault::Keys;
using namespace Azure::Security::KeyVault::Secrets;
using namespace Azure::Security::KeyVault::Certificates;
using namespace Azure::Storage::Blobs;
using namespace Azure::Storage::Queues;
using namespace Azure::Storage::Files::DataLake;
using namespace Azure::Storage::Files::Shares;
int main()
{
auto tenantId = "tenant";
auto clientId = "client";
auto clientSecret = "secret";
const std::string tenantId = "tenant";
const std::string clientId = "client";
const std::string clientSecret = "secret";
const std::string leaseID = "leaseID";
const std::string storageUrl = "https://blob.com";
auto credential
= std::make_shared<Azure::Identity::ClientSecretCredential>(tenantId, clientId, clientSecret);
// instantiate the clients
KeyClient keyClient(std::getenv("AZURE_KEYVAULT_URL"), credential);
SecretClient secretClient(std::getenv("AZURE_KEYVAULT_URL"), credential);
CertificateClient certificateClient(std::getenv("AZURE_KEYVAULT_URL"), credential);
try
{
std::cout << "Creating Keyvault Clients";
// keyvault
KeyClient keyClient(std::getenv("AZURE_KEYVAULT_URL"), credential);
SecretClient secretClient(std::getenv("AZURE_KEYVAULT_URL"), credential);
CertificateClient certificateClient(std::getenv("AZURE_KEYVAULT_URL"), credential);
std::cout << "Creating Storage Clients";
// Storage
BlobClient blobClient(storageUrl);
QueueClient queueClient(storageUrl);
std::cout << "Creating Storage Datalake Clients";
DataLakeDirectoryClient directoryClient(storageUrl);
DataLakeFileClient fileClient(storageUrl);
DataLakeFileSystemClient fileSystemClient(storageUrl);
DataLakePathClient pathClient(storageUrl);
DataLakeLeaseClient leaseClient(pathClient, leaseID);
DataLakeServiceClient serviceClient(storageUrl);
std::cout << "Creating Storage Share Clients";
ShareClient shareClient(storageUrl);
ShareDirectoryClient shareDirectoryClient(storageUrl);
ShareFileClient shareFileClient(storageUrl);
ShareLeaseClient shareLeaseClient(shareFileClient, leaseID);
ShareServiceClient shareServiceClient(storageUrl);
std::cout << "Successfully Created the Clients";
}
catch (std::exception exception)
{
std::cout << "Exception: " << exception.what();
}
return 0;
}