adding GetUrl to key vault clients (#2761)
* adding GetUrl to key vault clients * format
This commit is contained in:
parent
8db9c0b223
commit
beb4a94cb4
@ -4,6 +4,8 @@
|
||||
|
||||
### Features Added
|
||||
|
||||
- Added `GetUrl()` to `KeyClient`.
|
||||
|
||||
### Breaking Changes
|
||||
|
||||
### Bugs Fixed
|
||||
|
||||
@ -387,6 +387,13 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Keys {
|
||||
ImportKeyOptions const& importKeyOptions,
|
||||
Azure::Core::Context const& context = Azure::Core::Context()) const;
|
||||
|
||||
/**
|
||||
* @brief Gets the key client's primary URL endpoint.
|
||||
*
|
||||
* @return The key client's primary URL endpoint.
|
||||
*/
|
||||
std::string GetUrl() const { return m_vaultUrl.GetAbsoluteUrl(); }
|
||||
|
||||
private:
|
||||
std::unique_ptr<Azure::Core::Http::RawResponse> SendRequest(
|
||||
Azure::Core::Http::Request& request,
|
||||
|
||||
@ -43,3 +43,13 @@ TEST(KeyClient, ServiceVersion)
|
||||
EXPECT_EQ(options.Version.ToString(), "1.0"););
|
||||
}
|
||||
}
|
||||
|
||||
TEST(KeyClient, GetUrl)
|
||||
{
|
||||
auto credential
|
||||
= std::make_shared<Azure::Identity::ClientSecretCredential>("tenantID", "AppId", "SecretId");
|
||||
|
||||
auto url = "vaultUrl";
|
||||
KeyClient keyClient(url, credential);
|
||||
EXPECT_EQ(url, keyClient.GetUrl());
|
||||
}
|
||||
|
||||
@ -2,4 +2,4 @@
|
||||
|
||||
## 1.0.0-beta.1 (Unreleased)
|
||||
|
||||
* initial preview
|
||||
- initial preview
|
||||
|
||||
@ -292,5 +292,12 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Secrets {
|
||||
DeletedSecretPagedResponse GetDeletedSecrets(
|
||||
GetDeletedSecretsOptions const& options = GetDeletedSecretsOptions(),
|
||||
Azure::Core::Context const& context = Azure::Core::Context()) const;
|
||||
|
||||
/**
|
||||
* @brief Gets the secret client's primary URL endpoint.
|
||||
*
|
||||
* @return The key secret's primary URL endpoint.
|
||||
*/
|
||||
std::string GetUrl() const;
|
||||
};
|
||||
}}}} // namespace Azure::Security::KeyVault::Secrets
|
||||
|
||||
@ -185,5 +185,12 @@ namespace Azure { namespace Security { namespace KeyVault { namespace _detail {
|
||||
// Use the core pipeline directly to avoid checking the response code.
|
||||
return m_pipeline.Send(request, context);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the Url used to create the secret client.
|
||||
*
|
||||
* @return A constant reference to the Url.
|
||||
*/
|
||||
Azure::Core::Url const& GetUrl() const { return m_vaultUrl; }
|
||||
};
|
||||
}}}} // namespace Azure::Security::KeyVault::_detail
|
||||
|
||||
@ -311,3 +311,5 @@ DeletedSecretPagedResponse SecretClient::GetDeletedSecrets(
|
||||
std::move(response.RawResponse),
|
||||
std::make_unique<SecretClient>(*this));
|
||||
}
|
||||
|
||||
std::string SecretClient::GetUrl() const { return m_protocolClient->GetUrl().GetAbsoluteUrl(); }
|
||||
|
||||
@ -42,3 +42,13 @@ TEST(SecretClient, ServiceVersion)
|
||||
EXPECT_EQ(options.Version.ToString(), "1.0"););
|
||||
}
|
||||
}
|
||||
|
||||
TEST(SecretClient, GetUrl)
|
||||
{
|
||||
auto credential
|
||||
= std::make_shared<Azure::Identity::ClientSecretCredential>("tenantID", "AppId", "SecretId");
|
||||
|
||||
auto url = "vaultUrl";
|
||||
SecretClient secretClient(url, credential);
|
||||
EXPECT_EQ(url, secretClient.GetUrl());
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user