Debian Codegraph @

lib/3rdParty/composer/aws/aws-crt-php/src/AWS/CRT/Auth/StaticCredentialsProvider.php

raw symbols SCIP
1 <?php
2 /**
3 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 * SPDX-License-Identifier: Apache-2.0.
5 */
6 namespace AWS\CRT\Auth;
7
8 /**
9 * Provides a static set of AWS credentials
10 *
11 * @param array options:
12 * - string access_key_id - AWS Access Key Id
13 * - string secret_access_key - AWS Secret Access Key
14 * - string session_token - Optional STS session token
15 */
16 final class StaticCredentialsProvider extends CredentialsProvider {
17
18 private $credentials;
19
20 public function __get($name) {
21 return $this->$name;
22 }
23
24 function __construct(array $options = []) {
25 parent::__construct();
26 $this->credentials = new AwsCredentials($options);
27
28 $provider_options = self::$crt->credentials_provider_static_options_new();
29 self::$crt->credentials_provider_static_options_set_access_key_id($provider_options, $this->credentials->access_key_id);
30 self::$crt->credentials_provider_static_options_set_secret_access_key($provider_options, $this->credentials->secret_access_key);
31 self::$crt->credentials_provider_static_options_set_session_token($provider_options, $this->credentials->session_token);
32 $this->acquire(self::$crt->credentials_provider_static_new($provider_options));
33 self::$crt->credentials_provider_static_options_release($provider_options);
34 }
35 }