├── .github ├── CODEOWNERS ├── FUNDING.yml ├── dependabot.yml └── workflows │ └── tests.yaml ├── LICENSE ├── Makefile ├── composer.json ├── composer.lock ├── src ├── ACL │ ├── ACLAuthMethod.php │ ├── ACLAuthMethodListEntry.php │ ├── ACLAuthMethodListEntryQueryResponse.php │ ├── ACLAuthMethodNamespaceRule.php │ ├── ACLAuthMethodQueryResponse.php │ ├── ACLAuthMethodWriteResponse.php │ ├── ACLBindingRule.php │ ├── ACLBindingRuleQueryResponse.php │ ├── ACLBindingRuleWriteResponse.php │ ├── ACLBindingRulesQueryResponse.php │ ├── ACLClient.php │ ├── ACLEntriesResponse.php │ ├── ACLEntry.php │ ├── ACLLink.php │ ├── ACLLoginParams.php │ ├── ACLNodeIdentity.php │ ├── ACLOIDCAuthURLParams.php │ ├── ACLOIDCCallbackParams.php │ ├── ACLPolicy.php │ ├── ACLPolicyListEntry.php │ ├── ACLPolicyListEntryQueryResponse.php │ ├── ACLPolicyQueryResponse.php │ ├── ACLPolicyWriteResponse.php │ ├── ACLReplicationStatus.php │ ├── ACLReplicationStatusResponse.php │ ├── ACLRole.php │ ├── ACLRolePolicyLink.php │ ├── ACLRoleQueryResponse.php │ ├── ACLRoleWriteResponse.php │ ├── ACLRolesQueryResponse.php │ ├── ACLServiceIdentity.php │ ├── ACLToken.php │ ├── ACLTokenListEntry.php │ ├── ACLTokenListEntryQueryResponse.php │ ├── ACLTokenPolicyLink.php │ ├── ACLTokenQueryResponse.php │ ├── ACLTokenRoleLink.php │ ├── ACLTokenWriteResponse.php │ ├── KubernetesAuthMethodConfig.php │ └── OIDCAuthMethodConfig.php ├── AbstractClient.php ├── AbstractModel.php ├── AbstractResponse.php ├── AbstractValuedQueryResponse.php ├── AbstractValuedResponse.php ├── AbstractValuedWriteResponse.php ├── Agent │ ├── AgentCheck.php │ ├── AgentCheckRegistration.php │ ├── AgentCheckUpdate.php │ ├── AgentChecksResponse.php │ ├── AgentClient.php │ ├── AgentHealthServiceResponse.php │ ├── AgentHealthServicesResponse.php │ ├── AgentMember.php │ ├── AgentMembersResponse.php │ ├── AgentService.php │ ├── AgentServiceCheck.php │ ├── AgentServiceChecks.php │ ├── AgentServiceChecksInfo.php │ ├── AgentServiceConnect.php │ ├── AgentServiceConnectProxyConfig.php │ ├── AgentServiceRegistration.php │ ├── AgentServiceResponse.php │ ├── AgentServicesResponse.php │ ├── AgentToken.php │ ├── AgentWeights.php │ ├── EnvoyExtension.php │ ├── GaugeValue.php │ ├── MemberOpts.php │ ├── MetricsInfo.php │ ├── MetricsInfoResponse.php │ ├── PointValue.php │ ├── SampledValue.php │ ├── ServiceRegisterOpts.php │ ├── TransparentProxyConfig.php │ └── Upstream.php ├── Catalog │ ├── CatalogClient.php │ ├── CatalogDeregistration.php │ ├── CatalogNode.php │ ├── CatalogNodeResponse.php │ ├── CatalogNodeServiceList.php │ ├── CatalogNodeServicesListResponse.php │ ├── CatalogRegistration.php │ ├── CatalogService.php │ ├── CatalogServicesResponse.php │ ├── CompoundServiceName.php │ ├── GatewayService.php │ ├── GatewayServicesResponse.php │ ├── Node.php │ ├── NodesResponse.php │ ├── ServiceAddress.php │ └── Weights.php ├── Config.php ├── ConfigEntry │ ├── ConfigEntry.php │ ├── ConfigEntryTrait.php │ ├── ExposeConfig.php │ ├── ExposePath.php │ ├── MeshConfigEntry.php │ ├── MeshGatewayConfig.php │ ├── PassiveHealthCheck.php │ ├── ProxyConfigEntry.php │ ├── RingHashConfig.php │ ├── ServiceConfigEntry.php │ ├── ServiceResolverConfigEntry.php │ ├── ServiceResolverFailover.php │ ├── ServiceResolverRedirect.php │ ├── ServiceResolverSubset.php │ ├── ServiceRoute.php │ ├── ServiceRouteDestination.php │ ├── ServiceRouteHTTPMatch.php │ ├── ServiceRouteHTTPMatchHeader.php │ ├── ServiceRouteHTTPMatchQueryParam.php │ ├── ServiceRouteMatch.php │ ├── ServiceRouterConfigEntry.php │ ├── ServiceSplit.php │ ├── ServiceSplitterConfigEntry.php │ ├── TransparentProxyConfig.php │ ├── UpstreamConfiguration.php │ └── UpstreamLimits.php ├── Consul.php ├── Coordinate │ ├── Coordinate.php │ ├── CoordinateClient.php │ ├── CoordinateConfig.php │ ├── CoordinateDatacenterMap.php │ ├── CoordinateDatacentersResponse.php │ ├── CoordinateEntriesResponse.php │ ├── CoordinateEntry.php │ ├── DimensionalityConflictException.php │ └── funcs.php ├── Debug │ └── DebugClient.php ├── DecodedBody.php ├── Error.php ├── ErrorContainer.php ├── Event │ ├── EventClient.php │ ├── UserEvent.php │ ├── UserEventResponse.php │ └── UserEventsResponse.php ├── FakeMap.php ├── FakeSlice.php ├── HasSettableStringTags.php ├── HasStringTags.php ├── Health │ ├── HealthCheck.php │ ├── HealthCheckDefinition.php │ ├── HealthChecks.php │ ├── HealthChecksResponse.php │ ├── HealthClient.php │ ├── ServiceEntriesResponse.php │ └── ServiceEntry.php ├── HttpAuth.php ├── KV │ ├── CheckTxnOp.php │ ├── KVClient.php │ ├── KVPair.php │ ├── KVPairResponse.php │ ├── KVPairs.php │ ├── KVPairsResponse.php │ ├── KVTree.php │ ├── KVTxnAPIResponse.php │ ├── KVTxnOp.php │ ├── KVTxnOps.php │ ├── KVTxnResponse.php │ ├── NodeTxnOp.php │ ├── ServiceTxnOp.php │ ├── TxnError.php │ ├── TxnErrors.php │ ├── TxnOp.php │ ├── TxnOps.php │ ├── TxnResponse.php │ ├── TxnResult.php │ └── TxnResults.php ├── MapResponse.php ├── Marshaller.php ├── Operator │ ├── Area.php │ ├── AreaJoinResponse.php │ ├── AutopilotConfiguration.php │ ├── AutopilotServer.php │ ├── AutopilotState.php │ ├── AutopilotStateResponse.php │ ├── AutopilotUpgrade.php │ ├── AutopilotZone.php │ ├── AutopilotZoneUpgradeVersions.php │ ├── OperatorAreaJoinResponse.php │ ├── OperatorAreasResponse.php │ ├── OperatorAutopilotConfigurationResponse.php │ ├── OperatorClient.php │ ├── OperatorHealthReply.php │ ├── OperatorHealthReplyResponse.php │ ├── OperatorRaftConfigurationResponse.php │ ├── OperatorSerfMembersResponse.php │ ├── OperatorServerHealthsResponse.php │ ├── RaftConfiguration.php │ ├── RaftServer.php │ ├── ReadableDuration.php │ ├── SerfMember.php │ └── ServerHealth.php ├── Params.php ├── PreparedQuery │ ├── PreparedQueryClient.php │ ├── PreparedQueryDefinition.php │ ├── PreparedQueryDefinitionsResponse.php │ ├── PreparedQueryExecuteResponse.php │ ├── PreparedQueryExecuteResponseResponse.php │ ├── QueryDNSOptions.php │ ├── QueryDatacenterOptions.php │ ├── QueryTemplate.php │ └── ServiceQuery.php ├── QueryMeta.php ├── QueryMetaContainer.php ├── QueryOptions.php ├── Request.php ├── RequestMeta.php ├── RequestOptions.php ├── RequestResponse.php ├── ResponseValueBoolTrait.php ├── ResponseValueStringTrait.php ├── ResponseValueStringsTrait.php ├── ScalarType.php ├── Session │ ├── ServiceCheck.php │ ├── SessionClient.php │ ├── SessionEntriesQueryResponse.php │ ├── SessionEntriesWriteResponse.php │ └── SessionEntry.php ├── Status │ └── StatusClient.php ├── Transcoding.php ├── UnmarshalledResponseInterface.php ├── Unmarshaller.php ├── ValuedBoolResponse.php ├── ValuedQueryBoolResponse.php ├── ValuedQueryStringResponse.php ├── ValuedQueryStringsResponse.php ├── ValuedResponseInterface.php ├── ValuedStringResponse.php ├── ValuedStringsResponse.php ├── ValuedWriteBoolResponse.php ├── ValuedWriteStringResponse.php ├── Values.php ├── WriteMeta.php ├── WriteMetaContainer.php ├── WriteOptions.php ├── WriteResponse.php └── funcs.php └── tmp └── .gitignore /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @dcarbone -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: dcarbone 4 | ko_fi: dcarbone 5 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | 3 | updates: 4 | - package-ecosystem: "github-actions" 5 | directory: "/" 6 | schedule: 7 | interval: "daily" 8 | 9 | - package-ecosystem: "composer" 10 | directory: "/" 11 | assignees: 12 | - "dcarbone" 13 | schedule: 14 | interval: "daily" 15 | allow: 16 | - dependency-type: "all" 17 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: dev-docker 2 | dev-docker: 3 | docker buildx build -f docker/dev.Dockerfile -t php-dev:7.4-php-consul-api --load . 4 | 5 | .PHONY: php-cs-fixer 6 | php-cs-fixer: 7 | ./tools/php-cs-fixer/vendor/bin/php-cs-fixer fix \ 8 | --allow-risky=yes \ 9 | --config ./tools/php-cs-fixer/php-consul-api-rules.php_cs \ 10 | src 11 | ./tools/php-cs-fixer/vendor/bin/php-cs-fixer fix \ 12 | --allow-risky=yes \ 13 | --config ./tools/php-cs-fixer/php-consul-api-rules.php_cs \ 14 | tests -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dcarbone/php-consul-api", 3 | "type": "library", 4 | "description": "PHP client for the Consul HTTP API", 5 | "homepage": "https://github.com/dcarbone/php-consul-api", 6 | "license": "Apache-2.0", 7 | "authors": [ 8 | { 9 | "name": "Daniel Carbone", 10 | "email": "daniel.p.carbone@gmail.com" 11 | } 12 | ], 13 | "keywords": [ 14 | "consul", 15 | "consul-api", 16 | "php-consul-api" 17 | ], 18 | "require": { 19 | "php": "^8.1", 20 | "ext-json": "*", 21 | "dcarbone/gotime": "^v0.6", 22 | "dcarbone/gohttp": "v0.3.*", 23 | "guzzlehttp/guzzle": "^7.4", 24 | "guzzlehttp/psr7": "^2.4" 25 | }, 26 | "autoload": { 27 | "files": [ 28 | "src/Coordinate/funcs.php", 29 | "src/funcs.php" 30 | ], 31 | "psr-4": { 32 | "DCarbone\\PHPConsulAPI\\": "src/" 33 | } 34 | }, 35 | "require-dev": { 36 | "phpunit/phpunit": "^10.5 || ^11.0" 37 | }, 38 | "autoload-dev": { 39 | "files": [ 40 | "src/Coordinate/funcs.php", 41 | "tests/funcs.php" 42 | ], 43 | "psr-4": { 44 | "DCarbone\\PHPConsulAPI\\": "src/", 45 | "DCarbone\\PHPConsulAPITests\\": "tests/" 46 | } 47 | }, 48 | "scripts": { 49 | "php-cs-fixer": "tools/php-cs-fixer/vendor/bin/php-cs-fixer fix --config tools/php-cs-fixer/php-consul-api-rules.php_cs src/" 50 | } 51 | } -------------------------------------------------------------------------------- /src/ACL/ACLAuthMethodListEntryQueryResponse.php: -------------------------------------------------------------------------------- 1 | ACLAuthMethodListEntries; 33 | } 34 | 35 | public function unmarshalValue(mixed $decodedData): void 36 | { 37 | $this->ACLAuthMethodListEntries = []; 38 | foreach ($decodedData as $datum) { 39 | $this->ACLAuthMethodListEntries[] = new ACLAuthMethodListEntry($datum); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/ACL/ACLAuthMethodNamespaceRule.php: -------------------------------------------------------------------------------- 1 | Transcoding::OMITEMPTY_STRING_FIELD, 30 | self::FIELD_BIND_NAMESPACE => Transcoding::OMITEMPTY_STRING_FIELD, 31 | ]; 32 | 33 | private const FIELD_SELECTOR = 'Selector'; 34 | private const FIELD_BIND_NAMESPACE = 'BindNamespace'; 35 | 36 | public string $Selector = ''; 37 | public string $BindNamespace = ''; 38 | 39 | public function getSelector(): string 40 | { 41 | return $this->Selector; 42 | } 43 | 44 | public function setSelector(string $Selector): self 45 | { 46 | $this->Selector = $Selector; 47 | return $this; 48 | } 49 | 50 | public function getBindNamespace(): string 51 | { 52 | return $this->BindNamespace; 53 | } 54 | 55 | public function setBindNamespace(string $BindNamespace): self 56 | { 57 | $this->BindNamespace = $BindNamespace; 58 | return $this; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/ACL/ACLAuthMethodQueryResponse.php: -------------------------------------------------------------------------------- 1 | ACLAuthMethod; 33 | } 34 | 35 | public function unmarshalValue(mixed $decodedData): void 36 | { 37 | $this->ACLAuthMethod = new ACLAuthMethod((array)$decodedData); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/ACL/ACLAuthMethodWriteResponse.php: -------------------------------------------------------------------------------- 1 | ACLAuthMethod; 33 | } 34 | 35 | public function unmarshalValue(mixed $decodedData): void 36 | { 37 | $this->ACLAuthMethod = new ACLAuthMethod((array)$decodedData); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/ACL/ACLBindingRuleQueryResponse.php: -------------------------------------------------------------------------------- 1 | ACLBindingRule; 33 | } 34 | 35 | public function unmarshalValue(mixed $decodedData): void 36 | { 37 | $this->ACLBindingRule = new ACLBindingRule((array)$decodedData); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/ACL/ACLBindingRuleWriteResponse.php: -------------------------------------------------------------------------------- 1 | ACLBindingRule; 33 | } 34 | 35 | public function unmarshalValue(mixed $decodedData): void 36 | { 37 | $this->ACLBindingRule = new ACLBindingRule((array)$decodedData); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/ACL/ACLBindingRulesQueryResponse.php: -------------------------------------------------------------------------------- 1 | ACLBindingRules; 33 | } 34 | 35 | public function unmarshalValue(mixed $decodedData): void 36 | { 37 | $this->ACLBindingRules = []; 38 | foreach ($decodedData as $datum) { 39 | $this->ACLBindingRules[] = new ACLBindingRule($datum); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/ACL/ACLEntriesResponse.php: -------------------------------------------------------------------------------- 1 | ACLEntries; 33 | } 34 | 35 | public function unmarshalValue(mixed $decodedData): void 36 | { 37 | foreach ($decodedData as $entry) { 38 | $this->ACLEntries[] = new ACLEntry($entry); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/ACL/ACLLink.php: -------------------------------------------------------------------------------- 1 | ID; 33 | } 34 | 35 | public function getName(): string 36 | { 37 | return $this->Name; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/ACL/ACLLoginParams.php: -------------------------------------------------------------------------------- 1 | Transcoding::MAP_FIELD + [Transcoding::FIELD_OMITEMPTY => true], 31 | ]; 32 | 33 | private const FIELD_META = 'Meta'; 34 | 35 | public string $AuthMethod = ''; 36 | public string $BearerToken = ''; 37 | public ?FakeMap $Meta = null; 38 | 39 | public function getAuthMethod(): string 40 | { 41 | return $this->AuthMethod; 42 | } 43 | 44 | public function setAuthMethod(string $AuthMethod): self 45 | { 46 | $this->AuthMethod = $AuthMethod; 47 | return $this; 48 | } 49 | 50 | public function getBearerToken(): string 51 | { 52 | return $this->BearerToken; 53 | } 54 | 55 | public function setBearerToken(string $BearerToken): self 56 | { 57 | $this->BearerToken = $BearerToken; 58 | return $this; 59 | } 60 | 61 | public function getMeta(): ?FakeMap 62 | { 63 | return $this->Meta; 64 | } 65 | 66 | public function setMeta(mixed $Meta): self 67 | { 68 | $this->Meta = FakeMap::parse($Meta); 69 | return $this; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/ACL/ACLNodeIdentity.php: -------------------------------------------------------------------------------- 1 | NodeName; 33 | } 34 | 35 | public function getDatacenter(): string 36 | { 37 | return $this->Datacenter; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/ACL/ACLOIDCCallbackParams.php: -------------------------------------------------------------------------------- 1 | AuthMethod; 35 | } 36 | 37 | public function setAuthMethod(string $AuthMethod): self 38 | { 39 | $this->AuthMethod = $AuthMethod; 40 | return $this; 41 | } 42 | 43 | public function getState(): string 44 | { 45 | return $this->State; 46 | } 47 | 48 | public function setState(string $State): self 49 | { 50 | $this->State = $State; 51 | return $this; 52 | } 53 | 54 | public function getCode(): string 55 | { 56 | return $this->Code; 57 | } 58 | 59 | public function setCode(string $Code): self 60 | { 61 | $this->Code = $Code; 62 | return $this; 63 | } 64 | 65 | public function getClientNonce(): string 66 | { 67 | return $this->ClientNonce; 68 | } 69 | 70 | public function setClientNonce(string $ClientNonce): self 71 | { 72 | $this->ClientNonce = $ClientNonce; 73 | return $this; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /src/ACL/ACLPolicyListEntryQueryResponse.php: -------------------------------------------------------------------------------- 1 | ACLPolicyListEntries; 33 | } 34 | 35 | public function unmarshalValue(mixed $decodedData): void 36 | { 37 | $this->ACLPolicyListEntries = []; 38 | foreach ($decodedData as $datum) { 39 | $this->ACLPolicyListEntries[] = new ACLPolicyListEntry($datum); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/ACL/ACLPolicyQueryResponse.php: -------------------------------------------------------------------------------- 1 | ACLPolicy; 33 | } 34 | 35 | public function unmarshalValue(mixed $decodedData): void 36 | { 37 | $this->ACLPolicy = new ACLPolicy((array)$decodedData); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/ACL/ACLPolicyWriteResponse.php: -------------------------------------------------------------------------------- 1 | ACLPolicy; 33 | } 34 | 35 | public function unmarshalValue(mixed $decodedData): void 36 | { 37 | $this->ACLPolicy = new ACLPolicy((array)$decodedData); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/ACL/ACLReplicationStatusResponse.php: -------------------------------------------------------------------------------- 1 | ACLReplicationStatus; 33 | } 34 | 35 | public function unmarshalValue(mixed $decodedData): void 36 | { 37 | $this->ACLReplicationStatus = new ACLReplicationStatus((array)$decodedData); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/ACL/ACLRolePolicyLink.php: -------------------------------------------------------------------------------- 1 | ACLRole; 33 | } 34 | 35 | public function unmarshalValue(mixed $decodedData): void 36 | { 37 | $this->ACLRole = new ACLRole((array)$decodedData); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/ACL/ACLRoleWriteResponse.php: -------------------------------------------------------------------------------- 1 | ACLRole; 33 | } 34 | 35 | public function unmarshalValue(mixed $decodedData): void 36 | { 37 | $this->ACLRole = new ACLRole((array)$decodedData); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/ACL/ACLRolesQueryResponse.php: -------------------------------------------------------------------------------- 1 | ACLRoles; 33 | } 34 | 35 | public function unmarshalValue(mixed $decodedData): void 36 | { 37 | $this->ACLRoles = []; 38 | foreach ($decodedData as $datum) { 39 | $this->ACLRoles[] = new ACLRole($datum); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/ACL/ACLServiceIdentity.php: -------------------------------------------------------------------------------- 1 | [ 30 | Transcoding::FIELD_TYPE => Transcoding::ARRAY, 31 | Transcoding::FIELD_ARRAY_TYPE => Transcoding::STRING, 32 | Transcoding::FIELD_OMITEMPTY => true, 33 | ], 34 | ]; 35 | 36 | private const FIELD_DATACENTERS = 'Datacenters'; 37 | 38 | public string $ServiceName = ''; 39 | public array $Datacenters = []; 40 | 41 | public function getServiceName(): string 42 | { 43 | return $this->ServiceName; 44 | } 45 | 46 | public function getDatacenters(): array 47 | { 48 | return $this->Datacenters; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/ACL/ACLTokenListEntryQueryResponse.php: -------------------------------------------------------------------------------- 1 | ACLTokenListEntries; 33 | } 34 | 35 | public function unmarshalValue(mixed $decodedData): void 36 | { 37 | $this->ACLTokenListEntries = []; 38 | foreach ($decodedData as $datum) { 39 | $this->ACLTokenListEntries[] = new ACLTokenListEntry($datum); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/ACL/ACLTokenPolicyLink.php: -------------------------------------------------------------------------------- 1 | ACLToken; 33 | } 34 | 35 | public function unmarshalValue(mixed $decodedData): void 36 | { 37 | $this->ACLToken = new ACLToken((array)$decodedData); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/ACL/ACLTokenRoleLink.php: -------------------------------------------------------------------------------- 1 | ACLToken; 33 | } 34 | 35 | public function unmarshalValue(mixed $decodedData): void 36 | { 37 | $this->ACLToken = new ACLToken((array)$decodedData); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/ACL/OIDCAuthMethodConfig.php: -------------------------------------------------------------------------------- 1 | getValue(); 37 | } 38 | if (1 === $offset) { 39 | return $this->QueryMeta; 40 | } 41 | if (2 === $offset) { 42 | return $this->Err; 43 | } 44 | throw $this->_newOutOfRangeException($offset); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/AbstractValuedResponse.php: -------------------------------------------------------------------------------- 1 | getValue(); 36 | } 37 | if (1 === $offset) { 38 | return $this->Err; 39 | } 40 | throw $this->_newOutOfRangeException($offset); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/AbstractValuedWriteResponse.php: -------------------------------------------------------------------------------- 1 | getValue(); 37 | } 38 | if (1 === $offset) { 39 | return $this->WriteMeta; 40 | } 41 | if (2 === $offset) { 42 | return $this->Err; 43 | } 44 | throw $this->_newOutOfRangeException($offset); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/Agent/AgentCheckRegistration.php: -------------------------------------------------------------------------------- 1 | Transcoding::OMITEMPTY_STRING_FIELD, 29 | self::FIELD_SERVICE_ID => Transcoding::OMITEMPTY_STRING_FIELD, 30 | self::FIELD_NAMESPACE => Transcoding::OMITEMPTY_STRING_FIELD, 31 | ]; 32 | 33 | private const FIELD_ID = 'ID'; 34 | private const FIELD_SERVICE_ID = 'ServiceID'; 35 | private const FIELD_NAMESPACE = 'Namespace'; 36 | 37 | public string $ID = ''; 38 | public string $ServiceID = ''; 39 | public string $Namespace = ''; 40 | 41 | public function getID(): string 42 | { 43 | return $this->ID; 44 | } 45 | 46 | public function setID(string $ID): self 47 | { 48 | $this->ID = $ID; 49 | return $this; 50 | } 51 | 52 | public function getServiceID(): string 53 | { 54 | return $this->ServiceID; 55 | } 56 | 57 | public function setServiceID(string $ServiceID): self 58 | { 59 | $this->ServiceID = $ServiceID; 60 | return $this; 61 | } 62 | 63 | public function getNamespace(): string 64 | { 65 | return $this->Namespace; 66 | } 67 | 68 | public function setNamespace(string $Namespace): self 69 | { 70 | $this->Namespace = $Namespace; 71 | return $this; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /src/Agent/AgentCheckUpdate.php: -------------------------------------------------------------------------------- 1 | Status; 33 | } 34 | 35 | public function setStatus(string $status): self 36 | { 37 | $this->Status = $status; 38 | return $this; 39 | } 40 | 41 | public function getOutput(): string 42 | { 43 | return $this->Output; 44 | } 45 | 46 | public function setOutput(string $output): self 47 | { 48 | $this->Output = $output; 49 | return $this; 50 | } 51 | 52 | public function __toString(): string 53 | { 54 | return sprintf('%s: %s', $this->Status, $this->Output); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/Agent/AgentChecksResponse.php: -------------------------------------------------------------------------------- 1 | Checks; 33 | } 34 | 35 | public function unmarshalValue(mixed $decodedData): void 36 | { 37 | $this->Checks = []; 38 | foreach ($decodedData as $k => $v) { 39 | $this->Checks[$k] = new AgentCheck($v); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/Agent/AgentMembersResponse.php: -------------------------------------------------------------------------------- 1 | Members; 33 | } 34 | 35 | public function unmarshalValue(mixed $decodedData): void 36 | { 37 | $this->Members = []; 38 | foreach ($decodedData as $member) { 39 | $this->Members[] = new AgentMember($member); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/Agent/AgentServiceChecks.php: -------------------------------------------------------------------------------- 1 | Transcoding::OMITEMPTY_BOOLEAN_FIELD, 30 | self::FIELD_SIDECAR_SERVICE => [ 31 | Transcoding::FIELD_TYPE => Transcoding::ARRAY, 32 | Transcoding::FIELD_CLASS => AgentServiceRegistration::class, 33 | Transcoding::FIELD_OMITEMPTY => true, 34 | ], 35 | ]; 36 | 37 | private const FIELD_NATIVE = 'Native'; 38 | private const FIELD_SIDECAR_SERVICE = 'SidecarService'; 39 | 40 | public bool $Native = false; 41 | public array $SidecarService = []; 42 | 43 | public function isNative(): bool 44 | { 45 | return $this->Native; 46 | } 47 | 48 | public function setNative(bool $Native): self 49 | { 50 | $this->Native = $Native; 51 | return $this; 52 | } 53 | 54 | public function getSidecarService(): array 55 | { 56 | return $this->SidecarService; 57 | } 58 | 59 | public function setSidecarService(array $SidecarService): self 60 | { 61 | $this->SidecarService = $SidecarService; 62 | return $this; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/Agent/AgentServiceResponse.php: -------------------------------------------------------------------------------- 1 | Service; 33 | } 34 | 35 | public function unmarshalValue(mixed $decodedData): void 36 | { 37 | $this->Service = new AgentService((array)$decodedData); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Agent/AgentServicesResponse.php: -------------------------------------------------------------------------------- 1 | Services; 33 | } 34 | 35 | public function unmarshalValue(mixed $decodedData): void 36 | { 37 | $this->Services = []; 38 | foreach ($decodedData as $k => $service) { 39 | $this->Services[$k] = new AgentService($service); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/Agent/AgentToken.php: -------------------------------------------------------------------------------- 1 | Token; 32 | } 33 | 34 | public function setToken(string $Token): self 35 | { 36 | $this->Token = $Token; 37 | return $this; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Agent/AgentWeights.php: -------------------------------------------------------------------------------- 1 | Passing; 33 | } 34 | 35 | public function getWarning(): int 36 | { 37 | return $this->Warning; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Agent/GaugeValue.php: -------------------------------------------------------------------------------- 1 | Name; 34 | } 35 | 36 | public function setName(string $name): self 37 | { 38 | $this->Name = $name; 39 | return $this; 40 | } 41 | 42 | public function getValue(): float 43 | { 44 | return $this->Value; 45 | } 46 | 47 | public function setValue(float $value): self 48 | { 49 | $this->Value = $value; 50 | return $this; 51 | } 52 | 53 | public function getLabels(): array 54 | { 55 | return $this->Labels; 56 | } 57 | 58 | public function setLabels(array $labels): self 59 | { 60 | $this->Labels = $labels; 61 | return $this; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/Agent/MemberOpts.php: -------------------------------------------------------------------------------- 1 | WAN; 33 | } 34 | 35 | public function setWAN(bool $wan): self 36 | { 37 | $this->WAN = $wan; 38 | return $this; 39 | } 40 | 41 | public function getSegment(): string 42 | { 43 | return $this->Segment; 44 | } 45 | 46 | public function setSegment(string $segment): self 47 | { 48 | $this->Segment = $segment; 49 | return $this; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/Agent/MetricsInfoResponse.php: -------------------------------------------------------------------------------- 1 | MetricsInfo; 33 | } 34 | 35 | public function unmarshalValue(mixed $decodedData): void 36 | { 37 | $this->MetricsInfo = new MetricsInfo((array)$decodedData); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Agent/PointValue.php: -------------------------------------------------------------------------------- 1 | Name; 33 | } 34 | 35 | public function setName(string $name): self 36 | { 37 | $this->Name = $name; 38 | return $this; 39 | } 40 | 41 | public function getPoints(): array 42 | { 43 | return $this->Points; 44 | } 45 | 46 | public function setPoints(array $points): self 47 | { 48 | $this->Points = $points; 49 | return $this; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/Agent/ServiceRegisterOpts.php: -------------------------------------------------------------------------------- 1 | ReplaceExistingChecks; 32 | } 33 | 34 | public function setReplaceExistingChecks(bool $replaceExistingChecks): self 35 | { 36 | $this->ReplaceExistingChecks = $replaceExistingChecks; 37 | return $this; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Agent/TransparentProxyConfig.php: -------------------------------------------------------------------------------- 1 | OutboundListenerPort; 33 | } 34 | 35 | public function setOutboundListenerPort(int $OutboundListenerPort): TransparentProxyConfig 36 | { 37 | $this->OutboundListenerPort = $OutboundListenerPort; 38 | return $this; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/Catalog/CatalogNode.php: -------------------------------------------------------------------------------- 1 | [ 31 | Transcoding::FIELD_TYPE => Transcoding::OBJECT, 32 | Transcoding::FIELD_CLASS => Node::class, 33 | ], 34 | self::FIELD_SERVICES => [ 35 | Transcoding::FIELD_TYPE => Transcoding::ARRAY, 36 | Transcoding::FIELD_CLASS => AgentService::class, 37 | Transcoding::FIELD_ARRAY_TYPE => Transcoding::OBJECT, 38 | ], 39 | ]; 40 | 41 | private const FIELD_NODE = 'Node'; 42 | private const FIELD_SERVICES = 'Services'; 43 | 44 | public ?Node $Node = null; 45 | public array $Services = []; 46 | 47 | public function getNode(): ?Node 48 | { 49 | return $this->Node; 50 | } 51 | 52 | public function setNode(?Node $Node): self 53 | { 54 | $this->Node = $Node; 55 | return $this; 56 | } 57 | 58 | public function getServices(): array 59 | { 60 | return $this->Services; 61 | } 62 | 63 | public function setServices(array $Services): self 64 | { 65 | $this->Services = $Services; 66 | return $this; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/Catalog/CatalogNodeResponse.php: -------------------------------------------------------------------------------- 1 | Node; 33 | } 34 | 35 | public function unmarshalValue(mixed $decodedData): void 36 | { 37 | $this->Node = new CatalogNode((array)$decodedData); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Catalog/CatalogNodeServiceList.php: -------------------------------------------------------------------------------- 1 | [ 31 | Transcoding::FIELD_TYPE => Transcoding::OBJECT, 32 | Transcoding::FIELD_CLASS => Node::class, 33 | ], 34 | self::FIELD_SERVICES => [ 35 | Transcoding::FIELD_TYPE => Transcoding::ARRAY, 36 | Transcoding::FIELD_CLASS => AgentService::class, 37 | Transcoding::FIELD_ARRAY_TYPE => Transcoding::OBJECT, 38 | ], 39 | ]; 40 | 41 | private const FIELD_NODE = 'Node'; 42 | private const FIELD_SERVICES = 'Services'; 43 | 44 | public ?Node $Node = null; 45 | public array $Services = []; 46 | 47 | public function getNode(): ?Node 48 | { 49 | return $this->Node; 50 | } 51 | 52 | public function setNode(?Node $Node): self 53 | { 54 | $this->Node = $Node; 55 | return $this; 56 | } 57 | 58 | public function getServices(): array 59 | { 60 | return $this->Services; 61 | } 62 | 63 | public function setServices(array $Services): self 64 | { 65 | $this->Services = $Services; 66 | return $this; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/Catalog/CatalogNodeServicesListResponse.php: -------------------------------------------------------------------------------- 1 | CatalogNodeServiceList; 33 | } 34 | 35 | public function unmarshalValue(mixed $decodedData): void 36 | { 37 | $this->CatalogNodeServiceList = new CatalogNodeServiceList((array)$decodedData); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Catalog/CatalogServicesResponse.php: -------------------------------------------------------------------------------- 1 | Services; 33 | } 34 | 35 | public function unmarshalValue(mixed $decodedData): void 36 | { 37 | $this->Services = []; 38 | foreach ($decodedData as $node) { 39 | $this->Services[] = new CatalogService($node); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/Catalog/CompoundServiceName.php: -------------------------------------------------------------------------------- 1 | Transcoding::OMITEMPTY_STRING_FIELD, 30 | ]; 31 | 32 | private const FIELD_NAMESPACE = 'Namespace'; 33 | 34 | public string $Name = ''; 35 | public string $Namespace = ''; 36 | 37 | public function getName(): string 38 | { 39 | return $this->Name; 40 | } 41 | 42 | public function setName(string $Name): self 43 | { 44 | $this->Name = $Name; 45 | return $this; 46 | } 47 | 48 | public function getNamespace(): string 49 | { 50 | return $this->Namespace; 51 | } 52 | 53 | public function setNamespace(string $Namespace): self 54 | { 55 | $this->Namespace = $Namespace; 56 | return $this; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/Catalog/GatewayServicesResponse.php: -------------------------------------------------------------------------------- 1 | GatewayServices; 33 | } 34 | 35 | public function unmarshalValue(mixed $decodedData): void 36 | { 37 | $this->GatewayServices = []; 38 | foreach ($decodedData as $service) { 39 | $this->GatewayServices[] = new GatewayService($service); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/Catalog/NodesResponse.php: -------------------------------------------------------------------------------- 1 | Nodes; 33 | } 34 | 35 | public function unmarshalValue(mixed $decodedData): void 36 | { 37 | $this->Nodes = []; 38 | foreach ($decodedData as $node) { 39 | $this->Nodes[] = new Node($node); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/Catalog/ServiceAddress.php: -------------------------------------------------------------------------------- 1 | Address; 33 | } 34 | 35 | public function setAddress(string $address): self 36 | { 37 | $this->Address = $address; 38 | return $this; 39 | } 40 | 41 | public function getPort(): int 42 | { 43 | return $this->Port; 44 | } 45 | 46 | public function setPort(int $port): self 47 | { 48 | $this->Port = $port; 49 | return $this; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/Catalog/Weights.php: -------------------------------------------------------------------------------- 1 | Passing; 33 | } 34 | 35 | public function setPassing(int $Passing): self 36 | { 37 | $this->Passing = $Passing; 38 | return $this; 39 | } 40 | 41 | public function getWarning(): int 42 | { 43 | return $this->Warning; 44 | } 45 | 46 | public function setWarning(int $Warning): self 47 | { 48 | $this->Warning = $Warning; 49 | return $this; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/ConfigEntry/ConfigEntry.php: -------------------------------------------------------------------------------- 1 | Transcoding::OMITEMPTY_STRING_FIELD, 36 | self::FIELD_META => Transcoding::MAP_FIELD, 37 | ]; 38 | 39 | public const FIELD_NAMESPACE = 'Namespace'; 40 | public const FIELD_META = 'Meta'; 41 | 42 | public function GetKind(): string; 43 | 44 | public function GetName(): string; 45 | 46 | public function GetNamespace(): string; 47 | 48 | public function GetMeta(): ?FakeMap; 49 | 50 | public function GetCreateIndex(): int; 51 | 52 | public function GetModifyIndex(): int; 53 | } 54 | -------------------------------------------------------------------------------- /src/ConfigEntry/ExposeConfig.php: -------------------------------------------------------------------------------- 1 | Transcoding::OMITEMPTY_STRING_FIELD, 30 | self::FIELD_PATHS => [ 31 | Transcoding::FIELD_TYPE => Transcoding::ARRAY, 32 | Transcoding::FIELD_CLASS => ExposePath::class, 33 | Transcoding::FIELD_ARRAY_TYPE => Transcoding::OBJECT, 34 | Transcoding::FIELD_OMITEMPTY => true, 35 | ], 36 | ]; 37 | 38 | private const FIELD_CHECKS = 'Checks'; 39 | private const FIELD_PATHS = 'Paths'; 40 | 41 | public bool $Checks = false; 42 | public array $Paths = []; 43 | 44 | public function isChecks(): bool 45 | { 46 | return $this->Checks; 47 | } 48 | 49 | public function setChecks(bool $Checks): self 50 | { 51 | $this->Checks = $Checks; 52 | return $this; 53 | } 54 | 55 | public function getPaths(): array 56 | { 57 | return $this->Paths; 58 | } 59 | 60 | public function setPaths(array $Paths): self 61 | { 62 | $this->Paths = $Paths; 63 | return $this; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/ConfigEntry/MeshConfigEntry.php: -------------------------------------------------------------------------------- 1 | [ 32 | Transcoding::FIELD_TYPE => Transcoding::OBJECT, 33 | Transcoding::FIELD_CLASS => TransparentProxyConfig::class, 34 | Transcoding::FIELD_NULLABLE => false, 35 | Transcoding::FIELD_OMITEMPTY => false, 36 | ], 37 | ]; 38 | 39 | private const FIELD_TRANSPARENT_PROXY = 'TransparentProxy'; 40 | 41 | public TransparentProxyConfig $TransparentProxy; 42 | 43 | public function getTransparentProxy(): TransparentProxyConfig 44 | { 45 | return $this->TransparentProxy; 46 | } 47 | 48 | public function setTransparentProxy(TransparentProxyConfig $TransparentProxy): self 49 | { 50 | $this->TransparentProxy = $TransparentProxy; 51 | return $this; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/ConfigEntry/MeshGatewayConfig.php: -------------------------------------------------------------------------------- 1 | Transcoding::OMITEMPTY_STRING_FIELD, 30 | ]; 31 | 32 | private const FIELD_MODE = 'Mode'; 33 | 34 | public string $Mode = ''; 35 | 36 | public function getMode(): string 37 | { 38 | return $this->Mode; 39 | } 40 | 41 | public function setMode(string $mode): self 42 | { 43 | $this->Mode = $mode; 44 | return $this; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/ConfigEntry/PassiveHealthCheck.php: -------------------------------------------------------------------------------- 1 | [ 31 | Transcoding::FIELD_UNMARSHAL_CALLBACK => Transcoding::UNMARSHAL_DURATION, 32 | Transcoding::FIELD_OMITEMPTY => true, 33 | ], 34 | ]; 35 | 36 | private const FIELD_INTERVAL = 'Interval'; 37 | 38 | public Time\Duration $Interval; 39 | public int $MaxFailures = 0; 40 | 41 | public function __construct(?array $data = []) 42 | { 43 | parent::__construct($data); 44 | if (!isset($this->Interval)) { 45 | $this->Interval = new Time\Duration(); 46 | } 47 | } 48 | 49 | public function getInterval(): Time\Duration 50 | { 51 | return $this->Interval; 52 | } 53 | 54 | public function setInterval(Time\Duration $Interval): self 55 | { 56 | $this->Interval = $Interval; 57 | return $this; 58 | } 59 | 60 | public function getMaxFailures(): int 61 | { 62 | return $this->MaxFailures; 63 | } 64 | 65 | public function setMaxFailures(int $MaxFailures): self 66 | { 67 | $this->MaxFailures = $MaxFailures; 68 | return $this; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /src/ConfigEntry/RingHashConfig.php: -------------------------------------------------------------------------------- 1 | Transcoding::OMITEMPTY_INTEGER_FIELD, 30 | self::FIELD_MAXIMUM_RING_SIZE => Transcoding::OMITEMPTY_INTEGER_FIELD, 31 | ]; 32 | 33 | private const FIELD_MINIMUM_RING_SIZE = 'MinimumRingSize'; 34 | private const FIELD_MAXIMUM_RING_SIZE = 'MaximumRingSize'; 35 | } 36 | -------------------------------------------------------------------------------- /src/ConfigEntry/ServiceResolverConfigEntry.php: -------------------------------------------------------------------------------- 1 | Transcoding::OMITEMPTY_STRING_FIELD, 30 | self::FIELD_ONLY_PASSING => Transcoding::OMITEMPTY_BOOLEAN_FIELD, 31 | ]; 32 | 33 | private const FIELD_FILTER = 'Filter'; 34 | private const FIELD_ONLY_PASSING = 'OnlyPassing'; 35 | 36 | public string $Filter = ''; 37 | public bool $OnlyPassing = false; 38 | 39 | public function getFilter(): string 40 | { 41 | return $this->Filter; 42 | } 43 | 44 | public function setFilter(string $Filter): self 45 | { 46 | $this->Filter = $Filter; 47 | return $this; 48 | } 49 | 50 | public function isOnlyPassing(): bool 51 | { 52 | return $this->OnlyPassing; 53 | } 54 | 55 | public function setOnlyPassing(bool $OnlyPassing): self 56 | { 57 | $this->OnlyPassing = $OnlyPassing; 58 | return $this; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/ConfigEntry/ServiceRoute.php: -------------------------------------------------------------------------------- 1 | [ 30 | Transcoding::FIELD_TYPE => Transcoding::OBJECT, 31 | Transcoding::FIELD_CLASS => ServiceRouteHTTPMatch::class, 32 | Transcoding::FIELD_NULLABLE => true, 33 | Transcoding::FIELD_OMITEMPTY => true, 34 | ], 35 | ]; 36 | 37 | private const FIELD_HTTP = 'HTTP'; 38 | 39 | public ?ServiceRouteHTTPMatch $HTTP = null; 40 | 41 | public function getHTTP(): ?ServiceRouteHTTPMatch 42 | { 43 | return $this->HTTP; 44 | } 45 | 46 | public function setHTTP(?ServiceRouteHTTPMatch $HTTP): self 47 | { 48 | $this->HTTP = $HTTP; 49 | return $this; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/ConfigEntry/ServiceRouterConfigEntry.php: -------------------------------------------------------------------------------- 1 | [ 32 | Transcoding::FIELD_TYPE => Transcoding::ARRAY, 33 | Transcoding::FIELD_ARRAY_TYPE => Transcoding::OBJECT, 34 | Transcoding::FIELD_CLASS => ServiceRoute::class, 35 | Transcoding::FIELD_OMITEMPTY => true, 36 | ], 37 | ]; 38 | 39 | private const FIELD_ROUTES = 'Routes'; 40 | 41 | public array $Routes = []; 42 | 43 | public function getRoutes(): array 44 | { 45 | return $this->Routes; 46 | } 47 | 48 | public function setRoutes(array $Routes): self 49 | { 50 | $this->Routes = $Routes; 51 | return $this; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/ConfigEntry/ServiceSplitterConfigEntry.php: -------------------------------------------------------------------------------- 1 | [ 32 | Transcoding::FIELD_TYPE => Transcoding::ARRAY, 33 | Transcoding::FIELD_ARRAY_TYPE => Transcoding::OBJECT, 34 | Transcoding::FIELD_CLASS => ServiceSplit::class, 35 | Transcoding::FIELD_OMITEMPTY => true, 36 | ], 37 | ]; 38 | 39 | private const FIELD_SPLITS = 'Splits'; 40 | 41 | public array $Splits = []; 42 | 43 | public function getSplits(): array 44 | { 45 | return $this->Splits; 46 | } 47 | 48 | public function setSplits(array $Splits): self 49 | { 50 | $this->Splits = $Splits; 51 | return $this; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/ConfigEntry/TransparentProxyConfig.php: -------------------------------------------------------------------------------- 1 | Transcoding::OMITEMPTY_STRING_FIELD, 30 | self::FIELD_DIALED_DIRECTLY => Transcoding::OMITEMPTY_BOOLEAN_FIELD, 31 | ]; 32 | 33 | private const FIELD_OUTBOUND_LISTENER_PORT = 'OutboundListenerPort'; 34 | private const FIELD_DIALED_DIRECTLY = 'DialedDirectly'; 35 | 36 | public int $OutboundListenerPort = 0; 37 | public bool $DialedDirectly = false; 38 | 39 | public function getOutboundListenerPort(): int 40 | { 41 | return $this->OutboundListenerPort; 42 | } 43 | 44 | public function setOutboundListenerPort(int $OutboundListenerPort): self 45 | { 46 | $this->OutboundListenerPort = $OutboundListenerPort; 47 | return $this; 48 | } 49 | 50 | public function isDialedDirectly(): bool 51 | { 52 | return $this->DialedDirectly; 53 | } 54 | 55 | public function setDialedDirectly(bool $DialedDirectly): self 56 | { 57 | $this->DialedDirectly = $DialedDirectly; 58 | return $this; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/Coordinate/CoordinateClient.php: -------------------------------------------------------------------------------- 1 | _requireOK($this->_doGet('v1/coordinate/datacenters', null)); 34 | $ret = new CoordinateDatacentersResponse(); 35 | $this->_unmarshalResponse($resp, $ret); 36 | return $ret; 37 | } 38 | 39 | public function Nodes(?QueryOptions $opts = null): CoordinateEntriesResponse 40 | { 41 | $resp = $this->_requireOK($this->_doGet('v1/coordinate/nodes', $opts)); 42 | $ret = new CoordinateEntriesResponse(); 43 | $this->_unmarshalResponse($resp, $ret); 44 | return $ret; 45 | } 46 | 47 | public function Update(CoordinateEntry $coordinateEntry, ?WriteOptions $opts = null): WriteResponse 48 | { 49 | return $this->_executePut('v1/coordinate/update', $coordinateEntry, $opts); 50 | } 51 | 52 | public function Node(string $node, ?QueryOptions $opts = null): CoordinateEntriesResponse 53 | { 54 | $resp = $this->_requireOK($this->_doGet(sprintf('v1/coordinate/node/%s', $node), $opts)); 55 | $ret = new CoordinateEntriesResponse(); 56 | $this->_unmarshalResponse($resp, $ret); 57 | return $ret; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/Coordinate/CoordinateDatacenterMap.php: -------------------------------------------------------------------------------- 1 | [ 30 | Transcoding::FIELD_TYPE => Transcoding::ARRAY, 31 | Transcoding::FIELD_CLASS => Coordinate::class, 32 | Transcoding::FIELD_ARRAY_TYPE => Transcoding::OBJECT, 33 | ], 34 | ]; 35 | 36 | private const FIELD_COORDINATES = 'Coordinates'; 37 | 38 | public string $Datacenter = ''; 39 | public string $AreaID = ''; 40 | public array $Coordinates = []; 41 | 42 | public function getDatacenter(): string 43 | { 44 | return $this->Datacenter; 45 | } 46 | 47 | public function getAreaID(): string 48 | { 49 | return $this->AreaID; 50 | } 51 | 52 | public function getCoordinates(): array 53 | { 54 | return $this->Coordinates; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/Coordinate/CoordinateDatacentersResponse.php: -------------------------------------------------------------------------------- 1 | DatacenterMap; 33 | } 34 | 35 | public function unmarshalValue(mixed $decodedData): void 36 | { 37 | $this->DatacenterMap = []; 38 | foreach ($decodedData as $item) { 39 | $this->DatacenterMap[] = new CoordinateDatacenterMap($item); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/Coordinate/CoordinateEntriesResponse.php: -------------------------------------------------------------------------------- 1 | Nodes; 33 | } 34 | 35 | public function unmarshalValue(mixed $decodedData): void 36 | { 37 | $this->Nodes = []; 38 | foreach ($decodedData as $node) { 39 | $this->Nodes[] = new CoordinateEntry($node); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/Coordinate/CoordinateEntry.php: -------------------------------------------------------------------------------- 1 | [ 30 | Transcoding::FIELD_TYPE => Transcoding::OBJECT, 31 | Transcoding::FIELD_CLASS => Coordinate::class, 32 | Transcoding::FIELD_NULLABLE => true, 33 | ], 34 | ]; 35 | 36 | private const FIELD_COORDINATE = 'Coord'; 37 | 38 | public string $Node = ''; 39 | public string $Segment = ''; 40 | public ?Coordinate $Coord = null; 41 | 42 | public function getNode(): string 43 | { 44 | return $this->Node; 45 | } 46 | 47 | public function setNode(string $Node): self 48 | { 49 | $this->Node = $Node; 50 | return $this; 51 | } 52 | 53 | public function getSegment(): string 54 | { 55 | return $this->Segment; 56 | } 57 | 58 | public function setSegment(string $Segment): self 59 | { 60 | $this->Segment = $Segment; 61 | return $this; 62 | } 63 | 64 | public function getCoord(): ?Coordinate 65 | { 66 | return $this->Coord; 67 | } 68 | 69 | public function setCoord(?Coordinate $Coord): self 70 | { 71 | $this->Coord = $Coord; 72 | return $this; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /src/Coordinate/DimensionalityConflictException.php: -------------------------------------------------------------------------------- 1 | Decoded = $decoded; 32 | $this->Err = $err; 33 | } 34 | 35 | public function getDecoded(): mixed 36 | { 37 | return $this->Decoded; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Error.php: -------------------------------------------------------------------------------- 1 | time = Time::Now(); 42 | $this->message = $message; 43 | } 44 | 45 | public static function unexpectedResponseCodeError(RequestResponse $resp): self 46 | { 47 | return new static( 48 | sprintf( 49 | 'unexpected response code: %d (%s)', 50 | $resp->Response->getStatusCode(), 51 | $resp->Response->getBody()->getContents(), 52 | ) 53 | 54 | ); 55 | } 56 | 57 | public function getTime(): Time\Time 58 | { 59 | return $this->time; 60 | } 61 | 62 | public function getMessage(): string 63 | { 64 | return $this->message; 65 | } 66 | 67 | public function jsonSerialize(): array 68 | { 69 | return [ 70 | self::FIELD_MESSAGE => $this->message, 71 | self::FIELD_TIMESTAMP => $this->time, 72 | ]; 73 | } 74 | 75 | public function __toString(): string 76 | { 77 | return $this->message; 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /src/ErrorContainer.php: -------------------------------------------------------------------------------- 1 | Err; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Event/UserEventResponse.php: -------------------------------------------------------------------------------- 1 | UserEvent; 33 | } 34 | 35 | public function unmarshalValue(mixed $decodedData): void 36 | { 37 | $this->UserEvent = new UserEvent((array)$decodedData); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Event/UserEventsResponse.php: -------------------------------------------------------------------------------- 1 | UserEvents; 33 | } 34 | 35 | public function unmarshalValue(mixed $decodedData): void 36 | { 37 | $this->UserEvents = []; 38 | foreach ($decodedData as $datum) { 39 | $this->UserEvents[] = new UserEvent($datum); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/HasSettableStringTags.php: -------------------------------------------------------------------------------- 1 | Tags = $tags; 28 | return $this; 29 | } 30 | 31 | public function addTag(string $tag): static 32 | { 33 | $this->Tags[] = $tag; 34 | return $this; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/HasStringTags.php: -------------------------------------------------------------------------------- 1 | Tags; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Health/HealthChecksResponse.php: -------------------------------------------------------------------------------- 1 | HealthChecks; 33 | } 34 | 35 | public function unmarshalValue(mixed $decodedData): void 36 | { 37 | $this->HealthChecks = new HealthChecks((array)$decodedData); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Health/ServiceEntriesResponse.php: -------------------------------------------------------------------------------- 1 | ServiceEntries; 33 | } 34 | 35 | public function unmarshalValue(mixed $decodedData): void 36 | { 37 | $this->ServiceEntries = []; 38 | foreach ($decodedData as $entry) { 39 | $this->ServiceEntries[] = new ServiceEntry($entry); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/HttpAuth.php: -------------------------------------------------------------------------------- 1 | username = $username; 34 | $this->password = $password; 35 | } 36 | 37 | public function getUsername(): string 38 | { 39 | return $this->username; 40 | } 41 | 42 | public function getPassword(): string 43 | { 44 | return $this->password; 45 | } 46 | 47 | public function compileAuthString(): string 48 | { 49 | return (string)$this; 50 | } 51 | 52 | public function jsonSerialize(): array 53 | { 54 | return [self::FIELD_USERNAME => $this->username, self::FIELD_PASSWORD => $this->password]; 55 | } 56 | 57 | public function __debugInfo(): array 58 | { 59 | return [self::FIELD_USERNAME => $this->username]; 60 | } 61 | 62 | public function __toString(): string 63 | { 64 | return trim(sprintf('%s:%s', $this->username, $this->password), ':'); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/KV/CheckTxnOp.php: -------------------------------------------------------------------------------- 1 | [ 31 | Transcoding::FIELD_TYPE => Transcoding::OBJECT, 32 | Transcoding::FIELD_CLASS => HealthCheck::class, 33 | ], 34 | ]; 35 | 36 | private const FIELD_CHECK = 'Check'; 37 | 38 | public string $Verb = ''; 39 | public HealthCheck $Check; 40 | 41 | public function __construct(?array $data = []) 42 | { 43 | parent::__construct($data); 44 | if (!isset($this->Check)) { 45 | $this->Check = new HealthCheck(null); 46 | } 47 | } 48 | 49 | public function getVerb(): string 50 | { 51 | return $this->Verb; 52 | } 53 | 54 | public function setVerb(string $Verb): self 55 | { 56 | $this->Verb = $Verb; 57 | return $this; 58 | } 59 | 60 | public function getCheck(): HealthCheck 61 | { 62 | return $this->Check; 63 | } 64 | 65 | public function setCheck(HealthCheck $Check): self 66 | { 67 | $this->Check = $Check; 68 | return $this; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /src/KV/KVPairResponse.php: -------------------------------------------------------------------------------- 1 | KVPair; 33 | } 34 | 35 | public function unmarshalValue(mixed $decodedData): void 36 | { 37 | $this->KVPair = new KVPair((array)$decodedData, true); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/KV/KVPairs.php: -------------------------------------------------------------------------------- 1 | KVPairs; 33 | } 34 | 35 | public function unmarshalValue(mixed $decodedData): void 36 | { 37 | $this->KVPairs = new KVPairs((array)$decodedData); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/KV/KVTxnAPIResponse.php: -------------------------------------------------------------------------------- 1 | OK; 37 | } 38 | 39 | public function getKVTxnResponse(): ?KVTxnResponse 40 | { 41 | return $this->KVTxnResponse; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/KV/KVTxnOp.php: -------------------------------------------------------------------------------- 1 | Value, true); 44 | if (false === $dec) { 45 | throw new \InvalidArgumentException(sprintf('Could not base64 decode value "%s"', $this->Value)); 46 | } 47 | $this->Value = $dec; 48 | } 49 | } 50 | 51 | public function getVerb(): string 52 | { 53 | return $this->Verb; 54 | } 55 | 56 | public function getKey(): string 57 | { 58 | return $this->Key; 59 | } 60 | 61 | public function getValue(): string 62 | { 63 | return $this->Value; 64 | } 65 | 66 | public function getFlags(): int 67 | { 68 | return $this->Flags; 69 | } 70 | 71 | public function getIndex(): int 72 | { 73 | return $this->Index; 74 | } 75 | 76 | public function getSession(): string 77 | { 78 | return $this->Session; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /src/KV/KVTxnOps.php: -------------------------------------------------------------------------------- 1 | [ 30 | Transcoding::FIELD_TYPE => Transcoding::ARRAY, 31 | Transcoding::FIELD_CLASS => KVPair::class, 32 | Transcoding::FIELD_ARRAY_TYPE => Transcoding::OBJECT, 33 | ], 34 | self::FIELD_ERRORS => [ 35 | Transcoding::FIELD_TYPE => Transcoding::OBJECT, 36 | Transcoding::FIELD_CLASS => TxnErrors::class, 37 | ], 38 | ]; 39 | 40 | private const FIELD_RESULTS = 'Results'; 41 | private const FIELD_ERRORS = 'Errors'; 42 | 43 | public array $Results = []; 44 | public ?TxnErrors $Errors = null; 45 | 46 | public function getResults(): array 47 | { 48 | return $this->Results; 49 | } 50 | 51 | public function getErrors(): ?TxnErrors 52 | { 53 | return $this->Errors; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/KV/NodeTxnOp.php: -------------------------------------------------------------------------------- 1 | [ 31 | Transcoding::FIELD_TYPE => Transcoding::OBJECT, 32 | Transcoding::FIELD_CLASS => Node::class, 33 | ], 34 | ]; 35 | 36 | private const FIELD_NODE = 'Node'; 37 | 38 | public string $Verb = ''; 39 | public Node $Node; 40 | 41 | public function __construct(?array $data = []) 42 | { 43 | parent::__construct($data); 44 | if (!isset($this->Node)) { 45 | $this->Node = new Node(null); 46 | } 47 | } 48 | 49 | public function getVerb(): string 50 | { 51 | return $this->Verb; 52 | } 53 | 54 | public function setVerb(string $Verb): self 55 | { 56 | $this->Verb = $Verb; 57 | return $this; 58 | } 59 | 60 | public function getNode(): Node 61 | { 62 | return $this->Node; 63 | } 64 | 65 | public function setNode(Node $Node): self 66 | { 67 | $this->Node = $Node; 68 | return $this; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /src/KV/TxnError.php: -------------------------------------------------------------------------------- 1 | OpIndex; 33 | } 34 | 35 | public function setOpIndex(int $OpIndex): self 36 | { 37 | $this->OpIndex = $OpIndex; 38 | return $this; 39 | } 40 | 41 | public function getWhat(): string 42 | { 43 | return $this->What; 44 | } 45 | 46 | public function setWhat(string $What): self 47 | { 48 | $this->What = $What; 49 | return $this; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/KV/TxnErrors.php: -------------------------------------------------------------------------------- 1 | Map; 30 | } 31 | 32 | public function unmarshalValue(mixed $decodedData): void 33 | { 34 | $this->Map = $decodedData; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Operator/Area.php: -------------------------------------------------------------------------------- 1 | ID; 35 | } 36 | 37 | public function setID(string $id): self 38 | { 39 | $this->ID = $id; 40 | return $this; 41 | } 42 | 43 | public function getPeerDatacenter(): string 44 | { 45 | return $this->PeerDatacenter; 46 | } 47 | 48 | public function setPeerDatacenter(string $peerDatacenter): self 49 | { 50 | $this->PeerDatacenter = $peerDatacenter; 51 | return $this; 52 | } 53 | 54 | public function getRetryJoin(): array 55 | { 56 | return $this->RetryJoin; 57 | } 58 | 59 | public function setRetryJoin(array $retryJoin): self 60 | { 61 | $this->RetryJoin = $retryJoin; 62 | return $this; 63 | } 64 | 65 | public function isUseTLS(): bool 66 | { 67 | return $this->UseTLS; 68 | } 69 | 70 | public function setUseTLS(bool $useTLS): self 71 | { 72 | $this->UseTLS = $useTLS; 73 | return $this; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /src/Operator/AreaJoinResponse.php: -------------------------------------------------------------------------------- 1 | Address; 34 | } 35 | 36 | public function isJoined(): bool 37 | { 38 | return $this->Joined; 39 | } 40 | 41 | public function getError(): string 42 | { 43 | return $this->Error; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/Operator/AutopilotStateResponse.php: -------------------------------------------------------------------------------- 1 | AutopilotState; 33 | } 34 | 35 | public function unmarshalValue(mixed $decodedData): void 36 | { 37 | $this->AutopilotState = new AutopilotState($decodedData); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Operator/AutopilotZone.php: -------------------------------------------------------------------------------- 1 | Servers; 34 | } 35 | 36 | public function setServers(array $Servers): self 37 | { 38 | $this->Servers = $Servers; 39 | return $this; 40 | } 41 | 42 | public function getVoters(): array 43 | { 44 | return $this->Voters; 45 | } 46 | 47 | public function setVoters(array $Voters): self 48 | { 49 | $this->Voters = $Voters; 50 | return $this; 51 | } 52 | 53 | public function getFailureTolerance(): int 54 | { 55 | return $this->FailureTolerance; 56 | } 57 | 58 | public function setFailureTolerance(int $FailureTolerance): self 59 | { 60 | $this->FailureTolerance = $FailureTolerance; 61 | return $this; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/Operator/OperatorAreaJoinResponse.php: -------------------------------------------------------------------------------- 1 | AreaJoinResponses; 33 | } 34 | 35 | public function unmarshalValue(mixed $decodedData): void 36 | { 37 | $this->AreaJoinResponses = []; 38 | foreach ($decodedData as $area) { 39 | $this->AreaJoinResponses[] = new AreaJoinResponse($area); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/Operator/OperatorAreasResponse.php: -------------------------------------------------------------------------------- 1 | Areas; 33 | } 34 | 35 | public function unmarshalValue(mixed $decodedData): void 36 | { 37 | $this->Areas = []; 38 | foreach ($decodedData as $area) { 39 | $this->Areas[] = new Area($area); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/Operator/OperatorAutopilotConfigurationResponse.php: -------------------------------------------------------------------------------- 1 | AutopilotConfiguration; 33 | } 34 | 35 | public function unmarshalValue(mixed $decodedData): void 36 | { 37 | $this->AutopilotConfiguration = new AutopilotConfiguration((array)$decodedData); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Operator/OperatorHealthReply.php: -------------------------------------------------------------------------------- 1 | [ 30 | Transcoding::FIELD_TYPE => Transcoding::ARRAY, 31 | Transcoding::FIELD_CLASS => ServerHealth::class, 32 | Transcoding::FIELD_ARRAY_TYPE => Transcoding::OBJECT, 33 | ], 34 | ]; 35 | 36 | private const FIELD_SERVERS = 'Servers'; 37 | 38 | public bool $Healthy = false; 39 | public int $FailureTolerance = 0; 40 | public array $Servers = []; 41 | 42 | public function isHealthy(): bool 43 | { 44 | return $this->Healthy; 45 | } 46 | 47 | public function setHealthy(bool $Healthy): self 48 | { 49 | $this->Healthy = $Healthy; 50 | return $this; 51 | } 52 | 53 | public function getFailureTolerance(): int 54 | { 55 | return $this->FailureTolerance; 56 | } 57 | 58 | public function setFailureTolerance(int $FailureTolerance): self 59 | { 60 | $this->FailureTolerance = $FailureTolerance; 61 | return $this; 62 | } 63 | 64 | public function getServers(): array 65 | { 66 | return $this->Servers; 67 | } 68 | 69 | public function setServers(array $Servers): self 70 | { 71 | $this->Servers = $Servers; 72 | return $this; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /src/Operator/OperatorHealthReplyResponse.php: -------------------------------------------------------------------------------- 1 | OperatorHealthReply; 33 | } 34 | 35 | public function unmarshalValue(mixed $decodedData): void 36 | { 37 | $this->OperatorHealthReply = new OperatorHealthReply((array)$decodedData); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Operator/OperatorRaftConfigurationResponse.php: -------------------------------------------------------------------------------- 1 | RaftConfiguration; 33 | } 34 | 35 | public function unmarshalValue(mixed $decodedData): void 36 | { 37 | $this->RaftConfiguration = new RaftConfiguration($decodedData); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Operator/OperatorSerfMembersResponse.php: -------------------------------------------------------------------------------- 1 | SerfMembers; 33 | } 34 | 35 | public function unmarshalValue(mixed $decodedData): void 36 | { 37 | $this->SerfMembers = []; 38 | foreach ($decodedData as $datum) { 39 | $this->SerfMembers[] = new SerfMember($datum); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/Operator/OperatorServerHealthsResponse.php: -------------------------------------------------------------------------------- 1 | ServerHealths; 33 | } 34 | 35 | public function unmarshalValue(mixed $decodedData): void 36 | { 37 | $this->ServerHealths = []; 38 | foreach ($decodedData as $datum) { 39 | $this->ServerHealths[] = new ServerHealth($datum); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/Operator/RaftConfiguration.php: -------------------------------------------------------------------------------- 1 | [ 30 | Transcoding::FIELD_TYPE => Transcoding::ARRAY, 31 | Transcoding::FIELD_CLASS => RaftServer::class, 32 | Transcoding::FIELD_ARRAY_TYPE => Transcoding::OBJECT, 33 | ], 34 | ]; 35 | 36 | private const FIELD_SERVERS = 'Servers'; 37 | 38 | public array $Servers = []; 39 | public int $Index = 0; 40 | 41 | public function getServers(): array 42 | { 43 | return $this->Servers; 44 | } 45 | 46 | public function setServers(array $Servers): self 47 | { 48 | $this->Servers = $Servers; 49 | return $this; 50 | } 51 | 52 | public function getIndex(): int 53 | { 54 | return $this->Index; 55 | } 56 | 57 | public function setIndex(int $Index): self 58 | { 59 | $this->Index = $Index; 60 | return $this; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/Operator/ReadableDuration.php: -------------------------------------------------------------------------------- 1 | {$field} = new self(\intval($value, 10)); 31 | } 32 | 33 | public static function fromDuration(string $s): self 34 | { 35 | return new self(Time::ParseDuration($s)->Nanoseconds()); 36 | } 37 | 38 | public function jsonSerialize(): string 39 | { 40 | return (string)$this; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/Params.php: -------------------------------------------------------------------------------- 1 | PreparedQueryDefinitions; 33 | } 34 | 35 | public function unmarshalValue(mixed $decodedData): void 36 | { 37 | $this->PreparedQueryDefinitions = []; 38 | foreach ($decodedData as $datum) { 39 | $this->PreparedQueryDefinitions[] = new PreparedQueryDefinition($datum); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/PreparedQuery/PreparedQueryExecuteResponseResponse.php: -------------------------------------------------------------------------------- 1 | PreparedQueryExecuteResponse; 33 | } 34 | 35 | public function unmarshalValue(mixed $decodedData): void 36 | { 37 | $this->PreparedQueryExecuteResponse = new PreparedQueryExecuteResponse((array)$decodedData); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/PreparedQuery/QueryDNSOptions.php: -------------------------------------------------------------------------------- 1 | TTL; 32 | } 33 | 34 | public function setTTL(string $ttl): self 35 | { 36 | $this->TTL = $ttl; 37 | return $this; 38 | } 39 | 40 | public function __toString(): string 41 | { 42 | return $this->TTL; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/PreparedQuery/QueryDatacenterOptions.php: -------------------------------------------------------------------------------- 1 | NearestN; 33 | } 34 | 35 | public function setNearestN(int $nearestN): self 36 | { 37 | $this->NearestN = $nearestN; 38 | return $this; 39 | } 40 | 41 | public function getDatacenters(): array 42 | { 43 | return $this->Datacenters; 44 | } 45 | 46 | public function setDatacenters(array $datacenters): self 47 | { 48 | $this->Datacenters = $datacenters; 49 | return $this; 50 | } 51 | 52 | public function addDatacenter(string $datacenter): self 53 | { 54 | $this->Datacenters[] = $datacenter; 55 | return $this; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/PreparedQuery/QueryTemplate.php: -------------------------------------------------------------------------------- 1 | Type; 33 | } 34 | 35 | public function setType(string $Type): self 36 | { 37 | $this->Type = $Type; 38 | return $this; 39 | } 40 | 41 | public function getRegexp(): string 42 | { 43 | return $this->Regexp; 44 | } 45 | 46 | public function setRegexp(string $Regexp): self 47 | { 48 | $this->Regexp = $Regexp; 49 | return $this; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/QueryMeta.php: -------------------------------------------------------------------------------- 1 | RequestUrl; 40 | } 41 | 42 | public function getLastIndex(): int 43 | { 44 | return $this->LastIndex; 45 | } 46 | 47 | public function getLastContentHash(): string 48 | { 49 | return $this->LastContentHash; 50 | } 51 | 52 | public function getLastContact(): int 53 | { 54 | return $this->LastContact; 55 | } 56 | 57 | public function isKnownLeader(): bool 58 | { 59 | return $this->KnownLeader; 60 | } 61 | 62 | public function getRequestTime(): ?Time\Duration 63 | { 64 | return $this->RequestTime; 65 | } 66 | 67 | public function isAddressTranslationEnabled(): bool 68 | { 69 | return $this->AddressTranslationEnabled; 70 | } 71 | 72 | public function isCacheHit(): bool 73 | { 74 | return $this->CacheHit; 75 | } 76 | 77 | public function getCacheAge(): ?Time\Duration 78 | { 79 | return $this->CacheAge; 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /src/QueryMetaContainer.php: -------------------------------------------------------------------------------- 1 | QueryMeta; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/RequestMeta.php: -------------------------------------------------------------------------------- 1 | method = $method; 33 | $this->uri = $uri; 34 | } 35 | 36 | public function getMethod(): string 37 | { 38 | return $this->method; 39 | } 40 | 41 | public function getUri(): UriInterface 42 | { 43 | return $this->uri; 44 | } 45 | 46 | public function __toString(): string 47 | { 48 | return sprintf('%s %s', $this->method, $this->uri); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/RequestOptions.php: -------------------------------------------------------------------------------- 1 | Value; 30 | } 31 | 32 | public function unmarshalValue(mixed $decodedData): void 33 | { 34 | if (\is_bool($decodedData)) { 35 | $this->Value = $decodedData; 36 | return; 37 | } 38 | if (\is_string($decodedData)) { 39 | $this->Value = Transcoding::TRUE === strtolower(trim($decodedData)); 40 | return; 41 | } 42 | $this->Value = (bool)$decodedData; 43 | } 44 | 45 | public function __toString(): string 46 | { 47 | return $this->Value ? Transcoding::TRUE : Transcoding::FALSE; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/ResponseValueStringTrait.php: -------------------------------------------------------------------------------- 1 | Value; 30 | } 31 | 32 | public function unmarshalValue(mixed $decodedData): void 33 | { 34 | $this->Value = (string)$decodedData; 35 | } 36 | 37 | public function __toString(): string 38 | { 39 | return $this->Value; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/ResponseValueStringsTrait.php: -------------------------------------------------------------------------------- 1 | Value; 30 | } 31 | 32 | public function unmarshalValue(mixed $decodedData): void 33 | { 34 | $this->Value = (array)$decodedData; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/ScalarType.php: -------------------------------------------------------------------------------- 1 | ID; 33 | } 34 | 35 | public function setID(string $id): self 36 | { 37 | $this->ID = $id; 38 | return $this; 39 | } 40 | 41 | public function getNamespace(): string 42 | { 43 | return $this->Namespace; 44 | } 45 | 46 | public function setNamespace(string $namespace): self 47 | { 48 | $this->Namespace = $namespace; 49 | return $this; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/Session/SessionEntriesQueryResponse.php: -------------------------------------------------------------------------------- 1 | SessionEntries; 33 | } 34 | 35 | public function unmarshalValue(mixed $decodedData): void 36 | { 37 | $this->SessionEntries = []; 38 | foreach ($decodedData as $datum) { 39 | $this->SessionEntries[] = new SessionEntry($datum); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/Session/SessionEntriesWriteResponse.php: -------------------------------------------------------------------------------- 1 | SessionEntries; 33 | } 34 | 35 | public function unmarshalValue(mixed $decodedData): void 36 | { 37 | $this->SessionEntries = []; 38 | foreach ($decodedData as $datum) { 39 | $this->SessionEntries[] = new SessionEntry($datum); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/Status/StatusClient.php: -------------------------------------------------------------------------------- 1 | _requireOK($this->_doGet('v1/status/leader', $opts)); 33 | $ret = new ValuedStringResponse(); 34 | $this->_unmarshalResponse($resp, $ret); 35 | return $ret; 36 | } 37 | 38 | public function Leader(): ValuedStringResponse 39 | { 40 | return $this->LeaderWithQueryOptions(null); 41 | } 42 | 43 | public function PeersWithQueryOptions(?QueryOptions $opts): ValuedStringsResponse 44 | { 45 | $resp = $this->_requireOK($this->_doGet('v1/status/peers', $opts)); 46 | $ret = new ValuedStringsResponse(); 47 | $this->_unmarshalResponse($resp, $ret); 48 | return $ret; 49 | } 50 | 51 | public function Peers(): ValuedStringsResponse 52 | { 53 | return $this->PeersWithQueryOptions(null); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/UnmarshalledResponseInterface.php: -------------------------------------------------------------------------------- 1 | RequestTime; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/WriteMetaContainer.php: -------------------------------------------------------------------------------- 1 | WriteMeta; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/WriteResponse.php: -------------------------------------------------------------------------------- 1 | WriteMeta; 37 | } 38 | if (1 === $offset) { 39 | return $this->Err; 40 | } 41 | throw $this->_newOutOfRangeException($offset); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/funcs.php: -------------------------------------------------------------------------------- 1 | Nanoseconds(); 28 | $ms = $dur->Milliseconds(); 29 | 30 | if (0 < $ns && 0 === (int)$ms) { 31 | $ms = 1; 32 | } 33 | 34 | return sprintf('%dms', $ms); 35 | } 36 | -------------------------------------------------------------------------------- /tmp/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore --------------------------------------------------------------------------------