Skip to content

Commit 8b6b6db

Browse files
committed
couple bugfixes in agent client
1 parent c8f20ee commit 8b6b6db

File tree

4 files changed

+22
-5
lines changed

4 files changed

+22
-5
lines changed

src/Agent/AgentClient.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ class AgentClient extends AbstractClient
3636
/**
3737
* @param bool $refresh
3838
* @throws \GuzzleHttp\Exception\GuzzleException
39+
* @throws \Exception
3940
* @return \DCarbone\PHPConsulAPI\Agent\AgentSelfResponse
4041
*/
4142
public function Self(bool $refresh = false): AgentSelfResponse
@@ -54,6 +55,7 @@ public function Self(bool $refresh = false): AgentSelfResponse
5455

5556
/**
5657
* @throws \GuzzleHttp\Exception\GuzzleException
58+
* @throws \Exception
5759
* @return \DCarbone\PHPConsulAPI\Agent\MetricsInfoResponse
5860
*/
5961
public function Metrics(): MetricsInfoResponse
@@ -95,6 +97,7 @@ public function NodeName(bool $refresh = false): ValuedStringResponse
9597
/**
9698
* @param string $filter
9799
* @throws \GuzzleHttp\Exception\GuzzleException
100+
* @throws \Exception
98101
* @return \DCarbone\PHPConsulAPI\Agent\AgentChecksResponse
99102
*/
100103
public function ChecksWithFilter(string $filter): AgentChecksResponse
@@ -119,6 +122,7 @@ public function Checks(): AgentChecksResponse
119122
/**
120123
* @param string $filter
121124
* @throws \GuzzleHttp\Exception\GuzzleException
125+
* @throws \Exception
122126
* @return \DCarbone\PHPConsulAPI\Agent\AgentServicesResponse
123127
*/
124128
public function ServicesWithFilter(string $filter): AgentServicesResponse
@@ -162,6 +166,7 @@ public function AgentHealthServiceByID(string $id): AgentHealthServiceResponse
162166

163167
/**
164168
* @throws \GuzzleHttp\Exception\GuzzleException
169+
* @throws \Exception
165170
* @return \DCarbone\PHPConsulAPI\Agent\AgentMembersResponse
166171
*/
167172
public function Members(): AgentMembersResponse
@@ -175,6 +180,7 @@ public function Members(): AgentMembersResponse
175180
/**
176181
* @param \DCarbone\PHPConsulAPI\Agent\MemberOpts $memberOpts
177182
* @throws \GuzzleHttp\Exception\GuzzleException
183+
* @throws \Exception
178184
* @return \DCarbone\PHPConsulAPI\Agent\AgentMembersResponse
179185
*/
180186
public function MemberOpts(MemberOpts $memberOpts): AgentMembersResponse
@@ -194,6 +200,7 @@ public function MemberOpts(MemberOpts $memberOpts): AgentMembersResponse
194200
* @param \DCarbone\PHPConsulAPI\Agent\AgentServiceRegistration $service
195201
* @param \DCarbone\PHPConsulAPI\Agent\ServiceRegisterOpts $registerOpts
196202
* @throws \GuzzleHttp\Exception\GuzzleException
203+
* @throws \Exception
197204
* @return \DCarbone\PHPConsulAPI\Error|null
198205
*/
199206
public function ServiceRegisterOpts(AgentServiceRegistration $service, ServiceRegisterOpts $registerOpts): ?Error
@@ -222,6 +229,7 @@ public function ServiceRegister(AgentServiceRegistration $service): ?Error
222229
*
223230
* @param string $serviceID
224231
* @throws \GuzzleHttp\Exception\GuzzleException
232+
* @throws \Exception
225233
* @return \DCarbone\PHPConsulAPI\Error|null
226234
*/
227235
public function ServiceDeregister(string $serviceID): ?Error
@@ -277,6 +285,7 @@ public function FailTTL(string $checkID, string $note): ?Error
277285
* @param string $output
278286
* @param string $status
279287
* @throws \GuzzleHttp\Exception\GuzzleException
288+
* @throws \Exception
280289
* @return \DCarbone\PHPConsulAPI\Error|null
281290
*/
282291
public function UpdateTTL(string $checkID, string $output, string $status): ?Error
@@ -333,6 +342,7 @@ public function CheckDeregister(string $checkID): ?Error
333342
* @param string $addr
334343
* @param bool $wan
335344
* @throws \GuzzleHttp\Exception\GuzzleException
345+
* @throws \Exception
336346
* @return \DCarbone\PHPConsulAPI\Error|null
337347
*/
338348
public function Join(string $addr, bool $wan = false): ?Error
@@ -366,6 +376,7 @@ public function ForceLeave(string $node): ?Error
366376
/**
367377
* @param string $node
368378
* @throws \GuzzleHttp\Exception\GuzzleException
379+
* @throws \Exception
369380
* @return \DCarbone\PHPConsulAPI\Error|null
370381
*/
371382
public function ForceLeavePrune(string $node): ?Error
@@ -379,6 +390,7 @@ public function ForceLeavePrune(string $node): ?Error
379390
* @param string $serviceID
380391
* @param string $reason
381392
* @throws \GuzzleHttp\Exception\GuzzleException
393+
* @throws \Exception
382394
* @return \DCarbone\PHPConsulAPI\Error|null
383395
*/
384396
public function EnableServiceMaintenance(string $serviceID, string $reason = ''): ?Error
@@ -392,6 +404,7 @@ public function EnableServiceMaintenance(string $serviceID, string $reason = '')
392404
/**
393405
* @param string $serviceID
394406
* @throws \GuzzleHttp\Exception\GuzzleException
407+
* @throws \Exception
395408
* @return \DCarbone\PHPConsulAPI\Error|null
396409
*/
397410
public function DisableServiceMaintenance(string $serviceID): ?Error
@@ -404,6 +417,7 @@ public function DisableServiceMaintenance(string $serviceID): ?Error
404417
/**
405418
* @param string $reason
406419
* @throws \GuzzleHttp\Exception\GuzzleException
420+
* @throws \Exception
407421
* @return \DCarbone\PHPConsulAPI\Error|null
408422
*/
409423
public function EnableNodeMaintenance(string $reason = ''): ?Error
@@ -416,6 +430,7 @@ public function EnableNodeMaintenance(string $reason = ''): ?Error
416430

417431
/**
418432
* @throws \GuzzleHttp\Exception\GuzzleException
433+
* @throws \Exception
419434
* @return \DCarbone\PHPConsulAPI\Error|null
420435
*/
421436
public function DisableNodeMaintenance(): ?Error
@@ -428,6 +443,7 @@ public function DisableNodeMaintenance(): ?Error
428443
/**
429444
* @param string $path
430445
* @throws \GuzzleHttp\Exception\GuzzleException
446+
* @throws \Exception
431447
* @return \DCarbone\PHPConsulAPI\Agent\AgentHealthServiceResponse
432448
*/
433449
protected function _agentHealthService(string $path): AgentHealthServiceResponse

src/Agent/AgentSelfResponse.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@
1818
limitations under the License.
1919
*/
2020

21-
use DCarbone\PHPConsulAPI\AbstractValuedQueryResponse;
21+
use DCarbone\PHPConsulAPI\AbstractValuedResponse;
2222
use DCarbone\PHPConsulAPI\HydratedResponseInterface;
2323

2424
/**
2525
* Class AgentSelfResponse
2626
*/
27-
class AgentSelfResponse extends AbstractValuedQueryResponse implements HydratedResponseInterface
27+
class AgentSelfResponse extends AbstractValuedResponse implements HydratedResponseInterface
2828
{
2929
/** @var array|null */
3030
public ?array $AgentConfig = null;

src/Agent/AgentServicesResponse.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@
1818
limitations under the License.
1919
*/
2020

21-
use DCarbone\PHPConsulAPI\AbstractValuedQueryResponse;
21+
use DCarbone\PHPConsulAPI\AbstractValuedResponse;
2222
use DCarbone\PHPConsulAPI\HydratedResponseInterface;
2323

2424
/**
2525
* Class AgentServicesResponse
2626
*/
27-
class AgentServicesResponse extends AbstractValuedQueryResponse implements HydratedResponseInterface
27+
class AgentServicesResponse extends AbstractValuedResponse implements HydratedResponseInterface
2828
{
2929
/** @var \DCarbone\PHPConsulAPI\Agent\AgentService[]|null */
3030
public ?array $Services = null;

tests/Usage/Agent/AgentClientTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ public function testCanGetSelf(): void
5050
{
5151
$client = new AgentClient(new Config());
5252

53-
$self = $client->Self();
53+
[$self, $err] = $client->Self();
54+
static::assertNull($err);
5455
static::assertIsArray(
5556
$self,
5657
\sprintf(

0 commit comments

Comments
 (0)