mirror of
https://github.com/awslabs/aws-crt-php.git
synced 2026-08-18 10:07:12 +00:00
AWS Credentials support, StaticCredentials Provider (#17)
* added credentials API, disabled FFI backend for now * Added CredentialsTest * Added support for specifying CMAKE_BUILD_TYPE on the command line * Added support for AwsCredentials and StaticCredentialsProvider
This commit is contained in:
+63
-9
@@ -3,7 +3,6 @@
|
||||
namespace AWS\CRT;
|
||||
|
||||
use AWS\CRT\Internal\Extension;
|
||||
use AWS\CRT\Internal\FFI;
|
||||
|
||||
use \RuntimeException;
|
||||
|
||||
@@ -22,14 +21,6 @@ final class CRT {
|
||||
if (is_null(self::$impl)) {
|
||||
// Figure out what backends are/should be available
|
||||
$backends = ['Extension'];
|
||||
if (version_compare(PHP_VERSION, '7.0.0') >= 0) {
|
||||
$backends = ['Extension', 'FFI'];
|
||||
if (getenv('AWS_CRT_PHP_EXTENSION')) {
|
||||
$backends = ['Extension'];
|
||||
} else if (getenv('AWS_CRT_PHP_FFI')) {
|
||||
$backends = ['FFI'];
|
||||
}
|
||||
}
|
||||
|
||||
// Try to load each backend, give up if none succeed
|
||||
$exceptions = [];
|
||||
@@ -113,4 +104,67 @@ final class CRT {
|
||||
function event_loop_group_release($elg) {
|
||||
return self::$impl->aws_crt_event_loop_group_release($elg);
|
||||
}
|
||||
|
||||
/**
|
||||
* return object Pointer to native AWS credentials options
|
||||
*/
|
||||
function aws_credentials_options_new() {
|
||||
return self::$impl->aws_crt_credentials_options_new();
|
||||
}
|
||||
|
||||
function aws_credentials_options_release($options) {
|
||||
self::$impl->aws_crt_credentials_options_release($options);
|
||||
}
|
||||
|
||||
function aws_credentials_options_set_access_key_id($options, $access_key_id) {
|
||||
self::$impl->aws_crt_credentials_options_set_access_key_id($options, $access_key_id);
|
||||
}
|
||||
|
||||
function aws_credentials_options_set_secret_access_key($options, $secret_access_key) {
|
||||
self::$impl->aws_crt_credentials_options_set_secret_access_key($options, $secret_access_key);
|
||||
}
|
||||
|
||||
function aws_credentials_options_set_session_token($options, $session_token) {
|
||||
self::$impl->aws_crt_credentials_options_set_session_token($options, $session_token);
|
||||
}
|
||||
|
||||
function aws_credentials_options_set_expiration_timepoint_seconds($options, $expiration_timepoint_seconds) {
|
||||
self::$impl->aws_crt_credentials_options_set_expiration_timepoint_seconds($options, $expiration_timepoint_seconds);
|
||||
}
|
||||
|
||||
function aws_credentials_new($options) {
|
||||
return self::$impl->aws_crt_credentials_new($options);
|
||||
}
|
||||
|
||||
function aws_credentials_release($credentials) {
|
||||
self::$impl->aws_crt_credentials_release($credentials);
|
||||
}
|
||||
|
||||
function aws_credentials_provider_release($provider) {
|
||||
self::$impl->aws_crt_credentials_provider_release($provider);
|
||||
}
|
||||
|
||||
function aws_credentials_provider_static_options_new() {
|
||||
return self::$impl->aws_crt_credentials_provider_static_options_new();
|
||||
}
|
||||
|
||||
function aws_credentials_provider_static_options_release($options) {
|
||||
self::$impl->aws_crt_credentials_provider_static_options_release($options);
|
||||
}
|
||||
|
||||
function aws_credentials_provider_static_options_set_access_key_id($options, $access_key_id) {
|
||||
self::$impl->aws_crt_credentials_provider_static_options_set_access_key_id($options, $access_key_id);
|
||||
}
|
||||
|
||||
function aws_credentials_provider_static_options_set_secret_access_key($options, $secret_access_key) {
|
||||
self::$impl->aws_crt_credentials_provider_static_options_set_secret_access_key($options, $secret_access_key);
|
||||
}
|
||||
|
||||
function aws_credentials_provider_static_options_set_session_token($options, $session_token) {
|
||||
self::$impl->aws_crt_credentials_provider_static_options_set_session_token($options, $session_token);
|
||||
}
|
||||
|
||||
function aws_credentials_provider_static_new($options) {
|
||||
return self::$impl->aws_crt_credentials_provider_static_new($options);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user