* Properly coerce `Encrypted` attribute to bool on request/response.
* Create and use a default AWS managed CMK for EBS when clients request
an encrypted volume without specifying a KmsKeyId.
NOTE: A client-provided KmsKeyId is simply stored as-is, and is not validated
against the KMS backend. This is in keeping with other moto backends (RDS, Redshift)
that currently also accept unvalidated customer master key (CMK) parameters, but could
be an area for future improvement.
Closes#3248
* implement register_image
* format code
* add user_ids to snapshot model
* implement register_image
* format code
* add user_ids to snapshot model
* trying to un-deprecate tests
* Write tests and finalize implementation
* Add region parameter to boto3 resource call
* fixed test error
Previously there were a couple models which used different owner ids by
default, which could make tests relying on them fail if someone wasn't
expecting that. This change ensures a uniform owner id between
resources.
This commit adds a test for a case where an EBS volume has no tags. When
an EBS volume has no tags, calls to the aws ec2 endpoints `create_volume`
and `describe_volumes` do not include the `Tags` key in the
`response.Volumes[]` object.
However, moto does include the `Tags` key in this case. This discrepancy
in behaviour can result in code passing a moto test but failing in
production.
Sample snippets that trigger this condition:
```
def create_volume_and_then_get_tags_from_response():
client = boto3.client('ec2', region_name='us-east-1')
volume_response = client.create_volume(
Size=10,
AvailabilityZone='us-east-1a'
)
keys = volume_response['Keys']
```
```
def create_volume_and_then_get_tags_from_describe_volumes():
client = boto3.client('ec2', region_name='us-east-1')
volume_response = client.create_volume(
Size=10,
AvailabilityZone='us-east-1a'
)
volume_describe_response = client.describe_volumes()
keys = volume_describe_response['Volumes'][0]['Keys']
```
Both sample snippets will succeed in a moto test, but fail with a
`KeyError` when using the aws api.
The logic which contructed a list of values for parameters with
multiple values was flawed in that e.g. `Subnet.1` and `Subnet.10`
would be have their values counted against `Subnet.1` because they
share a prefix.
This now checks for a starting `.` before counting that name as
having the requested prefix.
* Adding owner-id/OwnerId to the AMI classes to allow the value to be specified to test filtering images based on owner.
* Added default AMIs and filtering by owner-id
* Fixed some tests
* Fixed more random tests
* Updated MANIFEST
* .