diff --git a/app/__init__.py b/app/__init__.py index efa1a6697..d79cb6bde 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -23,6 +23,7 @@ from werkzeug.local import LocalProxy from app.celery.celery import NotifyCelery from app.clients import Clients +from app.clients.cbc_proxy import CBCProxyClient, CBCProxyNoopClient from app.clients.document_download import DocumentDownloadClient from app.clients.email.aws_ses import AwsSesClient from app.clients.email.aws_ses_stub import AwsSesStubClient @@ -60,6 +61,7 @@ zendesk_client = ZendeskClient() statsd_client = StatsdClient() redis_store = RedisClient() performance_platform_client = PerformancePlatformClient() +cbc_proxy_client = CBCProxyNoopClient() document_download_client = DocumentDownloadClient() metrics = GDSMetrics() @@ -112,6 +114,10 @@ def create_app(application): performance_platform_client.init_app(application) document_download_client.init_app(application) + if application.config['CBC_PROXY_AWS_ACCESS_KEY_ID']: + cbc_proxy_client = CBCProxyClient() + cbc_proxy_client.init_app(application) + register_blueprint(application) register_v2_blueprints(application) diff --git a/app/clients/cbc_proxy.py b/app/clients/cbc_proxy.py new file mode 100644 index 000000000..8b8fe436c --- /dev/null +++ b/app/clients/cbc_proxy.py @@ -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 diff --git a/app/config.py b/app/config.py index 7b9981e52..91667bf0f 100644 --- a/app/config.py +++ b/app/config.py @@ -353,6 +353,11 @@ class Config(object): AWS_REGION = 'eu-west-1' + # CBC Proxy + # if the access keys are empty then noop client is used + CBC_PROXY_AWS_ACCESS_KEY_ID = os.environ.get('AWS_ACCESS_KEY_ID', '') + CBC_PROXY_AWS_SECRET_ACCESS_KEY = os.environ.get('AWS_SECRET_ACCESS_KEY', '') + ###################### # Config overrides ###