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
This commit is contained in:
parent
d3a0dd98b6
commit
b5ee71b676
@ -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
|
||||
)
|
||||
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
*/
|
||||
|
||||
#include "get_env.hpp"
|
||||
#include <azure/attestation.hpp>
|
||||
#include <azure/core.hpp>
|
||||
#include <azure/identity.hpp>
|
||||
#include <azure/keyvault/keyvault_certificates.hpp>
|
||||
@ -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<Azure::Identity::ClientSecretCredential>(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;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user