Line data Source code
1 : #pragma once 2 : 3 : #include <string> 4 : 5 : #include "envoy/common/pure.h" 6 : #include "envoy/config/context_provider.h" 7 : #include "envoy/config/core/v3/base.pb.h" 8 : #include "envoy/network/address.h" 9 : #include "envoy/stats/stats.h" 10 : 11 : namespace Envoy { 12 : namespace LocalInfo { 13 : 14 : /** 15 : * Information about the local environment. 16 : */ 17 : class LocalInfo { 18 : public: 19 1324 : virtual ~LocalInfo() = default; 20 : 21 : /** 22 : * @return the local (non-loopback) address of the server. 23 : */ 24 : virtual Network::Address::InstanceConstSharedPtr address() const PURE; 25 : 26 : /** 27 : * @return the human readable zone name. E.g., "us-east-1a". 28 : */ 29 : virtual const std::string& zoneName() const PURE; 30 : 31 : /** 32 : * @return the zone name as a stat name. 33 : */ 34 : virtual const Stats::StatName& zoneStatName() const PURE; 35 : 36 : /** 37 : * @return the human readable cluster name. E.g., "eta". 38 : */ 39 : virtual const std::string& clusterName() const PURE; 40 : 41 : /** 42 : * @return the human readable individual node name. E.g., "i-123456". 43 : */ 44 : virtual const std::string& nodeName() const PURE; 45 : 46 : /** 47 : * @return the full node identity presented to management servers. 48 : */ 49 : virtual const envoy::config::core::v3::Node& node() const PURE; 50 : 51 : /** 52 : * @return the xDS context provider for the node. 53 : */ 54 : virtual Config::ContextProvider& contextProvider() PURE; 55 : virtual const Config::ContextProvider& contextProvider() const PURE; 56 : }; 57 : 58 : using LocalInfoPtr = std::unique_ptr<LocalInfo>; 59 : 60 : } // namespace LocalInfo 61 : } // namespace Envoy