From b5ee71b676a476dd654969ce10e3746b61b59d65 Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Wed, 23 Mar 2022 12:50:02 -0700 Subject: [PATCH] Add attestation clients (#3464) * 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 * Adding attestation client * test done * PR comments * return --- .../vcpkg-all-smoke/CMakeLists.txt | 1 + .../integration/vcpkg-all-smoke/src/main.cpp | 44 +++++++++++-------- 2 files changed, 27 insertions(+), 18 deletions(-) diff --git a/samples/integration/vcpkg-all-smoke/CMakeLists.txt b/samples/integration/vcpkg-all-smoke/CMakeLists.txt index 14e5e3161..48b6ff6ed 100644 --- a/samples/integration/vcpkg-all-smoke/CMakeLists.txt +++ b/samples/integration/vcpkg-all-smoke/CMakeLists.txt @@ -33,6 +33,7 @@ target_link_libraries(vcpkg-all-smoke Azure::azure-security-keyvault-keys Azure::azure-security-keyvault-certificates Azure::azure-security-keyvault-secrets + Azure::azure-security-attestation get-env-helper ) diff --git a/samples/integration/vcpkg-all-smoke/src/main.cpp b/samples/integration/vcpkg-all-smoke/src/main.cpp index ab306ab8c..8b8ed7e92 100644 --- a/samples/integration/vcpkg-all-smoke/src/main.cpp +++ b/samples/integration/vcpkg-all-smoke/src/main.cpp @@ -7,6 +7,7 @@ */ #include "get_env.hpp" +#include #include #include #include @@ -25,6 +26,7 @@ using namespace Azure::Storage::Blobs; using namespace Azure::Storage::Queues; using namespace Azure::Storage::Files::DataLake; using namespace Azure::Storage::Files::Shares; +using namespace Azure::Security::Attestation; int main() { @@ -32,44 +34,50 @@ int main() const std::string clientId = "client"; const std::string clientSecret = "secret"; const std::string leaseID = "leaseID"; - const std::string storageUrl = "https://blob.com"; + const std::string smokeUrl = "https://blob.com"; auto credential = std::make_shared(tenantId, clientId, clientSecret); // instantiate the clients try { - std::cout << "Creating Keyvault Clients"; + std::cout << "Creating Keyvault Clients" << std::endl; // 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"; + std::cout << "Creating Storage Clients" << std::endl; // Storage - BlobClient blobClient(storageUrl); - QueueClient queueClient(storageUrl); + BlobClient blobClient(smokeUrl); + QueueClient queueClient(smokeUrl); - std::cout << "Creating Storage Datalake Clients"; - DataLakeDirectoryClient directoryClient(storageUrl); - DataLakeFileClient fileClient(storageUrl); - DataLakeFileSystemClient fileSystemClient(storageUrl); - DataLakePathClient pathClient(storageUrl); + std::cout << "Creating Storage Datalake Clients" << std::endl; + DataLakeDirectoryClient directoryClient(smokeUrl); + DataLakeFileClient fileClient(smokeUrl); + DataLakeFileSystemClient fileSystemClient(smokeUrl); + DataLakePathClient pathClient(smokeUrl); DataLakeLeaseClient leaseClient(pathClient, leaseID); - DataLakeServiceClient serviceClient(storageUrl); + DataLakeServiceClient serviceClient(smokeUrl); - std::cout << "Creating Storage Share Clients"; - ShareClient shareClient(storageUrl); - ShareDirectoryClient shareDirectoryClient(storageUrl); - ShareFileClient shareFileClient(storageUrl); + std::cout << "Creating Storage Share Clients" << std::endl; + ShareClient shareClient(smokeUrl); + ShareDirectoryClient shareDirectoryClient(smokeUrl); + ShareFileClient shareFileClient(smokeUrl); ShareLeaseClient shareLeaseClient(shareFileClient, leaseID); - ShareServiceClient shareServiceClient(storageUrl); + ShareServiceClient shareServiceClient(smokeUrl); - std::cout << "Successfully Created the Clients"; + //Attestation + std::cout << "Creating Attestation Clients" << std::endl; + AttestationClient attestationClient(smokeUrl); + AttestationAdministrationClient attestationAdminClient(smokeUrl, credential); + + std::cout << "Successfully Created the Clients" << std::endl; } catch (std::exception const& exception) { - std::cout << "Exception: " << exception.what(); + std::cout << "Exception: " << exception.what() << std::endl; + return 1; } return 0;