EBS - Defer imports until it's necessary (#5265)
This commit is contained in:
parent
e5830181dd
commit
6cf37c4b4b
@ -1,5 +1,4 @@
|
|||||||
from moto.core import get_account_id, CloudFormationModel
|
from moto.core import get_account_id, CloudFormationModel
|
||||||
from moto.kms import kms_backends
|
|
||||||
from moto.packages.boto.ec2.blockdevicemapping import BlockDeviceType
|
from moto.packages.boto.ec2.blockdevicemapping import BlockDeviceType
|
||||||
from ..exceptions import (
|
from ..exceptions import (
|
||||||
InvalidAMIAttributeItemValueError,
|
InvalidAMIAttributeItemValueError,
|
||||||
@ -404,6 +403,8 @@ class EBSBackend:
|
|||||||
# https://aws.amazon.com/kms/features/#AWS_Service_Integration
|
# https://aws.amazon.com/kms/features/#AWS_Service_Integration
|
||||||
# An AWS managed CMK is created automatically when you first create
|
# An AWS managed CMK is created automatically when you first create
|
||||||
# an encrypted resource using an AWS service integrated with KMS.
|
# an encrypted resource using an AWS service integrated with KMS.
|
||||||
|
from moto.kms import kms_backends
|
||||||
|
|
||||||
kms = kms_backends[self.region_name]
|
kms = kms_backends[self.region_name]
|
||||||
ebs_alias = "alias/aws/ebs"
|
ebs_alias = "alias/aws/ebs"
|
||||||
if not kms.alias_exists(ebs_alias):
|
if not kms.alias_exists(ebs_alias):
|
||||||
|
@ -6,13 +6,13 @@ from cryptography.exceptions import InvalidSignature
|
|||||||
from cryptography.hazmat.primitives import hashes
|
from cryptography.hazmat.primitives import hashes
|
||||||
|
|
||||||
from cryptography.hazmat.primitives.asymmetric import padding
|
from cryptography.hazmat.primitives.asymmetric import padding
|
||||||
from moto.apigateway.exceptions import ValidationException
|
|
||||||
|
|
||||||
from moto.core import get_account_id, BaseBackend, BaseModel, CloudFormationModel
|
from moto.core import get_account_id, BaseBackend, BaseModel, CloudFormationModel
|
||||||
from moto.core.utils import get_random_hex, unix_time, BackendDict
|
from moto.core.utils import get_random_hex, unix_time, BackendDict
|
||||||
from moto.utilities.tagging_service import TaggingService
|
from moto.utilities.tagging_service import TaggingService
|
||||||
from moto.core.exceptions import JsonRESTError
|
from moto.core.exceptions import JsonRESTError
|
||||||
|
|
||||||
|
from .exceptions import ValidationException
|
||||||
from .utils import (
|
from .utils import (
|
||||||
RESERVED_ALIASES,
|
RESERVED_ALIASES,
|
||||||
decrypt,
|
decrypt,
|
||||||
|
Loading…
Reference in New Issue
Block a user