Add outputs and vpc interfaces to a mediaconnect flow (#4034)

* Add outputs and vpc interfaces to a mediaconnect flow

* Add negative tests for add_flow_outputs and add_flow_vpc_interfaces

* fix: fstring to format

* MediaConnect - add appropriate URLs for ServerMode tests

Co-authored-by: Bert Blommers <info@bertblommers.nl>
This commit is contained in:
Alexandre Blanchet 2021-06-25 16:31:05 +02:00 committed by GitHub
commit 167423777b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 136 additions and 3 deletions

View file

@ -185,6 +185,26 @@ class MediaConnectBackend(BaseBackend):
raise NotFoundException(message="Resource not found.")
return resource.tags
def add_flow_vpc_interfaces(self, flow_arn, vpc_interfaces):
if flow_arn in self._flows:
flow = self._flows[flow_arn]
flow.vpc_interfaces = vpc_interfaces
else:
raise NotFoundException(
message="flow with arn={} not found".format(flow_arn)
)
return flow_arn, flow.vpc_interfaces
def add_flow_outputs(self, flow_arn, outputs):
if flow_arn in self._flows:
flow = self._flows[flow_arn]
flow.outputs = outputs
else:
raise NotFoundException(
message="flow with arn={} not found".format(flow_arn)
)
return flow_arn, flow.outputs
# add methods from here

View file

@ -81,3 +81,21 @@ class MediaConnectResponse(BaseResponse):
resource_arn=resource_arn,
)
return json.dumps(dict(tags=tags))
def add_flow_vpc_interfaces(self):
flow_arn = unquote(self._get_param("flowArn"))
vpc_interfaces = self._get_param("vpcInterfaces")
flow_arn, vpc_interfaces = self.mediaconnect_backend.add_flow_vpc_interfaces(
flow_arn=flow_arn, vpc_interfaces=vpc_interfaces
)
return json.dumps(dict(flow_arn=flow_arn, vpc_interfaces=vpc_interfaces))
def add_flow_outputs(self):
flow_arn = unquote(self._get_param("flowArn"))
outputs = self._get_param("outputs")
flow_arn, outputs = self.mediaconnect_backend.add_flow_outputs(
flow_arn=flow_arn, outputs=outputs
)
return json.dumps(dict(flow_arn=flow_arn, outputs=outputs))
# add methods from here

View file

@ -12,6 +12,8 @@ response = MediaConnectResponse()
url_paths = {
"{0}/v1/flows": response.dispatch,
"{0}/v1/flows/(?P<flowarn>[^/.]+)": response.dispatch,
"{0}/v1/flows/(?P<flowarn>[^/.]+)/vpcInterfaces": response.dispatch,
"{0}/v1/flows/(?P<flowarn>[^/.]+)/outputs": response.dispatch,
"{0}/v1/flows/start/(?P<flowarn>[^/.]+)": response.dispatch,
"{0}/v1/flows/stop/(?P<flowarn>[^/.]+)": response.dispatch,
"{0}/tags/(?P<resourcearn>[^/.]+)": response.dispatch,