You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dlab.apache.org by of...@apache.org on 2019/10/15 12:55:06 UTC

[incubator-dlab] 01/01: [DLAB-1138] Added quota for GCP

This is an automated email from the ASF dual-hosted git repository.

ofuks pushed a commit to branch DLAB-1138
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git

commit f6d265984ceeda936708f734666d07e9dc6feb19
Author: Oleh Fuks <ol...@gmail.com>
AuthorDate: Tue Oct 15 15:54:02 2019 +0300

    [DLAB-1138] Added quota for GCP
---
 .../com/epam/dlab/backendapi/modules/GcpSelfServiceModule.java    | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/modules/GcpSelfServiceModule.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/modules/GcpSelfServiceModule.java
index b94afb3..90c3fde 100644
--- a/services/self-service/src/main/java/com/epam/dlab/backendapi/modules/GcpSelfServiceModule.java
+++ b/services/self-service/src/main/java/com/epam/dlab/backendapi/modules/GcpSelfServiceModule.java
@@ -20,11 +20,13 @@
 package com.epam.dlab.backendapi.modules;
 
 import com.epam.dlab.backendapi.SelfServiceApplication;
+import com.epam.dlab.backendapi.annotation.BudgetLimited;
 import com.epam.dlab.backendapi.conf.SelfServiceApplicationConfiguration;
 import com.epam.dlab.backendapi.dao.BillingDAO;
 import com.epam.dlab.backendapi.dao.KeyDAO;
 import com.epam.dlab.backendapi.dao.gcp.GcpBillingDao;
 import com.epam.dlab.backendapi.dao.gcp.GcpKeyDao;
+import com.epam.dlab.backendapi.interceptor.BudgetLimitInterceptor;
 import com.epam.dlab.backendapi.resources.callback.gcp.EdgeCallbackGcp;
 import com.epam.dlab.backendapi.resources.callback.gcp.KeyUploaderCallbackGcp;
 import com.epam.dlab.backendapi.resources.gcp.BillingResourceGcp;
@@ -47,6 +49,9 @@ import org.quartz.Scheduler;
 import org.quartz.SchedulerException;
 import org.quartz.impl.StdSchedulerFactory;
 
+import static com.google.inject.matcher.Matchers.annotatedWith;
+import static com.google.inject.matcher.Matchers.any;
+
 public class GcpSelfServiceModule extends CloudModule {
 
     private static final String MONGO_URI_FORMAT = "mongodb://%s:%s@%s:%d/%s";
@@ -76,6 +81,9 @@ public class GcpSelfServiceModule extends CloudModule {
         bind(BillingDAO.class).to(GcpBillingDao.class);
         bind(SchedulerConfiguration.class).toInstance(
                 new SchedulerConfiguration(SelfServiceApplication.class.getPackage().getName()));
+        final BudgetLimitInterceptor budgetLimitInterceptor = new BudgetLimitInterceptor();
+        requestInjection(budgetLimitInterceptor);
+        bindInterceptor(any(), annotatedWith(BudgetLimited.class), budgetLimitInterceptor);
     }
 
     @Provides


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@dlab.apache.org
For additional commands, e-mail: commits-help@dlab.apache.org