Fix:Ec2-VPC:Added functionality describe-vpc-endpoint (#3524)

* Fix:Ec2:Added fucntionality describe-vpc-endpoint

* Refactor

* Added test cases for errors
This commit is contained in:
usmangani1 2020-12-08 03:09:57 +05:30 committed by GitHub
commit af60306371
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 154 additions and 3 deletions

View file

@ -108,6 +108,7 @@ from .exceptions import (
InvalidParameterDependency,
IncorrectStateIamProfileAssociationError,
InvalidAssociationIDIamProfileAssociationError,
InvalidVpcEndPointIdError,
)
from .utils import (
EC2_RESOURCE_TO_PREFIX,
@ -3222,6 +3223,25 @@ class VPCBackend(object):
return vpc_end_point
def get_vpc_end_point(self, vpc_end_point_ids, filters=None):
vpc_end_points = self.vpc_end_points.values()
if vpc_end_point_ids:
vpc_end_points = [
vpc_end_point
for vpc_end_point in vpc_end_points
if vpc_end_point.id in vpc_end_point_ids
]
if len(vpc_end_points) != len(vpc_end_point_ids):
invalid_id = list(
set(vpc_end_point_ids).difference(
set([vpc_end_point.id for vpc_end_point in vpc_end_points])
)
)[0]
raise InvalidVpcEndPointIdError(invalid_id)
return generic_filter(filters, vpc_end_points)
def get_vpc_end_point_services(self):
vpc_end_point_services = self.vpc_end_points.values()