@@ -36,23 +36,27 @@ class OperatorClient extends AbstractClient
3636 * @param \DCarbone\PHPConsulAPI\Operator\Area $area
3737 * @param \DCarbone\PHPConsulAPI\WriteOptions|null $opts
3838 * @throws \GuzzleHttp\Exception\GuzzleException
39+ * @throws \Exception
3940 * @return \DCarbone\PHPConsulAPI\ValuedWriteStringResponse
4041 */
4142 public function AreaCreate (Area $ area , ?WriteOptions $ opts = null ): ValuedWriteStringResponse
4243 {
43- return $ this ->_writeIDResponse ($ this ->_doPost ('v1/operator/area ' , $ area , $ opts ));
44+ return $ this ->_writeIDResponse ($ this ->_requireOK ( $ this -> _doPost ('v1/operator/area ' , $ area , $ opts) ));
4445 }
4546
4647 /**
4748 * @param string $areaID
4849 * @param \DCarbone\PHPConsulAPI\Operator\Area $area
4950 * @param \DCarbone\PHPConsulAPI\WriteOptions|null $opts
5051 * @throws \GuzzleHttp\Exception\GuzzleException
52+ * @throws \Exception
5153 * @return \DCarbone\PHPConsulAPI\ValuedWriteStringResponse
5254 */
5355 public function AreaUpdate (string $ areaID , Area $ area , ?WriteOptions $ opts = null ): ValuedWriteStringResponse
5456 {
55- return $ this ->_writeIDResponse ($ this ->_doPut (\sprintf ('v1/operator/area/%s ' , $ areaID ), $ area , $ opts ));
57+ return $ this ->_writeIDResponse (
58+ $ this ->_requireOK ($ this ->_doPut (\sprintf ('v1/operator/area/%s ' , $ areaID ), $ area , $ opts ))
59+ );
5660 }
5761
5862 /**
@@ -64,7 +68,7 @@ public function AreaUpdate(string $areaID, Area $area, ?WriteOptions $opts = nul
6468 */
6569 public function AreaGet (string $ areaID , ?QueryOptions $ opts = null ): OperatorAreasResponse
6670 {
67- $ resp = $ this ->_doGet (\sprintf ('v1/operator/area/%s ' , \urlencode ($ areaID )), $ opts );
71+ $ resp = $ this ->_requireOK ( $ this -> _doGet (\sprintf ('v1/operator/area/%s ' , \urlencode ($ areaID )), $ opts) );
6872 $ ret = new OperatorAreasResponse ();
6973 $ this ->_hydrateResponse ($ resp , $ ret );
7074 return $ ret ;
@@ -78,7 +82,7 @@ public function AreaGet(string $areaID, ?QueryOptions $opts = null): OperatorAre
7882 */
7983 public function AreaList (?QueryOptions $ opts = null ): OperatorAreasResponse
8084 {
81- $ resp = $ this ->_doGet ('v1/operator/area ' , $ opts );
85+ $ resp = $ this ->_requireOK ( $ this -> _doGet ('v1/operator/area ' , $ opts) );
8286 $ ret = new OperatorAreasResponse ();
8387 $ this ->_hydrateResponse ($ resp , $ ret );
8488 return $ ret ;
@@ -105,7 +109,7 @@ public function AreaDelete(string $areaID, ?WriteOptions $opts = null): WriteRes
105109 */
106110 public function AreaJoin (string $ areaID , array $ addresses , ?WriteOptions $ opts = null ): OperatorAreaJoinResponse
107111 {
108- $ resp = $ this ->_doPut (\sprintf ('v1/operator/area/%s/join ' , $ areaID ), $ addresses , $ opts );
112+ $ resp = $ this ->_requireOK ( $ this -> _doPut (\sprintf ('v1/operator/area/%s/join ' , $ areaID ), $ addresses , $ opts) );
109113 $ ret = new OperatorAreaJoinResponse ();
110114 $ this ->_hydrateResponse ($ resp , $ ret );
111115 return $ ret ;
@@ -120,7 +124,7 @@ public function AreaJoin(string $areaID, array $addresses, ?WriteOptions $opts =
120124 */
121125 public function AreaMembers (string $ areaID , ?QueryOptions $ opts = null ): OperatorSerfMembersResponse
122126 {
123- $ resp = $ this ->_doGet (\sprintf ('v1/operator/area/%s/members ' , $ areaID ), $ opts );
127+ $ resp = $ this ->_requireOK ( $ this -> _doGet (\sprintf ('v1/operator/area/%s/members ' , $ areaID ), $ opts) );
124128 $ ret = new OperatorSerfMembersResponse ();
125129 $ this ->_hydrateResponse ($ resp , $ ret );
126130 return $ ret ;
@@ -134,7 +138,7 @@ public function AreaMembers(string $areaID, ?QueryOptions $opts = null): Operato
134138 */
135139 public function AutopilotGetConfiguration (?QueryOptions $ opts = null ): OperatorAutopilotConfigurationResponse
136140 {
137- $ resp = $ this ->_doGet ('v1/operator/autopilot/configuration ' , $ opts );
141+ $ resp = $ this ->_requireOK ( $ this -> _doGet ('v1/operator/autopilot/configuration ' , $ opts) );
138142 $ ret = new OperatorAutopilotConfigurationResponse ();
139143 $ this ->_hydrateResponse ($ resp , $ ret );
140144 return $ ret ;
@@ -148,7 +152,7 @@ public function AutopilotGetConfiguration(?QueryOptions $opts = null): OperatorA
148152 */
149153 public function AutopilotSetConfiguration (AutopilotConfiguration $ conf , ?WriteOptions $ opts = null ): ?Error
150154 {
151- return $ this ->_doPut ('v1/operator/autopilot/configuration ' , $ conf , $ opts )->Err ;
155+ return $ this ->_requireOK ( $ this -> _doPut ('v1/operator/autopilot/configuration ' , $ conf , $ opts) )->Err ;
152156 }
153157
154158 /**
@@ -162,7 +166,7 @@ public function AutopilotCASConfiguration(
162166 AutopilotConfiguration $ conf ,
163167 ?WriteOptions $ opts = null
164168 ): ValuedBoolResponse {
165- $ resp = $ this ->_doPut ('v1/operator/autopilot/configuration ' , $ conf , $ opts );
169+ $ resp = $ this ->_requireOK ( $ this -> _doPut ('v1/operator/autopilot/configuration ' , $ conf , $ opts) );
166170 $ ret = new ValuedBoolResponse ();
167171 $ this ->_hydrateResponse ($ resp , $ ret );
168172 return $ ret ;
@@ -176,7 +180,7 @@ public function AutopilotCASConfiguration(
176180 */
177181 public function AutopilotServerHealth (?QueryOptions $ opts = null ): OperatorServerHealthsResponse
178182 {
179- $ resp = $ this ->_doGet ('v1/operator/autopilot/health ' , $ opts );
183+ $ resp = $ this ->_requireOK ( $ this -> _doGet ('v1/operator/autopilot/health ' , $ opts) );
180184 $ ret = new OperatorServerHealthsResponse ();
181185 $ this ->_hydrateResponse ($ resp , $ ret );
182186 return $ ret ;
@@ -190,7 +194,7 @@ public function AutopilotServerHealth(?QueryOptions $opts = null): OperatorServe
190194 */
191195 public function AutopilotState (?QueryOptions $ opts = null ): OperatorAutopilotStateResponse
192196 {
193- $ resp = $ this ->_doGet ('v1/operator/autopilot/state ' , $ opts );
197+ $ resp = $ this ->_requireOK ( $ this -> _doGet ('v1/operator/autopilot/state ' , $ opts) );
194198 $ ret = new OperatorAutopilotStateResponse ();
195199 $ this ->_hydrateResponse ($ resp , $ ret );
196200 return $ ret ;
@@ -204,7 +208,7 @@ public function AutopilotState(?QueryOptions $opts = null): OperatorAutopilotSta
204208 */
205209 public function RaftGetConfiguration (?QueryOptions $ opts = null ): OperatorRaftConfigurationResponse
206210 {
207- $ resp = $ this ->_doGet ('v1/operator/raft/configuration ' , $ opts );
211+ $ resp = $ this ->_requireOK ( $ this -> _doGet ('v1/operator/raft/configuration ' , $ opts) );
208212 $ ret = new OperatorRaftConfigurationResponse ();
209213 $ this ->_hydrateResponse ($ resp , $ ret );
210214 return $ ret ;
@@ -227,8 +231,8 @@ public function RaftRemovePeerByAddress(string $address, ?WriteOptions $opts = n
227231
228232 /**
229233 * @param \DCarbone\PHPConsulAPI\RequestResponse $resp
230- * @return \DCarbone\PHPConsulAPI\ValuedWriteStringResponse
231234 * @throws \Exception
235+ * @return \DCarbone\PHPConsulAPI\ValuedWriteStringResponse
232236 */
233237 protected function _writeIDResponse (RequestResponse $ resp ): ValuedWriteStringResponse
234238 {
0 commit comments