diff --git a/src/Agent/AgentServiceConnectProxyConfig.php b/src/Agent/AgentServiceConnectProxyConfig.php index a9996b8..f0edb36 100644 --- a/src/Agent/AgentServiceConnectProxyConfig.php +++ b/src/Agent/AgentServiceConnectProxyConfig.php @@ -31,6 +31,12 @@ class AgentServiceConnectProxyConfig extends AbstractModel { protected const FIELDS = [ + self::FIELD_ENVOY_EXTENSIONS => [ + Transcoding::FIELD_CLASS => EnvoyExtension::class, + Transcoding::FIELD_TYPE => Transcoding::ARRAY, + Transcoding::FIELD_ARRAY_TYPE => Transcoding::OBJECT, + Transcoding::FIELD_OMITEMPTY => true, + ], self::FIELD_DESTINATION_SERVICE_NAME => Transcoding::OMITEMPTY_STRING_FIELD, self::FIELD_DESTINATION_SERVICE_ID => Transcoding::OMITEMPTY_STRING_FIELD, self::FIELD_LOCAL_SERVICE_ADDRESS => Transcoding::OMITEMPTY_STRING_FIELD, @@ -57,6 +63,7 @@ class AgentServiceConnectProxyConfig extends AbstractModel ], ]; + private const FIELD_ENVOY_EXTENSIONS = 'EnvoyExtension'; private const FIELD_DESTINATION_SERVICE_NAME = 'DestinationServiceName'; private const FIELD_DESTINATION_SERVICE_ID = 'DestinationServiceID'; private const FIELD_LOCAL_SERVICE_ADDRESS = 'LocalServiceAddress'; @@ -66,6 +73,8 @@ class AgentServiceConnectProxyConfig extends AbstractModel private const FIELD_MESH_GATEWAY = 'MeshGateway'; private const FIELD_EXPOSE = 'Expose'; + /** @var \DCarbone\PHPConsulAPI\Agent\EnvoyExtension[] */ + public array $EnvoyExtensions = []; /** @var string */ public string $DestinationServiceName = ''; /** @var string */ @@ -74,6 +83,12 @@ class AgentServiceConnectProxyConfig extends AbstractModel public string $LocalServiceAddress = ''; /** @var int */ public int $LocalServicePort = 0; + /** @var string */ + public string $LocalServiceSocketPath = ''; + /** @var string */ + public string $Mode = ''; + /** @var \DCarbone\PHPConsulAPI\Agent\TransparentProxyConfig|null */ + public ?TransparentProxyConfig $TransparentProxy = null; /** @var \DCarbone\PHPConsulAPI\Agent\Upstream[] */ public array $Upstreams = []; /** @var \DCarbone\PHPConsulAPI\ConfigEntry\MeshGatewayConfig */ @@ -96,6 +111,34 @@ public function __construct(?array $data = []) } } + /** + * @return array + */ + public function getEnvoyExtensions(): array + { + return $this->EnvoyExtensions; + } + + /** + * @param EnvoyExtension $envoyExtension + * @return \DCarbone\PHPConsulAPI\Agent\AgentServiceConnectProxyConfig + */ + public function addEnvoyExtension(EnvoyExtension $envoyExtension): self + { + $this->EnvoyExtensions[] = $envoyExtension; + return $this; + } + + /** + * @param array $EnvoyExtensions + * @return \DCarbone\PHPConsulAPI\Agent\AgentServiceConnectProxyConfig + */ + public function setEnvoyExtensions(array $EnvoyExtensions): self + { + $this->EnvoyExtensions = $EnvoyExtensions; + return $this; + } + /** * @return string */ @@ -168,6 +211,60 @@ public function setLocalServicePort(int $LocalServicePort): self return $this; } + /** + * @return string + */ + public function getLocalServiceSocketPath(): string + { + return $this->LocalServiceSocketPath; + } + + /** + * @param string $LocalServiceSocketPath + * @return AgentServiceConnectProxyConfig + */ + public function setLocalServiceSocketPath(string $LocalServiceSocketPath): self + { + $this->LocalServiceSocketPath = $LocalServiceSocketPath; + return $this; + } + + /** + * @return string + */ + public function getMode(): string + { + return $this->Mode; + } + + /** + * @param string $Mode + * @return AgentServiceConnectProxyConfig + */ + public function setMode(string $Mode): self + { + $this->Mode = $Mode; + return $this; + } + + /** + * @return \DCarbone\PHPConsulAPI\Agent\TransparentProxyConfig|null + */ + public function getTransparentProxy(): ?TransparentProxyConfig + { + return $this->TransparentProxy; + } + + /** + * @param \DCarbone\PHPConsulAPI\Agent\TransparentProxyConfig|null $TransparentProxy + * @return AgentServiceConnectProxyConfig + */ + public function setTransparentProxy(?TransparentProxyConfig $TransparentProxy): self + { + $this->TransparentProxy = $TransparentProxy; + return $this; + } + /** * @return \DCarbone\PHPConsulAPI\Agent\Upstream[] */ diff --git a/src/Agent/EnvoyExtension.php b/src/Agent/EnvoyExtension.php new file mode 100644 index 0000000..4df7d45 --- /dev/null +++ b/src/Agent/EnvoyExtension.php @@ -0,0 +1,135 @@ + Transcoding::MAP_FIELD, + ]; + + private const FIELD_ARGUMENTS = 'Arguments'; + + /** @var string */ + public string $Name = ''; + /** @var bool */ + public bool $Required = false; + /** @var \DCarbone\PHPConsulAPI\FakeMap|null */ + public ?FakeMap $Arguments = null; + /** @var string */ + public string $ConsulVersion = ''; + /** @var string */ + public string $EnvoyVersion = ''; + + /** + * @return string + */ + public function getName(): string + { + return $this->Name; + } + + /** + * @param string $Name + * @return EnvoyExtension + */ + public function setName(string $Name): EnvoyExtension + { + $this->Name = $Name; + return $this; + } + + /** + * @return bool + */ + public function isRequired(): bool + { + return $this->Required; + } + + /** + * @param bool $Required + * @return EnvoyExtension + */ + public function setRequired(bool $Required): EnvoyExtension + { + $this->Required = $Required; + return $this; + } + + /** + * @return \DCarbone\PHPConsulAPI\FakeMap|null + */ + public function getArguments(): ?FakeMap + { + return $this->Arguments; + } + + /** + * @param \DCarbone\PHPConsulAPI\FakeMap|null $Arguments + * @return EnvoyExtension + */ + public function setArguments(?FakeMap $Arguments): EnvoyExtension + { + $this->Arguments = $Arguments; + return $this; + } + + /** + * @return string + */ + public function getConsulVersion(): string + { + return $this->ConsulVersion; + } + + /** + * @param string $ConsulVersion + * @return EnvoyExtension + */ + public function setConsulVersion(string $ConsulVersion): EnvoyExtension + { + $this->ConsulVersion = $ConsulVersion; + return $this; + } + + /** + * @return string + */ + public function getEnvoyVersion(): string + { + return $this->EnvoyVersion; + } + + /** + * @param string $EnvoyVersion + * @return EnvoyExtension + */ + public function setEnvoyVersion(string $EnvoyVersion): EnvoyExtension + { + $this->EnvoyVersion = $EnvoyVersion; + return $this; + } +} diff --git a/src/Agent/TransparentProxyConfig.php b/src/Agent/TransparentProxyConfig.php new file mode 100644 index 0000000..924f4d5 --- /dev/null +++ b/src/Agent/TransparentProxyConfig.php @@ -0,0 +1,49 @@ +OutboundListenerPort; + } + + /** + * @param int $OutboundListenerPort + * @return TransparentProxyConfig + */ + public function setOutboundListenerPort(int $OutboundListenerPort): TransparentProxyConfig + { + $this->OutboundListenerPort = $OutboundListenerPort; + return $this; + } +} diff --git a/src/Consul.php b/src/Consul.php index d81b7b8..e352254 100644 --- a/src/Consul.php +++ b/src/Consul.php @@ -131,6 +131,10 @@ class Consul public const ACLModeLegacy = '2'; public const ACLModeUnknown = '3'; + public const ProxyModeDefault = ''; + public const ProxyModeTransparent = 'transparent'; + public const ProxyModeDirect = 'direct'; + // "private" constants public const _headerConsulPrefix = 'X-Consul-';