本文整理汇总了PHP中Aws\Common\Aws::factory方法的典型用法代码示例。如果您正苦于以下问题:PHP Aws::factory方法的具体用法?PHP Aws::factory怎么用?PHP Aws::factory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Aws\Common\Aws
的用法示例。
在下文中一共展示了Aws::factory方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getSwfClient
/**
* @return \Aws\Swf\SwfClient
*/
private function getSwfClient()
{
$config = json_decode(file_get_contents(ROOT_PATH . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'parameters.json'), true);
$awsFactory = Aws::factory(array('credentials' => array('key' => $config['aws_access_key_id'], 'secret' => $config['aws_secret_access_key']), 'region' => $config['aws_region']));
$serviceFactory = new AwsSwfClientProvider($awsFactory);
return $serviceFactory->getSwfClient();
}
示例2: __construct
public function __construct()
{
$module = \Yii::$app->controller->module;
$this->key = isset($module->storage['s3']['key']) ? $module->storage['s3']['key'] : '';
$this->secret = isset($module->storage['s3']['secret']) ? $module->storage['s3']['secret'] : '';
$this->bucket = isset($module->storage['s3']['bucket']) ? $module->storage['s3']['bucket'] : '';
if ($this->key == '') {
throw new InvalidConfigException('Key cannot be empty!');
}
if ($this->secret == '') {
throw new InvalidConfigException('Secret cannot be empty!');
}
if ($this->bucket == '') {
throw new InvalidConfigException('Bucket cannot be empty!');
}
$param = ['key' => $this->key, 'secret' => $this->secret];
if (isset($module->storage['s3']['region'])) {
$param['region'] = $module->storage['s3']['region'];
}
if (isset($module->storage['s3']['proxy'])) {
$param['request.options']['proxy'] = $module->storage['s3']['proxy'];
}
$aws = Aws::factory($param);
$this->s3 = $aws->get('S3');
}
示例3: Credentials
function __construct($group_id = "", $region_id = "")
{
parent::__construct($group_id, $region_id);
$this->credentials = new Credentials($this->config['aws_access_key_id'], $this->config['aws_secret_access_key']);
$region = $this->region()->getRegion();
$this->AWS = Aws::factory(array('credentials' => $this->credentials, 'region' => $region['id']));
}
示例4: getAws
public function getAws()
{
if ($this->_aws === null) {
$this->_aws = Aws::factory($this->_config);
}
return $this->_aws;
}
示例5: updateImageCover
public function updateImageCover()
{
$sessionToken = $this->input->post('SessionToken');
$accessKeyId = $this->input->post('AccessKeyId');
$secretAccessKey = $this->input->post('SecretAccessKey');
$userId = $this->input->post('userId');
$coverAvatar = $_FILES['CoverFile']['name'];
$sourceCover = $_FILES['CoverFile']['tmp_name'];
$ext = Myclass::getFileExtension($coverAvatar);
$coverAvatar = sha1(time()) . '.' . $ext;
$config = array('key' => $accessKeyId, 'secret' => $secretAccessKey, 'token' => $sessionToken);
//print_r($config);exit;
$aws = Aws::factory($config);
$s3AWS = $aws->get('S3');
$bucket = 'superchat-dev';
try {
//Create folder and Upload image into S3 Amazon by userId
$result = $s3AWS->putObject(array('Bucket' => $bucket, 'Key' => $userId . '/' . $coverAvatar, 'SourceFile' => $sourceCover, 'Body' => "", 'ACL' => 'public-read'));
if ($result) {
echo '<img src="' . S3_AMAZONE_AWS_SUPERCHAT_DEV . '/' . $userId . '/' . $coverAvatar . '" height="300" id="aws-img-cover">';
}
} catch (Exeption $e) {
die($e->getMessage());
}
}
示例6: _init
protected function _init()
{
if (FALSE === $this->_initialized) {
$baseArn = NULL;
$apiKey = NULL;
$apiSecret = NULL;
$region = NULL;
if (class_exists('Configure') && NULL !== Configure::constant('AWS_SNS_ARN_BASE')) {
$baseArn = Configure::AWS_SNS_ARN_BASE;
}
if (class_exists('Configure') && NULL !== Configure::constant('AWS_KEY')) {
$apiKey = Configure::AWS_KEY;
}
if (class_exists('Configure') && NULL !== Configure::constant('AWS_SNS_API_KEY')) {
$apiKey = Configure::AWS_SNS_API_KEY;
}
if (class_exists('Configure') && NULL !== Configure::constant('AWS_SECRET')) {
$apiSecret = Configure::AWS_SECRET;
}
if (class_exists('Configure') && NULL !== Configure::constant('AWS_SNS_API_SECRET')) {
$apiSecret = Configure::AWS_SNS_API_SECRET;
}
if (class_exists('Configure') && NULL !== Configure::constant('AWS_REGION')) {
$region = Configure::AWS_REGION;
}
if (class_exists('Configure') && NULL !== Configure::constant('AWS_SNS_REGION')) {
$region = Configure::AWS_SNS_REGION;
} elseif (defined('PROJECT_NAME') && strlen(PROJECT_NAME) > 0 && class_exists(PROJECT_NAME . 'Configure')) {
$ProjectConfigure = PROJECT_NAME . 'Configure';
if (NULL !== $ProjectConfigure::constant('AWS_SNS_ARN_BASE')) {
$baseArn = $ProjectConfigure::AWS_SNS_ARN_BASE;
}
if (NULL !== $ProjectConfigure::constant('AWS_KEY')) {
$apiKey = $ProjectConfigure::AWS_KEY;
}
if (NULL !== $ProjectConfigure::constant('AWS_SNS_API_KEY')) {
$apiKey = $ProjectConfigure::AWS_SNS_API_KEY;
}
if (NULL !== $ProjectConfigure::constant('AWS_SECRET')) {
$apiSecret = $ProjectConfigure::AWS_SECRET;
}
if (NULL !== $ProjectConfigure::constant('AWS_SNS_API_SECRET')) {
$apiSecret = $ProjectConfigure::AWS_SNS_API_SECRET;
}
if (NULL !== $ProjectConfigure::constant('AWS_REGION')) {
$region = $ProjectConfigure::AWS_REGION;
}
if (NULL !== $ProjectConfigure::constant('AWS_SNS_REGION')) {
$region = $ProjectConfigure::AWS_SNS_REGION;
}
}
$arns = explode('://', $baseArn);
$this->_arnBase = 'arn:aws:sns:' . $arns[0] . ':app/%target_pratform%/' . $arns[1];
$this->_initialized = TRUE;
if (NULL === $this->_AWS) {
$this->_AWS = Aws::factory(array('key' => $apiKey, 'secret' => $apiSecret, 'region' => Region::TOKYO))->get('sns');
}
}
}
示例7: __construct
public function __construct($accessKeyId, $secretAccessKey, $bucket, $region, $host)
{
$this->bucket = $bucket;
$this->host = $host;
$this->accesKeyId = $accessKeyId;
$this->aws = Aws::factory(array('key' => $accessKeyId, 'secret' => $secretAccessKey, 'region' => $region));
$this->s3 = $this->aws->get('s3');
}
示例8: __construct
public function __construct($debug)
{
$this->debug = $debug;
// Create AWS SDK instance.
// We expect an AWS role or the proper AWS env variable sets for KEY/SECRET
$aws = Aws::factory(array('region' => getenv("AWS_DEFAULT_REGION")));
$this->sqs = $aws->get('Sqs');
}
示例9: createProvidedAws
private function createProvidedAws()
{
$accessKey = $this->app->make('config')->get('laravel-aws-ssh::aws.access_key');
$secretKey = $this->app->make('config')->get('laravel-aws-ssh::aws.secret_key');
$region = $this->app->make('config')->get('laravel-aws-ssh::aws.region', 'us-east-1');
$providedAws = ProvidedAWS::factory(array('key' => $accessKey, 'secret' => $secretKey, 'region' => $region));
return $providedAws;
}
示例10: setUp
/**
*
*/
protected function setUp()
{
$this->sBucketName = 'your-s3-bucket';
$aConfig = (include self::CONFIG_FILE);
$oAWS = Aws::factory($aConfig);
$oClient = $oAWS->get('S3');
$this->oService = new AwsS3Service($oClient);
}
示例11: init_s3
public function init_s3($access_key, $secret_key, $region = null)
{
if (!isset($region)) {
$region = Region::AP_NORTHEAST_1;
}
$s3 = Aws::factory(array('key' => $access_key, 'secret' => $secret_key, 'region' => $this->get_region($region)))->get('s3');
$this->s3 = $s3;
return $s3;
}
示例12: sendMailSES
function sendMailSES($text, $html, $subject, $from, $to = array())
{
try {
$client = Aws::factory(getServerRoot() . '/modulos/aws/modelos/configurationFile.php')->get('ses');
$messageId = $client->sendEmail(array('Source' => $from, 'Destination' => array('ToAddresses' => $to), 'Message' => array('Subject' => array('Data' => $subject), 'Body' => array('Text' => array('Data' => $text), 'Html' => array('Data' => $html)))));
return true;
} catch (Exception $e) {
return false;
}
}
示例13: init_s3
public function init_s3($access_key, $secret_key, $region = null)
{
if (!isset($region)) {
$region = Region::AP_NORTHEAST_1;
}
$param = array('key' => $access_key, 'secret' => $secret_key, 'region' => $this->get_region($region));
$s3 = Aws::factory(apply_filters('nephila_clavata_credential', $param))->get('s3');
$this->s3 = $s3;
return $s3;
}
示例14: getClient
protected function getClient()
{
if (!$this->client) {
$bucket = Config::get('storage.bucket', 'default');
$key = Config::get('storage.key');
$secret = Config::get('storage.secret');
$this->client = Aws::factory(array('bucket' => $bucket, 'key' => $key, 'secret' => $secret))->get('s3');
}
return $this->client;
}
示例15: register
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
$this->app->singleton('aws', function ($app) {
$config = $app['config']->get('aws');
if (isset($config['config_file'])) {
$config = $config['config_file'];
}
return Aws::factory($config);
});
$this->app->alias('aws', 'Aws\\Common\\Aws');
}