/**
  * Creates and returns the default SDK endpoint provider.
  *
  * @return callable
  */
 public static function defaultProvider()
 {
     $data = \Aws\load_compiled_json(__DIR__ . '/../data/endpoints.json');
     return new PatternEndpointProvider($data['endpoints']);
 }
Esempio n. 2
0
 /**
  * Execute the the provider.
  *
  * @param string $type    Type of data ('api', 'waiter', 'paginator').
  * @param string $service Service name.
  * @param string $version API version.
  *
  * @return array|null
  */
 public function __invoke($type, $service, $version)
 {
     // Resolve the type or return null.
     if (isset(self::$typeMap[$type])) {
         $type = self::$typeMap[$type];
     } else {
         return null;
     }
     // Resolve the version or return null.
     if (!isset($this->manifest)) {
         $this->buildVersionsList($service);
     }
     if (!isset($this->manifest[$service]['versions'][$version])) {
         return null;
     }
     $version = $this->manifest[$service]['versions'][$version];
     $path = "{$this->modelsDir}/{$service}/{$version}/{$type}.json";
     try {
         return \Aws\load_compiled_json($path);
     } catch (\InvalidArgumentException $e) {
         return null;
     }
 }
 /**
  * Creates and returns the default SDK partition provider.
  *
  * @return PartitionEndpointProvider
  */
 public static function defaultProvider()
 {
     $data = \Aws\load_compiled_json(__DIR__ . '/../data/endpoints.json');
     return new self($data['partitions']);
 }
 public static function defaultProvider()
 {
     $dir = __DIR__ . '/../data';
     return ApiProvider::manifest($dir, \Aws\load_compiled_json("{$dir}/manifest.json"));
 }