Skip to content

Commit

Permalink
updated doc (#197)
Browse files Browse the repository at this point in the history
  • Loading branch information
aliguyong authored and JacksonTian committed Sep 15, 2019
1 parent 96c0cb8 commit 10e0656
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/Request/Traits/AcsTrait.php
Expand Up @@ -193,8 +193,10 @@ public function resolveHost()
*/
private function resolveHostWays(&$host, $region_id)
{
$host = AlibabaCloud::resolveHostByStatic($this->product, $region_id);

// 1. Find host by map.
if ($this->network === 'public' && isset($this->endpointMap[$region_id])) {
if (!$host && $this->network === 'public' && isset($this->endpointMap[$region_id])) {
$host = $this->endpointMap[$region_id];
}

Expand Down
17 changes: 16 additions & 1 deletion src/Traits/EndpointTrait.php
Expand Up @@ -2,6 +2,7 @@

namespace AlibabaCloud\Client\Traits;

use InvalidArgumentException;
use AlibabaCloud\Client\AlibabaCloud;
use AlibabaCloud\Client\Config\Config;
use AlibabaCloud\Client\Request\Request;
Expand All @@ -10,7 +11,6 @@
use AlibabaCloud\Client\Filter\ClientFilter;
use AlibabaCloud\Client\Regions\LocationService;
use AlibabaCloud\Client\Exception\ClientException;
use InvalidArgumentException;

/**
* Help developers set up and get host.
Expand Down Expand Up @@ -53,6 +53,21 @@ public static function resolveHost($product, $regionId = LocationService::GLOBAL
return $domain;
}

/**
* @param string $product
* @param string $regionId
*
* @return string
*/
public static function resolveHostByStatic($product, $regionId)
{
if (isset(self::$hosts[$product][$regionId])) {
return self::$hosts[$product][$regionId];
}

return '';
}

/**
* Add host based on product name and region.
*
Expand Down

0 comments on commit 10e0656

Please sign in to comment.