當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。