How to use the azure-storage-common.azure.storage.common._error._validate_not_none function in azure-storage-common

To help you get started, we’ve selected a few azure-storage-common examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Azure / azure-storage-python / azure-storage-common / azure / storage / common / _encryption.py View on Github external
_validate_encryption_protocol_version(encryption_data.encryption_agent.protocol)

    content_encryption_key = None

    # If the resolver exists, give priority to the key it finds.
    if key_resolver is not None:
        key_encryption_key = key_resolver(encryption_data.wrapped_content_key.key_id)

    _validate_not_none('key_encryption_key', key_encryption_key)
    _validate_key_encryption_key_unwrap(key_encryption_key)
    _validate_kek_id(encryption_data.wrapped_content_key.key_id, key_encryption_key.get_kid())

    # Will throw an exception if the specified algorithm is not supported.
    content_encryption_key = key_encryption_key.unwrap_key(encryption_data.wrapped_content_key.encrypted_key,
                                                           encryption_data.wrapped_content_key.algorithm)
    _validate_not_none('content_encryption_key', content_encryption_key)

    return content_encryption_key
github Azure / azure-storage-python / azure-storage-common / azure / storage / common / _encryption.py View on Github external
def __init__(self, encryption_algorithm, protocol):
        '''
        :param _EncryptionAlgorithm encryption_algorithm:
            The algorithm used for encrypting the message contents.
        :param str protocol:
            The protocol version used for encryption.
        '''

        _validate_not_none('encryption_algorithm', encryption_algorithm)
        _validate_not_none('protocol', protocol)

        self.encryption_algorithm = str(encryption_algorithm)
        self.protocol = protocol
github Azure / azure-storage-python / azure-storage-common / azure / storage / common / models.py View on Github external
def __init__(self, enabled=False, include_apis=None,
                 retention_policy=None):
        '''
        :param bool enabled: 
            Indicates whether metrics are enabled for 
            the service.
        :param bool include_apis: 
            Required if enabled is True. Indicates whether metrics 
            should generate summary statistics for called API operations.
        :param RetentionPolicy retention_policy: 
            The retention policy for the metrics.
        '''
        _validate_not_none("enabled", enabled)
        if enabled:
            _validate_not_none("include_apis", include_apis)

        self.version = u'1.0'
        self.enabled = enabled
        self.include_apis = include_apis
        self.retention_policy = retention_policy if retention_policy else RetentionPolicy()
github Azure / azure-storage-python / azure-storage-common / azure / storage / common / models.py View on Github external
The number of seconds that the client/browser should cache a 
            preflight response.
        :param exposed_headers:
            Defaults to an empty list. A list of response headers to expose to CORS 
            clients. Limited to 64 defined headers and two prefixed headers. Each 
            header can be up to 256 characters.
        :type exposed_headers: list(str)
        :param allowed_headers:
            Defaults to an empty list. A list of headers allowed to be part of 
            the cross-origin request. Limited to 64 defined headers and 2 prefixed 
            headers. Each header can be up to 256 characters.
        :type allowed_headers: list(str)
        '''
        _validate_not_none("allowed_origins", allowed_origins)
        _validate_not_none("allowed_methods", allowed_methods)
        _validate_not_none("max_age_in_seconds", max_age_in_seconds)

        self.allowed_origins = allowed_origins if allowed_origins else list()
        self.allowed_methods = allowed_methods if allowed_methods else list()
        self.max_age_in_seconds = max_age_in_seconds
        self.exposed_headers = exposed_headers if exposed_headers else list()
        self.allowed_headers = allowed_headers if allowed_headers else list()
github Azure / azure-storage-python / azure-storage-common / azure / storage / common / _encryption.py View on Github external
key_wrapping_metadata):
        '''
        :param bytes content_encryption_IV:
            The content encryption initialization vector.
        :param _EncryptionAgent encryption_agent:
            The encryption agent.
        :param _WrappedContentKey wrapped_content_key:
            An object that stores the wrapping algorithm, the key identifier, 
            and the encrypted key bytes.
        :param dict key_wrapping_metadata:
            A dict containing metadata related to the key wrapping.
        '''

        _validate_not_none('content_encryption_IV', content_encryption_IV)
        _validate_not_none('encryption_agent', encryption_agent)
        _validate_not_none('wrapped_content_key', wrapped_content_key)

        self.content_encryption_IV = content_encryption_IV
        self.encryption_agent = encryption_agent
        self.wrapped_content_key = wrapped_content_key
        self.key_wrapping_metadata = key_wrapping_metadata
github Azure / azure-storage-python / azure-storage-common / azure / storage / common / _encryption.py View on Github external
def __init__(self, algorithm, encrypted_key, key_id):
        '''
        :param str algorithm:
            The algorithm used for wrapping.
        :param bytes encrypted_key:
            The encrypted content-encryption-key.
        :param str key_id:
            The key-encryption-key identifier string.
        '''

        _validate_not_none('algorithm', algorithm)
        _validate_not_none('encrypted_key', encrypted_key)
        _validate_not_none('key_id', key_id)

        self.algorithm = algorithm
        self.encrypted_key = encrypted_key
        self.key_id = key_id
github Azure / azure-storage-python / azure-storage-common / azure / storage / common / models.py View on Github external
:type allowed_methods: list(str)
        :param int max_age_in_seconds:
            The number of seconds that the client/browser should cache a 
            preflight response.
        :param exposed_headers:
            Defaults to an empty list. A list of response headers to expose to CORS 
            clients. Limited to 64 defined headers and two prefixed headers. Each 
            header can be up to 256 characters.
        :type exposed_headers: list(str)
        :param allowed_headers:
            Defaults to an empty list. A list of headers allowed to be part of 
            the cross-origin request. Limited to 64 defined headers and 2 prefixed 
            headers. Each header can be up to 256 characters.
        :type allowed_headers: list(str)
        '''
        _validate_not_none("allowed_origins", allowed_origins)
        _validate_not_none("allowed_methods", allowed_methods)
        _validate_not_none("max_age_in_seconds", max_age_in_seconds)

        self.allowed_origins = allowed_origins if allowed_origins else list()
        self.allowed_methods = allowed_methods if allowed_methods else list()
        self.max_age_in_seconds = max_age_in_seconds
        self.exposed_headers = exposed_headers if exposed_headers else list()
        self.allowed_headers = allowed_headers if allowed_headers else list()
github Azure / azure-storage-python / azure-storage-common / azure / storage / common / models.py View on Github external
def __init__(self, enabled=False, days=None):
        '''
        :param bool enabled: 
            Indicates whether a retention policy is enabled for the 
            storage service. If disabled, logging and metrics data will be retained 
            infinitely by the service unless explicitly deleted.
        :param int days: 
            Required if enabled is true. Indicates the number of 
            days that metrics or logging data should be retained. All data older 
            than this value will be deleted. The minimum value you can specify is 1; 
            the largest value is 365 (one year).
        '''
        _validate_not_none("enabled", enabled)
        if enabled:
            _validate_not_none("days", days)

        self.enabled = enabled
        self.days = days
github Azure / azure-storage-python / azure-storage-common / azure / storage / common / _encryption.py View on Github external
def __init__(self, algorithm, encrypted_key, key_id):
        '''
        :param str algorithm:
            The algorithm used for wrapping.
        :param bytes encrypted_key:
            The encrypted content-encryption-key.
        :param str key_id:
            The key-encryption-key identifier string.
        '''

        _validate_not_none('algorithm', algorithm)
        _validate_not_none('encrypted_key', encrypted_key)
        _validate_not_none('key_id', key_id)

        self.algorithm = algorithm
        self.encrypted_key = encrypted_key
        self.key_id = key_id
github Azure / azure-storage-python / azure-storage-common / azure / storage / common / _encryption.py View on Github external
def __init__(self, content_encryption_IV, encryption_agent, wrapped_content_key,
                 key_wrapping_metadata):
        '''
        :param bytes content_encryption_IV:
            The content encryption initialization vector.
        :param _EncryptionAgent encryption_agent:
            The encryption agent.
        :param _WrappedContentKey wrapped_content_key:
            An object that stores the wrapping algorithm, the key identifier, 
            and the encrypted key bytes.
        :param dict key_wrapping_metadata:
            A dict containing metadata related to the key wrapping.
        '''

        _validate_not_none('content_encryption_IV', content_encryption_IV)
        _validate_not_none('encryption_agent', encryption_agent)
        _validate_not_none('wrapped_content_key', wrapped_content_key)

        self.content_encryption_IV = content_encryption_IV
        self.encryption_agent = encryption_agent
        self.wrapped_content_key = wrapped_content_key
        self.key_wrapping_metadata = key_wrapping_metadata

azure-storage-common

Microsoft Azure Storage Common Client Library for Python

MIT
Latest version published 5 years ago

Package Health Score

76 / 100
Full package analysis

Similar packages