File tree Expand file tree Collapse file tree
lib/OpenCloud/Common/Service Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -134,16 +134,18 @@ public function getEndpoints()
134134 /**
135135 * Using a standard data object, extract its endpoint.
136136 *
137- * @param $region
137+ * @param string $region
138+ * @param bool $isRegionless
139+ *
138140 * @return mixed
139141 * @throws \OpenCloud\Common\Exceptions\EndpointError
140142 */
141- public function getEndpointFromRegion ($ region )
143+ public function getEndpointFromRegion ($ region, $ isRegionless = false )
142144 {
143145 foreach ($ this ->endpoints as $ endpoint ) {
144146 // Return the endpoint if it is regionless OR if the endpoint's
145147 // region matches the $region supplied by the caller.
146- if (!isset ($ endpoint ->region ) || $ endpoint ->region == $ region ) {
148+ if ($ isRegionless || !isset ($ endpoint ->region ) || $ endpoint ->region == $ region ) {
147149 return $ endpoint ;
148150 }
149151 }
Original file line number Diff line number Diff line change @@ -215,7 +215,8 @@ private function findEndpoint()
215215 // Search each service to find The One
216216 foreach ($ catalog ->getItems () as $ service ) {
217217 if ($ service ->hasType ($ this ->type ) && $ service ->hasName ($ this ->name )) {
218- return Endpoint::factory ($ service ->getEndpointFromRegion ($ this ->region ), static ::SUPPORTED_VERSION , $ this ->getClient ());
218+ $ endpoint = $ service ->getEndpointFromRegion ($ this ->region , $ this ->regionless );
219+ return Endpoint::factory ($ endpoint , static ::SUPPORTED_VERSION , $ this ->getClient ());
219220 }
220221 }
221222
You can’t perform that action at this time.
0 commit comments