File size: 1,351 Bytes
bfd87b5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/core/config/AWSProfileConfigLoaderBase.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <aws/core/utils/memory/stl/AWSMap.h>
#include <aws/core/utils/DateTime.h>
#include <aws/core/utils/threading/ReaderWriterLock.h>
namespace Aws
{
namespace Internal
{
class EC2MetadataClient;
}
namespace Config
{
static const char* const INSTANCE_PROFILE_KEY = "InstanceProfile";
/**
* Loads configuration from the EC2 Metadata Service
*/
class AWS_CORE_API EC2InstanceProfileConfigLoader : public AWSProfileConfigLoader
{
public:
/**
* If client is nullptr, the default EC2MetadataClient will be created.
*/
EC2InstanceProfileConfigLoader(const std::shared_ptr<Aws::Internal::EC2MetadataClient>& = nullptr);
virtual ~EC2InstanceProfileConfigLoader() = default;
protected:
virtual bool LoadInternal() override;
private:
std::shared_ptr<Aws::Internal::EC2MetadataClient> m_ec2metadataClient;
int64_t credentialsValidUntilMillis = 0;
int64_t calculateRetryTime() const;
};
}
}
|