Add support for remove_flow_output and remove_flow_vpc_interface (#4058)
Co-authored-by: Alexandre Blanchet <alexandre.blanchet@m2amedia.tv>
This commit is contained in:
parent
00be464c05
commit
cf5007b97d
5 changed files with 143 additions and 3 deletions
|
|
@ -205,6 +205,34 @@ class MediaConnectBackend(BaseBackend):
|
|||
)
|
||||
return flow_arn, flow.outputs
|
||||
|
||||
def remove_flow_vpc_interface(self, flow_arn, vpc_interface_name):
|
||||
if flow_arn in self._flows:
|
||||
flow = self._flows[flow_arn]
|
||||
flow.vpc_interfaces = [
|
||||
vpc_interface
|
||||
for vpc_interface in self._flows[flow_arn].vpc_interfaces
|
||||
if vpc_interface["name"] != vpc_interface_name
|
||||
]
|
||||
else:
|
||||
raise NotFoundException(
|
||||
message="flow with arn={} not found".format(flow_arn)
|
||||
)
|
||||
return flow_arn, vpc_interface_name
|
||||
|
||||
def remove_flow_output(self, flow_arn, output_name):
|
||||
if flow_arn in self._flows:
|
||||
flow = self._flows[flow_arn]
|
||||
flow.outputs = [
|
||||
output
|
||||
for output in self._flows[flow_arn].outputs
|
||||
if output["name"] != output_name
|
||||
]
|
||||
else:
|
||||
raise NotFoundException(
|
||||
message="flow with arn={} not found".format(flow_arn)
|
||||
)
|
||||
return flow_arn, output_name
|
||||
|
||||
# add methods from here
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -90,6 +90,19 @@ class MediaConnectResponse(BaseResponse):
|
|||
)
|
||||
return json.dumps(dict(flow_arn=flow_arn, vpc_interfaces=vpc_interfaces))
|
||||
|
||||
def remove_flow_vpc_interface(self):
|
||||
flow_arn = unquote(self._get_param("flowArn"))
|
||||
vpc_interface_name = unquote(self._get_param("vpcInterfaceName"))
|
||||
(
|
||||
flow_arn,
|
||||
vpc_interface_name,
|
||||
) = self.mediaconnect_backend.remove_flow_vpc_interface(
|
||||
flow_arn=flow_arn, vpc_interface_name=vpc_interface_name
|
||||
)
|
||||
return json.dumps(
|
||||
dict(flow_arn=flow_arn, vpc_interface_name=vpc_interface_name)
|
||||
)
|
||||
|
||||
def add_flow_outputs(self):
|
||||
flow_arn = unquote(self._get_param("flowArn"))
|
||||
outputs = self._get_param("outputs")
|
||||
|
|
@ -98,4 +111,12 @@ class MediaConnectResponse(BaseResponse):
|
|||
)
|
||||
return json.dumps(dict(flow_arn=flow_arn, outputs=outputs))
|
||||
|
||||
def remove_flow_output(self):
|
||||
flow_arn = unquote(self._get_param("flowArn"))
|
||||
output_name = unquote(self._get_param("outputArn"))
|
||||
flow_arn, output_name = self.mediaconnect_backend.remove_flow_output(
|
||||
flow_arn=flow_arn, output_name=output_name
|
||||
)
|
||||
return json.dumps(dict(flow_arn=flow_arn, output_name=output_name))
|
||||
|
||||
# add methods from here
|
||||
|
|
|
|||
|
|
@ -13,7 +13,9 @@ 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>[^/.]+)/vpcInterfaces/(?P<vpcinterfacename>[^/.]+)": response.dispatch,
|
||||
"{0}/v1/flows/(?P<flowarn>[^/.]+)/outputs": response.dispatch,
|
||||
"{0}/v1/flows/(?P<flowarn>[^/.]+)/outputs/(?P<outputarn>[^/.]+)": response.dispatch,
|
||||
"{0}/v1/flows/start/(?P<flowarn>[^/.]+)": response.dispatch,
|
||||
"{0}/v1/flows/stop/(?P<flowarn>[^/.]+)": response.dispatch,
|
||||
"{0}/tags/(?P<resourcearn>[^/.]+)": response.dispatch,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue