Skip to content
Snippets Groups Projects
Select Git revision
  • 8.x-1.0-alpha1
  • 8.x-1.x-dev default
  • 8.x-1.x
  • 8.x-1.0-alpha2
4 results

aws_connector

  • Clone with SSH
  • Clone with HTTPS
  • Mike Madison's avatar
    Issue #3020470 by Gaurav_drupal: updating AWS SDK version in composer.json
    Mike Madison authored
    9e378569
    History
    Name Last commit Last update
    config/install Issue #3020503 by Gaurav_drupal: adding default configuration on install for region.
    src re-adding settings overrides.
    .gitignore re-adding settings overrides.
    README.md updating readme
    README.txt Initial commit.
    aws_connector.info.yml first pass
    aws_connector.links.menu.yml first pass
    aws_connector.routing.yml first pass
    composer.json Issue #3020470 by Gaurav_drupal: updating AWS SDK version in composer.json

    Amazon Web Services (AWS) Connector

    This Drupal 8.x Module utilizes the AWS PHP SDK CredentialProvider to provide authentication methodology for other Drupal modules to connect to and utilize AWS services.

    This module provides a simple form for managing your credentials within Drupal itself. These credentials are then stored as part of Drupal configuration and are made accessible to the CredentialProvider class.

    To use this module, include it in your own PHP code (e.g. use Drupal\aws_connector\Credentials\AWSCredentialProvider;).

    Requirements

    This module requires the AWS PHP SDK to be loaded into your environment. This can be handled via composer and the included composer.json file.

    Examples

    <?php
    namespace <your namespace>
    
    use Drupal\aws_connector\Credentials\AWSCredentialProvider;
    use Aws\IotDataPlane\IotDataPlaneClient;
    use Aws\Iot\IotClient;
    /**
     * AWS IoT class.
     */
    class AWSIoT implements SenderInterface {
       /**
       * IoT client object.
       *
       * @var \Aws\IotDataPlane\IotDataPlaneClient
       */
      private $iotClient;
    
      /**
       * Construct.
       */
      public function __construct($topic = '') {
        $credentials = new AWSCredentialProvider();
        $a = AWSCredentialProvider::ini(NULL, NULL);
        $composed = AWSCredentialProvider::chain($a);
    
        $promise = $composed();
        $this->awsCredentials = $promise->wait();
    
        $this->iotClient = new IotClient([
          'credentials' => $this->awsCredentials,
          'region' => $credentials->getRegion(),
          'version' => "2015-05-28",
        ]);
      }
    }