config('ali.access_key_id'), "accessKeySecret" => config('ali.access_key_secret') ]); $config->endpoint = config('ali.sts_endpoint'); return new Sts($config); } /** * 获取 ali sts 控制器 * @param $payload * @return AssumeRoleResponse * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ public function getAliStsControls($payload): AssumeRoleResponse { $client = $this->createClient(); $assumeRoleRequest = new AssumeRoleRequest($payload); $runtime = new RuntimeOptions([]); try { $res = $client->assumeRoleWithOptions($assumeRoleRequest, $runtime); date_default_timezone_set('Asia/Shanghai'); return $res; } catch (Exception $error) { $this->log->error(__CLASS__.'-'.__FUNCTION__.'-'.__LINE__.':'.$error->getMessage()); } } }