azure-sdk-for-cpp/samples/helpers/service/src/client.cpp
Anton Kolesnyk 6aac5aba17
Make sample service an object library (#3728)
Co-authored-by: Anton Kolesnyk <antkmsft@users.noreply.github.com>
2022-06-08 16:25:45 -07:00

25 lines
883 B
C++

// Copyright (c) Microsoft Corporation. All rights reserved.
// SPDX-License-Identifier: MIT
#include "azure/service/client.hpp"
void Azure::Service::Client::DoSomething(const Azure::Core::Context& context) const
{
static_cast<void>(context); // to suppress the "unused variable" warning.
// An oversimplified logic of what a typical Azure SDK client does is below:
#if (0)
// Every client has its own scope. We use management.azure.com here as an example.
Core::Credentials::TokenRequestContext azureServiceClientContext;
azureServiceClientContext.Scopes = {"https://management.azure.com/"};
auto authenticationToken = m_credential->GetToken(azureServiceClientContext, context);
// Now that it has a token, Client can authorize and DoSomething().
// ...
// ...
static_cast<void>(authenticationToken); // to suppress the "unused variable" warning.
#endif
}