• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Common\Aws类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: 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;
 }
开发者ID:hideokamoto,项目名称:nephila-clavata,代码行数:10,代码来源:class-S3_helper.php


示例17: getAws

 /**
  * Returns the aws service builder
  * @return Guzzle\Service\Builder\ServiceBuilder
  * @throws CException
  */
 public function getAws()
 {
     if (null === $this->_aws) {
         $config = $this->_config !== null ? $this->_config : __DIR__ . '/../config/aws-config.php';
         if (is_scalar($config) && !@file_exists($config)) {
             throw new CException(Yii::t('zii', '"aws-config.php" configuration file not found'));
         }
         $this->_aws = Aws::factory($config);
     }
     return $this->_aws;
 }
开发者ID:MGGROUP,项目名称:SAMDEPURACION,代码行数:16,代码来源:A2Base.php


示例18: 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');
 }
开发者ID:kurtinau,项目名称:titanium,代码行数:16,代码来源:AwsServiceProvider.php


示例19: deleteMessageFromQueue

function deleteMessageFromQueue($receiptHandle)
{
    $client = Aws::factory(getServerRoot() . '/modulos/aws/modelos/configurationFile.php')->get('sqs');
    $res = false;
    try {
        $res = $client->deleteMessage(array('QueueUrl' => getQueueUrl(), 'ReceiptHandle' => $receiptHandle));
        return true;
    } catch (SqsException $e) {
        //Ocurrió un error al borrar el mensaje
        return false;
    }
}
开发者ID:netor27,项目名称:UnovaPrivado,代码行数:12,代码来源:sqsModelo.php


示例20: __construct

 public function __construct($config, $sesClient = null)
 {
     $this->sesClient = $sesClient;
     if (is_null($this->sesClient)) {
         $sesConfig = $config->getEmailSesConfig();
         if (!isset($sesConfig['aws-access-key']) || !isset($sesConfig['aws-secret-key']) || !isset($sesConfig['region'])) {
             throw new \Exception('Unable to initiate Emailer due to missing ' . 'configuration variables.  Please check your config.');
         }
         $aws = Aws::factory(array('ses' => array('alias' => 'Ses', 'class' => 'Aws\\Ses\\SesClient', 'extends' => 'default_settings'), 'key' => $sesConfig['aws-access-key'], 'secret' => $sesConfig['aws-secret-key'], 'region' => $sesConfig['region']))->enableFacades('ses');
         $this->sesClient = $aws->get('ses');
     }
 }
开发者ID:jwyuen,项目名称:dotslash,代码行数:12,代码来源:Emailer.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Client\ClientBuilder类代码示例发布时间:2022-05-23
下一篇:
PHP Auryn\Injector类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap