Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def new_static(cls, access_key_id, secret_access_key, session_token=None):
"""
Create a simple provider that just returns a fixed set of credentials
"""
assert isinstance_str(access_key_id)
assert isinstance_str(secret_access_key)
assert isinstance_str(session_token) or session_token is None
binding = _awscrt.credentials_provider_new_static(access_key_id, secret_access_key, session_token)
return cls(binding)
def override_default_trust_store_from_path(self, ca_dirpath, ca_filepath):
assert isinstance_str(ca_dirpath) or ca_dirpath is None
assert isinstance_str(ca_filepath) or ca_filepath is None
if ca_filepath:
ca_buffer = _read_binary_file(ca_filepath)
self.override_default_trust_store(ca_buffer)
self.ca_dirpath = ca_dirpath
algorithm, # type: AwsSigningAlgorithm
credentials_provider, # type: AwsCredentialsProviderBase
region, # type: str
service, # type: str
date=None, # type: Optional[datetime.datetime]
should_sign_param=None, # type: Optional[Callable[[str], bool]]
use_double_uri_encode=False, # type: bool
should_normalize_uri_path=True, # type: bool
body_signing_type=AwsBodySigningConfigType.BodySigningOn # type: AwsBodySigningConfigType
):
# type: (...) -> None
assert isinstance(algorithm, AwsSigningAlgorithm)
assert isinstance(credentials_provider, AwsCredentialsProviderBase)
assert isinstance_str(region)
assert isinstance_str(service)
assert isinstance(date, datetime.datetime) or date is None
assert callable(should_sign_param) or should_sign_param is None
assert isinstance(body_signing_type, AwsBodySigningConfigType)
super(AwsSigningConfig, self).__init__()
if date is None:
date = datetime.datetime.now(_utc)
try:
timestamp = date.timestamp()
except AttributeError:
# Python 2 doesn't have datetime.timestamp() function.
# If it did we could just call it from binding code instead of calculating it here.
if date.tzinfo is None:
timestamp = time.mktime(date.timetuple())
def create_client_with_mtls_from_path(cert_filepath, pk_filepath):
assert isinstance_str(cert_filepath)
assert isinstance_str(pk_filepath)
cert_buffer = _read_binary_file(cert_filepath)
key_buffer = _read_binary_file(pk_filepath)
return TlsContextOptions.create_client_with_mtls(cert_buffer, key_buffer)
def __init__(self, access_key_id, secret_access_key, session_token=None):
assert isinstance_str(access_key_id)
assert isinstance_str(secret_access_key)
assert isinstance_str(session_token) or session_token is None
super(AwsCredentials, self).__init__()
self._binding = _awscrt.credentials_new(access_key_id, secret_access_key, session_token)
def remove_value(self, name, value):
"""
Remove a specific value for this name.
Raises a ValueError if value not found.
"""
assert isinstance_str(name)
assert isinstance_str(value)
_awscrt.http_headers_remove_value(self._binding, name, value)
def new_static(cls, access_key_id, secret_access_key, session_token=None):
"""
Create a simple provider that just returns a fixed set of credentials
"""
assert isinstance_str(access_key_id)
assert isinstance_str(secret_access_key)
assert isinstance_str(session_token) or session_token is None
binding = _awscrt.credentials_provider_new_static(access_key_id, secret_access_key, session_token)
return cls(binding)
def set(self, name, value):
"""
Set a name-value pair, any existing values for the name are removed.
"""
assert isinstance_str(name)
assert isinstance_str(value)
_awscrt.http_headers_set(self._binding, name, value)
def create_server_from_path(cert_filepath, pk_filepath):
assert isinstance_str(cert_filepath)
assert isinstance_str(pk_filepath)
cert_buffer = _read_binary_file(cert_filepath)
key_buffer = _read_binary_file(pk_filepath)
return TlsContextOptions.create_server(cert_buffer, key_buffer)
def __init__(self, access_key_id, secret_access_key, session_token=None):
assert isinstance_str(access_key_id)
assert isinstance_str(secret_access_key)
assert isinstance_str(session_token) or session_token is None
super(AwsCredentials, self).__init__()
self._binding = _awscrt.credentials_new(access_key_id, secret_access_key, session_token)