clients: add cbc proxy clients

We are going to invoke a lambda to send a message to the CBC

We need a CBC Proxy Client to do this

The Client will be able to send/update/cancel broadcasts in the CBC

Unless we have configured the app with AWS credentials for the
CBCProxyClient, we just want to use a client that does nothing: the noop
client

The AWS access keys are separate for the CBC Proxy vs other Notify AWS
things because the CBC Proxy lives in another AWS account

Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk>
Co-authored-by: Pea <pea.tyczynska@digital.cabinet-office.gov.uk>
Co-authored-by: Katie <katie.smith@digital.cabinet-office.gov.uk>
This commit is contained in:
Toby Lorne
2020-10-20 11:18:46 +01:00
parent 05160bc064
commit 33ea75930a
3 changed files with 70 additions and 0 deletions

59
app/clients/cbc_proxy.py Normal file
View File

@@ -0,0 +1,59 @@
# Noop = no operation
class CBCProxyNoopClient:
def init_app(self, app):
pass
def create_and_send_broadcast(
self,
identifier, headline, description,
):
# identifier=broadcast_message.identifier,
# headline="GOV.UK Notify Broadcast",
# description=broadcast_message.description,
pass
# We have not implementated updating a broadcast
def update_and_send_broadcast(
self,
identifier, references, headline, description,
):
pass
# We have not implemented cancelling a broadcast
def cancel_broadcast(
self,
identifier, references, headline, description,
):
pass
class CBCProxyClient:
def init_app(self, app):
self.aws_access_key_id = app.config['CBC_PROXY_AWS_ACCESS_KEY_ID']
self.aws_secret_access_key = app.config['CBC_PROXY_AWS_SECRET_ACCESS_KEY']
self.aws_region = 'eu-west-2'
def create_and_send_broadcast(
self,
identifier, headline, description,
):
# identifier=broadcast_message.identifier,
# headline="GOV.UK Notify Broadcast",
# description=broadcast_message.description,
pass
# We have not implementated updating a broadcast
def update_and_send_broadcast(
self,
identifier, references, headline, description,
):
pass
# We have not implemented cancelling a broadcast
def cancel_broadcast(
self,
identifier, references, headline, description,
):
pass