def setup_kms_master_key_provider(): """Reads the test_values config file and builds the requested KMS Master Key Provider.""" config = read_test_config() cmk_arn = get_cmk_arn(config) botocore_session = setup_botocore_session(config) kms_master_key_provider = KMSMasterKeyProvider(botocore_session=botocore_session) kms_master_key_provider.add_master_key(cmk_arn) return kms_master_key_provider
def setup_kms_master_key_provider(cache=True): """Reads the test_values config file and builds the requested KMS Master Key Provider.""" global _KMS_MKP # pylint: disable=global-statement if cache and _KMS_MKP is not None: return _KMS_MKP cmk_arn = get_cmk_arn() kms_master_key_provider = KMSMasterKeyProvider() kms_master_key_provider.add_master_key(cmk_arn) if cache: _KMS_MKP = kms_master_key_provider return kms_master_key_provider
def setup_kms_master_key_provider_with_botocore_session(cache=True): """Reads the test_values config file and builds the requested KMS Master Key Provider with botocore_session.""" global _KMS_MKP_BOTO # pylint: disable=global-statement if cache and _KMS_MKP_BOTO is not None: return _KMS_MKP_BOTO cmk_arn = get_cmk_arn() kms_master_key_provider = KMSMasterKeyProvider(botocore_session=botocore.session.Session()) kms_master_key_provider.add_master_key(cmk_arn) if cache: _KMS_MKP_BOTO = kms_master_key_provider return kms_master_key_provider
def setup_kms_master_key_provider_with_botocore_session(cache=True): """Build an AWS KMS Master Key Provider with an explicit botocore_session.""" global _KMS_MKP_BOTO # pylint: disable=global-statement if cache and _KMS_MKP_BOTO is not None: return _KMS_MKP_BOTO cmk_arn = get_cmk_arn() kms_master_key_provider = KMSMasterKeyProvider(botocore_session=botocore.session.Session()) kms_master_key_provider.add_master_key(cmk_arn.encode("utf-8")) if cache: _KMS_MKP_BOTO = kms_master_key_provider return kms_master_key_provider
def setup_kms_master_key_provider(cache=True): """Build an AWS KMS Master Key Provider.""" global _KMS_MKP # pylint: disable=global-statement if cache and _KMS_MKP is not None: return _KMS_MKP cmk_arn = get_cmk_arn() kms_master_key_provider = KMSMasterKeyProvider() kms_master_key_provider.add_master_key(cmk_arn.encode("utf-8")) if cache: _KMS_MKP = kms_master_key_provider return kms_master_key_provider
def kms_master_key_provider(cache: Optional[bool] = True): """Build the expected KMS Master Key Provider based on environment variables.""" global _KMS_MKP # pylint: disable=global-statement if cache and _KMS_MKP is not None: return _KMS_MKP cmk_arn = get_cmk_arn() _kms_master_key_provider = KMSMasterKeyProvider() _kms_master_key_provider.add_master_key(cmk_arn) if cache: _KMS_MKP = _kms_master_key_provider return _kms_master_key_provider
def setup_kms_master_key_provider(): """Reads the test_values config file and builds the requested KMS Master Key Provider.""" cmk_arn = get_cmk_arn() kms_master_key_provider = KMSMasterKeyProvider() kms_master_key_provider.add_master_key(cmk_arn) return kms_master_key_provider