Improve autoscaling:CreateLaunchConfiguration request validation (#3687)
AWS requires certain parameters to be mutually inclusive. Moto wasn't doing anything with the InstanceId parameter, which is now made clear with a TODO.
This commit is contained in:
parent
ae2865d559
commit
e8f1522d1a
3 changed files with 43 additions and 0 deletions
|
|
@ -616,7 +616,19 @@ class AutoScalingBackend(BaseBackend):
|
|||
ebs_optimized,
|
||||
associate_public_ip_address,
|
||||
block_device_mappings,
|
||||
instance_id=None,
|
||||
):
|
||||
valid_requests = [
|
||||
instance_id is not None,
|
||||
image_id is not None and instance_type is not None,
|
||||
]
|
||||
if not any(valid_requests):
|
||||
raise ValidationError(
|
||||
"Valid requests must contain either the InstanceID parameter or both the ImageId and InstanceType parameters."
|
||||
)
|
||||
if instance_id is not None:
|
||||
# TODO: https://docs.aws.amazon.com/autoscaling/ec2/userguide/create-lc-with-instanceID.html
|
||||
pass
|
||||
launch_configuration = FakeLaunchConfiguration(
|
||||
name=name,
|
||||
image_id=image_id,
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ class AutoScalingResponse(BaseResponse):
|
|||
ebs_optimized=self._get_param("EbsOptimized"),
|
||||
associate_public_ip_address=self._get_param("AssociatePublicIpAddress"),
|
||||
block_device_mappings=self._get_list_prefix("BlockDeviceMappings.member"),
|
||||
instance_id=self._get_param("InstanceId"),
|
||||
)
|
||||
template = self.response_template(CREATE_LAUNCH_CONFIGURATION_TEMPLATE)
|
||||
return template.render()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue