parent
19fd7e5f32
commit
333891c972
@ -77,10 +77,10 @@ Call StartCreateCertificate to create a new certificate, with specified properti
|
||||
|
||||
```cpp Snippet:CertificateSample1Create
|
||||
std::string certificateName = "Sample1";
|
||||
CertificateCreateParameters params;
|
||||
CertificateCreateOptions options;
|
||||
...
|
||||
// start the create process
|
||||
auto response = certificateClient.StartCreateCertificate(certificateName, params);
|
||||
auto response = certificateClient.StartCreateCertificate(certificateName, options);
|
||||
auto result = response.PollUntilDone(defaultWait);
|
||||
```
|
||||
|
||||
@ -207,20 +207,20 @@ for (auto deletedCertificates = certificateClient.GetDeletedCertificates();
|
||||
|
||||
You will need the certificate content in PEM format to perform this operation. One sample is provided in certificate-ImportCertificate sample.
|
||||
|
||||
Once the import parameters are setup we can call Import certificate and get back the newly imported certificate.
|
||||
Once the import options are setup we can call Import certificate and get back the newly imported certificate.
|
||||
|
||||
```cpp Snippet:CertificateSample3ImportPEM
|
||||
// prepare the parameters
|
||||
ImportCertificateOptions params;
|
||||
params.Value = GetPemCertificate();
|
||||
// prepare the options
|
||||
ImportCertificateOptions options;
|
||||
options.Value = GetPemCertificate();
|
||||
|
||||
params.Policy.Enabled = true;
|
||||
params.Policy.KeyType = CertificateKeyType::Rsa;
|
||||
params.Policy.KeySize = 2048;
|
||||
params.Policy.ContentType = CertificateContentType::Pem;
|
||||
params.Policy.Exportable = true;
|
||||
options.Policy.Enabled = true;
|
||||
options.Policy.KeyType = CertificateKeyType::Rsa;
|
||||
options.Policy.KeySize = 2048;
|
||||
options.Policy.ContentType = CertificateContentType::Pem;
|
||||
options.Policy.Exportable = true;
|
||||
// call import API
|
||||
auto imported = certificateClient.ImportCertificate(pemName, params).Value;
|
||||
auto imported = certificateClient.ImportCertificate(pemName, options).Value;
|
||||
// get some value from the certificate
|
||||
std::cout << "Imported pem certificate with name " << imported.Name();
|
||||
```
|
||||
@ -229,20 +229,20 @@ std::cout << "Imported pem certificate with name " << imported.Name();
|
||||
|
||||
You will need the certificate content in PKCS format to perform this operation. One sample is provided in certificate-ImportCertificate sample.
|
||||
|
||||
Once the import parameters are setup we can call Import certificate and get back the newly imported certificate
|
||||
Once the import options are setup we can call Import certificate and get back the newly imported certificate
|
||||
|
||||
```cpp Snippet:CertificateSample3ImportPKCS
|
||||
// prepare the parameters
|
||||
ImportCertificateOptions params;
|
||||
params.Value = GetPemCertificate();
|
||||
// prepare the options
|
||||
ImportCertificateOptions options;
|
||||
options.Value = GetPemCertificate();
|
||||
|
||||
params.Policy.Enabled = true;
|
||||
params.Policy.KeyType = CertificateKeyType::Rsa;
|
||||
params.Policy.KeySize = 2048;
|
||||
params.Policy.ContentType = CertificateContentType::Pkcs12;
|
||||
params.Policy.Exportable = true;
|
||||
options.Policy.Enabled = true;
|
||||
options.Policy.KeyType = CertificateKeyType::Rsa;
|
||||
options.Policy.KeySize = 2048;
|
||||
options.Policy.ContentType = CertificateContentType::Pkcs12;
|
||||
options.Policy.Exportable = true;
|
||||
// call the import API
|
||||
auto imported = certificateClient.ImportCertificate(pkcsName, params).Value;
|
||||
auto imported = certificateClient.ImportCertificate(pkcsName, options).Value;
|
||||
// read something from the certificate
|
||||
std::cout << "Imported pkcs certificate with name " << imported.Name();
|
||||
```
|
||||
|
||||
@ -116,13 +116,13 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Certificat
|
||||
* @remark This operation requires the certificates/create permission.
|
||||
*
|
||||
* @param name The name of the certificate.
|
||||
* @param parameters Parameters for this operation.
|
||||
* @param options Options for this operation.
|
||||
* @param context The context for the operation can be used for request cancellation.
|
||||
* @return CreateCertificateOperation instance used to determine create status.
|
||||
*/
|
||||
CreateCertificateOperation StartCreateCertificate(
|
||||
std::string const& name,
|
||||
CertificateCreateParameters const& parameters,
|
||||
CertificateCreateOptions const& options,
|
||||
Azure::Core::Context const& context = Azure::Core::Context()) const;
|
||||
|
||||
/**
|
||||
|
||||
@ -845,10 +845,10 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Certificat
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Parameters for StartCreateCertificate.
|
||||
* @brief Options for StartCreateCertificate.
|
||||
*
|
||||
*/
|
||||
class CertificateCreateParameters final {
|
||||
class CertificateCreateOptions final {
|
||||
public:
|
||||
/**
|
||||
* @brief Certificate policy.
|
||||
@ -876,10 +876,10 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Certificat
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief The certificate operation update parameters.
|
||||
* @brief The certificate operation update Options.
|
||||
*
|
||||
*/
|
||||
struct CertificateOperationUpdateParameter final
|
||||
struct CertificateOperationUpdateOptions final
|
||||
{
|
||||
|
||||
/**
|
||||
@ -1470,7 +1470,7 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Certificat
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief The certificate merge parameters
|
||||
* @brief The certificate merge Options
|
||||
*
|
||||
*/
|
||||
struct MergeCertificateOptions final
|
||||
@ -1492,7 +1492,7 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Certificat
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief The certificate update parameters.
|
||||
* @brief The certificate update Options.
|
||||
*
|
||||
*/
|
||||
struct CertificateUpdateOptions final
|
||||
|
||||
@ -38,10 +38,10 @@ Call StartCreateCertificate to create a new certificate, with specified properti
|
||||
|
||||
```cpp Snippet:CertificateSample2Create
|
||||
std::string certificateName = "Sample1";
|
||||
auto params = CertificateCreateParameters();
|
||||
CertificateCreateOptions options
|
||||
...
|
||||
// start the create process
|
||||
auto response = certificateClient.StartCreateCertificate(certificateName, params);
|
||||
auto response = certificateClient.StartCreateCertificate(certificateName, options);
|
||||
auto result = response.PollUntilDone(defaultWait);
|
||||
```
|
||||
|
||||
|
||||
@ -131,7 +131,7 @@ KeyVaultCertificateWithPolicy CreateCertificate(
|
||||
std::string const& certificateName,
|
||||
CertificateClient const& certificateClient)
|
||||
{
|
||||
CertificateCreateParameters params;
|
||||
CertificateCreateOptions options;
|
||||
std::chrono::milliseconds defaultWait(10s);
|
||||
// setup certificate create properties/policy
|
||||
{
|
||||
@ -141,22 +141,22 @@ KeyVaultCertificateWithPolicy CreateCertificate(
|
||||
action.Action = CertificatePolicyAction::AutoRenew;
|
||||
|
||||
// setup properties
|
||||
params.Properties.Enabled = true;
|
||||
options.Properties.Enabled = true;
|
||||
// setup policy
|
||||
params.Policy.Subject = "CN=sample1";
|
||||
params.Policy.ValidityInMonths = 12;
|
||||
params.Policy.Enabled = true;
|
||||
params.Policy.ContentType = CertificateContentType::Pkcs12;
|
||||
params.Policy.IssuerName = "Self";
|
||||
options.Policy.Subject = "CN=sample1";
|
||||
options.Policy.ValidityInMonths = 12;
|
||||
options.Policy.Enabled = true;
|
||||
options.Policy.ContentType = CertificateContentType::Pkcs12;
|
||||
options.Policy.IssuerName = "Self";
|
||||
|
||||
// add a lifetime action
|
||||
params.Policy.LifetimeActions.emplace_back(action);
|
||||
options.Policy.LifetimeActions.emplace_back(action);
|
||||
}
|
||||
// create a certificate
|
||||
{
|
||||
params.Properties.Name = certificateName;
|
||||
options.Properties.Name = certificateName;
|
||||
// start the create process
|
||||
auto response = certificateClient.StartCreateCertificate(certificateName, params);
|
||||
auto response = certificateClient.StartCreateCertificate(certificateName, options);
|
||||
auto result = response.PollUntilDone(defaultWait);
|
||||
|
||||
// get the certificate
|
||||
|
||||
@ -28,20 +28,20 @@ CertificateClient certificateClient(std::getenv("AZURE_KEYVAULT_URL"), credentia
|
||||
|
||||
You will need the certificate content in PEM format to perform this operation. One sample is provided in certificate-ImportCertificate.hpp as the GetPemCertificate() string.
|
||||
|
||||
Once the import parameters are setup we can call Import certificate and get back the newly imported certificate.
|
||||
Once the import options are setup we can call Import certificate and get back the newly imported certificate.
|
||||
|
||||
```cpp Snippet:CertificateSample3ImportPEM
|
||||
// prepare the parameters
|
||||
ImportCertificateOptions params;
|
||||
params.Value = GetPemCertificate();
|
||||
// prepare the options
|
||||
ImportCertificateOptions options;
|
||||
options.Value = GetPemCertificate();
|
||||
|
||||
params.Policy.Enabled = true;
|
||||
params.Policy.KeyType = CertificateKeyType::Rsa;
|
||||
params.Policy.KeySize = 2048;
|
||||
params.Policy.ContentType = CertificateContentType::Pem;
|
||||
params.Policy.Exportable = true;
|
||||
options.Policy.Enabled = true;
|
||||
options.Policy.KeyType = CertificateKeyType::Rsa;
|
||||
options.Policy.KeySize = 2048;
|
||||
options.Policy.ContentType = CertificateContentType::Pem;
|
||||
options.Policy.Exportable = true;
|
||||
// call import API
|
||||
auto imported = certificateClient.ImportCertificate(pemName, params).Value;
|
||||
auto imported = certificateClient.ImportCertificate(pemName, options).Value;
|
||||
// get some value from the certificate
|
||||
std::cout << "Imported pem certificate with name " << imported.Name();
|
||||
```
|
||||
@ -50,20 +50,20 @@ std::cout << "Imported pem certificate with name " << imported.Name();
|
||||
|
||||
You will need the certificate content in PKCS format to perform this operation. One sample is provided in certificate-ImportCertificate.hpp as the GetPkcsCertificate() string.
|
||||
|
||||
Once the import parameters are setup we can call Import certificate and get back the newly imported certificate
|
||||
Once the import options are setup we can call Import certificate and get back the newly imported certificate
|
||||
|
||||
```cpp Snippet:CertificateSample3ImportPKCS
|
||||
// prepare the parameters
|
||||
ImportCertificateOptions params;
|
||||
params.Value = GetPemCertificate();
|
||||
// prepare the options
|
||||
ImportCertificateOptions options;
|
||||
options.Value = GetPemCertificate();
|
||||
|
||||
params.Policy.Enabled = true;
|
||||
params.Policy.KeyType = CertificateKeyType::Rsa;
|
||||
params.Policy.KeySize = 2048;
|
||||
params.Policy.ContentType = CertificateContentType::Pkcs12;
|
||||
params.Policy.Exportable = true;
|
||||
options.Policy.Enabled = true;
|
||||
options.Policy.KeyType = CertificateKeyType::Rsa;
|
||||
options.Policy.KeySize = 2048;
|
||||
options.Policy.ContentType = CertificateContentType::Pkcs12;
|
||||
options.Policy.Exportable = true;
|
||||
// call the import API
|
||||
auto imported = certificateClient.ImportCertificate(pkcsName, params).Value;
|
||||
auto imported = certificateClient.ImportCertificate(pkcsName, options).Value;
|
||||
// read something from the certificate
|
||||
std::cout << "Imported pkcs certificate with name " << imported.Name();
|
||||
```
|
||||
|
||||
@ -47,32 +47,32 @@ int main()
|
||||
// import pem certificate
|
||||
{
|
||||
// prepare the parameters
|
||||
ImportCertificateOptions params;
|
||||
params.Value = GetPemCertificate();
|
||||
ImportCertificateOptions options;
|
||||
options.Value = GetPemCertificate();
|
||||
|
||||
params.Policy.Enabled = true;
|
||||
params.Policy.KeyType = CertificateKeyType::Rsa;
|
||||
params.Policy.KeySize = 2048;
|
||||
params.Policy.ContentType = CertificateContentType::Pem;
|
||||
params.Policy.Exportable = true;
|
||||
options.Policy.Enabled = true;
|
||||
options.Policy.KeyType = CertificateKeyType::Rsa;
|
||||
options.Policy.KeySize = 2048;
|
||||
options.Policy.ContentType = CertificateContentType::Pem;
|
||||
options.Policy.Exportable = true;
|
||||
// call import API
|
||||
auto imported = certificateClient.ImportCertificate(pemName, params).Value;
|
||||
auto imported = certificateClient.ImportCertificate(pemName, options).Value;
|
||||
// get some value from the certificate
|
||||
std::cout << "Imported pem certificate with name " << imported.Name();
|
||||
}
|
||||
// import pkcs certificate
|
||||
{
|
||||
// prepare the parameters
|
||||
ImportCertificateOptions params;
|
||||
params.Value = GetPkcsCertificate();
|
||||
ImportCertificateOptions options;
|
||||
options.Value = GetPkcsCertificate();
|
||||
|
||||
params.Policy.Enabled = true;
|
||||
params.Policy.KeyType = CertificateKeyType::Rsa;
|
||||
params.Policy.KeySize = 2048;
|
||||
params.Policy.ContentType = CertificateContentType::Pkcs12;
|
||||
params.Policy.Exportable = true;
|
||||
options.Policy.Enabled = true;
|
||||
options.Policy.KeyType = CertificateKeyType::Rsa;
|
||||
options.Policy.KeySize = 2048;
|
||||
options.Policy.ContentType = CertificateContentType::Pkcs12;
|
||||
options.Policy.Exportable = true;
|
||||
// call the import API
|
||||
auto imported = certificateClient.ImportCertificate(pkcsName, params).Value;
|
||||
auto imported = certificateClient.ImportCertificate(pkcsName, options).Value;
|
||||
// read something from the certificate
|
||||
std::cout << "Imported pkcs certificate with name " << imported.Name();
|
||||
}
|
||||
|
||||
@ -37,10 +37,10 @@ Call StartCreateCertificate to create a new certificate, with specified properti
|
||||
|
||||
```cpp Snippet:CertificateSample1Create
|
||||
std::string certificateName = "Sample1";
|
||||
CertificateCreateParameters params;
|
||||
CertificateCreateOptions options;
|
||||
...
|
||||
// start the create process
|
||||
auto response = certificateClient.StartCreateCertificate(certificateName, params);
|
||||
auto response = certificateClient.StartCreateCertificate(certificateName, options);
|
||||
auto result = response.PollUntilDone(defaultWait);
|
||||
```
|
||||
|
||||
|
||||
@ -41,7 +41,7 @@ int main()
|
||||
{
|
||||
std::string certificateName = "Sample1";
|
||||
KeyVaultCertificateWithPolicy certificate;
|
||||
CertificateCreateParameters params;
|
||||
CertificateCreateOptions options;
|
||||
// setup certificate create properties/policy
|
||||
{
|
||||
// create a lifetime action
|
||||
@ -50,23 +50,23 @@ int main()
|
||||
action.Action = CertificatePolicyAction::AutoRenew;
|
||||
|
||||
// etu properties
|
||||
params.Properties.Enabled = true;
|
||||
params.Properties.Name = certificateName;
|
||||
options.Properties.Enabled = true;
|
||||
options.Properties.Name = certificateName;
|
||||
|
||||
// setup policy
|
||||
params.Policy.Subject = "CN=sample1";
|
||||
params.Policy.ValidityInMonths = 12;
|
||||
params.Policy.Enabled = true;
|
||||
params.Policy.ContentType = CertificateContentType::Pkcs12;
|
||||
params.Policy.IssuerName = "Self";
|
||||
options.Policy.Subject = "CN=sample1";
|
||||
options.Policy.ValidityInMonths = 12;
|
||||
options.Policy.Enabled = true;
|
||||
options.Policy.ContentType = CertificateContentType::Pkcs12;
|
||||
options.Policy.IssuerName = "Self";
|
||||
|
||||
// add a lifetime action
|
||||
params.Policy.LifetimeActions.emplace_back(action);
|
||||
options.Policy.LifetimeActions.emplace_back(action);
|
||||
}
|
||||
// create a certificate
|
||||
{
|
||||
// start the create process
|
||||
auto response = certificateClient.StartCreateCertificate(certificateName, params);
|
||||
auto response = certificateClient.StartCreateCertificate(certificateName, options);
|
||||
auto result = response.PollUntilDone(defaultWait);
|
||||
|
||||
// get the certificate
|
||||
|
||||
@ -118,10 +118,10 @@ Response<KeyVaultCertificateWithPolicy> CertificateClient::GetCertificateVersion
|
||||
|
||||
CreateCertificateOperation CertificateClient::StartCreateCertificate(
|
||||
std::string const& name,
|
||||
CertificateCreateParameters const& parameters,
|
||||
CertificateCreateOptions const& options,
|
||||
Azure::Core::Context const& context) const
|
||||
{
|
||||
auto payload = CertificateCreateParametersSerializer::Serialize(parameters);
|
||||
auto payload = CertificateCreateOptionsSerializer::Serialize(options);
|
||||
Azure::Core::IO::MemoryBodyStream payloadStream(
|
||||
reinterpret_cast<const uint8_t*>(payload.data()), payload.size());
|
||||
|
||||
@ -257,9 +257,9 @@ CertificateClient::CancelPendingCertificateOperation(
|
||||
std::string const& name,
|
||||
Azure::Core::Context const& context) const
|
||||
{
|
||||
CertificateOperationUpdateParameter parameter;
|
||||
parameter.CancelationRequested = true;
|
||||
auto payload = CertificateOperationUpdateParameterSerializer::Serialize(parameter);
|
||||
CertificateOperationUpdateOptions option;
|
||||
option.CancelationRequested = true;
|
||||
auto payload = CertificateOperationUpdateOptionSerializer::Serialize(option);
|
||||
Azure::Core::IO::MemoryBodyStream payloadStream(
|
||||
reinterpret_cast<const uint8_t*>(payload.data()), payload.size());
|
||||
|
||||
|
||||
@ -395,8 +395,8 @@ Azure::Core::Json::_internal::json CertificatePolicySerializer::JsonSerialize(
|
||||
return result;
|
||||
}
|
||||
|
||||
std::string CertificateCreateParametersSerializer::Serialize(
|
||||
CertificateCreateParameters const& parameters)
|
||||
std::string CertificateCreateOptionsSerializer::Serialize(
|
||||
CertificateCreateOptions const& parameters)
|
||||
{
|
||||
json parameter;
|
||||
|
||||
@ -410,8 +410,8 @@ std::string CertificateCreateParametersSerializer::Serialize(
|
||||
return parameter.dump();
|
||||
}
|
||||
|
||||
std::string CertificateOperationUpdateParameterSerializer::Serialize(
|
||||
CertificateOperationUpdateParameter const& parameters)
|
||||
std::string CertificateOperationUpdateOptionSerializer::Serialize(
|
||||
CertificateOperationUpdateOptions const& parameters)
|
||||
{
|
||||
json parameter;
|
||||
|
||||
|
||||
@ -98,18 +98,18 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Certificat
|
||||
static CertificatePolicy Deserialize(Azure::Core::Http::RawResponse const& rawResponse);
|
||||
};
|
||||
|
||||
class CertificateCreateParametersSerializer final {
|
||||
CertificateCreateParametersSerializer() = delete;
|
||||
class CertificateCreateOptionsSerializer final {
|
||||
CertificateCreateOptionsSerializer() = delete;
|
||||
|
||||
public:
|
||||
static std::string Serialize(CertificateCreateParameters const& parameters);
|
||||
static std::string Serialize(CertificateCreateOptions const& Options);
|
||||
};
|
||||
|
||||
class CertificateOperationUpdateParameterSerializer final {
|
||||
CertificateOperationUpdateParameterSerializer() = delete;
|
||||
class CertificateOperationUpdateOptionSerializer final {
|
||||
CertificateOperationUpdateOptionSerializer() = delete;
|
||||
|
||||
public:
|
||||
static std::string Serialize(CertificateOperationUpdateParameter const& parameters);
|
||||
static std::string Serialize(CertificateOperationUpdateOptions const& Options);
|
||||
};
|
||||
|
||||
class ServerErrorSerializer final {
|
||||
|
||||
@ -244,34 +244,35 @@ namespace Azure {
|
||||
std::string const& subject = "CN=xyz",
|
||||
CertificateContentType certificateType = CertificateContentType::Pkcs12)
|
||||
{
|
||||
auto params = CertificateCreateParameters();
|
||||
params.Policy.Subject = subject;
|
||||
params.Policy.ValidityInMonths = 12;
|
||||
params.Policy.Enabled = true;
|
||||
CertificateCreateOptions options;
|
||||
options.Policy.Subject = subject;
|
||||
options.Policy.ValidityInMonths = 12;
|
||||
options.Policy.Enabled = true;
|
||||
|
||||
params.Properties.Enabled = true;
|
||||
params.Properties.Name = name;
|
||||
params.Policy.ContentType = certificateType;
|
||||
params.Policy.IssuerName = "Self";
|
||||
options.Properties.Enabled = true;
|
||||
options.Properties.Name = name;
|
||||
options.Policy.ContentType = certificateType;
|
||||
options.Policy.IssuerName = "Self";
|
||||
|
||||
LifetimeAction action;
|
||||
action.LifetimePercentage = 80;
|
||||
action.Action = CertificatePolicyAction::AutoRenew;
|
||||
params.Policy.LifetimeActions.emplace_back(action);
|
||||
options.Policy.LifetimeActions.emplace_back(action);
|
||||
|
||||
auto response = client.StartCreateCertificate(name, params);
|
||||
auto response = client.StartCreateCertificate(name, options);
|
||||
auto result = response.PollUntilDone(defaultWait);
|
||||
|
||||
auto cert = client.GetCertificate(name);
|
||||
|
||||
EXPECT_EQ(cert.Value.Name(), params.Properties.Name);
|
||||
EXPECT_EQ(cert.Value.Properties.Name, params.Properties.Name);
|
||||
EXPECT_EQ(cert.Value.Name(), options.Properties.Name);
|
||||
EXPECT_EQ(cert.Value.Properties.Name, options.Properties.Name);
|
||||
EXPECT_EQ(cert.Value.Properties.Enabled.Value(), true);
|
||||
EXPECT_EQ(cert.Value.Policy.IssuerName.Value(), params.Policy.IssuerName.Value());
|
||||
EXPECT_EQ(cert.Value.Policy.ContentType.Value(), params.Policy.ContentType.Value());
|
||||
EXPECT_EQ(cert.Value.Policy.Subject, params.Policy.Subject);
|
||||
EXPECT_EQ(cert.Value.Policy.ValidityInMonths.Value(), params.Policy.ValidityInMonths.Value());
|
||||
EXPECT_EQ(cert.Value.Policy.Enabled.Value(), params.Policy.Enabled.Value());
|
||||
EXPECT_EQ(cert.Value.Policy.IssuerName.Value(), options.Policy.IssuerName.Value());
|
||||
EXPECT_EQ(cert.Value.Policy.ContentType.Value(), options.Policy.ContentType.Value());
|
||||
EXPECT_EQ(cert.Value.Policy.Subject, options.Policy.Subject);
|
||||
EXPECT_EQ(
|
||||
cert.Value.Policy.ValidityInMonths.Value(), options.Policy.ValidityInMonths.Value());
|
||||
EXPECT_EQ(cert.Value.Policy.Enabled.Value(), options.Policy.Enabled.Value());
|
||||
EXPECT_EQ(cert.Value.Policy.LifetimeActions.size(), size_t(1));
|
||||
EXPECT_EQ(cert.Value.Policy.LifetimeActions[0].Action, action.Action);
|
||||
EXPECT_EQ(
|
||||
|
||||
@ -44,23 +44,23 @@ TEST_F(KeyVaultCertificateClientTest, CreateCertificateResumeToken)
|
||||
|
||||
auto const& client = GetClientForTest(testName);
|
||||
|
||||
auto params = CertificateCreateParameters();
|
||||
params.Policy.Subject = "CN=xyz";
|
||||
params.Policy.ValidityInMonths = 12;
|
||||
params.Policy.Enabled = true;
|
||||
CertificateCreateOptions options;
|
||||
options.Policy.Subject = "CN=xyz";
|
||||
options.Policy.ValidityInMonths = 12;
|
||||
options.Policy.Enabled = true;
|
||||
|
||||
params.Properties.Enabled = true;
|
||||
params.Properties.Name = certificateName;
|
||||
params.Policy.ContentType = CertificateContentType::Pkcs12;
|
||||
params.Policy.IssuerName = "Self";
|
||||
options.Properties.Enabled = true;
|
||||
options.Properties.Name = certificateName;
|
||||
options.Policy.ContentType = CertificateContentType::Pkcs12;
|
||||
options.Policy.IssuerName = "Self";
|
||||
|
||||
LifetimeAction action;
|
||||
action.LifetimePercentage = 80;
|
||||
action.Action = CertificatePolicyAction::AutoRenew;
|
||||
params.Policy.LifetimeActions.emplace_back(action);
|
||||
options.Policy.LifetimeActions.emplace_back(action);
|
||||
{
|
||||
|
||||
auto response = client.StartCreateCertificate(certificateName, params);
|
||||
auto response = client.StartCreateCertificate(certificateName, options);
|
||||
|
||||
auto fromToken
|
||||
= CreateCertificateOperation::CreateFromResumeToken(response.GetResumeToken(), client);
|
||||
@ -68,7 +68,7 @@ TEST_F(KeyVaultCertificateClientTest, CreateCertificateResumeToken)
|
||||
auto result = fromToken.PollUntilDone(m_defaultWait);
|
||||
|
||||
auto cert = client.GetCertificate(certificateName);
|
||||
EXPECT_EQ(cert.Value.Name(), params.Properties.Name);
|
||||
EXPECT_EQ(cert.Value.Name(), options.Properties.Name);
|
||||
EXPECT_EQ(cert.Value.Properties.Enabled.Value(), true);
|
||||
}
|
||||
{
|
||||
@ -76,7 +76,7 @@ TEST_F(KeyVaultCertificateClientTest, CreateCertificateResumeToken)
|
||||
auto fromToken
|
||||
= DeleteCertificateOperation::CreateFromResumeToken(response.GetResumeToken(), client);
|
||||
auto result = fromToken.PollUntilDone(m_defaultWait);
|
||||
EXPECT_EQ(result.Value.Name(), params.Properties.Name);
|
||||
EXPECT_EQ(result.Value.Name(), options.Properties.Name);
|
||||
EXPECT_EQ(result.Value.Properties.Enabled.Value(), true);
|
||||
EXPECT_NE(result.Value.RecoveryId.length(), size_t(0));
|
||||
EXPECT_TRUE(result.Value.DeletedOn);
|
||||
@ -842,16 +842,16 @@ TEST_F(KeyVaultCertificateClientTest, DownloadImportPkcs)
|
||||
|
||||
{
|
||||
auto result = DownloadCertificate(pkcs, client);
|
||||
auto params = ImportCertificateOptions();
|
||||
params.Value = result.Value.Certificate;
|
||||
ImportCertificateOptions options;
|
||||
options.Value = result.Value.Certificate;
|
||||
|
||||
params.Policy.Enabled = true;
|
||||
params.Policy.KeyType = CertificateKeyType::Rsa;
|
||||
params.Policy.KeySize = 2048;
|
||||
params.Policy.ContentType = CertificateContentType::Pkcs12;
|
||||
params.Policy.Exportable = true;
|
||||
options.Policy.Enabled = true;
|
||||
options.Policy.KeyType = CertificateKeyType::Rsa;
|
||||
options.Policy.KeySize = 2048;
|
||||
options.Policy.ContentType = CertificateContentType::Pkcs12;
|
||||
options.Policy.Exportable = true;
|
||||
|
||||
auto imported = client.ImportCertificate(importName, params).Value;
|
||||
auto imported = client.ImportCertificate(importName, options).Value;
|
||||
|
||||
EXPECT_EQ(imported.Properties.Name, importName);
|
||||
EXPECT_EQ(imported.Policy.ContentType.Value(), originalCertificate.Policy.ContentType.Value());
|
||||
@ -891,16 +891,16 @@ TEST_F(KeyVaultCertificateClientTest, DownloadImportPem)
|
||||
|
||||
{
|
||||
auto result = DownloadCertificate(pem, client);
|
||||
auto params = ImportCertificateOptions();
|
||||
params.Value = result.Value.Certificate;
|
||||
ImportCertificateOptions options;
|
||||
options.Value = result.Value.Certificate;
|
||||
|
||||
params.Policy.Enabled = true;
|
||||
params.Policy.KeyType = CertificateKeyType::Rsa;
|
||||
params.Policy.KeySize = 2048;
|
||||
params.Policy.ContentType = CertificateContentType::Pem;
|
||||
params.Policy.Exportable = true;
|
||||
options.Policy.Enabled = true;
|
||||
options.Policy.KeyType = CertificateKeyType::Rsa;
|
||||
options.Policy.KeySize = 2048;
|
||||
options.Policy.ContentType = CertificateContentType::Pem;
|
||||
options.Policy.Exportable = true;
|
||||
|
||||
auto imported = client.ImportCertificate(importName, params).Value;
|
||||
auto imported = client.ImportCertificate(importName, options).Value;
|
||||
|
||||
EXPECT_EQ(imported.Properties.Name, importName);
|
||||
EXPECT_EQ(imported.Policy.ContentType.Value(), originalCertificate.Policy.ContentType.Value());
|
||||
@ -969,12 +969,12 @@ TEST_F(KeyVaultCertificateClientTest, DISABLED_MergeCertificate)
|
||||
std::string mergeTarget = "baaab";
|
||||
// cspell: disable-next-line
|
||||
std::string mergeTarget2 = "ccaac";
|
||||
auto mergeParams = MergeCertificateOptions();
|
||||
auto mergeOptions = MergeCertificateOptions();
|
||||
|
||||
{
|
||||
auto certificate = CreateCertificate(pkcsToMerge, client, 1s, "CN=bbb");
|
||||
auto result = DownloadCertificate(pkcsToMerge, client);
|
||||
// mergeParams.Certificates.emplace_back(Azure::Core::Convert::Base64Encode(certificate.Cer));
|
||||
// mergeoptions.Certificates.emplace_back(Azure::Core::Convert::Base64Encode(certificate.Cer));
|
||||
}
|
||||
{
|
||||
auto response = client.StartDeleteCertificate(pkcsToMerge);
|
||||
@ -983,17 +983,17 @@ TEST_F(KeyVaultCertificateClientTest, DISABLED_MergeCertificate)
|
||||
}
|
||||
{
|
||||
// CreateCertificate(mergeTarget, client, 1s, "CN=bbb");
|
||||
auto params = CertificateCreateParameters();
|
||||
params.Policy.Subject = "CN=bbb";
|
||||
params.Policy.ValidityInMonths = 12;
|
||||
params.Policy.Enabled = true;
|
||||
CertificateCreateOptions options;
|
||||
options.Policy.Subject = "CN=bbb";
|
||||
options.Policy.ValidityInMonths = 12;
|
||||
options.Policy.Enabled = true;
|
||||
|
||||
params.Properties.Enabled = true;
|
||||
params.Properties.Name = mergeTarget;
|
||||
params.Policy.ContentType = CertificateContentType::Pkcs12;
|
||||
params.Policy.IssuerName = "sss";
|
||||
options.Properties.Enabled = true;
|
||||
options.Properties.Name = mergeTarget;
|
||||
options.Policy.ContentType = CertificateContentType::Pkcs12;
|
||||
options.Policy.IssuerName = "sss";
|
||||
|
||||
auto response = client.StartCreateCertificate(mergeTarget, params);
|
||||
auto response = client.StartCreateCertificate(mergeTarget, options);
|
||||
auto result = response.PollUntilDone(100ms);
|
||||
|
||||
bool cont = true;
|
||||
@ -1001,7 +1001,7 @@ TEST_F(KeyVaultCertificateClientTest, DISABLED_MergeCertificate)
|
||||
{
|
||||
try
|
||||
{
|
||||
auto merged = client.MergeCertificate(mergeTarget, mergeParams);
|
||||
auto merged = client.MergeCertificate(mergeTarget, mergeOptions);
|
||||
cont = false;
|
||||
}
|
||||
catch (...)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user