feat(events): Add update_connection (#4095)
This commit is contained in:
parent
9d7746b9e3
commit
f849842414
@ -1438,6 +1438,18 @@ class EventsBackend(BaseBackend):
|
||||
self.connections[name] = connection
|
||||
return connection
|
||||
|
||||
def update_connection(self, *, name, **kwargs):
|
||||
connection = self.connections.get(name)
|
||||
if not connection:
|
||||
raise ResourceNotFoundException(
|
||||
"Connection '{}' does not exist.".format(name)
|
||||
)
|
||||
|
||||
for attr, value in kwargs.items():
|
||||
if value is not None and hasattr(connection, attr):
|
||||
setattr(connection, attr, value)
|
||||
return connection.describe_short()
|
||||
|
||||
def list_connections(self):
|
||||
return self.connections.values()
|
||||
|
||||
|
@ -54,7 +54,7 @@ class EventsHandler(BaseResponse):
|
||||
Returns:
|
||||
(str, dict): dumped result and headers
|
||||
"""
|
||||
return json.dumps(result), self.headers
|
||||
return json.dumps(result), self.response_headers
|
||||
|
||||
def error(self, type_, message="", status=400):
|
||||
headers = self.response_headers
|
||||
@ -467,6 +467,16 @@ class EventsHandler(BaseResponse):
|
||||
result = self.events_backend.describe_connection(name)
|
||||
return json.dumps(result), self.response_headers
|
||||
|
||||
def update_connection(self):
|
||||
updates = dict(
|
||||
name=self._get_param("Name"),
|
||||
description=self._get_param("Description"),
|
||||
authorization_type=self._get_param("AuthorizationType"),
|
||||
auth_parameters=self._get_param("AuthParameters"),
|
||||
)
|
||||
result = self.events_backend.update_connection(**updates)
|
||||
return self._create_response(result)
|
||||
|
||||
def delete_connection(self):
|
||||
name = self._get_param("Name")
|
||||
result = self.events_backend.delete_connection(name)
|
||||
|
@ -7,6 +7,7 @@ TestAccAWSCloudWatchDashboard
|
||||
TestAccAWSCloudWatchEventApiDestination
|
||||
TestAccAWSCloudWatchEventArchive
|
||||
TestAccAWSCloudWatchEventBus
|
||||
TestAccAWSCloudWatchEventConnection
|
||||
TestAccAWSCloudwatchLogGroupDataSource
|
||||
TestAccAWSDataSourceCloudwatch
|
||||
TestAccAWSDataSourceElasticBeanstalkHostedZone
|
||||
@ -51,4 +52,4 @@ TestAccAWSSageMakerPrebuiltECRImage
|
||||
TestAccAWSSsmParameterDataSource
|
||||
TestAccAWSUserGroupMembership
|
||||
TestAccAWSUserPolicyAttachment
|
||||
TestAccAWSUserSSHKey
|
||||
TestAccAWSUserSSHKey
|
||||
|
Loading…
Reference in New Issue
Block a user