Minor code cleanups (3) (#6179)
* Minor code cleanups (3) --------- Co-authored-by: Anton Kolesnyk <antkmsft@users.noreply.github.com>
This commit is contained in:
Родитель
4e67a7dc47
Коммит
b74d9c36be
|
@ -85,7 +85,7 @@ namespace Azure { namespace Security { namespace Attestation {
|
|||
*
|
||||
* @returns The remote endpoint used when communicating with the attestation service.
|
||||
*/
|
||||
std::string const Endpoint() const { return m_endpoint.GetAbsoluteUrl(); }
|
||||
std::string Endpoint() const { return m_endpoint.GetAbsoluteUrl(); }
|
||||
|
||||
/**
|
||||
* @brief Retrieves an Attestation Policy from the service.
|
||||
|
|
|
@ -173,7 +173,7 @@ namespace Azure { namespace Security { namespace Attestation {
|
|||
*
|
||||
* @returns The absolute URL for this attestation client.
|
||||
*/
|
||||
std::string const Endpoint() const { return m_endpoint.GetAbsoluteUrl(); }
|
||||
std::string Endpoint() const { return m_endpoint.GetAbsoluteUrl(); }
|
||||
|
||||
/**
|
||||
* Retrieves metadata about the attestation signing keys in use by the attestation service.
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace Azure { namespace Security { namespace Attestation { namespace _detail
|
|||
class AsymmetricKey {
|
||||
|
||||
public:
|
||||
virtual ~AsymmetricKey() {}
|
||||
virtual ~AsymmetricKey() = default;
|
||||
|
||||
/**
|
||||
* @brief Verifies an Asymmetric Key signature. Valid for all asymmetric keys.
|
||||
|
@ -79,7 +79,7 @@ namespace Azure { namespace Security { namespace Attestation { namespace _detail
|
|||
X509Certificate() {}
|
||||
|
||||
public:
|
||||
virtual ~X509Certificate() {}
|
||||
virtual ~X509Certificate() = default;
|
||||
/**
|
||||
* @brief Returns the public key associated with this X.509 certificate.
|
||||
*
|
||||
|
|
|
@ -94,8 +94,7 @@ public:
|
|||
// Strong comparison
|
||||
// If either is weak then there is no match
|
||||
// else tags must match character for character
|
||||
return !left.IsWeak() && !right.IsWeak()
|
||||
&& (left.m_value.Value().compare(right.m_value.Value()) == 0);
|
||||
return !left.IsWeak() && !right.IsWeak() && left.m_value.Value() == right.m_value.Value();
|
||||
break;
|
||||
|
||||
case ETagComparison::Weak:
|
||||
|
|
|
@ -181,7 +181,7 @@ namespace Azure { namespace Core {
|
|||
private:
|
||||
static std::string GetRawResponseField(
|
||||
std::unique_ptr<Azure::Core::Http::RawResponse> const& rawResponse,
|
||||
std::string fieldName);
|
||||
std::string const& fieldName);
|
||||
|
||||
/**
|
||||
* @brief Returns a descriptive string for this RawResponse.
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <unordered_set>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#if defined(_azure_TESTING_BUILD)
|
||||
|
@ -244,7 +245,7 @@ namespace Azure { namespace Core { namespace Http {
|
|||
* @param bodyStream #Azure::Core::IO::BodyStream.
|
||||
*/
|
||||
explicit Request(HttpMethod httpMethod, Url url, Azure::Core::IO::BodyStream* bodyStream)
|
||||
: Request(httpMethod, std::move(url), bodyStream, true)
|
||||
: Request(std::move(httpMethod), std::move(url), bodyStream, true)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@ public:
|
|||
Md5AlgorithmProvider()
|
||||
{
|
||||
// open an algorithm handle
|
||||
Handle = nullptr;
|
||||
if (!BCRYPT_SUCCESS(
|
||||
m_status = BCryptOpenAlgorithmProvider(&Handle, BCRYPT_MD5_ALGORITHM, nullptr, 0)))
|
||||
{
|
||||
|
|
|
@ -48,7 +48,7 @@ std::string Environment::GetVariable(const char* name)
|
|||
}
|
||||
#endif
|
||||
}
|
||||
return std::string();
|
||||
return {};
|
||||
}
|
||||
|
||||
void Environment::SetVariable(const char* name, const char* value)
|
||||
|
|
|
@ -55,7 +55,7 @@ namespace Azure { namespace Core {
|
|||
|
||||
std::string RequestFailedException::GetRawResponseField(
|
||||
std::unique_ptr<Azure::Core::Http::RawResponse> const& rawResponse,
|
||||
std::string fieldName)
|
||||
std::string const& fieldName)
|
||||
{
|
||||
auto& headers = rawResponse->GetHeaders();
|
||||
std::string contentType = HttpShared::GetHeaderOrEmptyString(headers, HttpShared::ContentType);
|
||||
|
|
|
@ -13,8 +13,8 @@ using namespace Azure::Core::Diagnostics;
|
|||
using namespace Azure::Core::Diagnostics::_internal;
|
||||
|
||||
namespace {
|
||||
static std::shared_timed_mutex g_logListenerMutex;
|
||||
static std::function<void(Logger::Level level, std::string const& message)> g_logListener(
|
||||
std::shared_timed_mutex g_logListenerMutex{};
|
||||
std::function<void(Logger::Level level, std::string const& message)> g_logListener(
|
||||
_detail::EnvironmentLogLevelListener::GetLogListener());
|
||||
} // namespace
|
||||
|
||||
|
|
|
@ -53,8 +53,6 @@ namespace Azure { namespace Messaging { namespace EventHubs {
|
|||
*/
|
||||
class EventDataBatch final {
|
||||
private:
|
||||
const std::string anyPartitionId = "";
|
||||
|
||||
std::mutex m_rwMutex;
|
||||
std::string m_partitionId;
|
||||
std::string m_partitionKey;
|
||||
|
@ -150,7 +148,7 @@ namespace Azure { namespace Messaging { namespace EventHubs {
|
|||
bool TryAddAmqpMessage(
|
||||
std::shared_ptr<Azure::Core::Amqp::Models::AmqpMessage const> const& message);
|
||||
|
||||
size_t CalculateActualSizeForPayload(std::vector<uint8_t> const& payload)
|
||||
static size_t CalculateActualSizeForPayload(std::vector<uint8_t> const& payload)
|
||||
{
|
||||
const size_t vbin8Overhead = 5;
|
||||
const size_t vbin32Overhead = 8;
|
||||
|
@ -177,7 +175,7 @@ namespace Azure { namespace Messaging { namespace EventHubs {
|
|||
*
|
||||
* @param options Options settings for creating the data batch
|
||||
*/
|
||||
EventDataBatch(EventDataBatchOptions options = {})
|
||||
EventDataBatch(EventDataBatchOptions const& options = {})
|
||||
: m_partitionId{options.PartitionId}, m_partitionKey{options.PartitionKey},
|
||||
m_maxBytes{options.MaxBytes}, m_marshalledMessages{}, m_batchEnvelope{}, m_currentSize{0}
|
||||
{
|
||||
|
@ -188,7 +186,7 @@ namespace Azure { namespace Messaging { namespace EventHubs {
|
|||
|
||||
if (options.PartitionId.empty())
|
||||
{
|
||||
m_partitionId = anyPartitionId;
|
||||
m_partitionId = ""; // "" means "any partition ID"
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -156,7 +156,7 @@ namespace Azure { namespace Messaging { namespace EventHubs { namespace Models {
|
|||
ReceivedEventData(std::shared_ptr<Azure::Core::Amqp::Models::AmqpMessage const> const& message);
|
||||
|
||||
// Destructor
|
||||
~ReceivedEventData() = default;
|
||||
~ReceivedEventData() override = default;
|
||||
|
||||
/** @brief Copy an ReceivedEventData to another.
|
||||
*/
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace Azure { namespace Messaging { namespace EventHubs {
|
|||
Azure::Core::Amqp::Models::AmqpMessage EventDataBatch::ToAmqpMessage() const
|
||||
{
|
||||
Azure::Core::Amqp::Models::AmqpMessage returnValue{m_batchEnvelope};
|
||||
if (m_marshalledMessages.size() == 0)
|
||||
if (m_marshalledMessages.empty())
|
||||
{
|
||||
throw std::runtime_error("No messages added to the batch.");
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ namespace Azure { namespace Messaging { namespace EventHubs {
|
|||
|
||||
std::lock_guard<std::mutex> lock(m_rwMutex);
|
||||
|
||||
if (m_marshalledMessages.size() == 0)
|
||||
if (m_marshalledMessages.empty())
|
||||
{
|
||||
// The first message is special - we use its properties and annotations on the envelope for
|
||||
// the batch message.
|
||||
|
@ -83,7 +83,7 @@ namespace Azure { namespace Messaging { namespace EventHubs {
|
|||
<< " Max size: " << m_maxBytes.Value() << std::endl;
|
||||
// If we don't have any messages and we can't add this one, then we can't add it at all.
|
||||
// Discard the contents of the batch.
|
||||
if (m_marshalledMessages.size() == 0)
|
||||
if (m_marshalledMessages.empty())
|
||||
{
|
||||
m_currentSize = 0;
|
||||
m_batchEnvelope = nullptr;
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include <azure/core/internal/diagnostics/log.hpp>
|
||||
|
||||
#include <chrono>
|
||||
#include <utility>
|
||||
|
||||
namespace Azure { namespace Messaging { namespace EventHubs { namespace _detail {
|
||||
|
||||
|
@ -93,7 +94,7 @@ namespace Azure { namespace Messaging { namespace EventHubs { namespace _detail
|
|||
EventHubsPropertiesClient(
|
||||
const Azure::Core::Amqp::_internal::Connection& connection,
|
||||
std::string eventHubName)
|
||||
: m_session{connection.CreateSession()}, m_eventHub{eventHubName} {};
|
||||
: m_session{connection.CreateSession()}, m_eventHub{std::move(eventHubName)} {};
|
||||
|
||||
~EventHubsPropertiesClient()
|
||||
{
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#if defined(_azure_TESTING_BUILD)
|
||||
// Define the class used from tests
|
||||
|
@ -102,7 +103,7 @@ namespace Azure { namespace Identity {
|
|||
* @param id The resource ID of the user-assigned managed identity.
|
||||
*
|
||||
*/
|
||||
static ManagedIdentityId FromUserAssignedResourceId(Azure::Core::ResourceIdentifier id)
|
||||
static ManagedIdentityId FromUserAssignedResourceId(Azure::Core::ResourceIdentifier const& id)
|
||||
{
|
||||
return ManagedIdentityId(_detail::ManagedIdentityIdKind::ResourceId, id.ToString());
|
||||
}
|
||||
|
@ -121,16 +122,16 @@ namespace Azure { namespace Identity {
|
|||
* ID and object ID are NOT interchangeable, even though they are both Uuid values.
|
||||
*/
|
||||
explicit ManagedIdentityId(_detail::ManagedIdentityIdKind idKind, std::string id)
|
||||
: m_idKind(idKind), m_id(id)
|
||||
: m_idKind(idKind), m_id(std::move(id))
|
||||
{
|
||||
if (idKind == _detail::ManagedIdentityIdKind::SystemAssigned && !id.empty())
|
||||
if (idKind == _detail::ManagedIdentityIdKind::SystemAssigned && !m_id.empty())
|
||||
{
|
||||
throw std::invalid_argument(
|
||||
"There is no need to provide an ID (such as client, object, or resource ID) if you are "
|
||||
"using system-assigned managed identity.");
|
||||
}
|
||||
|
||||
if (id.empty()
|
||||
if (m_id.empty()
|
||||
&& (idKind == _detail::ManagedIdentityIdKind::ClientId
|
||||
|| idKind == _detail::ManagedIdentityIdKind::ObjectId
|
||||
|| idKind == _detail::ManagedIdentityIdKind::ResourceId))
|
||||
|
|
|
@ -499,7 +499,7 @@ ShellProcess::ShellProcess(std::string const& command, OutputPipe& outputPipe)
|
|||
constexpr auto PathEnvVarName = "PATH";
|
||||
auto pathValue = Environment::GetVariable(PathEnvVarName);
|
||||
|
||||
for (auto const pf :
|
||||
for (auto const& pf :
|
||||
{Environment::GetVariable("ProgramFiles"),
|
||||
Environment::GetVariable("ProgramFiles(x86)")})
|
||||
{
|
||||
|
|
|
@ -57,7 +57,7 @@ EnvironmentCredential::EnvironmentCredential(
|
|||
|
||||
if (!clientSecret.empty())
|
||||
{
|
||||
envVarsToParams.push_back({AzureClientSecretEnvVarName, "clientSecret"});
|
||||
envVarsToParams.emplace_back(std::make_pair(AzureClientSecretEnvVarName, "clientSecret"));
|
||||
|
||||
ClientSecretCredentialOptions clientSecretCredentialOptions;
|
||||
static_cast<TokenCredentialOptions&>(clientSecretCredentialOptions) = options;
|
||||
|
@ -65,19 +65,21 @@ EnvironmentCredential::EnvironmentCredential(
|
|||
|
||||
if (!authority.empty())
|
||||
{
|
||||
envVarsToParams.push_back({_detail::AzureAuthorityHostEnvVarName, "authorityHost"});
|
||||
envVarsToParams.emplace_back(
|
||||
std::make_pair(_detail::AzureAuthorityHostEnvVarName, "authorityHost"));
|
||||
clientSecretCredentialOptions.AuthorityHost = authority;
|
||||
}
|
||||
|
||||
PrintCredentialCreationLogMessage(
|
||||
GetCredentialName(), envVarsToParams, "ClientSecretCredential");
|
||||
|
||||
m_credentialImpl.reset(new ClientSecretCredential(
|
||||
tenantId, clientId, clientSecret, clientSecretCredentialOptions));
|
||||
m_credentialImpl = std::make_unique<ClientSecretCredential>(
|
||||
tenantId, clientId, clientSecret, clientSecretCredentialOptions);
|
||||
}
|
||||
else if (!clientCertificatePath.empty())
|
||||
{
|
||||
envVarsToParams.push_back({AzureClientCertificatePathEnvVarName, "clientCertificatePath"});
|
||||
envVarsToParams.emplace_back(
|
||||
std::make_pair(AzureClientCertificatePathEnvVarName, "clientCertificatePath"));
|
||||
|
||||
ClientCertificateCredentialOptions clientCertificateCredentialOptions;
|
||||
static_cast<TokenCredentialOptions&>(clientCertificateCredentialOptions) = options;
|
||||
|
@ -85,15 +87,16 @@ EnvironmentCredential::EnvironmentCredential(
|
|||
|
||||
if (!authority.empty())
|
||||
{
|
||||
envVarsToParams.push_back({_detail::AzureAuthorityHostEnvVarName, "authorityHost"});
|
||||
envVarsToParams.emplace_back(
|
||||
std::make_pair(_detail::AzureAuthorityHostEnvVarName, "authorityHost"));
|
||||
clientCertificateCredentialOptions.AuthorityHost = authority;
|
||||
}
|
||||
|
||||
PrintCredentialCreationLogMessage(
|
||||
GetCredentialName(), envVarsToParams, "ClientCertificateCredential");
|
||||
|
||||
m_credentialImpl.reset(new ClientCertificateCredential(
|
||||
tenantId, clientId, clientCertificatePath, clientCertificateCredentialOptions));
|
||||
m_credentialImpl = std::make_unique<ClientCertificateCredential>(
|
||||
tenantId, clientId, clientCertificatePath, clientCertificateCredentialOptions);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -61,10 +61,10 @@ std::string ExpectedArcKeyDirectory()
|
|||
#endif
|
||||
}
|
||||
|
||||
static constexpr off_t MaximumAzureArcKeySize = 4096;
|
||||
constexpr off_t MaximumAzureArcKeySize = 4096;
|
||||
|
||||
#if defined(AZ_PLATFORM_WINDOWS)
|
||||
static constexpr char DirectorySeparator = '\\';
|
||||
constexpr char DirectorySeparator = '\\';
|
||||
#else
|
||||
static constexpr char DirectorySeparator = '/';
|
||||
#endif
|
||||
|
@ -74,7 +74,7 @@ static constexpr char DirectorySeparator = '/';
|
|||
// - be in the expected directory for the OS
|
||||
// - have a .key extension
|
||||
// - contain at most 4096 bytes
|
||||
void ValidateArcKeyFile(std::string fileName)
|
||||
void ValidateArcKeyFile(std::string const& fileName)
|
||||
{
|
||||
using Azure::Core::Credentials::AuthenticationException;
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ namespace Azure { namespace Identity { namespace _detail {
|
|||
public:
|
||||
Core::Credentials::AccessToken GetToken(
|
||||
Core::Credentials::TokenRequestContext const& tokenRequestContext,
|
||||
Core::Context const& context) const override final;
|
||||
Core::Context const& context) const final;
|
||||
};
|
||||
|
||||
class AppServiceV2017ManagedIdentitySource final : public AppServiceManagedIdentitySource {
|
||||
|
@ -96,7 +96,7 @@ namespace Azure { namespace Identity { namespace _detail {
|
|||
objectId,
|
||||
resourceId,
|
||||
options,
|
||||
endpointUrl,
|
||||
std::move(endpointUrl),
|
||||
secret,
|
||||
"2017-09-01",
|
||||
"secret",
|
||||
|
@ -129,7 +129,7 @@ namespace Azure { namespace Identity { namespace _detail {
|
|||
objectId,
|
||||
resourceId,
|
||||
options,
|
||||
endpointUrl,
|
||||
std::move(endpointUrl),
|
||||
secret,
|
||||
"2019-08-01",
|
||||
"X-IDENTITY-HEADER",
|
||||
|
|
|
@ -45,7 +45,8 @@ Azure::Core::Http::Request KeyVaultSettingsCommonRequest::CreateRequest(
|
|||
Azure::Core::IO::BodyStream* content)
|
||||
{
|
||||
using namespace Azure::Core::Http;
|
||||
Request request = content == nullptr ? Request(method, url) : Request(method, url, content);
|
||||
Request request = content == nullptr ? Request(std::move(method), std::move(url))
|
||||
: Request(std::move(method), std::move(url), content);
|
||||
|
||||
request.SetHeader(ContentHeaderName, ApplicationJsonValue);
|
||||
request.GetUrl().AppendQueryParameter(ApiVersionQueryParamName, apiVersion);
|
||||
|
|
|
@ -45,7 +45,8 @@ Azure::Core::Http::Request _detail::KeyVaultCertificatesCommonRequest::CreateReq
|
|||
Azure::Core::IO::BodyStream* content)
|
||||
{
|
||||
using namespace Azure::Core::Http;
|
||||
Request request = content == nullptr ? Request(method, url) : Request(method, url, content);
|
||||
Request request = content == nullptr ? Request(std::move(method), std::move(url))
|
||||
: Request(std::move(method), std::move(url), content);
|
||||
|
||||
request.SetHeader(ContentHeaderName, ApplicationJsonValue);
|
||||
request.GetUrl().AppendQueryParameter(ApiVersionQueryParamName, apiVersion);
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace Azure {
|
||||
|
@ -76,7 +77,7 @@ namespace Azure {
|
|||
Azure::Core::Url keyId,
|
||||
std::string const& apiVersion,
|
||||
std::shared_ptr<Azure::Core::Http::_internal::HttpPipeline> pipeline)
|
||||
: m_keyId(keyId), m_apiVersion(apiVersion), m_pipeline(pipeline)
|
||||
: m_keyId(std::move(keyId)), m_apiVersion(apiVersion), m_pipeline(std::move(pipeline))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -142,7 +143,7 @@ namespace Azure {
|
|||
* wrapped key.
|
||||
*/
|
||||
Azure::Response<WrapResult> WrapKey(
|
||||
KeyWrapAlgorithm algorithm,
|
||||
KeyWrapAlgorithm const& algorithm,
|
||||
std::vector<uint8_t> const& key,
|
||||
Azure::Core::Context const& context = Azure::Core::Context());
|
||||
|
||||
|
@ -157,7 +158,7 @@ namespace Azure {
|
|||
* information regarding the algorithm and key used to unwrap it.
|
||||
*/
|
||||
Azure::Response<UnwrapResult> UnwrapKey(
|
||||
KeyWrapAlgorithm algorithm,
|
||||
KeyWrapAlgorithm const& algorithm,
|
||||
std::vector<uint8_t> const& encryptedKey,
|
||||
Azure::Core::Context const& context = Azure::Core::Context());
|
||||
|
||||
|
@ -175,7 +176,7 @@ namespace Azure {
|
|||
* signature.
|
||||
*/
|
||||
Azure::Response<SignResult> Sign(
|
||||
SignatureAlgorithm algorithm,
|
||||
SignatureAlgorithm const& algorithm,
|
||||
std::vector<uint8_t> const& digest,
|
||||
Azure::Core::Context const& context = Azure::Core::Context());
|
||||
|
||||
|
@ -192,7 +193,7 @@ namespace Azure {
|
|||
* signature.
|
||||
*/
|
||||
Azure::Response<SignResult> SignData(
|
||||
SignatureAlgorithm algorithm,
|
||||
SignatureAlgorithm const& algorithm,
|
||||
Azure::Core::IO::BodyStream& data,
|
||||
Azure::Core::Context const& context = Azure::Core::Context());
|
||||
|
||||
|
@ -209,7 +210,7 @@ namespace Azure {
|
|||
* signature.
|
||||
*/
|
||||
Azure::Response<SignResult> SignData(
|
||||
SignatureAlgorithm algorithm,
|
||||
SignatureAlgorithm const& algorithm,
|
||||
std::vector<uint8_t> const& data,
|
||||
Azure::Core::Context const& context = Azure::Core::Context());
|
||||
|
||||
|
@ -227,7 +228,7 @@ namespace Azure {
|
|||
* #Azure::Security::KeyVault::Keys::Cryptography::VerifyResult will be set to true.
|
||||
*/
|
||||
Azure::Response<VerifyResult> Verify(
|
||||
SignatureAlgorithm algorithm,
|
||||
SignatureAlgorithm const& algorithm,
|
||||
std::vector<uint8_t> const& digest,
|
||||
std::vector<uint8_t> const& signature,
|
||||
Azure::Core::Context const& context = Azure::Core::Context());
|
||||
|
@ -245,7 +246,7 @@ namespace Azure {
|
|||
* #Azure::Security::KeyVault::Keys::Cryptography::VerifyResult will be set to true.
|
||||
*/
|
||||
Azure::Response<VerifyResult> VerifyData(
|
||||
SignatureAlgorithm algorithm,
|
||||
SignatureAlgorithm const& algorithm,
|
||||
Azure::Core::IO::BodyStream& data,
|
||||
std::vector<uint8_t> const& signature,
|
||||
Azure::Core::Context const& context = Azure::Core::Context());
|
||||
|
@ -263,7 +264,7 @@ namespace Azure {
|
|||
* #Azure::Security::KeyVault::Keys::Cryptography::VerifyResult will be set to true.
|
||||
*/
|
||||
Azure::Response<VerifyResult> VerifyData(
|
||||
SignatureAlgorithm algorithm,
|
||||
SignatureAlgorithm const& algorithm,
|
||||
std::vector<uint8_t> const& data,
|
||||
std::vector<uint8_t> const& signature,
|
||||
Azure::Core::Context const& context = Azure::Core::Context());
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include <memory>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace Azure {
|
||||
|
@ -583,7 +584,7 @@ namespace Azure {
|
|||
* use for decrypt operation.
|
||||
* @param ciphertext The content to decrypt.
|
||||
*/
|
||||
DecryptParameters(EncryptionAlgorithm algorithm, std::vector<uint8_t> const ciphertext)
|
||||
DecryptParameters(EncryptionAlgorithm algorithm, std::vector<uint8_t> ciphertext)
|
||||
: Algorithm(std::move(algorithm)), Ciphertext(std::move(ciphertext))
|
||||
{
|
||||
}
|
||||
|
@ -892,7 +893,7 @@ namespace Azure {
|
|||
* use for encrypt operation.
|
||||
* @param plaintext The content to encrypt.
|
||||
*/
|
||||
EncryptParameters(EncryptionAlgorithm algorithm, std::vector<uint8_t> const plaintext)
|
||||
EncryptParameters(EncryptionAlgorithm algorithm, std::vector<uint8_t> plaintext)
|
||||
: Algorithm(std::move(algorithm)), Plaintext(std::move(plaintext))
|
||||
{
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Keys {
|
|||
explicit KeyClient(
|
||||
std::string const& vaultUrl,
|
||||
std::shared_ptr<Core::Credentials::TokenCredential const> credential,
|
||||
KeyClientOptions options = KeyClientOptions());
|
||||
KeyClientOptions const& options = KeyClientOptions());
|
||||
|
||||
/**
|
||||
* @brief Construct a new Key Client object from another key client.
|
||||
|
|
|
@ -21,11 +21,13 @@
|
|||
#include <azure/core/paged_response.hpp>
|
||||
#include <azure/core/response.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
#include <unordered_map>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace Azure { namespace Security { namespace KeyVault { namespace Keys {
|
||||
|
@ -448,16 +450,10 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Keys {
|
|||
std::vector<uint8_t> Y;
|
||||
|
||||
/** @brief Returns true if the key supports the desired key operation. */
|
||||
bool SupportsOperation(KeyOperation operation) const
|
||||
bool SupportsOperation(KeyOperation const& operation) const
|
||||
{
|
||||
for (auto supportedOperation : m_keyOps)
|
||||
{
|
||||
if (operation == supportedOperation)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return std::any_of(
|
||||
m_keyOps.cbegin(), m_keyOps.cend(), [&](auto const& op) { return op == operation; });
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -705,7 +701,7 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Keys {
|
|||
*
|
||||
* @param name The name of the deleted key.
|
||||
*/
|
||||
DeletedKey(std::string name) : KeyVaultKey(name) {}
|
||||
DeletedKey(std::string name) : KeyVaultKey(std::move(name)) {}
|
||||
|
||||
/**
|
||||
* @brief Indicate when the key was deleted.
|
||||
|
@ -754,8 +750,8 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Keys {
|
|||
std::unique_ptr<Azure::Core::Http::RawResponse> rawResponse,
|
||||
std::shared_ptr<KeyClient> keyClient,
|
||||
std::string const& keyName = std::string())
|
||||
: PagedResponse(std::move(keyProperties)), m_keyName(keyName), m_keyClient(keyClient),
|
||||
Items(std::move(keyProperties.Items))
|
||||
: PagedResponse(std::move(keyProperties)), m_keyName(keyName),
|
||||
m_keyClient(std::move(keyClient)), Items(std::move(keyProperties.Items))
|
||||
{
|
||||
RawResponse = std::move(rawResponse);
|
||||
}
|
||||
|
@ -801,7 +797,7 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Keys {
|
|||
DeletedKeyPagedResponse&& deletedKeyProperties,
|
||||
std::unique_ptr<Azure::Core::Http::RawResponse> rawResponse,
|
||||
std::shared_ptr<KeyClient> keyClient)
|
||||
: PagedResponse(std::move(deletedKeyProperties)), m_keyClient(keyClient),
|
||||
: PagedResponse(std::move(deletedKeyProperties)), m_keyClient(std::move(keyClient)),
|
||||
Items(std::move(deletedKeyProperties.Items))
|
||||
{
|
||||
RawResponse = std::move(rawResponse);
|
||||
|
@ -875,7 +871,7 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Keys {
|
|||
DeleteKeyOperation(
|
||||
std::string resumeToken,
|
||||
std::shared_ptr<Azure::Security::KeyVault::Keys::KeyClient> keyClient)
|
||||
: m_keyClient(keyClient), m_value(DeletedKey(resumeToken)),
|
||||
: m_keyClient(std::move(keyClient)), m_value(DeletedKey(resumeToken)),
|
||||
m_continuationToken(std::move(resumeToken))
|
||||
{
|
||||
}
|
||||
|
@ -966,7 +962,7 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Keys {
|
|||
RecoverDeletedKeyOperation(
|
||||
std::string resumeToken,
|
||||
std::shared_ptr<Azure::Security::KeyVault::Keys::KeyClient> keyClient)
|
||||
: m_keyClient(keyClient), m_value(DeletedKey(resumeToken)),
|
||||
: m_keyClient(std::move(keyClient)), m_value(DeletedKey(resumeToken)),
|
||||
m_continuationToken(std::move(resumeToken))
|
||||
{
|
||||
}
|
||||
|
@ -1062,7 +1058,7 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Keys {
|
|||
/**
|
||||
* @brief The action that will be executed.
|
||||
*/
|
||||
LifetimeActionType Action;
|
||||
LifetimeActionType Action{};
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -364,7 +364,7 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Keys {
|
|||
* @param keyMaterial The cryptographic key
|
||||
*/
|
||||
ImportKeyOptions(std::string name, JsonWebKey keyMaterial)
|
||||
: Key(keyMaterial), Properties(std::move(name))
|
||||
: Key(std::move(keyMaterial)), Properties(std::move(name))
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ inline std::vector<uint8_t> CreateDigest(
|
|||
{
|
||||
// Use heap for the reading buffer.
|
||||
auto heapBuffer = std::make_unique<std::vector<uint8_t>>(DefaultStreamDigestReadSize);
|
||||
auto* buffer = heapBuffer.get()->data();
|
||||
auto* buffer = heapBuffer->data();
|
||||
auto hashAlgorithm = algorithm.GetHashAlgorithm();
|
||||
for (size_t read = data.Read(buffer, DefaultStreamDigestReadSize); read > 0;
|
||||
read = data.Read(buffer, DefaultStreamDigestReadSize))
|
||||
|
@ -54,7 +54,7 @@ inline std::vector<uint8_t> CreateDigest(
|
|||
}
|
||||
|
||||
inline std::vector<uint8_t> CreateDigest(
|
||||
SignatureAlgorithm algorithm,
|
||||
SignatureAlgorithm const& algorithm,
|
||||
std::vector<uint8_t> const& data)
|
||||
{
|
||||
auto hashAlgorithm = algorithm.GetHashAlgorithm();
|
||||
|
@ -106,7 +106,7 @@ CryptographyClient::CryptographyClient(
|
|||
|
||||
perRetrypolicies.emplace_back(
|
||||
std::make_unique<_internal::KeyVaultChallengeBasedAuthenticationPolicy>(
|
||||
credential, tokenContext));
|
||||
std::move(credential), tokenContext));
|
||||
}
|
||||
std::vector<std::unique_ptr<HttpPolicy>> perCallpolicies;
|
||||
|
||||
|
@ -143,7 +143,7 @@ Azure::Response<DecryptResult> CryptographyClient::Decrypt(
|
|||
}
|
||||
|
||||
Azure::Response<WrapResult> CryptographyClient::WrapKey(
|
||||
KeyWrapAlgorithm algorithm,
|
||||
KeyWrapAlgorithm const& algorithm,
|
||||
std::vector<uint8_t> const& key,
|
||||
Azure::Core::Context const& context)
|
||||
{
|
||||
|
@ -159,7 +159,7 @@ Azure::Response<WrapResult> CryptographyClient::WrapKey(
|
|||
}
|
||||
|
||||
Azure::Response<UnwrapResult> CryptographyClient::UnwrapKey(
|
||||
KeyWrapAlgorithm algorithm,
|
||||
KeyWrapAlgorithm const& algorithm,
|
||||
std::vector<uint8_t> const& encryptedKey,
|
||||
Azure::Core::Context const& context)
|
||||
{
|
||||
|
@ -175,7 +175,7 @@ Azure::Response<UnwrapResult> CryptographyClient::UnwrapKey(
|
|||
}
|
||||
|
||||
Azure::Response<SignResult> CryptographyClient::Sign(
|
||||
SignatureAlgorithm algorithm,
|
||||
SignatureAlgorithm const& algorithm,
|
||||
std::vector<uint8_t> const& digest,
|
||||
Azure::Core::Context const& context)
|
||||
{
|
||||
|
@ -191,7 +191,7 @@ Azure::Response<SignResult> CryptographyClient::Sign(
|
|||
}
|
||||
|
||||
Azure::Response<SignResult> CryptographyClient::SignData(
|
||||
SignatureAlgorithm algorithm,
|
||||
SignatureAlgorithm const& algorithm,
|
||||
Azure::Core::IO::BodyStream& data,
|
||||
Azure::Core::Context const& context)
|
||||
{
|
||||
|
@ -199,7 +199,7 @@ Azure::Response<SignResult> CryptographyClient::SignData(
|
|||
}
|
||||
|
||||
Azure::Response<SignResult> CryptographyClient::SignData(
|
||||
SignatureAlgorithm algorithm,
|
||||
SignatureAlgorithm const& algorithm,
|
||||
std::vector<uint8_t> const& data,
|
||||
Azure::Core::Context const& context)
|
||||
{
|
||||
|
@ -207,7 +207,7 @@ Azure::Response<SignResult> CryptographyClient::SignData(
|
|||
}
|
||||
|
||||
Azure::Response<VerifyResult> CryptographyClient::Verify(
|
||||
SignatureAlgorithm algorithm,
|
||||
SignatureAlgorithm const& algorithm,
|
||||
std::vector<uint8_t> const& digest,
|
||||
std::vector<uint8_t> const& signature,
|
||||
Azure::Core::Context const& context)
|
||||
|
@ -225,7 +225,7 @@ Azure::Response<VerifyResult> CryptographyClient::Verify(
|
|||
}
|
||||
|
||||
Azure::Response<VerifyResult> CryptographyClient::VerifyData(
|
||||
SignatureAlgorithm algorithm,
|
||||
SignatureAlgorithm const& algorithm,
|
||||
Azure::Core::IO::BodyStream& data,
|
||||
std::vector<uint8_t> const& signature,
|
||||
Azure::Core::Context const& context)
|
||||
|
@ -234,7 +234,7 @@ Azure::Response<VerifyResult> CryptographyClient::VerifyData(
|
|||
}
|
||||
|
||||
Azure::Response<VerifyResult> CryptographyClient::VerifyData(
|
||||
SignatureAlgorithm algorithm,
|
||||
SignatureAlgorithm const& algorithm,
|
||||
std::vector<uint8_t> const& data,
|
||||
std::vector<uint8_t> const& signature,
|
||||
Azure::Core::Context const& context)
|
||||
|
|
|
@ -27,18 +27,18 @@ namespace Azure {
|
|||
payload[ValueParameterValue] = Base64Url::Base64UrlEncode(parameters.Ciphertext);
|
||||
auto& iv = parameters.GetIv();
|
||||
|
||||
if (iv.size() > 0)
|
||||
if (!iv.empty())
|
||||
{
|
||||
payload[IvValue] = Base64Url::Base64UrlEncode(iv);
|
||||
}
|
||||
|
||||
if (parameters.AdditionalAuthenticatedData.size() > 0)
|
||||
if (!parameters.AdditionalAuthenticatedData.empty())
|
||||
{
|
||||
payload[AdditionalAuthenticatedValue]
|
||||
= Base64Url::Base64UrlEncode(parameters.AdditionalAuthenticatedData);
|
||||
}
|
||||
|
||||
if (parameters.AuthenticationTag.size() > 0)
|
||||
if (!parameters.AuthenticationTag.empty())
|
||||
{
|
||||
payload[TagsPropertyName] = Base64Url::Base64UrlEncode(parameters.AuthenticationTag);
|
||||
}
|
||||
|
|
|
@ -27,12 +27,12 @@ namespace Azure {
|
|||
payload[ValueParameterValue] = Base64Url::Base64UrlEncode(parameters.Plaintext);
|
||||
auto& iv = parameters.GetIv();
|
||||
|
||||
if (iv.size() > 0)
|
||||
if (!iv.empty())
|
||||
{
|
||||
payload[IvValue] = Base64Url::Base64UrlEncode(iv);
|
||||
}
|
||||
|
||||
if (parameters.AdditionalAuthenticatedData.size() > 0)
|
||||
if (!parameters.AdditionalAuthenticatedData.empty())
|
||||
{
|
||||
payload[AdditionalAuthenticatedValue]
|
||||
= Base64Url::Base64UrlEncode(parameters.AdditionalAuthenticatedData);
|
||||
|
|
|
@ -57,7 +57,7 @@ Azure::Security::KeyVault::Keys::DeleteKeyOperation::PollInternal(
|
|||
Azure::Security::KeyVault::Keys::DeleteKeyOperation::DeleteKeyOperation(
|
||||
std::shared_ptr<Azure::Security::KeyVault::Keys::KeyClient> keyClient,
|
||||
Azure::Response<Azure::Security::KeyVault::Keys::DeletedKey> response)
|
||||
: m_keyClient(keyClient)
|
||||
: m_keyClient(std::move(keyClient))
|
||||
{
|
||||
// The response becomes useless and the value and rawResponse are now owned by the
|
||||
// DeleteKeyOperation. This is fine because the DeleteKeyOperation is what the delete key api
|
||||
|
|
|
@ -27,7 +27,7 @@ void ParseStringOperationsToKeyOperations(
|
|||
}
|
||||
}
|
||||
|
||||
static inline void AssignBytesIfExists(
|
||||
inline void AssignBytesIfExists(
|
||||
Azure::Core::Json::_internal::json const& jsonKey,
|
||||
std::string const& keyName,
|
||||
std::vector<uint8_t>& destBytes)
|
||||
|
@ -38,14 +38,14 @@ static inline void AssignBytesIfExists(
|
|||
});
|
||||
}
|
||||
|
||||
static inline void WriteJsonIfVectorHasData(
|
||||
inline void WriteJsonIfVectorHasData(
|
||||
std::vector<uint8_t> const& srcVector,
|
||||
Azure::Core::Json::_internal::json& jsonKey,
|
||||
std::string const& keyName)
|
||||
{
|
||||
JsonOptional::SetFromIfPredicate<std::vector<uint8_t> const&>(
|
||||
srcVector,
|
||||
[](std::vector<uint8_t> const& value) { return value.size() > 0; },
|
||||
[](std::vector<uint8_t> const& value) { return !value.empty(); },
|
||||
jsonKey,
|
||||
keyName,
|
||||
Base64Url::Base64UrlEncode);
|
||||
|
@ -60,7 +60,7 @@ void Azure::Security::KeyVault::Keys::_detail::JsonWebKeySerializer::JsonWebKeyS
|
|||
destJson[_detail::KeyTypePropertyName] = jwk.KeyType.ToString();
|
||||
|
||||
// ops
|
||||
for (KeyOperation op : jwk.KeyOperations())
|
||||
for (KeyOperation const& op : jwk.KeyOperations())
|
||||
{
|
||||
destJson[_detail::KeyOpsPropertyName].push_back(op.ToString());
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ void Azure::Security::KeyVault::Keys::_detail::JsonWebKeySerializer::JsonWebKeyS
|
|||
jwk.CurveName, destJson, _detail::CurveNamePropertyName, [](KeyCurveName const& value) {
|
||||
return value.ToString();
|
||||
});
|
||||
if (jwk.Id.length() > 0)
|
||||
if (!jwk.Id.empty())
|
||||
{
|
||||
destJson[_detail::KeyIdPropertyName] = jwk.Id;
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ using namespace Azure::Core::Http::Policies::_internal;
|
|||
using namespace Azure::Core::Http::_internal;
|
||||
|
||||
namespace {
|
||||
constexpr static const char CreateValue[] = "create";
|
||||
constexpr const char CreateValue[] = "create";
|
||||
} // namespace
|
||||
|
||||
std::unique_ptr<RawResponse> KeyClient::SendRequest(
|
||||
|
@ -48,7 +48,7 @@ Request KeyClient::CreateRequest(
|
|||
Azure::Core::IO::BodyStream* content) const
|
||||
{
|
||||
return Azure::Security::KeyVault::_detail::KeyVaultKeysCommonRequest::CreateRequest(
|
||||
m_vaultUrl, m_apiVersion, method, path, content);
|
||||
m_vaultUrl, m_apiVersion, std::move(method), path, content);
|
||||
}
|
||||
|
||||
Request KeyClient::ContinuationTokenRequest(
|
||||
|
@ -68,7 +68,7 @@ Request KeyClient::ContinuationTokenRequest(
|
|||
KeyClient::KeyClient(
|
||||
std::string const& vaultUrl,
|
||||
std::shared_ptr<Core::Credentials::TokenCredential const> credential,
|
||||
KeyClientOptions options)
|
||||
KeyClientOptions const& options)
|
||||
: m_vaultUrl(vaultUrl), m_apiVersion(options.ApiVersion)
|
||||
{
|
||||
std::vector<std::unique_ptr<HttpPolicy>> perRetrypolicies;
|
||||
|
@ -78,7 +78,7 @@ KeyClient::KeyClient(
|
|||
|
||||
perRetrypolicies.emplace_back(
|
||||
std::make_unique<_internal::KeyVaultChallengeBasedAuthenticationPolicy>(
|
||||
credential, std::move(tokenContext)));
|
||||
std::move(credential), std::move(tokenContext)));
|
||||
}
|
||||
std::vector<std::unique_ptr<HttpPolicy>> perCallpolicies;
|
||||
|
||||
|
@ -111,7 +111,7 @@ Azure::Response<KeyVaultKey> KeyClient::CreateKey(
|
|||
Azure::Core::Context const& context) const
|
||||
{
|
||||
// Payload for the request
|
||||
_detail::KeyRequestParameters const params(keyType, options);
|
||||
_detail::KeyRequestParameters const params(std::move(keyType), options);
|
||||
auto payload = params.Serialize();
|
||||
Azure::Core::IO::MemoryBodyStream payloadStream(
|
||||
reinterpret_cast<const uint8_t*>(payload.data()), payload.size());
|
||||
|
|
|
@ -28,7 +28,7 @@ Azure::Security::KeyVault::Keys::_detail::KeyReleaseOptionsSerializer::KeyReleas
|
|||
keyReleaseOptions.Encryption,
|
||||
payload,
|
||||
_detail::EncryptionValue,
|
||||
[](KeyEncryptionAlgorithm enc) { return enc.ToString(); });
|
||||
[](KeyEncryptionAlgorithm const& enc) { return enc.ToString(); });
|
||||
|
||||
JsonOptional::SetFromNullable(keyReleaseOptions.Nonce, payload, _detail::NonceValue);
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ std::string KeyRequestParameters::Serialize() const
|
|||
Azure::Core::Json::_internal::json payload;
|
||||
// kty
|
||||
JsonOptional::SetFromNullable<KeyVaultKeyType, std::string>(
|
||||
m_keyType, payload, _detail::KeyTypePropertyName, [](KeyVaultKeyType type) {
|
||||
m_keyType, payload, _detail::KeyTypePropertyName, [](KeyVaultKeyType const& type) {
|
||||
return type.ToString();
|
||||
});
|
||||
|
||||
|
@ -39,7 +39,7 @@ std::string KeyRequestParameters::Serialize() const
|
|||
// key_size
|
||||
// public_exponent
|
||||
// key_ops
|
||||
for (KeyOperation op : m_options.KeyOperations)
|
||||
for (KeyOperation const& op : m_options.KeyOperations)
|
||||
{
|
||||
payload[_detail::KeyOpsPropertyName].push_back(op.ToString());
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ std::string KeyRequestParameters::Serialize() const
|
|||
PosixTimeConverter::DateTimeToPosixTime);
|
||||
|
||||
// tags
|
||||
for (auto tag : m_options.Tags)
|
||||
for (auto const& tag : m_options.Tags)
|
||||
{
|
||||
payload[_detail::TagsPropertyName][tag.first] = tag.second;
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ std::string _detail::KeyRotationPolicySerializer::KeyRotationPolicySerialize(
|
|||
payload[_detail::AttributesPropertyName],
|
||||
_detail::ExpiryTimeValue);
|
||||
|
||||
for (auto lifetimeAction : rotationPolicy.LifetimeActions)
|
||||
for (auto const& lifetimeAction : rotationPolicy.LifetimeActions)
|
||||
{
|
||||
json oneAction;
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ void _detail::KeyVaultKeySerializer::KeyVaultKeyDeserialize(
|
|||
// "Attributes"
|
||||
if (jsonParser.contains(_detail::AttributesPropertyName))
|
||||
{
|
||||
auto attributes = jsonParser[_detail::AttributesPropertyName];
|
||||
auto const& attributes = jsonParser[_detail::AttributesPropertyName];
|
||||
JsonOptional::SetIfExists(key.Properties.Enabled, attributes, _detail::EnabledPropertyName);
|
||||
JsonOptional::SetIfExists(
|
||||
key.Properties.Exportable, attributes, _detail::ExportablePropertyName);
|
||||
|
|
|
@ -43,7 +43,8 @@ Azure::Core::Http::Request _detail::KeyVaultKeysCommonRequest::CreateRequest(
|
|||
Azure::Core::IO::BodyStream* content)
|
||||
{
|
||||
using namespace Azure::Core::Http;
|
||||
Request request = content == nullptr ? Request(method, url) : Request(method, url, content);
|
||||
Request request = content == nullptr ? Request(std::move(method), std::move(url))
|
||||
: Request(std::move(method), std::move(url), content);
|
||||
|
||||
request.GetUrl().AppendQueryParameter(ApiVersionValue, apiVersion);
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace Azure {
|
|||
std::string const& apiVersion,
|
||||
std::shared_ptr<Azure::Core::Http::_internal::HttpPipeline> pipeline)
|
||||
{
|
||||
return CryptographyClient(keyId, apiVersion, pipeline);
|
||||
return CryptographyClient(std::move(keyId), apiVersion, std::move(pipeline));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include <memory>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace Azure { namespace Security { namespace KeyVault { namespace Keys { namespace _detail {
|
||||
|
@ -50,7 +51,7 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Keys { nam
|
|||
{
|
||||
m_options.NotBefore = key.NotBefore.Value();
|
||||
}
|
||||
if (key.Tags.size() > 0)
|
||||
if (!key.Tags.empty())
|
||||
{
|
||||
m_options.Tags = std::unordered_map<std::string, std::string>(key.Tags);
|
||||
}
|
||||
|
@ -69,7 +70,7 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Keys { nam
|
|||
}
|
||||
|
||||
explicit KeyRequestParameters(KeyVaultKeyType keyType, CreateKeyOptions const& options)
|
||||
: m_keyType(keyType), m_options(options)
|
||||
: m_keyType(std::move(keyType)), m_options(options)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include <azure/core/paged_response.hpp>
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace Azure { namespace Security { namespace KeyVault { namespace Secrets {
|
||||
|
@ -42,7 +43,7 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Secrets {
|
|||
std::shared_ptr<SecretClient> secretClient,
|
||||
std::string const& secretName = std::string())
|
||||
: PagedResponse(std::move(secretProperties)), m_secretName(secretName),
|
||||
m_secretClient(secretClient), Items(std::move(secretProperties.Items))
|
||||
m_secretClient(std::move(secretClient)), Items(std::move(secretProperties.Items))
|
||||
{
|
||||
RawResponse = std::move(rawResponse);
|
||||
}
|
||||
|
@ -79,7 +80,7 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Secrets {
|
|||
DeletedSecretPagedResponse&& deletedKeyProperties,
|
||||
std::unique_ptr<Azure::Core::Http::RawResponse> rawResponse,
|
||||
std::shared_ptr<SecretClient> secretClient)
|
||||
: PagedResponse(std::move(deletedKeyProperties)), m_secretClient(secretClient),
|
||||
: PagedResponse(std::move(deletedKeyProperties)), m_secretClient(std::move(secretClient)),
|
||||
Items(std::move(deletedKeyProperties.Items))
|
||||
{
|
||||
RawResponse = std::move(rawResponse);
|
||||
|
|
|
@ -71,7 +71,7 @@ std::unique_ptr<Azure::Core::Http::RawResponse> RecoverDeletedSecretOperation::P
|
|||
RecoverDeletedSecretOperation::RecoverDeletedSecretOperation(
|
||||
std::shared_ptr<SecretClient> secretClient,
|
||||
Azure::Response<SecretProperties> response)
|
||||
: m_secretClient(secretClient)
|
||||
: m_secretClient(std::move(secretClient))
|
||||
{
|
||||
m_value = response.Value;
|
||||
|
||||
|
@ -88,9 +88,9 @@ RecoverDeletedSecretOperation::RecoverDeletedSecretOperation(
|
|||
RecoverDeletedSecretOperation::RecoverDeletedSecretOperation(
|
||||
std::string resumeToken,
|
||||
std::shared_ptr<SecretClient> secretClient)
|
||||
: m_secretClient(secretClient), m_continuationToken(std::move(resumeToken))
|
||||
: m_secretClient(std::move(secretClient)), m_continuationToken(std::move(resumeToken))
|
||||
{
|
||||
m_value.Name = resumeToken;
|
||||
m_value.Name = m_continuationToken;
|
||||
}
|
||||
|
||||
RecoverDeletedSecretOperation RecoverDeletedSecretOperation::CreateFromResumeToken(
|
||||
|
@ -160,7 +160,7 @@ std::unique_ptr<Azure::Core::Http::RawResponse> DeleteSecretOperation::PollInter
|
|||
DeleteSecretOperation::DeleteSecretOperation(
|
||||
std::shared_ptr<SecretClient> secretClient,
|
||||
Azure::Response<DeletedSecret> response)
|
||||
: m_secretClient(secretClient)
|
||||
: m_secretClient(std::move(secretClient))
|
||||
{
|
||||
m_value = response.Value;
|
||||
m_rawResponse = std::move(response.RawResponse);
|
||||
|
@ -175,9 +175,9 @@ DeleteSecretOperation::DeleteSecretOperation(
|
|||
DeleteSecretOperation::DeleteSecretOperation(
|
||||
std::string resumeToken,
|
||||
std::shared_ptr<SecretClient> secretClient)
|
||||
: m_secretClient(secretClient), m_continuationToken(std::move(resumeToken))
|
||||
: m_secretClient(std::move(secretClient)), m_continuationToken(std::move(resumeToken))
|
||||
{
|
||||
m_value.Name = resumeToken;
|
||||
m_value.Name = m_continuationToken;
|
||||
}
|
||||
|
||||
DeleteSecretOperation DeleteSecretOperation::CreateFromResumeToken(
|
||||
|
|
|
@ -17,8 +17,8 @@ Azure::Core::Http::Request _detail::KeyVaultProtocolClient::CreateRequest(
|
|||
std::vector<std::string> const& path) const
|
||||
{
|
||||
Azure::Core::Http::Request request = content == nullptr
|
||||
? Azure::Core::Http::Request(method, m_vaultUrl)
|
||||
: Azure::Core::Http::Request(method, m_vaultUrl, content);
|
||||
? Azure::Core::Http::Request(std::move(method), m_vaultUrl)
|
||||
: Azure::Core::Http::Request(std::move(method), m_vaultUrl, content);
|
||||
|
||||
request.SetHeader(HttpShared::ContentType, HttpShared::ApplicationJson);
|
||||
request.SetHeader(HttpShared::Accept, HttpShared::ApplicationJson);
|
||||
|
@ -40,7 +40,7 @@ Azure::Core::Http::Request _detail::KeyVaultProtocolClient::CreateRequest(
|
|||
Azure::Core::Http::HttpMethod method,
|
||||
std::vector<std::string> const& path) const
|
||||
{
|
||||
return CreateRequest(method, nullptr, path);
|
||||
return CreateRequest(std::move(method), nullptr, path);
|
||||
}
|
||||
|
||||
std::unique_ptr<Azure::Core::Http::RawResponse> _detail::KeyVaultProtocolClient::SendRequest(
|
||||
|
|
|
@ -42,7 +42,8 @@ Azure::Core::Http::Request _detail::KeyVaultSecretsCommonRequest::CreateRequest(
|
|||
Azure::Core::IO::BodyStream* content)
|
||||
{
|
||||
using namespace Azure::Core::Http;
|
||||
Request request = content == nullptr ? Request(method, url) : Request(method, url, content);
|
||||
Request request = content == nullptr ? Request(std::move(method), std::move(url))
|
||||
: Request(std::move(method), std::move(url), content);
|
||||
|
||||
request.SetHeader(ContentHeaderName, ApplicationJsonValue);
|
||||
request.GetUrl().AppendQueryParameter(ApiVersionQueryParamName, apiVersion);
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include <functional>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace Azure { namespace Security { namespace KeyVault { namespace _detail {
|
||||
|
@ -181,7 +182,7 @@ namespace Azure { namespace Security { namespace KeyVault { namespace _detail {
|
|||
Azure::Core::Http::HttpMethod method,
|
||||
std::vector<std::string> const& path)
|
||||
{
|
||||
auto request = CreateRequest(method, path);
|
||||
auto request = CreateRequest(std::move(method), path);
|
||||
// Use the core pipeline directly to avoid checking the response code.
|
||||
return m_pipeline.Send(request, context);
|
||||
}
|
||||
|
|
|
@ -39,8 +39,8 @@ namespace Azure { namespace Security { namespace KeyVault { namespace _internal
|
|||
public:
|
||||
explicit KeyVaultChallengeBasedAuthenticationPolicy(
|
||||
std::shared_ptr<Core::Credentials::TokenCredential const> credential,
|
||||
Core::Credentials::TokenRequestContext tokenRequestContext)
|
||||
: BearerTokenAuthenticationPolicy(credential, tokenRequestContext),
|
||||
Core::Credentials::TokenRequestContext const& tokenRequestContext)
|
||||
: BearerTokenAuthenticationPolicy(std::move(credential), tokenRequestContext),
|
||||
m_tokenRequestContext(tokenRequestContext)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -104,7 +104,7 @@ namespace Azure { namespace Data { namespace Tables {
|
|||
|
||||
private:
|
||||
QueryTablesPagedResponse(std::shared_ptr<TableServiceClient> tableServiceClient)
|
||||
: m_tableServiceClient(tableServiceClient){};
|
||||
: m_tableServiceClient(std::move(tableServiceClient)){};
|
||||
|
||||
friend class Azure::Data::Tables::TableServiceClient;
|
||||
friend class Azure::Core::PagedResponse<QueryTablesPagedResponse>;
|
||||
|
@ -438,14 +438,14 @@ namespace Azure { namespace Data { namespace Tables {
|
|||
*
|
||||
* @param value Property value.
|
||||
*/
|
||||
TableEntityProperty(std::string const& value) : Value(std::move(value)) {}
|
||||
TableEntityProperty(std::string value) : Value(std::move(value)) {}
|
||||
/**
|
||||
* @brief Construct a new TableEntityProperty object.
|
||||
* @param value Property value.
|
||||
* @param type Property type.
|
||||
*/
|
||||
TableEntityProperty(std::string const& value, TableEntityDataType type)
|
||||
: Value(std::move(value)), Type(type)
|
||||
TableEntityProperty(std::string value, TableEntityDataType type)
|
||||
: Value(std::move(value)), Type(std::move(type))
|
||||
{
|
||||
}
|
||||
/**
|
||||
|
@ -687,7 +687,7 @@ namespace Azure { namespace Data { namespace Tables {
|
|||
* @param other Merge Entity result.
|
||||
*/
|
||||
UpsertEntityResult(MergeEntityResult const& other)
|
||||
: MergeEntityResult(other), ETag(std::move(other.ETag))
|
||||
: MergeEntityResult(other), ETag(other.ETag)
|
||||
{
|
||||
}
|
||||
/**
|
||||
|
@ -696,7 +696,7 @@ namespace Azure { namespace Data { namespace Tables {
|
|||
* @param other Update Entity result.
|
||||
*/
|
||||
UpsertEntityResult(UpdateEntityResult const& other)
|
||||
: UpdateEntityResult(other), ETag(std::move(other.ETag))
|
||||
: UpdateEntityResult(other), ETag(other.ETag)
|
||||
{
|
||||
}
|
||||
/**
|
||||
|
@ -704,10 +704,7 @@ namespace Azure { namespace Data { namespace Tables {
|
|||
*
|
||||
* @param other Add Entity result.
|
||||
*/
|
||||
UpsertEntityResult(AddEntityResult const& other)
|
||||
: AddEntityResult(other), ETag(std::move(other.ETag))
|
||||
{
|
||||
}
|
||||
UpsertEntityResult(AddEntityResult const& other) : AddEntityResult(other), ETag(other.ETag) {}
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -774,7 +771,7 @@ namespace Azure { namespace Data { namespace Tables {
|
|||
|
||||
private:
|
||||
QueryEntitiesPagedResponse(std::shared_ptr<TableClient> tableClient)
|
||||
: m_tableClient(tableClient){};
|
||||
: m_tableClient(std::move(tableClient)){};
|
||||
|
||||
std::shared_ptr<TableClient> m_tableClient;
|
||||
friend class Azure::Data::Tables::TableClient;
|
||||
|
@ -806,7 +803,7 @@ namespace Azure { namespace Data { namespace Tables {
|
|||
/**
|
||||
* Action.
|
||||
*/
|
||||
TransactionActionType Action;
|
||||
TransactionActionType Action{};
|
||||
/**
|
||||
* Entity.
|
||||
*/
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
namespace Azure { namespace Data { namespace Tables { namespace Sas {
|
||||
namespace {
|
||||
constexpr static const char* SasVersion = "2023-08-03";
|
||||
constexpr const char* SasVersion = "2023-08-03";
|
||||
}
|
||||
|
||||
void AccountSasBuilder::SetPermissions(AccountSasPermissions permissions)
|
||||
|
|
|
@ -55,6 +55,7 @@ namespace Azure { namespace Data { namespace Tables { namespace _detail { namesp
|
|||
{
|
||||
algorithmFlags = BCRYPT_ALG_HANDLE_HMAC_FLAG;
|
||||
}
|
||||
Handle = nullptr;
|
||||
NTSTATUS status = BCryptOpenAlgorithmProvider(&Handle, algorithmId, nullptr, algorithmFlags);
|
||||
if (!BCRYPT_SUCCESS(status))
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче