* investigateTestFail

* undo stuffs

* couple more comments

* changelog
This commit is contained in:
George Arama 2021-11-04 13:59:31 -07:00 committed by GitHub
parent 4614b80d22
commit 8148444413
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 29 additions and 21 deletions

View File

@ -1,7 +1,7 @@
# Release History
## 4.0.0-beta.1 (Unreleased)
## 4.0.0-beta.1
### New Features
- Added `CertificateClient` with `GetCertificate()` and `GetCertificateVersion()` APIs.
- initial preview

View File

@ -442,13 +442,11 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Certificat
*
* @remark This operation requires the certificates/import permission.
*
* @param name The name of the certificate.
* @param options The options for the request.
* @param context The context for the operation can be used for request cancellation.
* @return Imported certificate bundle to the vault.
*/
Azure::Response<KeyVaultCertificateWithPolicy> ImportCertificate(
std::string const& name,
ImportCertificateOptions const& options,
Azure::Core::Context const& context = Azure::Core::Context()) const;
@ -460,13 +458,11 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Certificat
*
* @remark This operation requires the certificates/create permission.
*
* @param name The name of the certificate.
* @param options The options for the request.
* @param context The context for the operation can be used for request cancellation.
* @return Merged certificate bundle to the vault.
*/
Azure::Response<KeyVaultCertificateWithPolicy> MergeCertificate(
std::string const& name,
MergeCertificateOptions const& options,
Azure::Core::Context const& context = Azure::Core::Context()) const;

View File

@ -1441,7 +1441,7 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Certificat
* needs to contain the private key.
*
*/
std::string Value;
std::string Certificate;
/**
* @brief If the private key in base64EncodedCertificate is encrypted, the password used for
@ -1467,6 +1467,12 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Certificat
*
*/
std::unordered_map<std::string, std::string> Tags;
/**
* @brief The name of the certificate.
*
*/
std::string Name;
};
/**
@ -1489,6 +1495,12 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Certificat
*
*/
std::unordered_map<std::string, std::string> Tags;
/**
* @brief The name of the certificate
*
*/
std::string Name;
};
/**

View File

@ -437,7 +437,6 @@ DeletedCertificatesPagedResponse CertificateClient::GetDeletedCertificates(
}
Azure::Response<KeyVaultCertificateWithPolicy> CertificateClient::ImportCertificate(
std::string const& name,
ImportCertificateOptions const& options,
Azure::Core::Context const& context) const
{
@ -445,16 +444,15 @@ Azure::Response<KeyVaultCertificateWithPolicy> CertificateClient::ImportCertific
Azure::Core::IO::MemoryBodyStream payloadStream(
reinterpret_cast<const uint8_t*>(payload.data()), payload.size());
auto request
= CreateRequest(HttpMethod::Post, {CertificatesPath, name, ImportPath}, &payloadStream);
auto request = CreateRequest(
HttpMethod::Post, {CertificatesPath, options.Name, ImportPath}, &payloadStream);
auto rawResponse = SendRequest(request, context);
auto value = KeyVaultCertificateSerializer::Deserialize(name, *rawResponse);
auto value = KeyVaultCertificateSerializer::Deserialize(options.Name, *rawResponse);
return Azure::Response<KeyVaultCertificateWithPolicy>(std::move(value), std::move(rawResponse));
}
Azure::Response<KeyVaultCertificateWithPolicy> CertificateClient::MergeCertificate(
std::string const& name,
MergeCertificateOptions const& options,
Azure::Core::Context const& context) const
{
@ -463,10 +461,10 @@ Azure::Response<KeyVaultCertificateWithPolicy> CertificateClient::MergeCertifica
reinterpret_cast<const uint8_t*>(payload.data()), payload.size());
auto request = CreateRequest(
HttpMethod::Post, {CertificatesPath, name, PendingPath, MergePath}, &payloadStream);
HttpMethod::Post, {CertificatesPath, options.Name, PendingPath, MergePath}, &payloadStream);
auto rawResponse = SendRequest(request, context);
auto value = KeyVaultCertificateSerializer::Deserialize(name, *rawResponse);
auto value = KeyVaultCertificateSerializer::Deserialize(options.Name, *rawResponse);
return Azure::Response<KeyVaultCertificateWithPolicy>(std::move(value), std::move(rawResponse));
}

View File

@ -783,7 +783,7 @@ std::string ImportCertificateOptionsSerializer::Serialize(ImportCertificateOptio
{
json importOptions;
importOptions[ValuePropertyName] = options.Value;
importOptions[ValuePropertyName] = options.Certificate;
JsonOptional::SetFromNullable(options.Password, importOptions, PwdPropertyValue);
importOptions[PolicyPropertyName] = CertificatePolicySerializer::JsonSerialize(options.Policy);
importOptions[AttributesPropertyName]

View File

@ -753,15 +753,15 @@ TEST_F(KeyVaultCertificateClientTest, DownloadImportPkcs)
{
auto result = DownloadCertificate(pkcs, client);
ImportCertificateOptions options;
options.Value = result.Value.Certificate;
options.Certificate = result.Value.Certificate;
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, options).Value;
options.Name = importName;
auto imported = client.ImportCertificate(options).Value;
EXPECT_EQ(imported.Properties.Name, importName);
EXPECT_EQ(imported.Policy.ContentType.Value(), originalCertificate.Policy.ContentType.Value());
@ -786,15 +786,16 @@ TEST_F(KeyVaultCertificateClientTest, DownloadImportPem)
{
auto result = DownloadCertificate(pem, client);
ImportCertificateOptions options;
options.Value = result.Value.Certificate;
options.Certificate = result.Value.Certificate;
options.Policy.Enabled = true;
options.Policy.KeyType = CertificateKeyType::Rsa;
options.Policy.KeySize = 2048;
options.Policy.ContentType = CertificateContentType::Pem;
options.Policy.Exportable = true;
options.Name = importName;
auto imported = client.ImportCertificate(importName, options).Value;
auto imported = client.ImportCertificate(options).Value;
EXPECT_EQ(imported.Properties.Name, importName);
EXPECT_EQ(imported.Policy.ContentType.Value(), originalCertificate.Policy.ContentType.Value());
@ -879,7 +880,8 @@ TEST_F(KeyVaultCertificateClientTest, DISABLED_MergeCertificate)
{
try
{
auto merged = client.MergeCertificate(mergeTarget, mergeOptions);
mergeOptions.Name = mergeTarget;
auto merged = client.MergeCertificate(mergeOptions);
cont = false;
}
catch (...)