当前位置: 首页>>代码示例>>PHP>>正文


PHP Common\Aws类代码示例

本文整理汇总了PHP中Aws\Common\Aws的典型用法代码示例。如果您正苦于以下问题:PHP Aws类的具体用法?PHP Aws怎么用?PHP Aws使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Aws类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __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');
 }
开发者ID:tomaj,项目名称:nette-images,代码行数:8,代码来源:S3Backend.php

示例2: 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();
 }
开发者ID:breathbath,项目名称:amazon-workflow-discovering-test,代码行数:10,代码来源:SwfCommands.php

示例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']));
 }
开发者ID:awcode,项目名称:cloudmngr,代码行数:7,代码来源:cloudmngr.instance-AWS.class.php

示例4: 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());
     }
 }
开发者ID:AutoWeb-AutoAds,项目名称:superchat,代码行数:25,代码来源:profile.php

示例5: getAws

 public function getAws()
 {
     if ($this->_aws === null) {
         $this->_aws = Aws::factory($this->_config);
     }
     return $this->_aws;
 }
开发者ID:grigorieff,项目名称:yii2-aws,代码行数:7,代码来源:AWSComponent.php

示例6: __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');
 }
开发者ID:dpodium,项目名称:yii2-filemanager-aws2,代码行数:25,代码来源:S3.php

示例7: _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');
         }
     }
 }
开发者ID:s-nakazawa,项目名称:UNICORN,代码行数:59,代码来源:GenericAWSNotification.class.php

示例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');
 }
开发者ID:koxon,项目名称:CloudProcessingEngine-SDK,代码行数:8,代码来源:CpeSqsWriter.php

示例9: getPublicDNSFromEBEnvironmentName

 public function getPublicDNSFromEBEnvironmentName($envName)
 {
     $ec2Client = $this->providedAws->get('ec2');
     $result = $ec2Client->describeInstances(array('Filters' => array(array('Name' => 'tag-key', 'Values' => array('elasticbeanstalk:environment-name')), array('Name' => 'tag-value', 'Values' => array($envName)))));
     $dnsArray = array();
     //ugh, no dot notation checks
     $reservations = $result->get('Reservations', array());
     if (count($reservations) > 0) {
         foreach ($reservations as $reservation) {
             if (isset($reservation['Instances']) && count($reservation['Instances']) > 0) {
                 $instance = $reservation['Instances'][0];
                 $dnsArray[] = $instance['PublicDnsName'];
             }
         }
     }
     return $dnsArray;
 }
开发者ID:atyagi,项目名称:laravel-aws-ssh,代码行数:17,代码来源:AWS.php

示例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);
 }
开发者ID:Beanbiscuit,项目名称:examples,代码行数:11,代码来源:AwsS3ServiceTest.php

示例11: 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;
 }
开发者ID:atyagi,项目名称:laravel-aws-ssh,代码行数:8,代码来源:LaravelAwsSshServiceProvider.php

示例12: 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;
 }
开发者ID:khanhnd91,项目名称:khaosan,代码行数:9,代码来源:class-S3_helper.php

示例13: 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;
 }
开发者ID:hyhyxu,项目名称:hook,代码行数:10,代码来源:AmazonAWS.php

示例14: 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;
    }
}
开发者ID:netor27,项目名称:UnovaPrivado,代码行数:10,代码来源:sesModelo.php

示例15: getAws

 /**
  * Get aws object or aws service
  *
  * @return mixed
  */
 protected function getAws($service = null)
 {
     if (is_null($this->aws)) {
         $this->aws = Aws::factory($this->getAwsCredentials());
     }
     if (!is_null($service)) {
         return $this->aws->get($service);
     }
     return $this->aws;
 }
开发者ID:pulkitjalan,项目名称:git-s3,代码行数:15,代码来源:AbstractCommand.php


注:本文中的Aws\Common\Aws类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。