File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed
lib/OpenCloud/Common/Service Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -134,16 +134,18 @@ public function getEndpoints()
134
134
/**
135
135
* Using a standard data object, extract its endpoint.
136
136
*
137
- * @param $region
137
+ * @param string $region
138
+ * @param bool $isRegionless
139
+ *
138
140
* @return mixed
139
141
* @throws \OpenCloud\Common\Exceptions\EndpointError
140
142
*/
141
- public function getEndpointFromRegion ($ region )
143
+ public function getEndpointFromRegion ($ region, $ isRegionless = false )
142
144
{
143
145
foreach ($ this ->endpoints as $ endpoint ) {
144
146
// Return the endpoint if it is regionless OR if the endpoint's
145
147
// 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 ) {
147
149
return $ endpoint ;
148
150
}
149
151
}
Original file line number Diff line number Diff line change @@ -215,7 +215,8 @@ private function findEndpoint()
215
215
// Search each service to find The One
216
216
foreach ($ catalog ->getItems () as $ service ) {
217
217
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 ());
219
220
}
220
221
}
221
222
You can’t perform that action at this time.
0 commit comments