Skip to content

Commit b3247ba

Browse files
committed
Adding basic Coordinate and Health documentation
- No longer using getters for client clients. Just use properties.
1 parent 3681526 commit b3247ba

File tree

10 files changed

+175
-113
lines changed

10 files changed

+175
-113
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ var_dump($kv_list);
4646
- [Catalog](./docs/CATALOG.md)
4747
- [Status](./docs/STATUS.md)
4848
- [Event](./docs/EVENT.md)
49+
- [Coordinate](./docs/COORDINATE.md)
50+
- [Health](./docs/HEALTH.md)
4951

5052
More will be added as time goes on!
5153

docs/AGENT.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ via the [AgentClient](./src/Agent/AgentClient.php) class.
66
If you have constructed a [Client](./src/Client.php) object, this is done as so:
77

88
```php
9-
$agent = $client->Agent();
9+
$agent = $client->Agent;
1010
```
1111

1212
## Actions
1313

1414
### Get "Self"
1515

1616
```php
17-
list($self, $qm, $err) = $client->Agent()->self();
17+
list($self, $qm, $err) = $client->Agent->self();
1818
if (null !== $err)
1919
die($err);
2020

@@ -24,7 +24,7 @@ var_dump($qm, $self);
2424
### Get Name of Node
2525

2626
```php
27-
list($nodeName, $err) = $client->Agent()->nodeName();
27+
list($nodeName, $err) = $client->Agent->nodeName();
2828
if (null !== $err)
2929
die($err);
3030

@@ -34,7 +34,7 @@ var_dump($nodeName);
3434
### Get List of Agent Checks
3535

3636
```php
37-
list($checks, $err) = $client->Agent()->checks();
37+
list($checks, $err) = $client->Agent->checks();
3838
if (null !== $err)
3939
die($err);
4040

@@ -44,7 +44,7 @@ var_dump($checks);
4444
### Get List of Agent Services
4545

4646
```php
47-
list($services, $err) = $client->Agent()->services();
47+
list($services, $err) = $client->Agent->services();
4848
if (null !== $err)
4949
die($err);
5050

@@ -54,7 +54,7 @@ var_dump($services);
5454
### Get List of Cluster Members
5555

5656
```php
57-
list($members, $err) = $client->Agent()->members();
57+
list($members, $err) = $client->Agent->members();
5858
if (null !== $err)
5959
die($err);
6060

@@ -79,15 +79,15 @@ $service = new \DCarbone\PHPConsulAPI\Agent\AgentServiceRegistration(
7979
)
8080
);
8181

82-
$err = $client->Agent()->serviceRegister($service);
82+
$err = $client->Agent->serviceRegister($service);
8383
if (null !== $err)
8484
die($err);
8585
```
8686

8787
### Deregister Service
8888

8989
```php
90-
$err = $client->Agent()->serviceDeregister('dan test service');
90+
$err = $client->Agent->serviceDeregister('dan test service');
9191
if (null !== $err)
9292
die($err);
9393
```
@@ -107,7 +107,7 @@ $check = new \DCarbone\PHPConsulAPI\Agent\AgentCheckRegistration(
107107
)
108108
);
109109

110-
$err = $client->Agent()->checkRegister($check);
110+
$err = $client->Agent->checkRegister($check);
111111
if (null !== $err)
112112
die($err);
113113
```
@@ -123,71 +123,71 @@ if (null !== $err)
123123
### Join
124124

125125
```php
126-
$err = $client->Agent()->join('address to join');
126+
$err = $client->Agent->join('address to join');
127127
if (null !== $err)
128128
die($err);
129129
```
130130

131131
### Force Leave
132132

133133
```php
134-
$err = $client->Agent()->forceLeave('node name');
134+
$err = $client->Agent->forceLeave('node name');
135135
if (null !== $err)
136136
die($err);
137137
```
138138

139139
### Enable Service Maintenance
140140

141141
```php
142-
$err = $client->Agent()->enableServiceMaintenance('service id', 'because reasons');
142+
$err = $client->Agent->enableServiceMaintenance('service id', 'because reasons');
143143
if (null !== $err)
144144
die($err);
145145
```
146146

147147
### Disable Service Maintenance
148148

149149
```php
150-
$err = $client->Agent()->disableServiceMaintenance('service id');
150+
$err = $client->Agent->disableServiceMaintenance('service id');
151151
if (null !== $er)
152152
die($err);
153153
```
154154

155155
### Enable Node Maintenance
156156

157157
```php
158-
$err = $client->Agent()->enableNodeMaintenance('because GOOD reasons');
158+
$err = $client->Agent->enableNodeMaintenance('because GOOD reasons');
159159
if (null !== $err)
160160
die($err);
161161
```
162162

163163
### Disable Node Maintenance
164164

165165
```php
166-
$err = $client->Agent()->disableNodeMaintenance();
166+
$err = $client->Agent->disableNodeMaintenance();
167167
if (null !== $err)
168168
die($err);
169169
```
170170

171171
### Set TTL Check to Passing
172172

173173
```php
174-
$err = $client->Agent()->passTTL('check id', 'all good here, dudes');
174+
$err = $client->Agent->passTTL('check id', 'all good here, dudes');
175175
if (null !== $err)
176176
die($err);
177177
```
178178

179179
### Set TTL Check to Warning
180180

181181
```php
182-
$err = $client->Agent()->warnTTL('check id', 'might not be good here, dudes');
182+
$err = $client->Agent->warnTTL('check id', 'might not be good here, dudes');
183183
if (null !== $err)
184184
die($err);
185185
```
186186

187187
### Set TTL Check to Failing
188188

189189
```php
190-
$err = $client->Agent()->failTTL('check id', 'super not good here, dudes.');
190+
$err = $client->Agent->failTTL('check id', 'super not good here, dudes.');
191191
if (null !== $err)
192192
die($err);
193193
```

docs/CATALOG.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ via the [CatalogClient](./src/Catalog/CatalogClient.php) class.
88
If you have constructed a [Client](./src/Client.php) object, this is done as so:
99

1010
```php
11-
$catalog = $client->Catalog();
11+
$catalog = $client->Catalog;
1212
```
1313

1414
## Actions
@@ -31,7 +31,7 @@ $catalogRegistration = new \DCarbone\PHPConsulAPI\Catalog\CatalogRegistration(
3131
)
3232
);
3333

34-
list($wm, $err) = $client->Catalog()->register($catalogRegistration);
34+
list($wm, $err) = $client->Catalog->register($catalogRegistration);
3535
if (null !== $err)
3636
die($err);
3737

@@ -53,7 +53,7 @@ $catalogDeregistration = new \DCarbone\PHPConsulAPI\Catalog\CatalogDeregistratio
5353
)
5454
);
5555

56-
list($wm, $err) = $client->Catalog()->deregister($catalogDeregistration);
56+
list($wm, $err) = $client->Catalog->deregister($catalogDeregistration);
5757
if (null !== $err)
5858
die($err);
5959

@@ -63,7 +63,7 @@ var_dump($wm);
6363
### List Datacenters
6464

6565
```php
66-
list ($datacenters, $err) = $client->Catalog()->datacenters();
66+
list ($datacenters, $err) = $client->Catalog->datacenters();
6767
if (null !== $err)
6868
die($err);
6969

@@ -73,7 +73,7 @@ var_dump($datacenters);
7373
### List Nodes
7474

7575
```php
76-
list($nodes, $qm, $err) = $client->Catalog()->nodes();
76+
list($nodes, $qm, $err) = $client->Catalog->nodes();
7777
if (null !== $err)
7878
die($err);
7979

@@ -83,7 +83,7 @@ var_dump($nodes, $qm);
8383
### List Services
8484

8585
```php
86-
list($services, $qm, $err) = $client->Catalog()->services();
86+
list($services, $qm, $err) = $client->Catalog->services();
8787
if (null !== $err)
8888
die($err);
8989

@@ -93,7 +93,7 @@ var_dump($services, $qm);
9393
### Get Specific Service
9494

9595
```php
96-
list($service, $qm, $err) = $client->Catalog()->service('servicename');
96+
list($service, $qm, $err) = $client->Catalog->service('servicename');
9797
if (null !== $err)
9898
die($err);
9999

@@ -103,7 +103,7 @@ var_dump($service, $qm);
103103
### Get Specific Node
104104

105105
```php
106-
list($node, $qm, $err) = $client->Catalog()->node('nodename');
106+
list($node, $qm, $err) = $client->Catalog->node('nodename');
107107
if (null !== $err)
108108
die($err);
109109

docs/COORDINATE.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# PHP Consul API Coordinate
2+
3+
All interactions with the [`v1/coordinate`](https://www.consul.io/docs/agent/http/coordinate.html) endpoint are done
4+
via the [CoordinateClient](./src/Coordinate/CoordinateClient.php) class.
5+
6+
If you have constructed a [Client](./src/Client.php) object, this is done as so:
7+
8+
```php
9+
$coordinate = $client->Coordinate;
10+
```
11+
12+
## Actions
13+
14+
### Get Datacenter Map
15+
16+
```php
17+
list($datacenters, $err) = $client->Coordinate->datacenters();
18+
if (null !== $err)
19+
die($err);
20+
21+
var_dump($datacenters);
22+
```
23+
24+
### Get Nodes List
25+
26+
```php
27+
list($nodes, $qm, $err) = $client->Coordinate->nodes();
28+
if (null !== $err)
29+
die($err);
30+
31+
var_dupm($nodes, $qm);
32+
```

docs/EVENT.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ are done via the [EventClient](./src/Event/EventClient.php) class.
66
If you have constructed a [Client](./src/Client.php) object, this is done as so:
77

88
```php
9-
$event = $client->Event();
9+
$event = $client->Event;
1010
```
1111

1212
## Actions
@@ -26,7 +26,7 @@ $userEvent = new \DCarbone\PHPConsulAPI\Event\UserEvent(
2626
)
2727
);
2828

29-
list($event, $wm, $err) = $client->Event()->fire($userEvent);
29+
list($event, $wm, $err) = $client->Event->fire($userEvent);
3030
if (null !== $err)
3131
die($err);
3232

@@ -36,7 +36,7 @@ var_dump($event, $wm);
3636
### List Events
3737

3838
```php
39-
list($userEvents, $qm, $err) = $client->Event()->eventList();
39+
list($userEvents, $qm, $err) = $client->Event->eventList();
4040
if (null !== $err)
4141
die($err);
4242

docs/HEALTH.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# PHP Consul API Health
2+
3+
ALl interactions with the [`v1/health`](https://www.consul.io/docs/agent/http/health.html) endpoint are done
4+
via the [HealthClient](./src/Health/HealthClient.php) class.
5+
6+
If you have constructed a [Client](./src/Client.php) object, this is done as so:
7+
8+
```php
9+
$health = $client->Health;
10+
```
11+
12+
## Actions
13+
14+
### Get Node Health
15+
16+
```php
17+
list($healthCheck, $qm, $err) = $client->Health->node('nodename');
18+
if (null !== $err)
19+
die($err);
20+
21+
var_dump($healthCheck, $qm);
22+
```
23+
24+
### Get Service Checks
25+
26+
```php
27+
list($checks, $qm, $err) = $client->Health->checks('service name');
28+
if (null !== $err)
29+
die($err);
30+
31+
var_dump($checks, $qm);
32+
```
33+
34+
### Get Service Health
35+
36+
```php
37+
list($services, $qm, $err) = $client->Health->service('service name');
38+
if (null !== $err)
39+
die($err);
40+
41+
var_dump($services, $qm);
42+
```
43+
44+
### Get Checks in State
45+
46+
```php
47+
list($checks, $qm, $err) = $client->health->state('state');
48+
if (null !== $err)
49+
die($err);
50+
51+
var_dump($checks, $qm);
52+
```

0 commit comments

Comments
 (0)