From 36c06a27cc3f7bb6411aec470cba9710bb47aabf Mon Sep 17 00:00:00 2001 From: tharindu1st Date: Thu, 16 Nov 2023 15:41:39 +0530 Subject: [PATCH 1/3] refactoring code --- .../controllers/cp/application_controller.go | 76 +++++++++---------- .../cp/applicationmapping_controller.go | 31 +++----- .../controllers/cp/subscription_controller.go | 42 ++++------ common-controller/internal/server/server.go | 70 +++++++++++++---- .../internal/utils/event_utils.go | 18 ++--- 5 files changed, 123 insertions(+), 114 deletions(-) diff --git a/common-controller/internal/operator/controllers/cp/application_controller.go b/common-controller/internal/operator/controllers/cp/application_controller.go index 7a0fd47c4..a5929d94b 100644 --- a/common-controller/internal/operator/controllers/cp/application_controller.go +++ b/common-controller/internal/operator/controllers/cp/application_controller.go @@ -102,70 +102,64 @@ func (applicationReconciler *ApplicationReconciler) Reconcile(ctx context.Contex if found { utils.SendAppDeletionEvent(applicationKey.Name, applicationSpec) applicationReconciler.ods.DeleteApplicationFromStore(applicationKey) + server.DeleteApplication(applicationKey.Name) } else { - loggers.LoggerAPKOperator.Infof("Application %s/%s does not exist in k8s", applicationKey.Namespace, applicationKey.Name) + loggers.LoggerAPKOperator.Debugf("Application %s/%s does not exist in k8s", applicationKey.Namespace, applicationKey.Name) } } } else { - loggers.LoggerAPKOperator.Infof("Application cr available in k8s") + loggers.LoggerAPKOperator.Debugf("Application cr available in k8s") applicationSpec, found := applicationReconciler.ods.GetApplicationFromStore(applicationKey) if found { // update - loggers.LoggerAPKOperator.Infof("Application in ods") + loggers.LoggerAPKOperator.Debugf("Application in ods") utils.SendAppUpdateEvent(applicationKey.Name, applicationSpec, application.Spec) - } else { - loggers.LoggerAPKOperator.Infof("Application in ods consider as update") + loggers.LoggerAPKOperator.Debugf("Application in ods consider as update") utils.SendAddApplicationEvent(application) } applicationReconciler.ods.AddorUpdateApplicationToStore(applicationKey, application.Spec) + applicationReconciler.sendAppUpdates(application, found) } - sendAppUpdates(applicationList) return ctrl.Result{}, nil } -func sendAppUpdates(applicationList *cpv1alpha2.ApplicationList) { - appList := marshalApplicationList(applicationList.Items) - server.AddApplication(appList) - appKeyMappingList := marshalApplicationKeyMapping(applicationList.Items) - server.AddApplicationKeyMapping(appKeyMappingList) +func (applicationReconciler *ApplicationReconciler) sendAppUpdates(application cpv1alpha2.Application, update bool) { + resolvedApplication := marshalApplication(application) + if update { + server.DeleteApplication(application.Name) + } + server.AddApplication(resolvedApplication) + appKeyMappingList := marshalApplicationKeyMapping(application) + for _, applicationKeyMapping := range appKeyMappingList { + server.AddApplicationKeyMapping(applicationKeyMapping) + } } -func marshalApplicationList(applicationList []cpv1alpha2.Application) server.ApplicationList { - applications := []server.Application{} - for _, appInternal := range applicationList { - app := server.Application{ - UUID: appInternal.Name, - Name: appInternal.Spec.Name, - Owner: appInternal.Spec.Owner, - OrganizationID: appInternal.Spec.Organization, - Attributes: appInternal.Spec.Attributes, - } - applications = append(applications, app) - } - return server.ApplicationList{ - List: applications, +func marshalApplication(application cpv1alpha2.Application) server.Application { + return server.Application{ + UUID: application.Name, + Name: application.Spec.Name, + Owner: application.Spec.Owner, + OrganizationID: application.Spec.Organization, + Attributes: application.Spec.Attributes, } } -func marshalApplicationKeyMapping(applicationList []cpv1alpha2.Application) server.ApplicationKeyMappingList { +func marshalApplicationKeyMapping(appInternal cpv1alpha2.Application) []server.ApplicationKeyMapping { applicationKeyMappings := []server.ApplicationKeyMapping{} - for _, appInternal := range applicationList { - var oauth2SecurityScheme = appInternal.Spec.SecuritySchemes.OAuth2 - if oauth2SecurityScheme != nil { - for _, env := range oauth2SecurityScheme.Environments { - appIdentifier := server.ApplicationKeyMapping{ - ApplicationUUID: appInternal.Name, - SecurityScheme: constants.OAuth2, - ApplicationIdentifier: env.AppID, - KeyType: env.KeyType, - EnvID: env.EnvID, - } - applicationKeyMappings = append(applicationKeyMappings, appIdentifier) + var oauth2SecurityScheme = appInternal.Spec.SecuritySchemes.OAuth2 + if oauth2SecurityScheme != nil { + for _, env := range oauth2SecurityScheme.Environments { + appIdentifier := server.ApplicationKeyMapping{ + ApplicationUUID: appInternal.Name, + SecurityScheme: constants.OAuth2, + ApplicationIdentifier: env.AppID, + KeyType: env.KeyType, + EnvID: env.EnvID, } + applicationKeyMappings = append(applicationKeyMappings, appIdentifier) } } - return server.ApplicationKeyMappingList{ - List: applicationKeyMappings, - } + return applicationKeyMappings } diff --git a/common-controller/internal/operator/controllers/cp/applicationmapping_controller.go b/common-controller/internal/operator/controllers/cp/applicationmapping_controller.go index fc395bc83..69120ae74 100644 --- a/common-controller/internal/operator/controllers/cp/applicationmapping_controller.go +++ b/common-controller/internal/operator/controllers/cp/applicationmapping_controller.go @@ -19,7 +19,6 @@ package cp import ( "context" - "fmt" "github.com/wso2/apk/adapter/pkg/logging" "github.com/wso2/apk/common-controller/internal/cache" @@ -34,7 +33,6 @@ import ( "sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/manager" "sigs.k8s.io/controller-runtime/pkg/predicate" - "sigs.k8s.io/controller-runtime/pkg/reconcile" "sigs.k8s.io/controller-runtime/pkg/source" cpv1alpha2 "github.com/wso2/apk/common-controller/internal/operator/apis/cp/v1alpha2" @@ -87,14 +85,8 @@ func NewApplicationMappingController(mgr manager.Manager, subscriptionStore *cac func (r *ApplicationMappingReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { _ = log.FromContext(ctx) applicationMappingKey := req.NamespacedName - var applicationMappingList = new(cpv1alpha2.ApplicationMappingList) loggers.LoggerAPKOperator.Debugf("Reconciling application mapping: %v", applicationMappingKey.String()) - if err := r.client.List(ctx, applicationMappingList); err != nil { - return reconcile.Result{}, fmt.Errorf("failed to get application mappings %s/%s", - applicationMappingKey.Namespace, applicationMappingKey.Name) - } - sendUpdates(applicationMappingList) var applicationMapping cpv1alpha2.ApplicationMapping if err := r.client.Get(ctx, req.NamespacedName, &applicationMapping); err != nil { if k8error.IsNotFound(err) { @@ -102,33 +94,28 @@ func (r *ApplicationMappingReconciler) Reconcile(ctx context.Context, req ctrl.R if found { utils.SendDeleteApplicationMappingEvent(applicationMappingKey.Name, applicationMapping) r.ods.DeleteApplicationMappingFromStore(applicationMappingKey) + server.DeleteApplicationMapping(applicationMappingKey.Name) } else { loggers.LoggerAPKOperator.Debugf("Application mapping %s/%s not found. Ignoring since object must be deleted", applicationMappingKey.Namespace, applicationMappingKey.Name) } } } else { + sendUpdates(&applicationMapping) utils.SendCreateApplicationMappingEvent(applicationMapping) r.ods.AddorUpdateApplicationMappingToStore(applicationMappingKey, applicationMapping.Spec) } return ctrl.Result{}, nil } -func sendUpdates(applicationMappingList *cpv1alpha2.ApplicationMappingList) { - appMappingList := marshalApplicationMappingList(applicationMappingList.Items) +func sendUpdates(applicationMapping *cpv1alpha2.ApplicationMapping) { + appMappingList := marshalApplicationMapping(applicationMapping) server.AddApplicationMapping(appMappingList) } -func marshalApplicationMappingList(applicationMappingList []cpv1alpha2.ApplicationMapping) server.ApplicationMappingList { - applicationMappings := []server.ApplicationMapping{} - for _, appMappingInternal := range applicationMappingList { - appMapping := server.ApplicationMapping{ - UUID: appMappingInternal.Name, - ApplicationRef: appMappingInternal.Spec.ApplicationRef, - SubscriptionRef: appMappingInternal.Spec.SubscriptionRef, - } - applicationMappings = append(applicationMappings, appMapping) - } - return server.ApplicationMappingList{ - List: applicationMappings, +func marshalApplicationMapping(applicationMapping *cpv1alpha2.ApplicationMapping) server.ApplicationMapping { + return server.ApplicationMapping{ + UUID: applicationMapping.Name, + ApplicationRef: applicationMapping.Spec.ApplicationRef, + SubscriptionRef: applicationMapping.Spec.SubscriptionRef, } } diff --git a/common-controller/internal/operator/controllers/cp/subscription_controller.go b/common-controller/internal/operator/controllers/cp/subscription_controller.go index 2d62c4d1c..eb29003e8 100644 --- a/common-controller/internal/operator/controllers/cp/subscription_controller.go +++ b/common-controller/internal/operator/controllers/cp/subscription_controller.go @@ -19,7 +19,6 @@ package cp import ( "context" - "fmt" "github.com/wso2/apk/adapter/pkg/logging" "github.com/wso2/apk/common-controller/internal/cache" @@ -36,7 +35,6 @@ import ( "sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/manager" "sigs.k8s.io/controller-runtime/pkg/predicate" - "sigs.k8s.io/controller-runtime/pkg/reconcile" "sigs.k8s.io/controller-runtime/pkg/source" cpv1alpha2 "github.com/wso2/apk/common-controller/internal/operator/apis/cp/v1alpha2" @@ -90,12 +88,6 @@ func (subscriptionReconciler *SubscriptionReconciler) Reconcile(ctx context.Cont loggers.LoggerAPKOperator.Debugf("Reconciling subscription: %v", req.NamespacedName.String()) subscriptionKey := req.NamespacedName - var subscriptionList = new(cpv1alpha2.SubscriptionList) - if err := subscriptionReconciler.client.List(ctx, subscriptionList); err != nil { - return reconcile.Result{}, fmt.Errorf("failed to get subscriptions %s/%s", - subscriptionKey.Namespace, subscriptionKey.Name) - } - sendSubUpdates(subscriptionList) var subscription cpv1alpha2.Subscription if err := subscriptionReconciler.client.Get(ctx, req.NamespacedName, &subscription); err != nil { if k8error.IsNotFound(err) { @@ -105,36 +97,34 @@ func (subscriptionReconciler *SubscriptionReconciler) Reconcile(ctx context.Cont loggers.LoggerAPKOperator.Debugf("Subscription %s/%s not found. Ignoring since object must be deleted", subscriptionKey.Namespace, subscriptionKey.Name) utils.SendDeleteSubscriptionEvent(subscriptionKey.Name, subscriptionSpec) subscriptionReconciler.ods.DeleteSubscriptionFromStore(subscriptionKey) + server.DeleteSubscription(subscriptionKey.Name) return ctrl.Result{}, nil } } } else { + sendSubUpdates(subscription) utils.SendAddSubscriptionEvent(subscription) subscriptionReconciler.ods.AddorUpdateSubscriptionToStore(subscriptionKey, subscription.Spec) } return ctrl.Result{}, nil } -func sendSubUpdates(subscriptionsList *cpv1alpha2.SubscriptionList) { - subList := marshalSubscriptionList(subscriptionsList.Items) +func sendSubUpdates(subscription cpv1alpha2.Subscription) { + subList := marshalSubscription(subscription) server.AddSubscription(subList) } -func marshalSubscriptionList(subscriptionList []cpv1alpha2.Subscription) server.SubscriptionList { - subscriptions := []server.Subscription{} - for _, subInternal := range subscriptionList { - subscribedAPI := &server.SubscribedAPI{} - sub := server.Subscription{ - UUID: subInternal.Name, - SubStatus: subInternal.Spec.SubscriptionStatus, - Organization: subInternal.Spec.Organization, - } - if subInternal.Spec.API.Name != "" && subInternal.Spec.API.Version != "" { - subscribedAPI.Name = subInternal.Spec.API.Name - subscribedAPI.Version = subInternal.Spec.API.Version - } - sub.SubscribedAPI = subscribedAPI - subscriptions = append(subscriptions, sub) +func marshalSubscription(subscription cpv1alpha2.Subscription) server.Subscription { + subscribedAPI := &server.SubscribedAPI{} + sub := server.Subscription{ + UUID: subscription.Name, + SubStatus: subscription.Spec.SubscriptionStatus, + Organization: subscription.Spec.Organization, + } + if subscription.Spec.API.Name != "" && subscription.Spec.API.Version != "" { + subscribedAPI.Name = subscription.Spec.API.Name + subscribedAPI.Version = subscription.Spec.API.Version } - return server.SubscriptionList{List: subscriptions} + sub.SubscribedAPI = subscribedAPI + return sub } diff --git a/common-controller/internal/server/server.go b/common-controller/internal/server/server.go index c48081102..659e2ec6c 100644 --- a/common-controller/internal/server/server.go +++ b/common-controller/internal/server/server.go @@ -3,31 +3,48 @@ package server import ( "fmt" "net/http" + "strings" "github.com/gin-gonic/gin" "github.com/wso2/apk/common-controller/internal/config" ) -var applicationList = ApplicationList{List: []Application{}} -var subscriptionList = SubscriptionList{List: []Subscription{}} -var applicationMappingList = ApplicationMappingList{List: []ApplicationMapping{}} -var applicationKeyMappingList = ApplicationKeyMappingList{List: []ApplicationKeyMapping{}} +var applicationMap = make(map[string]Application) +var subscriptionMap = make(map[string]Subscription) +var applicationMappingMap = make(map[string]ApplicationMapping) +var applicationKeyMappingMap = make(map[string]ApplicationKeyMapping) // StartInternalServer starts the internal server func StartInternalServer() { r := gin.Default() r.GET("/applications", func(c *gin.Context) { - c.JSON(http.StatusOK, applicationList) + applicationList := []Application{} + for _, application := range applicationMap { + applicationList = append(applicationList, application) + } + c.JSON(http.StatusOK, ApplicationList{List: applicationList}) }) r.GET("/subscriptions", func(c *gin.Context) { - c.JSON(http.StatusOK, subscriptionList) + subscriptionList := []Subscription{} + for _, subscription := range subscriptionMap { + subscriptionList = append(subscriptionList, subscription) + } + c.JSON(http.StatusOK, SubscriptionList{List: subscriptionList}) }) r.GET("/applicationmappings", func(c *gin.Context) { - c.JSON(http.StatusOK, applicationMappingList) + applicationMappingList := []ApplicationMapping{} + for _, applicationMapping := range applicationMappingMap { + applicationMappingList = append(applicationMappingList, applicationMapping) + } + c.JSON(http.StatusOK, ApplicationMappingList{List: applicationMappingList}) }) r.GET("/applicationkeymappings", func(c *gin.Context) { - c.JSON(http.StatusOK, applicationKeyMappingList) + applicationKeyMappingList := []ApplicationKeyMapping{} + for _, applicationKeyMapping := range applicationKeyMappingMap { + applicationKeyMappingList = append(applicationKeyMappingList, applicationKeyMapping) + } + c.JSON(http.StatusOK, ApplicationKeyMappingList{List: applicationKeyMappingList}) }) gin.SetMode(gin.ReleaseMode) conf := config.ReadConfigs() @@ -38,21 +55,42 @@ func StartInternalServer() { } // AddApplication adds an application to the application list -func AddApplication(appList ApplicationList) { - applicationList = appList +func AddApplication(application Application) { + applicationMap[application.UUID] = application } // AddSubscription adds a subscription to the subscription list -func AddSubscription(subList SubscriptionList) { - subscriptionList = subList +func AddSubscription(subscription Subscription) { + subscriptionMap[subscription.UUID] = subscription } // AddApplicationMapping adds an application mapping to the application mapping list -func AddApplicationMapping(appMappingList ApplicationMappingList) { - applicationMappingList = appMappingList +func AddApplicationMapping(applicationMapping ApplicationMapping) { + applicationMappingMap[applicationMapping.UUID] = applicationMapping } // AddApplicationKeyMapping adds an application key mapping to the application key mapping list -func AddApplicationKeyMapping(appKeyMappingList ApplicationKeyMappingList) { - applicationKeyMappingList = appKeyMappingList +func AddApplicationKeyMapping(applicationKeyMapping ApplicationKeyMapping) { + applicationMappingKey := strings.Join([]string{applicationKeyMapping.ApplicationUUID, applicationKeyMapping.EnvID, applicationKeyMapping.SecurityScheme, applicationKeyMapping.KeyType}, ":") + applicationKeyMappingMap[applicationMappingKey] = applicationKeyMapping +} + +// DeleteApplication deletes an application from the application list +func DeleteApplication(applicationUUID string) { + delete(applicationMap, applicationUUID) + for key := range applicationKeyMappingMap { + if strings.HasPrefix(key, applicationUUID) { + delete(applicationKeyMappingMap, key) + } + } +} + +// DeleteSubscription deletes a subscription from the subscription list +func DeleteSubscription(subscriptionUUID string) { + delete(subscriptionMap, subscriptionUUID) +} + +// DeleteApplicationMapping deletes an application mapping from the application mapping list +func DeleteApplicationMapping(applicationMappingUUID string) { + delete(applicationMappingMap, applicationMappingUUID) } diff --git a/common-controller/internal/utils/event_utils.go b/common-controller/internal/utils/event_utils.go index 68fe3f495..6d4fa5fab 100644 --- a/common-controller/internal/utils/event_utils.go +++ b/common-controller/internal/utils/event_utils.go @@ -16,7 +16,7 @@ func SendAppDeletionEvent(applicationUUID string, applicationSpec cpv1alpha2.App currentTime := time.Now() milliseconds := currentTime.UnixNano() / int64(time.Millisecond) event := subscription.Event{ - Uuid: applicationUUID, + Uuid: uuid.New().String(), Type: constants.ApplicationDeleted, TimeStamp: milliseconds, Application: &subscription.Application{ @@ -35,7 +35,7 @@ func SendAppUpdateEvent(applicationUUID string, oldApplicationSpec cpv1alpha2.Ap currentTime := time.Now() milliseconds := currentTime.UnixNano() / int64(time.Millisecond) event := subscription.Event{ - Uuid: applicationUUID, + Uuid: uuid.New().String(), Type: constants.ApplicationUpdated, TimeStamp: milliseconds, Application: &subscription.Application{ @@ -57,7 +57,7 @@ func SendAddApplicationEvent(application cpv1alpha2.Application) { currentTime := time.Now() milliseconds := currentTime.UnixNano() / int64(time.Millisecond) event := subscription.Event{ - Uuid: application.ObjectMeta.Name, + Uuid: uuid.New().String(), Type: constants.ApplicationCreated, TimeStamp: milliseconds, Application: &subscription.Application{ @@ -77,7 +77,7 @@ func SendAddSubscriptionEvent(sub cpv1alpha2.Subscription) { currentTime := time.Now() milliseconds := currentTime.UnixNano() / int64(time.Millisecond) event := subscription.Event{ - Uuid: sub.ObjectMeta.Name, + Uuid: uuid.New().String(), Type: constants.SubscriptionCreated, TimeStamp: milliseconds, Subscription: &subscription.Subscription{ @@ -102,7 +102,7 @@ func SendDeleteSubscriptionEvent(subscriptionUUID string, subscriptionSpec cpv1a Type: constants.SubscriptionDeleted, TimeStamp: milliseconds, Subscription: &subscription.Subscription{ - Uuid: subscriptionUUID, + Uuid: uuid.New().String(), SubStatus: subscriptionSpec.SubscriptionStatus, Organization: subscriptionSpec.Organization, SubscribedApi: &subscription.SubscribedAPI{ @@ -119,7 +119,7 @@ func SendCreateApplicationMappingEvent(applicationMapping cpv1alpha2.Application currentTime := time.Now() milliseconds := currentTime.UnixNano() / int64(time.Millisecond) event := subscription.Event{ - Uuid: applicationMapping.ObjectMeta.Name, + Uuid: uuid.New().String(), Type: constants.ApplicationMappingCreated, TimeStamp: milliseconds, ApplicationMapping: &subscription.ApplicationMapping{ @@ -136,7 +136,7 @@ func SendDeleteApplicationMappingEvent(applicationMappingUUID string, applicatio currentTime := time.Now() milliseconds := currentTime.UnixNano() / int64(time.Millisecond) event := subscription.Event{ - Uuid: applicationMappingUUID, + Uuid: uuid.New().String(), Type: constants.ApplicationMappingDeleted, TimeStamp: milliseconds, ApplicationMapping: &subscription.ApplicationMapping{ @@ -154,7 +154,7 @@ func sendDeleteApplicationKeyMappingEvent(applicationUUID string, applicationKey if oauth2SecurityScheme != nil { for _, env := range oauth2SecurityScheme.Environments { event := subscription.Event{ - Uuid: applicationUUID, + Uuid: uuid.New().String(), Type: constants.ApplicationKeyMappingDeleted, TimeStamp: milliseconds, ApplicationKeyMapping: &subscription.ApplicationKeyMapping{ @@ -176,7 +176,7 @@ func sendApplicationKeyMappingEvent(applicationUUID string, applicationSpec cpv1 if oauth2SecurityScheme != nil { for _, env := range oauth2SecurityScheme.Environments { event := subscription.Event{ - Uuid: applicationUUID, + Uuid: uuid.New().String(), Type: constants.ApplicationKeyMappingCreated, TimeStamp: milliseconds, ApplicationKeyMapping: &subscription.ApplicationKeyMapping{ From fdcb398f74db84c3dd131bca9fbc17e3089100f2 Mon Sep 17 00:00:00 2001 From: tharindu1st Date: Thu, 16 Nov 2023 15:43:50 +0530 Subject: [PATCH 2/3] refactoring code --- .../controllers/cp/application_controller.go | 13 +++---------- common-controller/internal/utils/event_utils.go | 7 ++++--- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/common-controller/internal/operator/controllers/cp/application_controller.go b/common-controller/internal/operator/controllers/cp/application_controller.go index a5929d94b..04e09cac3 100644 --- a/common-controller/internal/operator/controllers/cp/application_controller.go +++ b/common-controller/internal/operator/controllers/cp/application_controller.go @@ -19,7 +19,6 @@ package cp import ( "context" - "fmt" "github.com/wso2/apk/adapter/pkg/logging" "github.com/wso2/apk/common-controller/internal/cache" @@ -37,7 +36,6 @@ import ( "sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/manager" "sigs.k8s.io/controller-runtime/pkg/predicate" - "sigs.k8s.io/controller-runtime/pkg/reconcile" "sigs.k8s.io/controller-runtime/pkg/source" ) @@ -86,19 +84,14 @@ func NewApplicationController(mgr manager.Manager, subscriptionStore *cache.Subs func (applicationReconciler *ApplicationReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { _ = log.FromContext(ctx) applicationKey := req.NamespacedName - var applicationList = new(cpv1alpha2.ApplicationList) - loggers.LoggerAPKOperator.Infof("Reconciling application: %v", applicationKey.String()) - if err := applicationReconciler.client.List(ctx, applicationList); err != nil { - return reconcile.Result{}, fmt.Errorf("failed to get applications %s/%s", - applicationKey.Namespace, applicationKey.Name) - } + loggers.LoggerAPKOperator.Debugf("Reconciling application: %v", applicationKey.String()) var application cpv1alpha2.Application if err := applicationReconciler.client.Get(ctx, req.NamespacedName, &application); err != nil { if k8error.IsNotFound(err) { applicationSpec, found := applicationReconciler.ods.GetApplicationFromStore(applicationKey) - loggers.LoggerAPKOperator.Infof("Application cr not available in k8s") - loggers.LoggerAPKOperator.Infof("cached Application spec: %v,%v", applicationSpec, found) + loggers.LoggerAPKOperator.Debugf("Application cr not available in k8s") + loggers.LoggerAPKOperator.Debugf("cached Application spec: %v,%v", applicationSpec, found) if found { utils.SendAppDeletionEvent(applicationKey.Name, applicationSpec) applicationReconciler.ods.DeleteApplicationFromStore(applicationKey) diff --git a/common-controller/internal/utils/event_utils.go b/common-controller/internal/utils/event_utils.go index 6d4fa5fab..a1c34501d 100644 --- a/common-controller/internal/utils/event_utils.go +++ b/common-controller/internal/utils/event_utils.go @@ -46,7 +46,7 @@ func SendAppUpdateEvent(applicationUUID string, oldApplicationSpec cpv1alpha2.Ap Attributes: newApplicationSpec.Attributes, }, } - loggers.LoggerAPKOperator.Infof("Sending event to all clients: %v", &event) + loggers.LoggerAPKOperator.Debugf("Sending event to all clients: %v", &event) sendEvent(&event) sendDeleteApplicationKeyMappingEvent(applicationUUID, oldApplicationSpec) sendApplicationKeyMappingEvent(applicationUUID, newApplicationSpec) @@ -192,13 +192,13 @@ func sendApplicationKeyMappingEvent(applicationUUID string, applicationSpec cpv1 } } func sendEvent(event *subscription.Event) { - loggers.LoggerAPKOperator.Infof("Sending event to all clients: %v", event) + loggers.LoggerAPKOperator.Debugf("Sending event to all clients: %v", event) for clientID, stream := range GetAllClientConnections() { err := stream.Send(event) if err != nil { loggers.LoggerAPKOperator.Errorf("Error sending event to client %s: %v", clientID, err) } else { - loggers.LoggerAPKOperator.Infof("Event sent to client %s", clientID) + loggers.LoggerAPKOperator.Debugf("Event sent to client %s", clientID) } } } @@ -213,5 +213,6 @@ func SendInitialEvent(srv apkmgt.EventStreamService_StreamEventsServer) { Type: constants.AllEvnts, TimeStamp: milliseconds, } + loggers.LoggerAPKOperator.Debugf("Sending initial event to client: %v", &event) srv.Send(&event) } From 852c59bfb42b9cae9288a61150de1b79b0c428ca Mon Sep 17 00:00:00 2001 From: tharindu1st Date: Fri, 24 Nov 2023 00:13:41 +0530 Subject: [PATCH 3/3] refactor subscription data --- .../service/subscription/apids.proto | 18 - .../wso2/discovery/subscription/api.proto | 27 - .../discovery/subscription/api_list.proto | 17 - .../application_key_mapping.proto | 1 + .../subscription/applicationmapping.proto | 1 + adapter/internal/adapter/adapter.go | 1 - adapter/internal/discovery/xds/marshaller.go | 112 - adapter/internal/discovery/xds/server.go | 37 +- .../service/subscription/apids.pb.go | 207 -- .../api/wso2/discovery/subscription/api.pb.go | 259 --- .../discovery/subscription/api_list.pb.go | 161 -- .../application_key_mapping.pb.go | 34 +- .../subscription/applicationmapping.pb.go | 47 +- .../discovery/protocol/cache/v3/resource.go | 2 - .../discovery/protocol/server/v3/server.go | 9 +- .../commoncontroller/common_controller.go | 8 +- common-controller/go.mod | 18 +- common-controller/go.sum | 36 +- .../controllers/cp/application_controller.go | 1 + .../cp/applicationmapping_controller.go | 162 +- .../server/application_key_mapping.go | 1 + .../server/application_mapping_types.go | 1 + .../internal/server/event_server.go | 16 +- .../internal/utils/event_utils.go | 4 +- common-controller/internal/utils/utils.go | 13 +- .../enforcer/analytics/AnalyticsUtils.java | 16 +- .../ChoreoFaultAnalyticsProvider.java | 5 +- .../org/wso2/apk/enforcer/api/RestAPI.java | 69 +- .../discovery/ApiListDiscoveryClient.java | 203 -- .../discovery/JWTIssuerDiscoveryClient.java | 37 +- .../apk/enforcer/discovery/api/Scopes.java | 622 ------ .../discovery/api/ScopesOrBuilder.java | 34 - .../enforcer/discovery/api/SecurityList.java | 713 ------ .../discovery/api/SecurityListOrBuilder.java | 43 - .../discovery/api/SecurityScheme.java | 1091 ---------- .../api/SecuritySchemeOrBuilder.java | 89 - .../discovery/api/SecuritySchemeProto.java | 90 - .../scheduler/XdsSchedulerManager.java | 17 - .../service/subscription/ApiListDSProto.java | 47 - .../subscription/ApiListDiscoveryService.java | 241 --- .../ApiListDiscoveryServiceGrpc.java | 287 --- .../service/subscription/AppDSProto.java | 47 - .../subscription/AppKeyMappingDSProto.java | 48 - .../subscription/AppMappingDSProto.java | 48 - .../subscription/AppPolicyDSProto.java | 48 - .../ApplicationDiscoveryService.java | 241 --- .../ApplicationDiscoveryServiceGrpc.java | 287 --- ...ApplicationKeyMappingDiscoveryService.java | 241 --- ...icationKeyMappingDiscoveryServiceGrpc.java | 287 --- .../ApplicationMappingDiscoveryService.java | 241 --- ...pplicationMappingDiscoveryServiceGrpc.java | 287 --- .../ApplicationPolicyDiscoveryService.java | 241 --- ...ApplicationPolicyDiscoveryServiceGrpc.java | 287 --- .../subscription/EventServiceProto.java | 58 - .../subscription/EventStreamService.java | 241 --- .../subscription/EventStreamServiceGrpc.java | 296 --- .../service/subscription/Request.java | 557 ----- .../subscription/RequestOrBuilder.java | 21 - .../service/subscription/SdsProto.java | 47 - .../subscription/SubPolicyDSProto.java | 48 - .../SubscriptionDiscoveryService.java | 241 --- .../SubscriptionDiscoveryServiceGrpc.java | 287 --- .../SubscriptionPolicyDiscoveryService.java | 241 --- ...ubscriptionPolicyDiscoveryServiceGrpc.java | 287 --- .../discovery/subscription/APIList.java | 778 ------- .../subscription/APIListOrBuilder.java | 33 - .../discovery/subscription/APIListProto.java | 56 - .../enforcer/discovery/subscription/APIs.java | 1922 ----------------- .../discovery/subscription/APIsOrBuilder.java | 138 -- .../discovery/subscription/APIsProto.java | 60 - .../subscription/ApplicationKeyMapping.java | 138 ++ .../ApplicationKeyMappingOrBuilder.java | 12 + .../ApplicationKeyMappingProto.java | 14 +- .../subscription/ApplicationMapping.java | 138 ++ .../ApplicationMappingOrBuilder.java | 12 + .../subscription/ApplicationMappingProto.java | 14 +- .../enforcer/dto/APIKeyValidationInfoDTO.java | 95 +- .../enforcer/models/ApplicationMapping.java | 38 +- .../apk/enforcer/security/KeyValidator.java | 153 +- .../security/jwt/APIKeyAuthenticator.java | 3 +- .../jwt/InternalAPIKeyAuthenticator.java | 22 - .../security/jwt/JWTAuthenticator.java | 27 +- .../jwt/UnsecuredAPIAuthenticator.java | 17 +- .../security/jwt/validator/JWTValidator.java | 2 +- .../wso2/apk/enforcer/server/AuthServer.java | 11 +- .../ApplicationKeyMappingDTO.java | 12 + .../subscription/ApplicationMappingDto.java | 11 + .../subscription/EventingGrpcClient.java | 15 +- .../subscription/SubscriptionDataHolder.java | 16 +- .../subscription/SubscriptionDataStore.java | 24 +- .../SubscriptionDataStoreImpl.java | 224 +- .../SubscriptionDataStoreUtil.java | 160 ++ .../org/wso2/apk/enforcer/util/GRPCUtils.java | 2 + .../apk/enforcer/jwt/JWTValidatorTest.java | 111 +- .../adapter/adapter-service.yaml | 3 + helm-charts/values.yaml | 4 +- test/k8s-resources/gw-interceptor.yaml | 4 +- 97 files changed, 1118 insertions(+), 12575 deletions(-) delete mode 100644 adapter/api/proto/wso2/discovery/service/subscription/apids.proto delete mode 100644 adapter/api/proto/wso2/discovery/subscription/api.proto delete mode 100644 adapter/api/proto/wso2/discovery/subscription/api_list.proto delete mode 100644 adapter/pkg/discovery/api/wso2/discovery/service/subscription/apids.pb.go delete mode 100644 adapter/pkg/discovery/api/wso2/discovery/subscription/api.pb.go delete mode 100644 adapter/pkg/discovery/api/wso2/discovery/subscription/api_list.pb.go delete mode 100644 gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/ApiListDiscoveryClient.java delete mode 100644 gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/api/Scopes.java delete mode 100644 gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/api/ScopesOrBuilder.java delete mode 100644 gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/api/SecurityList.java delete mode 100644 gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/api/SecurityListOrBuilder.java delete mode 100644 gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/api/SecurityScheme.java delete mode 100644 gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/api/SecuritySchemeOrBuilder.java delete mode 100644 gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/api/SecuritySchemeProto.java delete mode 100644 gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/ApiListDSProto.java delete mode 100644 gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/ApiListDiscoveryService.java delete mode 100644 gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/ApiListDiscoveryServiceGrpc.java delete mode 100644 gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/AppDSProto.java delete mode 100644 gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/AppKeyMappingDSProto.java delete mode 100644 gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/AppMappingDSProto.java delete mode 100644 gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/AppPolicyDSProto.java delete mode 100644 gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/ApplicationDiscoveryService.java delete mode 100644 gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/ApplicationDiscoveryServiceGrpc.java delete mode 100644 gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/ApplicationKeyMappingDiscoveryService.java delete mode 100644 gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/ApplicationKeyMappingDiscoveryServiceGrpc.java delete mode 100644 gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/ApplicationMappingDiscoveryService.java delete mode 100644 gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/ApplicationMappingDiscoveryServiceGrpc.java delete mode 100644 gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/ApplicationPolicyDiscoveryService.java delete mode 100644 gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/ApplicationPolicyDiscoveryServiceGrpc.java delete mode 100644 gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/EventServiceProto.java delete mode 100644 gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/EventStreamService.java delete mode 100644 gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/EventStreamServiceGrpc.java delete mode 100644 gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/Request.java delete mode 100644 gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/RequestOrBuilder.java delete mode 100644 gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/SdsProto.java delete mode 100644 gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/SubPolicyDSProto.java delete mode 100644 gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/SubscriptionDiscoveryService.java delete mode 100644 gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/SubscriptionDiscoveryServiceGrpc.java delete mode 100644 gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/SubscriptionPolicyDiscoveryService.java delete mode 100644 gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/SubscriptionPolicyDiscoveryServiceGrpc.java delete mode 100644 gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/APIList.java delete mode 100644 gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/APIListOrBuilder.java delete mode 100644 gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/APIListProto.java delete mode 100644 gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/APIs.java delete mode 100644 gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/APIsOrBuilder.java delete mode 100644 gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/APIsProto.java diff --git a/adapter/api/proto/wso2/discovery/service/subscription/apids.proto b/adapter/api/proto/wso2/discovery/service/subscription/apids.proto deleted file mode 100644 index 2afbac165..000000000 --- a/adapter/api/proto/wso2/discovery/service/subscription/apids.proto +++ /dev/null @@ -1,18 +0,0 @@ -syntax = "proto3"; - -package discovery.service.subscription; - -import "envoy/service/discovery/v3/discovery.proto"; - -option go_package = "github.com/envoyproxy/go-control-plane/wso2/discovery/service/subscription"; -option java_package = "org.wso2.apk.enforcer.discovery.service.subscription"; -option java_outer_classname = "ApiListDSProto"; -option java_multiple_files = true; -option java_generic_services = true; - -// [#protodoc-title: ApiListDS] -service ApiListDiscoveryService { - rpc StreamApiList(stream envoy.service.discovery.v3.DiscoveryRequest) - returns (stream envoy.service.discovery.v3.DiscoveryResponse) { - } -} diff --git a/adapter/api/proto/wso2/discovery/subscription/api.proto b/adapter/api/proto/wso2/discovery/subscription/api.proto deleted file mode 100644 index e9d4e26c6..000000000 --- a/adapter/api/proto/wso2/discovery/subscription/api.proto +++ /dev/null @@ -1,27 +0,0 @@ -syntax = "proto3"; - -package wso2.discovery.subscription; - -import "wso2/discovery/subscription/url_mapping.proto"; - -option go_package = "github.com/envoyproxy/go-control-plane/wso2/discovery/subscription;subscription"; -option java_package = "org.wso2.apk.enforcer.discovery.subscription"; -option java_outer_classname = "APIsProto"; -option java_multiple_files = true; - -// [#protodoc-title: APIs] - -// APIs data model -message APIs { - string apiId = 1; - string name = 2; - string provider = 3; - string version = 4; - string basePath = 5; - string policy = 6; - string apiType = 7; - bool isDefaultVersion = 8; - URLMapping urlMappings = 9; - string uuid = 10; - string lcState = 11; -} diff --git a/adapter/api/proto/wso2/discovery/subscription/api_list.proto b/adapter/api/proto/wso2/discovery/subscription/api_list.proto deleted file mode 100644 index b2ff16d8e..000000000 --- a/adapter/api/proto/wso2/discovery/subscription/api_list.proto +++ /dev/null @@ -1,17 +0,0 @@ -syntax = "proto3"; - -package wso2.discovery.subscription; - -import "wso2/discovery/subscription/api.proto"; - -option go_package = "github.com/envoyproxy/go-control-plane/wso2/discovery/subscription;subscription"; -option java_package = "org.wso2.apk.enforcer.discovery.subscription"; -option java_outer_classname = "APIListProto"; -option java_multiple_files = true; - -// [#protodoc-title: APIList] - -// APIList data model -message APIList { - repeated APIs list = 2; -} diff --git a/adapter/api/proto/wso2/discovery/subscription/application_key_mapping.proto b/adapter/api/proto/wso2/discovery/subscription/application_key_mapping.proto index 03459771d..6f124e7cd 100644 --- a/adapter/api/proto/wso2/discovery/subscription/application_key_mapping.proto +++ b/adapter/api/proto/wso2/discovery/subscription/application_key_mapping.proto @@ -33,4 +33,5 @@ message ApplicationKeyMapping { string keyType = 4; string envID = 5; int64 timestamp = 6; + string organization = 7; } diff --git a/adapter/api/proto/wso2/discovery/subscription/applicationmapping.proto b/adapter/api/proto/wso2/discovery/subscription/applicationmapping.proto index 2c217c79e..5ae10010b 100644 --- a/adapter/api/proto/wso2/discovery/subscription/applicationmapping.proto +++ b/adapter/api/proto/wso2/discovery/subscription/applicationmapping.proto @@ -30,4 +30,5 @@ message ApplicationMapping { string uuid = 1; string applicationRef = 2; string subscriptionRef = 3; + string organization = 4; } diff --git a/adapter/internal/adapter/adapter.go b/adapter/internal/adapter/adapter.go index 7330f0835..08ba6d809 100644 --- a/adapter/internal/adapter/adapter.go +++ b/adapter/internal/adapter/adapter.go @@ -118,7 +118,6 @@ func runManagementServer(conf *config.Config, server xdsv3.Server, enforcerServe discoveryv3.RegisterAggregatedDiscoveryServiceServer(grpcServer, server) configservice.RegisterConfigDiscoveryServiceServer(grpcServer, enforcerServer) apiservice.RegisterApiDiscoveryServiceServer(grpcServer, enforcerServer) - subscriptionservice.RegisterApiListDiscoveryServiceServer(grpcServer, enforcerAPIDsSrv) subscriptionservice.RegisterJWTIssuerDiscoveryServiceServer(grpcServer, enforcerJwtIssuerDsSrv) // register health service healthservice.RegisterHealthServer(grpcServer, &health.Server{}) diff --git a/adapter/internal/discovery/xds/marshaller.go b/adapter/internal/discovery/xds/marshaller.go index fac287266..f9430295b 100644 --- a/adapter/internal/discovery/xds/marshaller.go +++ b/adapter/internal/discovery/xds/marshaller.go @@ -18,18 +18,8 @@ package xds import ( - "strconv" - "github.com/wso2/apk/adapter/config" - logger "github.com/wso2/apk/adapter/internal/loggers" "github.com/wso2/apk/adapter/pkg/discovery/api/wso2/discovery/config/enforcer" - "github.com/wso2/apk/adapter/pkg/discovery/api/wso2/discovery/subscription" - "github.com/wso2/apk/adapter/pkg/eventhub/types" -) - -var ( - // APIListMap has the following mapping label -> apiUUID -> API (Metadata) - APIListMap map[string]map[string]*subscription.APIs ) // EventType is a enum to distinguish Create, Update and Delete Events @@ -174,105 +164,3 @@ func marshalAnalyticsPublishers(config config.Config) []*enforcer.AnalyticsPubli } return resolvedAnalyticsPublishers } - -// marshalAPIListMapToList converts the data into APIList proto type -func marshalAPIListMapToList(apiMap map[string]*subscription.APIs) *subscription.APIList { - apis := []*subscription.APIs{} - for _, api := range apiMap { - apis = append(apis, api) - } - - return &subscription.APIList{ - List: apis, - } -} - -// MarshalAPIMetataAndReturnList updates the internal APIListMap and returns the XDS compatible APIList. -// apiList is the internal APIList object (For single API, this would contain a List with just one API) -// initialAPIUUIDListMap is assigned during startup when global adapter is associated. This would be empty otherwise. -// gatewayLabel is the environment. -func MarshalAPIMetataAndReturnList(apiList *types.APIList, initialAPIUUIDListMap map[string]int, gatewayLabel string) *subscription.APIList { - - if APIListMap == nil { - APIListMap = make(map[string]map[string]*subscription.APIs) - } - // var resourceMapForLabel map[string]*subscription.APIs - if _, ok := APIListMap[gatewayLabel]; !ok { - APIListMap[gatewayLabel] = make(map[string]*subscription.APIs) - } - resourceMapForLabel := APIListMap[gatewayLabel] - for item := range apiList.List { - api := apiList.List[item] - // initialAPIUUIDListMap is not null if the adapter is running with global adapter enabled, and it is - // the first method invocation. - if initialAPIUUIDListMap != nil { - if _, ok := initialAPIUUIDListMap[api.UUID]; !ok { - continue - } - } - newAPI := marshalAPIMetadata(&api) - resourceMapForLabel[api.UUID] = newAPI - } - return marshalAPIListMapToList(resourceMapForLabel) -} - -// DeleteAPIAndReturnList removes the API from internal maps and returns the marshalled API List. -// If the apiUUID is not found in the internal map under the provided environment, then it would return a -// nil value. Hence it is required to check if the return value is nil, prior to updating the XDS cache. -func DeleteAPIAndReturnList(apiUUID, organizationUUID string, gatewayLabel string) *subscription.APIList { - if _, ok := APIListMap[gatewayLabel]; !ok { - logger.LoggerXds.Debugf("No API Metadata is available under gateway Environment : %s", gatewayLabel) - return nil - } - delete(APIListMap[gatewayLabel], apiUUID) - return marshalAPIListMapToList(APIListMap[gatewayLabel]) -} - -// MarshalAPIForLifeCycleChangeEventAndReturnList updates the internal map's API instances lifecycle state only if -// stored API Instance's or input status event is a blocked event. -// If no change is applied, it would return nil. Hence the XDS cache should not be updated. -func MarshalAPIForLifeCycleChangeEventAndReturnList(apiUUID, status, gatewayLabel string) *subscription.APIList { - if _, ok := APIListMap[gatewayLabel]; !ok { - logger.LoggerXds.Debugf("No API Metadata is available under gateway Environment : %s", gatewayLabel) - return nil - } - if _, ok := APIListMap[gatewayLabel][apiUUID]; !ok { - logger.LoggerXds.Debugf("No API Metadata for API ID: %s is available under gateway Environment : %s", - apiUUID, gatewayLabel) - return nil - } - storedAPILCState := APIListMap[gatewayLabel][apiUUID].LcState - - // Because the adapter only required to update the XDS if it is related to blocked state. - if !(storedAPILCState == blockedStatus || status == blockedStatus) { - return nil - } - APIListMap[gatewayLabel][apiUUID].LcState = status - return marshalAPIListMapToList(APIListMap[gatewayLabel]) -} - -func marshalAPIMetadata(api *types.API) *subscription.APIs { - return &subscription.APIs{ - ApiId: strconv.Itoa(api.APIID), - Name: api.Name, - Provider: api.Provider, - Version: api.Version, - BasePath: api.BasePath, - Policy: api.Policy, - ApiType: api.APIType, - Uuid: api.UUID, - IsDefaultVersion: api.IsDefaultVersion, - LcState: api.APIStatus, - } -} - -// CheckIfAPIMetadataIsAlreadyAvailable returns true only if the API Metadata for the given API UUID -// is already available -func CheckIfAPIMetadataIsAlreadyAvailable(apiUUID, label string) bool { - if _, labelAvailable := APIListMap[label]; labelAvailable { - if _, apiAvailale := APIListMap[label][apiUUID]; apiAvailale { - return true - } - } - return false -} diff --git a/adapter/internal/discovery/xds/server.go b/adapter/internal/discovery/xds/server.go index 0cc2d476f..dafea55f5 100644 --- a/adapter/internal/discovery/xds/server.go +++ b/adapter/internal/discovery/xds/server.go @@ -47,7 +47,6 @@ import ( "github.com/wso2/apk/adapter/internal/oasparser/envoyconf" "github.com/wso2/apk/adapter/internal/oasparser/model" operatorconsts "github.com/wso2/apk/adapter/internal/operator/constants" - disc_api "github.com/wso2/apk/adapter/pkg/discovery/api/wso2/discovery/api" "github.com/wso2/apk/adapter/pkg/discovery/api/wso2/discovery/subscription" wso2_cache "github.com/wso2/apk/adapter/pkg/discovery/protocol/cache/v3" wso2_resource "github.com/wso2/apk/adapter/pkg/discovery/protocol/resource/v3" @@ -326,6 +325,7 @@ func updateXdsCacheOnAPIChange(oldLabels []string, newLabels []string) bool { for _, oldLabel := range oldLabels { if !stringutils.StringInSlice(oldLabel, newLabels) { listeners, clusters, routes, endpoints, apis := GenerateEnvoyResoucesForGateway(oldLabel) + GenerateEnvoyResoucesForGateway(oldLabel) UpdateEnforcerApis(oldLabel, apis, "") UpdateXdsCacheWithLock(oldLabel, endpoints, clusters, routes, listeners) logger.LoggerXds.Debugf("Xds Cache is updated for the already existing label : %v", oldLabel) @@ -533,22 +533,6 @@ func UpdateEnforcerApis(label string, apis []types.Resource, version string) { } logger.LoggerXds.Infof("New API cache update for the label: " + label + " version: " + fmt.Sprint(version)) - subAPIs := []*subscription.APIs{} - for _, api := range apis { - subAPI := subscription.APIs{} - subAPI.ApiId = api.(*disc_api.Api).GetId() - subAPI.Name = api.(*disc_api.Api).GetTitle() - subAPI.Version = api.(*disc_api.Api).GetVersion() - subAPI.BasePath = api.(*disc_api.Api).GetBasePath() - subAPI.Policy = api.(*disc_api.Api).GetTier() - subAPI.ApiType = api.(*disc_api.Api).GetApiType() - subAPI.Uuid = api.(*disc_api.Api).GetId() - subAPIs = append(subAPIs, &subAPI) - } - subAPIList := &subscription.APIList{ - List: subAPIs, - } - UpdateEnforcerAPIList(label, subAPIList) } // UpdateEnforcerJWTIssuers sets new update to the enforcer's Applications @@ -571,25 +555,6 @@ func UpdateEnforcerJWTIssuers(jwtIssuers *subscription.JWTIssuerList) { logger.LoggerXds.Infof("New JWTIssuer cache update for the label: " + label + " version: " + fmt.Sprint(version)) } -// UpdateEnforcerAPIList sets new update to the enforcer's Apis -func UpdateEnforcerAPIList(label string, apis *subscription.APIList) { - logger.LoggerXds.Debugf("Updating Enforcer API Cache") - apiList := append(enforcerLabelMap[label].apiList, apis) - - version, _ := crand.Int(crand.Reader, maxRandomBigInt()) - snap, _ := wso2_cache.NewSnapshot(fmt.Sprint(version), map[wso2_resource.Type][]types.Resource{ - wso2_resource.APIListType: apiList, - }) - snap.Consistent() - - errSetSnap := enforcerAPICache.SetSnapshot(context.Background(), label, snap) - if errSetSnap != nil { - logger.LoggerXds.ErrorC(logging.PrintError(logging.Error1414, logging.MAJOR, "Error while setting the snapshot : %v", errSetSnap.Error())) - } - enforcerLabelMap[label].apiList = apiList - logger.LoggerXds.Infof("New API List cache update for the label: " + label + " version: " + fmt.Sprint(version)) -} - // UpdateXdsCacheWithLock uses mutex and lock to avoid different go routines updating XDS at the same time func UpdateXdsCacheWithLock(label string, endpoints []types.Resource, clusters []types.Resource, routes []types.Resource, listeners []types.Resource) bool { diff --git a/adapter/pkg/discovery/api/wso2/discovery/service/subscription/apids.pb.go b/adapter/pkg/discovery/api/wso2/discovery/service/subscription/apids.pb.go deleted file mode 100644 index d41ecea0d..000000000 --- a/adapter/pkg/discovery/api/wso2/discovery/service/subscription/apids.pb.go +++ /dev/null @@ -1,207 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.25.0-devel -// protoc v3.13.0 -// source: wso2/discovery/service/subscription/apids.proto - -package subscription - -import ( - context "context" - v3 "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -var File_wso2_discovery_service_subscription_apids_proto protoreflect.FileDescriptor - -var file_wso2_discovery_service_subscription_apids_proto_rawDesc = []byte{ - 0x0a, 0x2f, 0x77, 0x73, 0x6f, 0x32, 0x2f, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, - 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x61, 0x70, 0x69, 0x64, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x12, 0x1e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x73, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x2e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x1a, 0x2a, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x2f, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2f, 0x76, 0x33, 0x2f, 0x64, 0x69, - 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x8d, 0x01, - 0x0a, 0x17, 0x41, 0x70, 0x69, 0x4c, 0x69, 0x73, 0x74, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, - 0x72, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x72, 0x0a, 0x0d, 0x53, 0x74, 0x72, - 0x65, 0x61, 0x6d, 0x41, 0x70, 0x69, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x2c, 0x2e, 0x65, 0x6e, 0x76, - 0x6f, 0x79, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, - 0x76, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x33, 0x2e, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, - 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2d, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, - 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, - 0x72, 0x79, 0x2e, 0x76, 0x33, 0x2e, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x28, 0x01, 0x30, 0x01, 0x42, 0x97, 0x01, - 0x0a, 0x34, 0x6f, 0x72, 0x67, 0x2e, 0x77, 0x73, 0x6f, 0x32, 0x2e, 0x61, 0x70, 0x6b, 0x2e, 0x65, - 0x6e, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x72, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, - 0x79, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, - 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0e, 0x41, 0x70, 0x69, 0x4c, 0x69, 0x73, 0x74, 0x44, - 0x53, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x4a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, - 0x67, 0x6f, 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2d, 0x70, 0x6c, 0x61, 0x6e, 0x65, - 0x2f, 0x77, 0x73, 0x6f, 0x32, 0x2f, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2f, - 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x88, 0x01, 0x01, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var file_wso2_discovery_service_subscription_apids_proto_goTypes = []interface{}{ - (*v3.DiscoveryRequest)(nil), // 0: envoy.service.discovery.v3.DiscoveryRequest - (*v3.DiscoveryResponse)(nil), // 1: envoy.service.discovery.v3.DiscoveryResponse -} -var file_wso2_discovery_service_subscription_apids_proto_depIdxs = []int32{ - 0, // 0: discovery.service.subscription.ApiListDiscoveryService.StreamApiList:input_type -> envoy.service.discovery.v3.DiscoveryRequest - 1, // 1: discovery.service.subscription.ApiListDiscoveryService.StreamApiList:output_type -> envoy.service.discovery.v3.DiscoveryResponse - 1, // [1:2] is the sub-list for method output_type - 0, // [0:1] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_wso2_discovery_service_subscription_apids_proto_init() } -func file_wso2_discovery_service_subscription_apids_proto_init() { - if File_wso2_discovery_service_subscription_apids_proto != nil { - return - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_wso2_discovery_service_subscription_apids_proto_rawDesc, - NumEnums: 0, - NumMessages: 0, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_wso2_discovery_service_subscription_apids_proto_goTypes, - DependencyIndexes: file_wso2_discovery_service_subscription_apids_proto_depIdxs, - }.Build() - File_wso2_discovery_service_subscription_apids_proto = out.File - file_wso2_discovery_service_subscription_apids_proto_rawDesc = nil - file_wso2_discovery_service_subscription_apids_proto_goTypes = nil - file_wso2_discovery_service_subscription_apids_proto_depIdxs = nil -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConnInterface - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion6 - -// ApiListDiscoveryServiceClient is the client API for ApiListDiscoveryService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type ApiListDiscoveryServiceClient interface { - StreamApiList(ctx context.Context, opts ...grpc.CallOption) (ApiListDiscoveryService_StreamApiListClient, error) -} - -type apiListDiscoveryServiceClient struct { - cc grpc.ClientConnInterface -} - -func NewApiListDiscoveryServiceClient(cc grpc.ClientConnInterface) ApiListDiscoveryServiceClient { - return &apiListDiscoveryServiceClient{cc} -} - -func (c *apiListDiscoveryServiceClient) StreamApiList(ctx context.Context, opts ...grpc.CallOption) (ApiListDiscoveryService_StreamApiListClient, error) { - stream, err := c.cc.NewStream(ctx, &_ApiListDiscoveryService_serviceDesc.Streams[0], "/discovery.service.subscription.ApiListDiscoveryService/StreamApiList", opts...) - if err != nil { - return nil, err - } - x := &apiListDiscoveryServiceStreamApiListClient{stream} - return x, nil -} - -type ApiListDiscoveryService_StreamApiListClient interface { - Send(*v3.DiscoveryRequest) error - Recv() (*v3.DiscoveryResponse, error) - grpc.ClientStream -} - -type apiListDiscoveryServiceStreamApiListClient struct { - grpc.ClientStream -} - -func (x *apiListDiscoveryServiceStreamApiListClient) Send(m *v3.DiscoveryRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *apiListDiscoveryServiceStreamApiListClient) Recv() (*v3.DiscoveryResponse, error) { - m := new(v3.DiscoveryResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -// ApiListDiscoveryServiceServer is the server API for ApiListDiscoveryService service. -type ApiListDiscoveryServiceServer interface { - StreamApiList(ApiListDiscoveryService_StreamApiListServer) error -} - -// UnimplementedApiListDiscoveryServiceServer can be embedded to have forward compatible implementations. -type UnimplementedApiListDiscoveryServiceServer struct { -} - -func (*UnimplementedApiListDiscoveryServiceServer) StreamApiList(ApiListDiscoveryService_StreamApiListServer) error { - return status.Errorf(codes.Unimplemented, "method StreamApiList not implemented") -} - -func RegisterApiListDiscoveryServiceServer(s *grpc.Server, srv ApiListDiscoveryServiceServer) { - s.RegisterService(&_ApiListDiscoveryService_serviceDesc, srv) -} - -func _ApiListDiscoveryService_StreamApiList_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(ApiListDiscoveryServiceServer).StreamApiList(&apiListDiscoveryServiceStreamApiListServer{stream}) -} - -type ApiListDiscoveryService_StreamApiListServer interface { - Send(*v3.DiscoveryResponse) error - Recv() (*v3.DiscoveryRequest, error) - grpc.ServerStream -} - -type apiListDiscoveryServiceStreamApiListServer struct { - grpc.ServerStream -} - -func (x *apiListDiscoveryServiceStreamApiListServer) Send(m *v3.DiscoveryResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *apiListDiscoveryServiceStreamApiListServer) Recv() (*v3.DiscoveryRequest, error) { - m := new(v3.DiscoveryRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -var _ApiListDiscoveryService_serviceDesc = grpc.ServiceDesc{ - ServiceName: "discovery.service.subscription.ApiListDiscoveryService", - HandlerType: (*ApiListDiscoveryServiceServer)(nil), - Methods: []grpc.MethodDesc{}, - Streams: []grpc.StreamDesc{ - { - StreamName: "StreamApiList", - Handler: _ApiListDiscoveryService_StreamApiList_Handler, - ServerStreams: true, - ClientStreams: true, - }, - }, - Metadata: "wso2/discovery/service/subscription/apids.proto", -} diff --git a/adapter/pkg/discovery/api/wso2/discovery/subscription/api.pb.go b/adapter/pkg/discovery/api/wso2/discovery/subscription/api.pb.go deleted file mode 100644 index bac1257fe..000000000 --- a/adapter/pkg/discovery/api/wso2/discovery/subscription/api.pb.go +++ /dev/null @@ -1,259 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.25.0-devel -// protoc v3.13.0 -// source: wso2/discovery/subscription/api.proto - -package subscription - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// APIs data model -type APIs struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ApiId string `protobuf:"bytes,1,opt,name=apiId,proto3" json:"apiId,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - Provider string `protobuf:"bytes,3,opt,name=provider,proto3" json:"provider,omitempty"` - Version string `protobuf:"bytes,4,opt,name=version,proto3" json:"version,omitempty"` - BasePath string `protobuf:"bytes,5,opt,name=basePath,proto3" json:"basePath,omitempty"` - Policy string `protobuf:"bytes,6,opt,name=policy,proto3" json:"policy,omitempty"` - ApiType string `protobuf:"bytes,7,opt,name=apiType,proto3" json:"apiType,omitempty"` - IsDefaultVersion bool `protobuf:"varint,8,opt,name=isDefaultVersion,proto3" json:"isDefaultVersion,omitempty"` - UrlMappings *URLMapping `protobuf:"bytes,9,opt,name=urlMappings,proto3" json:"urlMappings,omitempty"` - Uuid string `protobuf:"bytes,10,opt,name=uuid,proto3" json:"uuid,omitempty"` - LcState string `protobuf:"bytes,11,opt,name=lcState,proto3" json:"lcState,omitempty"` -} - -func (x *APIs) Reset() { - *x = APIs{} - if protoimpl.UnsafeEnabled { - mi := &file_wso2_discovery_subscription_api_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *APIs) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*APIs) ProtoMessage() {} - -func (x *APIs) ProtoReflect() protoreflect.Message { - mi := &file_wso2_discovery_subscription_api_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use APIs.ProtoReflect.Descriptor instead. -func (*APIs) Descriptor() ([]byte, []int) { - return file_wso2_discovery_subscription_api_proto_rawDescGZIP(), []int{0} -} - -func (x *APIs) GetApiId() string { - if x != nil { - return x.ApiId - } - return "" -} - -func (x *APIs) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *APIs) GetProvider() string { - if x != nil { - return x.Provider - } - return "" -} - -func (x *APIs) GetVersion() string { - if x != nil { - return x.Version - } - return "" -} - -func (x *APIs) GetBasePath() string { - if x != nil { - return x.BasePath - } - return "" -} - -func (x *APIs) GetPolicy() string { - if x != nil { - return x.Policy - } - return "" -} - -func (x *APIs) GetApiType() string { - if x != nil { - return x.ApiType - } - return "" -} - -func (x *APIs) GetIsDefaultVersion() bool { - if x != nil { - return x.IsDefaultVersion - } - return false -} - -func (x *APIs) GetUrlMappings() *URLMapping { - if x != nil { - return x.UrlMappings - } - return nil -} - -func (x *APIs) GetUuid() string { - if x != nil { - return x.Uuid - } - return "" -} - -func (x *APIs) GetLcState() string { - if x != nil { - return x.LcState - } - return "" -} - -var File_wso2_discovery_subscription_api_proto protoreflect.FileDescriptor - -var file_wso2_discovery_subscription_api_proto_rawDesc = []byte{ - 0x0a, 0x25, 0x77, 0x73, 0x6f, 0x32, 0x2f, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, - 0x2f, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x61, 0x70, - 0x69, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1b, 0x77, 0x73, 0x6f, 0x32, 0x2e, 0x64, 0x69, - 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x2d, 0x77, 0x73, 0x6f, 0x32, 0x2f, 0x64, 0x69, 0x73, 0x63, 0x6f, - 0x76, 0x65, 0x72, 0x79, 0x2f, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x2f, 0x75, 0x72, 0x6c, 0x5f, 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x22, 0xd9, 0x02, 0x0a, 0x04, 0x41, 0x50, 0x49, 0x73, 0x12, 0x14, 0x0a, 0x05, - 0x61, 0x70, 0x69, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x70, 0x69, - 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, - 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, - 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, - 0x62, 0x61, 0x73, 0x65, 0x50, 0x61, 0x74, 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, - 0x62, 0x61, 0x73, 0x65, 0x50, 0x61, 0x74, 0x68, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x6f, 0x6c, 0x69, - 0x63, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, - 0x12, 0x18, 0x0a, 0x07, 0x61, 0x70, 0x69, 0x54, 0x79, 0x70, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x07, 0x61, 0x70, 0x69, 0x54, 0x79, 0x70, 0x65, 0x12, 0x2a, 0x0a, 0x10, 0x69, 0x73, - 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x08, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x69, 0x73, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x56, - 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x49, 0x0a, 0x0b, 0x75, 0x72, 0x6c, 0x4d, 0x61, 0x70, - 0x70, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x77, 0x73, - 0x6f, 0x32, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x73, 0x75, 0x62, - 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x55, 0x52, 0x4c, 0x4d, 0x61, 0x70, - 0x70, 0x69, 0x6e, 0x67, 0x52, 0x0b, 0x75, 0x72, 0x6c, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, - 0x73, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x75, 0x69, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x75, 0x75, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x6c, 0x63, 0x53, 0x74, 0x61, 0x74, 0x65, - 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6c, 0x63, 0x53, 0x74, 0x61, 0x74, 0x65, 0x42, - 0x8c, 0x01, 0x0a, 0x2c, 0x6f, 0x72, 0x67, 0x2e, 0x77, 0x73, 0x6f, 0x32, 0x2e, 0x61, 0x70, 0x6b, - 0x2e, 0x65, 0x6e, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x72, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, - 0x65, 0x72, 0x79, 0x2e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x42, 0x09, 0x41, 0x50, 0x49, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x4f, 0x67, - 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, - 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x67, 0x6f, 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2d, - 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x77, 0x73, 0x6f, 0x32, 0x2f, 0x64, 0x69, 0x73, 0x63, 0x6f, - 0x76, 0x65, 0x72, 0x79, 0x2f, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x3b, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_wso2_discovery_subscription_api_proto_rawDescOnce sync.Once - file_wso2_discovery_subscription_api_proto_rawDescData = file_wso2_discovery_subscription_api_proto_rawDesc -) - -func file_wso2_discovery_subscription_api_proto_rawDescGZIP() []byte { - file_wso2_discovery_subscription_api_proto_rawDescOnce.Do(func() { - file_wso2_discovery_subscription_api_proto_rawDescData = protoimpl.X.CompressGZIP(file_wso2_discovery_subscription_api_proto_rawDescData) - }) - return file_wso2_discovery_subscription_api_proto_rawDescData -} - -var file_wso2_discovery_subscription_api_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_wso2_discovery_subscription_api_proto_goTypes = []interface{}{ - (*APIs)(nil), // 0: wso2.discovery.subscription.APIs - (*URLMapping)(nil), // 1: wso2.discovery.subscription.URLMapping -} -var file_wso2_discovery_subscription_api_proto_depIdxs = []int32{ - 1, // 0: wso2.discovery.subscription.APIs.urlMappings:type_name -> wso2.discovery.subscription.URLMapping - 1, // [1:1] is the sub-list for method output_type - 1, // [1:1] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name -} - -func init() { file_wso2_discovery_subscription_api_proto_init() } -func file_wso2_discovery_subscription_api_proto_init() { - if File_wso2_discovery_subscription_api_proto != nil { - return - } - file_wso2_discovery_subscription_url_mapping_proto_init() - if !protoimpl.UnsafeEnabled { - file_wso2_discovery_subscription_api_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*APIs); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_wso2_discovery_subscription_api_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_wso2_discovery_subscription_api_proto_goTypes, - DependencyIndexes: file_wso2_discovery_subscription_api_proto_depIdxs, - MessageInfos: file_wso2_discovery_subscription_api_proto_msgTypes, - }.Build() - File_wso2_discovery_subscription_api_proto = out.File - file_wso2_discovery_subscription_api_proto_rawDesc = nil - file_wso2_discovery_subscription_api_proto_goTypes = nil - file_wso2_discovery_subscription_api_proto_depIdxs = nil -} diff --git a/adapter/pkg/discovery/api/wso2/discovery/subscription/api_list.pb.go b/adapter/pkg/discovery/api/wso2/discovery/subscription/api_list.pb.go deleted file mode 100644 index f60bbc061..000000000 --- a/adapter/pkg/discovery/api/wso2/discovery/subscription/api_list.pb.go +++ /dev/null @@ -1,161 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.25.0-devel -// protoc v3.13.0 -// source: wso2/discovery/subscription/api_list.proto - -package subscription - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// APIList data model -type APIList struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - List []*APIs `protobuf:"bytes,2,rep,name=list,proto3" json:"list,omitempty"` -} - -func (x *APIList) Reset() { - *x = APIList{} - if protoimpl.UnsafeEnabled { - mi := &file_wso2_discovery_subscription_api_list_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *APIList) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*APIList) ProtoMessage() {} - -func (x *APIList) ProtoReflect() protoreflect.Message { - mi := &file_wso2_discovery_subscription_api_list_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use APIList.ProtoReflect.Descriptor instead. -func (*APIList) Descriptor() ([]byte, []int) { - return file_wso2_discovery_subscription_api_list_proto_rawDescGZIP(), []int{0} -} - -func (x *APIList) GetList() []*APIs { - if x != nil { - return x.List - } - return nil -} - -var File_wso2_discovery_subscription_api_list_proto protoreflect.FileDescriptor - -var file_wso2_discovery_subscription_api_list_proto_rawDesc = []byte{ - 0x0a, 0x2a, 0x77, 0x73, 0x6f, 0x32, 0x2f, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, - 0x2f, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x61, 0x70, - 0x69, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1b, 0x77, 0x73, - 0x6f, 0x32, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x73, 0x75, 0x62, - 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x25, 0x77, 0x73, 0x6f, 0x32, 0x2f, - 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2f, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, - 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x22, 0x40, 0x0a, 0x07, 0x41, 0x50, 0x49, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x35, 0x0a, 0x04, 0x6c, - 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x77, 0x73, 0x6f, 0x32, - 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x73, 0x75, 0x62, 0x73, 0x63, - 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x41, 0x50, 0x49, 0x73, 0x52, 0x04, 0x6c, 0x69, - 0x73, 0x74, 0x42, 0x8f, 0x01, 0x0a, 0x2c, 0x6f, 0x72, 0x67, 0x2e, 0x77, 0x73, 0x6f, 0x32, 0x2e, - 0x61, 0x70, 0x6b, 0x2e, 0x65, 0x6e, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x72, 0x2e, 0x64, 0x69, 0x73, - 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x42, 0x0c, 0x41, 0x50, 0x49, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x72, 0x6f, 0x74, - 0x6f, 0x50, 0x01, 0x5a, 0x4f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, - 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x67, 0x6f, 0x2d, 0x63, 0x6f, - 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2d, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x77, 0x73, 0x6f, 0x32, - 0x2f, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2f, 0x73, 0x75, 0x62, 0x73, 0x63, - 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_wso2_discovery_subscription_api_list_proto_rawDescOnce sync.Once - file_wso2_discovery_subscription_api_list_proto_rawDescData = file_wso2_discovery_subscription_api_list_proto_rawDesc -) - -func file_wso2_discovery_subscription_api_list_proto_rawDescGZIP() []byte { - file_wso2_discovery_subscription_api_list_proto_rawDescOnce.Do(func() { - file_wso2_discovery_subscription_api_list_proto_rawDescData = protoimpl.X.CompressGZIP(file_wso2_discovery_subscription_api_list_proto_rawDescData) - }) - return file_wso2_discovery_subscription_api_list_proto_rawDescData -} - -var file_wso2_discovery_subscription_api_list_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_wso2_discovery_subscription_api_list_proto_goTypes = []interface{}{ - (*APIList)(nil), // 0: wso2.discovery.subscription.APIList - (*APIs)(nil), // 1: wso2.discovery.subscription.APIs -} -var file_wso2_discovery_subscription_api_list_proto_depIdxs = []int32{ - 1, // 0: wso2.discovery.subscription.APIList.list:type_name -> wso2.discovery.subscription.APIs - 1, // [1:1] is the sub-list for method output_type - 1, // [1:1] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name -} - -func init() { file_wso2_discovery_subscription_api_list_proto_init() } -func file_wso2_discovery_subscription_api_list_proto_init() { - if File_wso2_discovery_subscription_api_list_proto != nil { - return - } - file_wso2_discovery_subscription_api_proto_init() - if !protoimpl.UnsafeEnabled { - file_wso2_discovery_subscription_api_list_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*APIList); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_wso2_discovery_subscription_api_list_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_wso2_discovery_subscription_api_list_proto_goTypes, - DependencyIndexes: file_wso2_discovery_subscription_api_list_proto_depIdxs, - MessageInfos: file_wso2_discovery_subscription_api_list_proto_msgTypes, - }.Build() - File_wso2_discovery_subscription_api_list_proto = out.File - file_wso2_discovery_subscription_api_list_proto_rawDesc = nil - file_wso2_discovery_subscription_api_list_proto_goTypes = nil - file_wso2_discovery_subscription_api_list_proto_depIdxs = nil -} diff --git a/adapter/pkg/discovery/api/wso2/discovery/subscription/application_key_mapping.pb.go b/adapter/pkg/discovery/api/wso2/discovery/subscription/application_key_mapping.pb.go index 21a914365..84cd52c21 100644 --- a/adapter/pkg/discovery/api/wso2/discovery/subscription/application_key_mapping.pb.go +++ b/adapter/pkg/discovery/api/wso2/discovery/subscription/application_key_mapping.pb.go @@ -48,6 +48,7 @@ type ApplicationKeyMapping struct { KeyType string `protobuf:"bytes,4,opt,name=keyType,proto3" json:"keyType,omitempty"` EnvID string `protobuf:"bytes,5,opt,name=envID,proto3" json:"envID,omitempty"` Timestamp int64 `protobuf:"varint,6,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + Organization string `protobuf:"bytes,7,opt,name=organization,proto3" json:"organization,omitempty"` } func (x *ApplicationKeyMapping) Reset() { @@ -124,6 +125,13 @@ func (x *ApplicationKeyMapping) GetTimestamp() int64 { return 0 } +func (x *ApplicationKeyMapping) GetOrganization() string { + if x != nil { + return x.Organization + } + return "" +} + var File_wso2_discovery_subscription_application_key_mapping_proto protoreflect.FileDescriptor var file_wso2_discovery_subscription_application_key_mapping_proto_rawDesc = []byte{ @@ -132,7 +140,7 @@ var file_wso2_discovery_subscription_application_key_mapping_proto_rawDesc = []b 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1b, 0x77, 0x73, 0x6f, 0x32, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x73, 0x75, 0x62, 0x73, - 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xed, 0x01, 0x0a, 0x15, 0x41, 0x70, 0x70, + 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x91, 0x02, 0x0a, 0x15, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x12, 0x28, 0x0a, 0x0f, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x55, 0x55, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x61, 0x70, 0x70, @@ -147,17 +155,19 @@ var file_wso2_discovery_subscription_application_key_mapping_proto_rawDesc = []b 0x54, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6e, 0x76, 0x49, 0x44, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6e, 0x76, 0x49, 0x44, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, - 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, 0x97, 0x01, 0x0a, 0x2c, 0x6f, 0x72, 0x67, - 0x2e, 0x77, 0x73, 0x6f, 0x32, 0x2e, 0x61, 0x70, 0x6b, 0x2e, 0x65, 0x6e, 0x66, 0x6f, 0x72, 0x63, - 0x65, 0x72, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x73, 0x75, 0x62, - 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x1a, 0x41, 0x70, 0x70, 0x6c, 0x69, - 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, - 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x49, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, - 0x63, 0x6f, 0x6d, 0x2f, 0x77, 0x73, 0x6f, 0x32, 0x2f, 0x61, 0x70, 0x6b, 0x2f, 0x61, 0x64, 0x61, - 0x70, 0x74, 0x65, 0x72, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, - 0x72, 0x79, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x77, 0x73, 0x6f, 0x32, 0x2f, 0x64, 0x69, 0x73, 0x63, - 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2f, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x22, 0x0a, 0x0c, 0x6f, 0x72, 0x67, 0x61, + 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, + 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x97, 0x01, 0x0a, + 0x2c, 0x6f, 0x72, 0x67, 0x2e, 0x77, 0x73, 0x6f, 0x32, 0x2e, 0x61, 0x70, 0x6b, 0x2e, 0x65, 0x6e, + 0x66, 0x6f, 0x72, 0x63, 0x65, 0x72, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, + 0x2e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x1a, 0x41, + 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x4d, 0x61, 0x70, + 0x70, 0x69, 0x6e, 0x67, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x49, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x77, 0x73, 0x6f, 0x32, 0x2f, 0x61, 0x70, 0x6b, + 0x2f, 0x61, 0x64, 0x61, 0x70, 0x74, 0x65, 0x72, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x64, 0x69, 0x73, + 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x77, 0x73, 0x6f, 0x32, 0x2f, + 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2f, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/adapter/pkg/discovery/api/wso2/discovery/subscription/applicationmapping.pb.go b/adapter/pkg/discovery/api/wso2/discovery/subscription/applicationmapping.pb.go index 3eb0e4da9..3fc571044 100644 --- a/adapter/pkg/discovery/api/wso2/discovery/subscription/applicationmapping.pb.go +++ b/adapter/pkg/discovery/api/wso2/discovery/subscription/applicationmapping.pb.go @@ -45,6 +45,7 @@ type ApplicationMapping struct { Uuid string `protobuf:"bytes,1,opt,name=uuid,proto3" json:"uuid,omitempty"` ApplicationRef string `protobuf:"bytes,2,opt,name=applicationRef,proto3" json:"applicationRef,omitempty"` SubscriptionRef string `protobuf:"bytes,3,opt,name=subscriptionRef,proto3" json:"subscriptionRef,omitempty"` + Organization string `protobuf:"bytes,4,opt,name=organization,proto3" json:"organization,omitempty"` } func (x *ApplicationMapping) Reset() { @@ -100,6 +101,13 @@ func (x *ApplicationMapping) GetSubscriptionRef() string { return "" } +func (x *ApplicationMapping) GetOrganization() string { + if x != nil { + return x.Organization + } + return "" +} + var File_wso2_discovery_subscription_applicationmapping_proto protoreflect.FileDescriptor var file_wso2_discovery_subscription_applicationmapping_proto_rawDesc = []byte{ @@ -108,24 +116,27 @@ var file_wso2_discovery_subscription_applicationmapping_proto_rawDesc = []byte{ 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1b, 0x77, 0x73, 0x6f, 0x32, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x22, 0x7a, 0x0a, 0x12, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x75, 0x69, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x75, 0x75, 0x69, 0x64, 0x12, 0x26, 0x0a, - 0x0e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x66, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x52, 0x65, 0x66, 0x12, 0x28, 0x0a, 0x0f, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x66, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, - 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x66, 0x42, - 0x94, 0x01, 0x0a, 0x2c, 0x6f, 0x72, 0x67, 0x2e, 0x77, 0x73, 0x6f, 0x32, 0x2e, 0x61, 0x70, 0x6b, - 0x2e, 0x65, 0x6e, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x72, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, - 0x65, 0x72, 0x79, 0x2e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x42, 0x17, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x61, 0x70, - 0x70, 0x69, 0x6e, 0x67, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x49, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x77, 0x73, 0x6f, 0x32, 0x2f, 0x61, 0x70, 0x6b, - 0x2f, 0x61, 0x64, 0x61, 0x70, 0x74, 0x65, 0x72, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x64, 0x69, 0x73, - 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x77, 0x73, 0x6f, 0x32, 0x2f, - 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2f, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, - 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x69, 0x6f, 0x6e, 0x22, 0x9e, 0x01, 0x0a, 0x12, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x75, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x75, 0x75, 0x69, 0x64, 0x12, 0x26, + 0x0a, 0x0e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x66, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x66, 0x12, 0x28, 0x0a, 0x0f, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x66, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0f, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x66, + 0x12, 0x22, 0x0a, 0x0c, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x94, 0x01, 0x0a, 0x2c, 0x6f, 0x72, 0x67, 0x2e, 0x77, 0x73, 0x6f, + 0x32, 0x2e, 0x61, 0x70, 0x6b, 0x2e, 0x65, 0x6e, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x72, 0x2e, 0x64, + 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x17, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, + 0x5a, 0x49, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x77, 0x73, 0x6f, + 0x32, 0x2f, 0x61, 0x70, 0x6b, 0x2f, 0x61, 0x64, 0x61, 0x70, 0x74, 0x65, 0x72, 0x2f, 0x70, 0x6b, + 0x67, 0x2f, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2f, 0x61, 0x70, 0x69, 0x2f, + 0x77, 0x73, 0x6f, 0x32, 0x2f, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2f, 0x73, + 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( diff --git a/adapter/pkg/discovery/protocol/cache/v3/resource.go b/adapter/pkg/discovery/protocol/cache/v3/resource.go index 526b4bff5..d786b5ad0 100644 --- a/adapter/pkg/discovery/protocol/cache/v3/resource.go +++ b/adapter/pkg/discovery/protocol/cache/v3/resource.go @@ -78,8 +78,6 @@ func GetResourceName(res envoy_types.Resource) string { return "Config" case *subscription.JWTIssuerList: return "JWTIssuer" - case *subscription.APIList: - return "APIList" case *subscription.Application: return fmt.Sprint(v.Uuid) case *subscription.Subscription: diff --git a/adapter/pkg/discovery/protocol/server/v3/server.go b/adapter/pkg/discovery/protocol/server/v3/server.go index 1332178d9..5824c78c9 100644 --- a/adapter/pkg/discovery/protocol/server/v3/server.go +++ b/adapter/pkg/discovery/protocol/server/v3/server.go @@ -37,7 +37,6 @@ import ( type Server interface { config.ConfigDiscoveryServiceServer api.ApiDiscoveryServiceServer - subscription.ApiListDiscoveryServiceServer subscription.JWTIssuerDiscoveryServiceServer rest.Server envoy_sotw.Server @@ -59,7 +58,6 @@ type server struct { config.UnimplementedConfigDiscoveryServiceServer api.UnimplementedApiDiscoveryServiceServer subscription.UnimplementedJWTIssuerDiscoveryServiceServer - subscription.UnimplementedApiListDiscoveryServiceServer rest rest.Server sotw envoy_sotw.Server delta envoy_delta.Server @@ -77,12 +75,7 @@ func (s *server) StreamApis(stream api.ApiDiscoveryService_StreamApisServer) err return s.StreamHandler(stream, resource.APIType) } - -func (s *server) StreamApiList(stream subscription.ApiListDiscoveryService_StreamApiListServer) error { - return s.StreamHandler(stream, resource.APIListType) -} - -func (s *server)StreamJWTIssuers(stream subscription.JWTIssuerDiscoveryService_StreamJWTIssuersServer) error { + func (s *server)StreamJWTIssuers(stream subscription.JWTIssuerDiscoveryService_StreamJWTIssuersServer) error { return s.StreamHandler(stream, resource.JWTIssuerListType) } diff --git a/common-controller/commoncontroller/common_controller.go b/common-controller/commoncontroller/common_controller.go index 6021488d5..1093b4c22 100644 --- a/common-controller/commoncontroller/common_controller.go +++ b/common-controller/commoncontroller/common_controller.go @@ -145,7 +145,13 @@ func runRatelimitServer(rlsServer xdsv3.Server) { func runCommonEnforcerServer(Port uint) { var grpcOptions []grpc.ServerOption - grpcOptions = append(grpcOptions, grpc.MaxConcurrentStreams(grpcMaxConcurrentStreams)) + grpcOptions = append(grpcOptions, grpc.KeepaliveParams( + keepalive.ServerParameters{ + Time: time.Duration(5 * time.Minute), + Timeout: time.Duration(20 * time.Second), + }), + grpc.MaxConcurrentStreams(grpcMaxConcurrentStreams), + ) publicKeyLocation, privateKeyLocation, truststoreLocation := utils.GetKeyLocations() cert, err := utils.GetServerCertificate(publicKeyLocation, privateKeyLocation) diff --git a/common-controller/go.mod b/common-controller/go.mod index f13833977..6b6004480 100644 --- a/common-controller/go.mod +++ b/common-controller/go.mod @@ -19,7 +19,7 @@ require ( github.com/redis/go-redis/v9 v9.2.1 github.com/wso2/apk/adapter v0.0.0-20230811031118-fa0d1ec8848c golang.org/x/exp v0.0.0-20230801115018-d63ba01acd4b - google.golang.org/grpc v1.57.0 + google.golang.org/grpc v1.58.3 ) replace github.com/wso2/apk/adapter => ../adapter @@ -42,7 +42,7 @@ require ( github.com/twitchyliquid64/golang-asm v0.15.1 // indirect github.com/ugorji/go/codec v1.2.11 // indirect golang.org/x/arch v0.3.0 // indirect - golang.org/x/crypto v0.9.0 // indirect + golang.org/x/crypto v0.11.0 // indirect ) require ( @@ -52,7 +52,7 @@ require ( github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/emicklei/go-restful/v3 v3.9.0 // indirect - github.com/envoyproxy/protoc-gen-validate v1.0.1 // indirect + github.com/envoyproxy/protoc-gen-validate v1.0.2 // indirect github.com/evanphx/json-patch/v5 v5.6.0 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/go-logr/logr v1.2.4 // indirect @@ -87,13 +87,13 @@ require ( go.uber.org/atomic v1.7.0 // indirect go.uber.org/multierr v1.6.0 // indirect go.uber.org/zap v1.24.0 // indirect - golang.org/x/net v0.10.0 // indirect - golang.org/x/oauth2 v0.7.0 // indirect - golang.org/x/sys v0.8.0 // indirect - golang.org/x/term v0.8.0 // indirect - golang.org/x/text v0.9.0 // indirect + golang.org/x/net v0.12.0 // indirect + golang.org/x/oauth2 v0.10.0 // indirect + golang.org/x/sys v0.10.0 // indirect + golang.org/x/term v0.10.0 // indirect + golang.org/x/text v0.11.0 // indirect golang.org/x/time v0.3.0 // indirect - golang.org/x/tools v0.9.1 // indirect + golang.org/x/tools v0.10.0 // indirect gomodules.xyz/jsonpatch/v2 v2.3.0 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/genproto v0.0.0-20230731193218-e0aa005b6bdf // indirect diff --git a/common-controller/go.sum b/common-controller/go.sum index 4080541a0..4295e7edf 100644 --- a/common-controller/go.sum +++ b/common-controller/go.sum @@ -38,8 +38,8 @@ github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.m github.com/envoyproxy/go-control-plane v0.11.2-0.20230802074621-eea0b3bd0f81 h1:dx15VeDt3L5Z0Wx28jXbwgpeTrLsVvqC/wSvNgYPb/k= github.com/envoyproxy/go-control-plane v0.11.2-0.20230802074621-eea0b3bd0f81/go.mod h1:zV+ml0OfGpQxGvM1qlmhvZzE9ShvBO7CPWzGb3q5cog= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/envoyproxy/protoc-gen-validate v1.0.1 h1:kt9FtLiooDc0vbwTLhdg3dyNX1K9Qwa1EK9LcD4jVUQ= -github.com/envoyproxy/protoc-gen-validate v1.0.1/go.mod h1:0vj8bNkYbSTNS2PIyH87KZaeN4x9zpL9Qt8fQC7d+vs= +github.com/envoyproxy/protoc-gen-validate v1.0.2 h1:QkIBuU5k+x7/QXPvPPnWXWlCdaBFApVqftFV6k087DA= +github.com/envoyproxy/protoc-gen-validate v1.0.2/go.mod h1:GpiZQP3dDbg4JouG/NNS7QWXpgx6x8QiMKdmN72jogE= github.com/evanphx/json-patch v4.12.0+incompatible h1:4onqiflcdA9EOZ4RxV643DvftH5pOlLGNtQ5lPWQu84= github.com/evanphx/json-patch/v5 v5.6.0 h1:b91NhWfaz02IuVxO9faSllyAtNXHMPkC5J8sJCLunww= github.com/evanphx/json-patch/v5 v5.6.0/go.mod h1:G79N1coSVB93tBe7j6PhzjmR3/2VvlbKOFpnXhI9Bw4= @@ -209,8 +209,8 @@ golang.org/x/arch v0.3.0/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g= -golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= +golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA= +golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20230801115018-d63ba01acd4b h1:r+vk0EmXNmekl0S0BascoeeoHk/L7wmaW2QF90K+kYI= golang.org/x/exp v0.0.0-20230801115018-d63ba01acd4b/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= @@ -232,11 +232,11 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= -golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50= +golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.7.0 h1:qe6s0zUXlPX80/dITx3440hWZ7GwMwgDDyrSGTPJG/g= -golang.org/x/oauth2 v0.7.0/go.mod h1:hPLQkd9LyjfXTiRohC/41GhcFqxisoUQ99sCUOHO9x4= +golang.org/x/oauth2 v0.10.0 h1:zHCpF2Khkwy4mMB4bv0U37YtJdTGW8jI0glAApi0Kh8= +golang.org/x/oauth2 v0.10.0/go.mod h1:kTpgurOux7LqtuxjuyZa4Gj2gdezIt/jQtGnNFfypQI= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -256,16 +256,16 @@ golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= +golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.8.0 h1:n5xxQn2i3PC0yLAbjTpNT85q/Kgzcr2gIoX9OrJUols= -golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= +golang.org/x/term v0.10.0 h1:3R7pNqamzBraeqj/Tj8qt1aQ2HpmlC+Cx/qL/7hn4/c= +golang.org/x/term v0.10.0/go.mod h1:lpqdcUyK/oCiQxvxVrppt5ggO2KCZ5QblwqPnfZ6d5o= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= -golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4= +golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -277,8 +277,8 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.9.1 h1:8WMNJAz3zrtPmnYC7ISf5dEn3MT0gY7jBJfw27yrrLo= -golang.org/x/tools v0.9.1/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc= +golang.org/x/tools v0.10.0 h1:tvDr/iQoUqNdohiYm0LmmKcBk+q86lb9EprIUFhHHGg= +golang.org/x/tools v0.10.0/go.mod h1:UJwyiVBsOA2uwvK/e5OY3GTpDUJriEd+/YlqAwLPmyM= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -303,8 +303,8 @@ google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZi google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.57.0 h1:kfzNeI/klCGD2YPMUlaGNT3pxvYfga7smW3Vth8Zsiw= -google.golang.org/grpc v1.57.0/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo= +google.golang.org/grpc v1.58.3 h1:BjnpXut1btbtgN/6sp+brB2Kbm2LjNXnidYujAVbSoQ= +google.golang.org/grpc v1.58.3/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/common-controller/internal/operator/controllers/cp/application_controller.go b/common-controller/internal/operator/controllers/cp/application_controller.go index 04e09cac3..2f7090bd3 100644 --- a/common-controller/internal/operator/controllers/cp/application_controller.go +++ b/common-controller/internal/operator/controllers/cp/application_controller.go @@ -150,6 +150,7 @@ func marshalApplicationKeyMapping(appInternal cpv1alpha2.Application) []server.A ApplicationIdentifier: env.AppID, KeyType: env.KeyType, EnvID: env.EnvID, + OrganizationID: appInternal.Spec.Organization, } applicationKeyMappings = append(applicationKeyMappings, appIdentifier) } diff --git a/common-controller/internal/operator/controllers/cp/applicationmapping_controller.go b/common-controller/internal/operator/controllers/cp/applicationmapping_controller.go index 69120ae74..346667090 100644 --- a/common-controller/internal/operator/controllers/cp/applicationmapping_controller.go +++ b/common-controller/internal/operator/controllers/cp/applicationmapping_controller.go @@ -22,17 +22,21 @@ import ( "github.com/wso2/apk/adapter/pkg/logging" "github.com/wso2/apk/common-controller/internal/cache" + "github.com/wso2/apk/common-controller/internal/config" "github.com/wso2/apk/common-controller/internal/loggers" "github.com/wso2/apk/common-controller/internal/server" k8error "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/fields" "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/types" ctrl "sigs.k8s.io/controller-runtime" - "sigs.k8s.io/controller-runtime/pkg/client" + k8client "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/controller" "sigs.k8s.io/controller-runtime/pkg/handler" "sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/manager" "sigs.k8s.io/controller-runtime/pkg/predicate" + "sigs.k8s.io/controller-runtime/pkg/reconcile" "sigs.k8s.io/controller-runtime/pkg/source" cpv1alpha2 "github.com/wso2/apk/common-controller/internal/operator/apis/cp/v1alpha2" @@ -42,17 +46,29 @@ import ( // ApplicationMappingReconciler reconciles a ApplicationMapping object type ApplicationMappingReconciler struct { - client client.Client + client k8client.Client Scheme *runtime.Scheme ods *cache.SubscriptionDataStore } +const ( + applicationIndex = "applicationIndex" + subscriptionIndex = "subscriptionIndex" +) + // NewApplicationMappingController creates a new Application and Subscription mapping (i.e. ApplicationMapping) controller instance func NewApplicationMappingController(mgr manager.Manager, subscriptionStore *cache.SubscriptionDataStore) error { r := &ApplicationMappingReconciler{ client: mgr.GetClient(), ods: subscriptionStore, } + ctx := context.Background() + conf := config.ReadConfigs() + predicates := []predicate.Predicate{predicate.NewPredicateFuncs(utils.FilterByNamespaces(conf.CommonController.Operator.Namespaces))} + if err := addApplicationMappingControllerIndexes(ctx, mgr); err != nil { + loggers.LoggerAPKOperator.ErrorC(logging.PrintError(logging.Error2658, logging.CRITICAL, "Error adding indexes: %v", err)) + return err + } c, err := controller.New(constants.ApplicationMappingController, mgr, controller.Options{Reconciler: r}) if err != nil { loggers.LoggerAPKOperator.ErrorC(logging.PrintError(logging.Error2610, logging.BLOCKER, "Error creating ApplicationMapping controller: %v", err.Error())) @@ -65,6 +81,17 @@ func NewApplicationMappingController(mgr manager.Manager, subscriptionStore *cac return err } + if err := c.Watch(source.Kind(mgr.GetCache(), &cpv1alpha2.Application{}), handler.EnqueueRequestsFromMapFunc(r.getApplicationMappingsForApplication), + predicates...); err != nil { + loggers.LoggerAPKOperator.ErrorC(logging.PrintError(logging.Error2613, logging.BLOCKER, "Error watching Application resources: %v", err)) + return err + } + + if err := c.Watch(source.Kind(mgr.GetCache(), &cpv1alpha2.Subscription{}), handler.EnqueueRequestsFromMapFunc(r.getApplicationMappingsForSubscription), + predicates...); err != nil { + loggers.LoggerAPKOperator.ErrorC(logging.PrintError(logging.Error2613, logging.BLOCKER, "Error watching Subscription resources: %v", err)) + return err + } loggers.LoggerAPKOperator.Debug("ApplicationMapping Controller successfully started. Watching ApplicationMapping Objects...") return nil } @@ -98,24 +125,139 @@ func (r *ApplicationMappingReconciler) Reconcile(ctx context.Context, req ctrl.R } else { loggers.LoggerAPKOperator.Debugf("Application mapping %s/%s not found. Ignoring since object must be deleted", applicationMappingKey.Namespace, applicationMappingKey.Name) } + } else { + var application cpv1alpha2.Application + if err := r.client.Get(ctx, types.NamespacedName{Name: string(applicationMapping.Spec.ApplicationRef), Namespace: applicationMapping.Namespace}, &application); err != nil { + loggers.LoggerAPKOperator.ErrorC(logging.PrintError(logging.Error2614, logging.BLOCKER, "Error getting Application: %v", err)) + return ctrl.Result{}, nil + } + var subscription cpv1alpha2.Subscription + if err := r.client.Get(ctx, types.NamespacedName{Name: string(applicationMapping.Spec.SubscriptionRef), Namespace: applicationMapping.Namespace}, &subscription); err != nil { + loggers.LoggerAPKOperator.ErrorC(logging.PrintError(logging.Error2615, logging.BLOCKER, "Error getting Subscription: %v", err)) + return ctrl.Result{}, nil + } + sendUpdates(&applicationMapping, application, subscription) + utils.SendCreateApplicationMappingEvent(applicationMapping, application, subscription) + r.ods.AddorUpdateApplicationMappingToStore(applicationMappingKey, applicationMapping.Spec) } - } else { - sendUpdates(&applicationMapping) - utils.SendCreateApplicationMappingEvent(applicationMapping) - r.ods.AddorUpdateApplicationMappingToStore(applicationMappingKey, applicationMapping.Spec) } return ctrl.Result{}, nil } -func sendUpdates(applicationMapping *cpv1alpha2.ApplicationMapping) { - appMappingList := marshalApplicationMapping(applicationMapping) - server.AddApplicationMapping(appMappingList) +func sendUpdates(applicationMapping *cpv1alpha2.ApplicationMapping, application cpv1alpha2.Application, subscription cpv1alpha2.Subscription) { + resolvedApplication := marshalApplication(application) + appMapping := marshalApplicationMapping(applicationMapping, resolvedApplication) + server.AddApplicationMapping(appMapping) } -func marshalApplicationMapping(applicationMapping *cpv1alpha2.ApplicationMapping) server.ApplicationMapping { +func marshalApplicationMapping(applicationMapping *cpv1alpha2.ApplicationMapping, application server.Application) server.ApplicationMapping { return server.ApplicationMapping{ UUID: applicationMapping.Name, ApplicationRef: applicationMapping.Spec.ApplicationRef, SubscriptionRef: applicationMapping.Spec.SubscriptionRef, + OrganizationID: application.OrganizationID, + } +} + +// addApplicationMappingControllerIndexes adds indexes to the ApplicationMapping controller +func addApplicationMappingControllerIndexes(ctx context.Context, mgr manager.Manager) error { + // Secret to TokenIssuer indexer + if err := mgr.GetFieldIndexer().IndexField(ctx, &cpv1alpha2.ApplicationMapping{}, applicationIndex, + func(rawObj k8client.Object) []string { + applicationMapping := rawObj.(*cpv1alpha2.ApplicationMapping) + var application []string + application = append(application, + types.NamespacedName{ + Name: string(applicationMapping.Spec.ApplicationRef), + Namespace: applicationMapping.Namespace, + }.String()) + return application + }); err != nil { + return err + } + err := mgr.GetFieldIndexer().IndexField(ctx, &cpv1alpha2.ApplicationMapping{}, subscriptionIndex, + func(rawObj k8client.Object) []string { + applicationMapping := rawObj.(*cpv1alpha2.ApplicationMapping) + var subscriptions []string + subscriptions = append(subscriptions, + types.NamespacedName{ + Name: string(applicationMapping.Spec.SubscriptionRef), + Namespace: applicationMapping.Namespace, + }.String()) + return subscriptions + }) + return err +} + +// getApplicationMappingsForApplication triggers the ApplicationMapping controller reconcile method based on the changes detected +// from Application objects. If the changes are done for an API stored in the Operator Data store, +// a new reconcile event will be created and added to the reconcile event queue. +func (r *ApplicationMappingReconciler) getApplicationMappingsForApplication(ctx context.Context, obj k8client.Object) []reconcile.Request { + application, ok := obj.(*cpv1alpha2.Application) + if !ok { + loggers.LoggerAPKOperator.ErrorC(logging.PrintError(logging.Error2622, logging.TRIVIAL, "Unexpected object type, bypassing reconciliation: %v", application)) + return []reconcile.Request{} + } + + applicationMappingList := &cpv1alpha2.ApplicationMappingList{} + if err := r.client.List(ctx, applicationMappingList, &k8client.ListOptions{ + FieldSelector: fields.OneTermEqualSelector(applicationIndex, utils.NamespacedName(application).String()), + }); err != nil { + loggers.LoggerAPKOperator.ErrorC(logging.PrintError(logging.Error2623, logging.CRITICAL, "Unable to find associated application mappings: %s", utils.NamespacedName(application).String())) + return []reconcile.Request{} + } + + if len(applicationMappingList.Items) == 0 { + loggers.LoggerAPKOperator.Debugf("ApplicationMappings for Application %s/%s not found", application.Namespace, application.Name) + return []reconcile.Request{} + } + + requests := []reconcile.Request{} + for _, applicationMapping := range applicationMappingList.Items { + req := reconcile.Request{ + NamespacedName: types.NamespacedName{ + Name: applicationMapping.Name, + Namespace: applicationMapping.Namespace}, + } + requests = append(requests, req) + loggers.LoggerAPKOperator.Infof("Adding reconcile request for ApplicationMapping: %s/%s with Application UUID: %v", applicationMapping.Namespace, applicationMapping.Name, + string(applicationMapping.ObjectMeta.UID)) + } + return requests +} + +// getApplicationMappingsForSubscription triggers the ApplicationMapping controller reconcile method based on the changes detected +// from Subscription objects. If the changes are done for an API stored in the Operator Data store, +func (r *ApplicationMappingReconciler) getApplicationMappingsForSubscription(ctx context.Context, obj k8client.Object) []reconcile.Request { + subscription, ok := obj.(*cpv1alpha2.Subscription) + if !ok { + loggers.LoggerAPKOperator.ErrorC(logging.PrintError(logging.Error2622, logging.TRIVIAL, "Unexpected object type, bypassing reconciliation: %v", subscription)) + return []reconcile.Request{} + } + + applicationMappingList := &cpv1alpha2.ApplicationMappingList{} + if err := r.client.List(ctx, applicationMappingList, &k8client.ListOptions{ + FieldSelector: fields.OneTermEqualSelector(subscriptionIndex, utils.NamespacedName(subscription).String()), + }); err != nil { + loggers.LoggerAPKOperator.ErrorC(logging.PrintError(logging.Error2623, logging.CRITICAL, "Unable to find associated Application mappings: %s", utils.NamespacedName(subscription).String())) + return []reconcile.Request{} + } + + if len(applicationMappingList.Items) == 0 { + loggers.LoggerAPKOperator.Debugf("ApplicationMappings for Subscription %s/%s not found", subscription.Namespace, subscription.Name) + return []reconcile.Request{} + } + + requests := []reconcile.Request{} + for _, applicationMapping := range applicationMappingList.Items { + req := reconcile.Request{ + NamespacedName: types.NamespacedName{ + Name: applicationMapping.Name, + Namespace: applicationMapping.Namespace}, + } + requests = append(requests, req) + loggers.LoggerAPKOperator.Infof("Adding reconcile request for ApplicationMapping: %s/%s with Subscription UUID: %v", applicationMapping.Namespace, applicationMapping.Name, + string(applicationMapping.ObjectMeta.UID)) } + return requests } diff --git a/common-controller/internal/server/application_key_mapping.go b/common-controller/internal/server/application_key_mapping.go index 998d76d55..efdb9b688 100644 --- a/common-controller/internal/server/application_key_mapping.go +++ b/common-controller/internal/server/application_key_mapping.go @@ -7,6 +7,7 @@ type ApplicationKeyMapping struct { ApplicationIdentifier string `json:"applicationIdentifier,omitempty"` KeyType string `json:"keyType,omitempty"` EnvID string `json:"envID,omitempty"` + OrganizationID string `json:"organizationId"` } // ApplicationKeyMappingList contains a list of ApplicationKeyMapping diff --git a/common-controller/internal/server/application_mapping_types.go b/common-controller/internal/server/application_mapping_types.go index 34155b4e8..fb4e56f3d 100644 --- a/common-controller/internal/server/application_mapping_types.go +++ b/common-controller/internal/server/application_mapping_types.go @@ -22,6 +22,7 @@ type ApplicationMapping struct { UUID string `json:"uuid"` ApplicationRef string `json:"applicationRef"` SubscriptionRef string `json:"subscriptionRef"` + OrganizationID string `json:"organizationId"` } // ApplicationMappingList contains a list of ApplicationMapping diff --git a/common-controller/internal/server/event_server.go b/common-controller/internal/server/event_server.go index e9cae33f4..79cfbda95 100644 --- a/common-controller/internal/server/event_server.go +++ b/common-controller/internal/server/event_server.go @@ -1,8 +1,6 @@ package server import ( - "log" - apkmgt "github.com/wso2/apk/adapter/pkg/discovery/api/wso2/discovery/service/apkmgt" "github.com/wso2/apk/common-controller/internal/loggers" utils "github.com/wso2/apk/common-controller/internal/utils" @@ -27,14 +25,8 @@ func (s EventServer) StreamEvents(req *apkmgt.Request, srv apkmgt.EventStreamSer loggers.LoggerAPKOperator.Debugf("Enforcer ID : %v", enforcerID[0]) utils.AddClientConnection(enforcerID[0], srv) utils.SendInitialEvent(srv) - for { - if srv.Context().Done() == nil { - utils.DeleteClientConnection(enforcerID[0]) - return nil // Client closed the connection - } else if srv.Context().Err() != nil { - log.Printf("error : %v", srv.Context().Err()) - utils.DeleteClientConnection(enforcerID[0]) - return nil - } - } + <-srv.Context().Done() + loggers.LoggerAPKOperator.Infof("Connection closed by the client : %v", enforcerID[0]) + utils.DeleteClientConnection(enforcerID[0]) + return nil // Client closed the connection } diff --git a/common-controller/internal/utils/event_utils.go b/common-controller/internal/utils/event_utils.go index a1c34501d..afe593178 100644 --- a/common-controller/internal/utils/event_utils.go +++ b/common-controller/internal/utils/event_utils.go @@ -115,7 +115,7 @@ func SendDeleteSubscriptionEvent(subscriptionUUID string, subscriptionSpec cpv1a } // SendCreateApplicationMappingEvent sends an application mapping event to the enforcer -func SendCreateApplicationMappingEvent(applicationMapping cpv1alpha2.ApplicationMapping) { +func SendCreateApplicationMappingEvent(applicationMapping cpv1alpha2.ApplicationMapping, application cpv1alpha2.Application, subscriptionCr cpv1alpha2.Subscription) { currentTime := time.Now() milliseconds := currentTime.UnixNano() / int64(time.Millisecond) event := subscription.Event{ @@ -126,6 +126,7 @@ func SendCreateApplicationMappingEvent(applicationMapping cpv1alpha2.Application Uuid: applicationMapping.ObjectMeta.Name, ApplicationRef: applicationMapping.Spec.ApplicationRef, SubscriptionRef: applicationMapping.Spec.SubscriptionRef, + Organization: application.Spec.Organization, }, } sendEvent(&event) @@ -163,6 +164,7 @@ func sendDeleteApplicationKeyMappingEvent(applicationUUID string, applicationKey ApplicationIdentifier: env.AppID, KeyType: env.KeyType, EnvID: env.EnvID, + Organization: applicationKeyMapping.Organization, }, } sendEvent(&event) diff --git a/common-controller/internal/utils/utils.go b/common-controller/internal/utils/utils.go index 0faf82fde..6c99df509 100644 --- a/common-controller/internal/utils/utils.go +++ b/common-controller/internal/utils/utils.go @@ -22,11 +22,12 @@ import ( "sync" discovery "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3" - constants "github.com/wso2/apk/common-controller/internal/operator/constant" "github.com/wso2/apk/adapter/pkg/utils/envutils" "github.com/wso2/apk/adapter/pkg/utils/stringutils" - k8client "sigs.k8s.io/controller-runtime/pkg/client" "github.com/wso2/apk/common-controller/internal/config" + constants "github.com/wso2/apk/common-controller/internal/operator/constant" + "k8s.io/apimachinery/pkg/types" + k8client "sigs.k8s.io/controller-runtime/pkg/client" ) const nodeIDArrayMaxLength int = 20 @@ -125,3 +126,11 @@ func GetEnvironment(environment string) string { } return config.ReadConfigs().CommonController.Environment } + +// NamespacedName generates namespaced name for Kubernetes objects +func NamespacedName(obj k8client.Object) types.NamespacedName { + return types.NamespacedName{ + Namespace: obj.GetNamespace(), + Name: obj.GetName(), + } +} diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/analytics/AnalyticsUtils.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/analytics/AnalyticsUtils.java index 8e94f9f1c..39d7084d0 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/analytics/AnalyticsUtils.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/analytics/AnalyticsUtils.java @@ -22,7 +22,6 @@ import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.wso2.apk.enforcer.commons.analytics.collectors.AnalyticsCustomDataProvider; import org.wso2.apk.enforcer.commons.model.AuthenticationContext; import org.wso2.apk.enforcer.commons.model.RequestContext; import org.wso2.apk.enforcer.constants.AnalyticsConstants; @@ -30,9 +29,6 @@ import org.wso2.apk.enforcer.models.API; import org.wso2.apk.enforcer.subscription.SubscriptionDataHolder; -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; - /** * Common Utility functions */ @@ -42,19 +38,13 @@ public class AnalyticsUtils { public static String getAPIId(RequestContext requestContext) { return requestContext.getMatchedAPI().getUuid(); } - + public static String getOrganization(RequestContext requestContext) { + return requestContext.getMatchedAPI().getOrganizationId(); + } public static String setDefaultIfNull(String value) { return value == null ? AnalyticsConstants.DEFAULT_FOR_UNASSIGNED : value; } - public static String getAPIProvider(String uuid) { - API api = SubscriptionDataHolder.getInstance().getSubscriptionDataStore().getApiByContextAndVersion(uuid); - if (api == null) { - return AnalyticsConstants.DEFAULT_FOR_UNASSIGNED; - } - return setDefaultIfNull(api.getApiProvider()); - } - /** * Extracts Authentication Context from the request Context. If Authentication Context is not available, * new Authentication Context object will be created with authenticated property is set to false. diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/analytics/ChoreoFaultAnalyticsProvider.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/analytics/ChoreoFaultAnalyticsProvider.java index 3943de45e..44cfa5fda 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/analytics/ChoreoFaultAnalyticsProvider.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/analytics/ChoreoFaultAnalyticsProvider.java @@ -122,7 +122,6 @@ public API getApi() { ExtendedAPI api = new ExtendedAPI(); String apiUUID = AnalyticsUtils.getAPIId(requestContext); api.setApiId(apiUUID); - api.setApiCreator(AnalyticsUtils.getAPIProvider(apiUUID)); api.setApiType(requestContext.getMatchedAPI().getApiType()); api.setApiName(requestContext.getMatchedAPI().getName()); api.setApiVersion(requestContext.getMatchedAPI().getVersion()); @@ -182,7 +181,7 @@ public Latencies getLatencies() { // Latencies information are not required. Latencies latencies = new Latencies(); - latencies.setResponseLatency(System.currentTimeMillis()-getRequestTime()); + latencies.setResponseLatency(System.currentTimeMillis() - getRequestTime()); return latencies; } @@ -252,7 +251,7 @@ public String getEndUserIP() { @Override public Map getProperties() { - Map map = new HashMap<>(); + Map map = new HashMap<>(); // Adding Gateway URL String gatewayUrl = requestContext.getHeaders().get(AnalyticsConstants.GATEWAY_URL); if (!StringUtils.isNotEmpty(gatewayUrl)) { diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/api/RestAPI.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/api/RestAPI.java index d40ddb7cb..c220107b4 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/api/RestAPI.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/api/RestAPI.java @@ -19,30 +19,25 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.wso2.apk.enforcer.common.CacheProviderUtil; -import org.wso2.apk.enforcer.commons.dto.ClaimValueDTO; -import org.wso2.apk.enforcer.commons.dto.JWTConfigurationDto; -import org.wso2.apk.enforcer.config.EnforcerConfig; -import org.wso2.apk.enforcer.discovery.api.Api; -import org.wso2.apk.enforcer.discovery.api.BackendJWTTokenInfo; -import org.wso2.apk.enforcer.discovery.api.Certificate; -import org.wso2.apk.enforcer.discovery.api.Claim; -import org.wso2.apk.enforcer.discovery.api.Operation; -import org.wso2.apk.enforcer.discovery.api.Resource; import org.wso2.apk.enforcer.analytics.AnalyticsFilter; import org.wso2.apk.enforcer.commons.Filter; +import org.wso2.apk.enforcer.commons.dto.ClaimValueDTO; +import org.wso2.apk.enforcer.commons.dto.JWTConfigurationDto; import org.wso2.apk.enforcer.commons.model.APIConfig; -import org.wso2.apk.enforcer.commons.model.MockedApiConfig; -import org.wso2.apk.enforcer.commons.model.MockedContentExamples; -import org.wso2.apk.enforcer.commons.model.MockedHeaderConfig; -import org.wso2.apk.enforcer.commons.model.MockedResponseConfig; import org.wso2.apk.enforcer.commons.model.RequestContext; import org.wso2.apk.enforcer.commons.model.ResourceConfig; import org.wso2.apk.enforcer.config.ConfigHolder; +import org.wso2.apk.enforcer.config.EnforcerConfig; import org.wso2.apk.enforcer.config.dto.FilterDTO; import org.wso2.apk.enforcer.constants.APIConstants; import org.wso2.apk.enforcer.constants.HttpConstants; import org.wso2.apk.enforcer.cors.CorsFilter; +import org.wso2.apk.enforcer.discovery.api.Api; +import org.wso2.apk.enforcer.discovery.api.BackendJWTTokenInfo; +import org.wso2.apk.enforcer.discovery.api.Certificate; +import org.wso2.apk.enforcer.discovery.api.Claim; +import org.wso2.apk.enforcer.discovery.api.Operation; +import org.wso2.apk.enforcer.discovery.api.Resource; import org.wso2.apk.enforcer.interceptor.MediationPolicyFilter; import org.wso2.apk.enforcer.security.AuthFilter; import org.wso2.apk.enforcer.security.mtls.MtlsUtils; @@ -68,7 +63,6 @@ public class RestAPI implements API { private static final Logger logger = LogManager.getLogger(RestAPI.class); private final List filters = new ArrayList<>(); private APIConfig apiConfig; - private String apiLifeCycleState; @Override public List getFilters() { @@ -95,8 +89,6 @@ public String init(Api api) { APIProcessUtils.convertProtoEndpointSecurity(res.getEndpointSecurityList())); resConfig.setPolicyConfig(Utils.genPolicyConfig(operation.getPolicies())); resConfig.setEndpoints(Utils.processEndpoints(res.getEndpoints())); -// resConfig.setMockApiConfig(getMockedApiOperationConfig(operation.getMockedApiConfig(), -// operation.getMethod())); resources.add(resConfig); } } @@ -133,14 +125,10 @@ public String init(Api api) { enforcerConfig.getJwtConfigurationDto().getKidValue()); } - byte[] apiDefinition = null; - if (api.getApiDefinitionFile() != null) { - apiDefinition = api.getApiDefinitionFile().toByteArray(); - } + byte[] apiDefinition = api.getApiDefinitionFile().toByteArray(); - this.apiLifeCycleState = api.getApiLifeCycleState(); this.apiConfig = new APIConfig.Builder(name).uuid(api.getId()).vhost(vhost).basePath(basePath).version(version) - .resources(resources).apiType(apiType).apiLifeCycleState(apiLifeCycleState).tier(api.getTier()) + .resources(resources).apiType(apiType).tier(api.getTier()) .envType(api.getEnvType()).disableAuthentication(api.getDisableAuthentications()) .disableScopes(api.getDisableScopes()).trustStore(trustStore).organizationId(api.getOrganizationId()) .mtlsCertificateTiers(mtlsCertificateTiers).mutualSSL(mutualSSL).systemAPI(api.getSystemAPI()) @@ -231,41 +219,6 @@ public APIConfig getAPIConfig() { return this.apiConfig; } - private MockedApiConfig getMockedApiOperationConfig( - org.wso2.apk.enforcer.discovery.api.MockedApiConfig mockedApiConfig, String operationName) { - - MockedApiConfig configData = new MockedApiConfig(); - Map responses = new HashMap<>(); - for (org.wso2.apk.enforcer.discovery.api.MockedResponseConfig response : mockedApiConfig.getResponsesList()) { - MockedResponseConfig responseData = new MockedResponseConfig(); - List headers = new ArrayList<>(); - for (org.wso2.apk.enforcer.discovery.api.MockedHeaderConfig header : response.getHeadersList()) { - MockedHeaderConfig headerConfig = new MockedHeaderConfig(); - headerConfig.setName(header.getName()); - headerConfig.setValue(header.getValue()); - headers.add(headerConfig); - } - responseData.setHeaders(headers); - HashMap contentMap = new HashMap<>(); - - for (org.wso2.apk.enforcer.discovery.api.MockedContentConfig contentConfig : response.getContentList()) { - MockedContentExamples mockedContentExamples = new MockedContentExamples(); - HashMap exampleMap = new HashMap<>(); - for (org.wso2.apk.enforcer.discovery.api.MockedContentExample exampleConfig : - contentConfig.getExamplesList()) { - exampleMap.put(exampleConfig.getRef(), exampleConfig.getBody()); - } - mockedContentExamples.setExampleMap(exampleMap); - contentMap.put(contentConfig.getContentType(), mockedContentExamples); - } - responseData.setContentMap(contentMap); - responses.put(response.getCode(), responseData); - } - configData.setResponses(responses); - logger.debug("Mock API config processed successfully for the " + operationName + " operation."); - return configData; - } - private void initFilters() { AuthFilter authFilter = new AuthFilter(); diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/ApiListDiscoveryClient.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/ApiListDiscoveryClient.java deleted file mode 100644 index c2f220abc..000000000 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/ApiListDiscoveryClient.java +++ /dev/null @@ -1,203 +0,0 @@ -/* -* Copyright (c) 2021, WSO2 LLC. (http://www.wso2.org) All Rights Reserved. -* -* WSO2 LLC. licenses this file to you under the Apache License, -* Version 2.0 (the "License"); you may not use this file except -* in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, -* software distributed under the License is distributed on an -* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -* KIND, either express or implied. See the License for the -* specific language governing permissions and limitations -* under the License. -*/ - -package org.wso2.apk.enforcer.discovery; - -import com.google.protobuf.Any; -import com.google.rpc.Status; -import io.envoyproxy.envoy.config.core.v3.Node; -import io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest; -import io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse; -import io.grpc.ConnectivityState; -import io.grpc.ManagedChannel; -import io.grpc.stub.StreamObserver; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.wso2.apk.enforcer.discovery.service.subscription.ApiListDiscoveryServiceGrpc; -import org.wso2.apk.enforcer.discovery.subscription.APIList; -import org.wso2.apk.enforcer.discovery.subscription.APIs; -import org.wso2.apk.enforcer.config.ConfigHolder; -import org.wso2.apk.enforcer.constants.Constants; -import org.wso2.apk.enforcer.discovery.common.XDSCommonUtils; -import org.wso2.apk.enforcer.discovery.scheduler.XdsSchedulerManager; -import org.wso2.apk.enforcer.subscription.SubscriptionDataStoreImpl; -import org.wso2.apk.enforcer.util.GRPCUtils; - -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.TimeUnit; - -/** - * Client to communicate with API list discovery service at the adapter. - */ -public class ApiListDiscoveryClient implements Runnable { - private static final Logger logger = LogManager.getLogger(ApiListDiscoveryClient.class); - private static ApiListDiscoveryClient instance; - private ManagedChannel channel; - private ApiListDiscoveryServiceGrpc.ApiListDiscoveryServiceStub stub; - private StreamObserver reqObserver; - private final SubscriptionDataStoreImpl subscriptionDataStore; - private final String host; - private final String hostname; - private final int port; - - /** - * This is a reference to the latest received response from the ADS. - *

- * Usage: When ack/nack a DiscoveryResponse this value is used to identify the latest received DiscoveryResponse - * which may not have been acked/nacked so far. - *

- */ - private DiscoveryResponse latestReceived; - - /** - * This is a reference to the latest acked response from the ADS. - *

- * Usage: When nack a DiscoveryResponse this value is used to find the latest successfully processed - * DiscoveryResponse. Information sent in the nack request will contain information about this response value. - *

- */ - private DiscoveryResponse latestACKed; - - /** - * Node struct for the discovery client - */ - private final Node node; - - private ApiListDiscoveryClient(String host, String hostname, int port) { - this.host = host; - this.hostname = hostname; - this.port = port; - this.subscriptionDataStore = SubscriptionDataStoreImpl.getInstance(); - initConnection(); - this.node = XDSCommonUtils.generateXDSNode(ConfigHolder.getInstance().getEnvVarConfig().getEnforcerLabel()); - this.latestACKed = DiscoveryResponse.getDefaultInstance(); - } - - private void initConnection() { - if (GRPCUtils.isReInitRequired(channel)) { - if (channel != null && !channel.isShutdown()) { - channel.shutdownNow(); - do { - try { - channel.awaitTermination(100, TimeUnit.MILLISECONDS); - } catch (InterruptedException e) { - logger.error("API list discovery channel shutdown wait was interrupted", e); - } - } while (!channel.isShutdown()); - } - this.channel = GRPCUtils.createSecuredChannel(logger, host, port, hostname); - this.stub = ApiListDiscoveryServiceGrpc.newStub(channel); - } else if (channel.getState(true) == ConnectivityState.READY) { - XdsSchedulerManager.getInstance().stopAPIListDiscoveryScheduling(); - } - } - - public static ApiListDiscoveryClient getInstance() { - if (instance == null) { - String sdsHost = ConfigHolder.getInstance().getEnvVarConfig().getAdapterHost(); - String sdsHostname = ConfigHolder.getInstance().getEnvVarConfig().getAdapterHostname(); - int sdsPort = Integer.parseInt(ConfigHolder.getInstance().getEnvVarConfig().getAdapterXdsPort()); - instance = new ApiListDiscoveryClient(sdsHost, sdsHostname, sdsPort); - } - return instance; - } - - public void run() { - initConnection(); - watchApiList(); - } - - public void watchApiList() { - // TODO: (Praminda) implement a deadline with retries - reqObserver = stub.streamApiList(new StreamObserver() { - @Override - public void onNext(DiscoveryResponse response) { - logger.info("API list event received with version : " + response.getVersionInfo()); - logger.debug("Received Api list discovery response " + response); - XdsSchedulerManager.getInstance().stopAPIListDiscoveryScheduling(); - latestReceived = response; - try { - List apiList = new ArrayList<>(); - for (Any res : response.getResourcesList()) { - apiList.addAll(res.unpack(APIList.class).getListList()); - } - subscriptionDataStore.addApis(apiList); - logger.info("Number of APIs received : " + apiList.size()); - ack(); - } catch (Exception e) { - // catching generic error here to wrap any grpc communication errors in the runtime - onError(e); - } - } - - @Override - public void onError(Throwable throwable) { - logger.error("Error occurred during Api list discovery", throwable); - XdsSchedulerManager.getInstance().startAPIListDiscoveryScheduling(); - nack(throwable); - } - - @Override - public void onCompleted() { - logger.info("Completed receiving Api list"); - } - }); - - try { - DiscoveryRequest req = DiscoveryRequest.newBuilder() - .setNode(node) - .setVersionInfo(latestACKed.getVersionInfo()) - .setTypeUrl(Constants.API_LIST_TYPE_URL).build(); - reqObserver.onNext(req); - logger.debug("Sent Discovery request for type url: " + Constants.API_LIST_TYPE_URL); - - } catch (Exception e) { - logger.error("Unexpected error occurred in API list discovery service", e); - reqObserver.onError(e); - } - } - - /** - * Send acknowledgement of successfully processed DiscoveryResponse from the xDS server. This is part of the xDS - * communication protocol. - */ - private void ack() { - DiscoveryRequest req = DiscoveryRequest.newBuilder() - .setNode(node) - .setVersionInfo(latestReceived.getVersionInfo()) - .setResponseNonce(latestReceived.getNonce()) - .setTypeUrl(Constants.API_LIST_TYPE_URL).build(); - reqObserver.onNext(req); - latestACKed = latestReceived; - } - - private void nack(Throwable e) { - if (latestReceived == null) { - return; - } - DiscoveryRequest req = DiscoveryRequest.newBuilder() - .setNode(node) - .setVersionInfo(latestACKed.getVersionInfo()) - .setResponseNonce(latestReceived.getNonce()) - .setTypeUrl(Constants.API_LIST_TYPE_URL) - .setErrorDetail(Status.newBuilder().setMessage(e.getMessage())) - .build(); - reqObserver.onNext(req); - } -} diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/JWTIssuerDiscoveryClient.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/JWTIssuerDiscoveryClient.java index 83476aaee..9d751a267 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/JWTIssuerDiscoveryClient.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/JWTIssuerDiscoveryClient.java @@ -34,26 +34,28 @@ import org.wso2.apk.enforcer.discovery.common.XDSCommonUtils; import org.wso2.apk.enforcer.discovery.scheduler.XdsSchedulerManager; import org.wso2.apk.enforcer.discovery.service.subscription.JWTIssuerDiscoveryServiceGrpc; - import org.wso2.apk.enforcer.discovery.subscription.JWTIssuer; import org.wso2.apk.enforcer.discovery.subscription.JWTIssuerList; -import org.wso2.apk.enforcer.subscription.SubscriptionDataStoreImpl; +import org.wso2.apk.enforcer.subscription.SubscriptionDataHolder; +import org.wso2.apk.enforcer.subscription.SubscriptionDataStore; import org.wso2.apk.enforcer.util.GRPCUtils; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.concurrent.TimeUnit; /** * Client to communicate with JWTIssuer discovery service at the adapter. */ public class JWTIssuerDiscoveryClient implements Runnable { + private static final Logger logger = LogManager.getLogger(JWTIssuerDiscoveryClient.class); private static JWTIssuerDiscoveryClient instance; private ManagedChannel channel; private JWTIssuerDiscoveryServiceGrpc.JWTIssuerDiscoveryServiceStub stub; private StreamObserver reqObserver; - private final SubscriptionDataStoreImpl subscriptionDataStore; private final String host; private final String hostname; private final int port; @@ -82,16 +84,17 @@ public class JWTIssuerDiscoveryClient implements Runnable { private final Node node; private JWTIssuerDiscoveryClient(String host, String hostname, int port) { + this.host = host; this.hostname = hostname; this.port = port; - this.subscriptionDataStore = SubscriptionDataStoreImpl.getInstance(); initConnection(); this.node = XDSCommonUtils.generateXDSNode(AdapterConstants.COMMON_ENFORCER_LABEL); this.latestACKed = DiscoveryResponse.getDefaultInstance(); } private void initConnection() { + if (GRPCUtils.isReInitRequired(channel)) { if (channel != null && !channel.isShutdown()) { channel.shutdownNow(); @@ -111,24 +114,28 @@ private void initConnection() { } public static JWTIssuerDiscoveryClient getInstance() { + if (instance == null) { String sdsHost = ConfigHolder.getInstance().getEnvVarConfig().getAdapterHost(); String sdsHostname = ConfigHolder.getInstance().getEnvVarConfig().getAdapterHostname(); int sdsPort = Integer.parseInt(ConfigHolder.getInstance().getEnvVarConfig().getAdapterXdsPort()); - instance = new JWTIssuerDiscoveryClient(sdsHost,sdsHostname, sdsPort); + instance = new JWTIssuerDiscoveryClient(sdsHost, sdsHostname, sdsPort); } return instance; } public void run() { + initConnection(); watchJWTIssuers(); } public void watchJWTIssuers() { + reqObserver = stub.streamJWTIssuers(new StreamObserver<>() { @Override public void onNext(DiscoveryResponse response) { + logger.info("JWTIssuer creation event received with version : " + response.getVersionInfo()); logger.debug("Received JWTIssuer discovery response " + response); XdsSchedulerManager.getInstance().stopJWTIssuerDiscoveryScheduling(); @@ -138,7 +145,21 @@ public void onNext(DiscoveryResponse response) { for (Any res : response.getResourcesList()) { jwtIssuers.addAll(res.unpack(JWTIssuerList.class).getListList()); } - subscriptionDataStore.addJWTIssuers(jwtIssuers); + Map> orgWizeIssuerMap = new HashMap<>(); + for (JWTIssuer jwtIssuer : jwtIssuers) { + List jwtIssuerList = orgWizeIssuerMap.computeIfAbsent(jwtIssuer.getOrganization(), + k -> new ArrayList<>()); + jwtIssuerList.add(jwtIssuer); + } + orgWizeIssuerMap.forEach((k, v) -> { + SubscriptionDataStore subscriptionDataStore = + SubscriptionDataHolder.getInstance().getSubscriptionDataStore(k); + if (subscriptionDataStore == null) { + subscriptionDataStore = + SubscriptionDataHolder.getInstance().initializeSubscriptionDataStore(k); + } + subscriptionDataStore.addJWTIssuers(v); + }); logger.info("Number of jwt issuers received : " + jwtIssuers.size()); ack(); } catch (Exception e) { @@ -149,6 +170,7 @@ public void onNext(DiscoveryResponse response) { @Override public void onError(Throwable throwable) { + logger.error("Error occurred during JWTIssuer discovery", throwable); XdsSchedulerManager.getInstance().startJWTIssuerDiscoveryScheduling(); nack(throwable); @@ -156,6 +178,7 @@ public void onError(Throwable throwable) { @Override public void onCompleted() { + logger.info("Completed receiving JWT Issuer data"); } }); @@ -179,6 +202,7 @@ public void onCompleted() { * communication protocol. */ private void ack() { + DiscoveryRequest req = DiscoveryRequest.newBuilder() .setNode(node) .setVersionInfo(latestReceived.getVersionInfo()) @@ -189,6 +213,7 @@ private void ack() { } private void nack(Throwable e) { + if (latestReceived == null) { return; } diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/api/Scopes.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/api/Scopes.java deleted file mode 100644 index 44bc327bb..000000000 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/api/Scopes.java +++ /dev/null @@ -1,622 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: wso2/discovery/api/security_scheme.proto - -package org.wso2.apk.enforcer.discovery.api; - -/** - *
- * Holds the list of scopes belongs to a particular security schema
- * 
- * - * Protobuf type {@code wso2.discovery.api.Scopes} - */ -public final class Scopes extends - com.google.protobuf.GeneratedMessageV3 implements - // @@protoc_insertion_point(message_implements:wso2.discovery.api.Scopes) - ScopesOrBuilder { -private static final long serialVersionUID = 0L; - // Use Scopes.newBuilder() to construct. - private Scopes(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - private Scopes() { - scopes_ = com.google.protobuf.LazyStringArrayList.EMPTY; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance( - UnusedPrivateParameter unused) { - return new Scopes(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private Scopes( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: { - java.lang.String s = input.readStringRequireUtf8(); - if (!((mutable_bitField0_ & 0x00000001) != 0)) { - scopes_ = new com.google.protobuf.LazyStringArrayList(); - mutable_bitField0_ |= 0x00000001; - } - scopes_.add(s); - break; - } - default: { - if (!parseUnknownField( - input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - if (((mutable_bitField0_ & 0x00000001) != 0)) { - scopes_ = scopes_.getUnmodifiableView(); - } - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return org.wso2.apk.enforcer.discovery.api.SecuritySchemeProto.internal_static_wso2_discovery_api_Scopes_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return org.wso2.apk.enforcer.discovery.api.SecuritySchemeProto.internal_static_wso2_discovery_api_Scopes_fieldAccessorTable - .ensureFieldAccessorsInitialized( - org.wso2.apk.enforcer.discovery.api.Scopes.class, org.wso2.apk.enforcer.discovery.api.Scopes.Builder.class); - } - - public static final int SCOPES_FIELD_NUMBER = 1; - private com.google.protobuf.LazyStringList scopes_; - /** - * repeated string scopes = 1; - * @return A list containing the scopes. - */ - public com.google.protobuf.ProtocolStringList - getScopesList() { - return scopes_; - } - /** - * repeated string scopes = 1; - * @return The count of scopes. - */ - public int getScopesCount() { - return scopes_.size(); - } - /** - * repeated string scopes = 1; - * @param index The index of the element to return. - * @return The scopes at the given index. - */ - public java.lang.String getScopes(int index) { - return scopes_.get(index); - } - /** - * repeated string scopes = 1; - * @param index The index of the value to return. - * @return The bytes of the scopes at the given index. - */ - public com.google.protobuf.ByteString - getScopesBytes(int index) { - return scopes_.getByteString(index); - } - - private byte memoizedIsInitialized = -1; - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - for (int i = 0; i < scopes_.size(); i++) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, scopes_.getRaw(i)); - } - unknownFields.writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - { - int dataSize = 0; - for (int i = 0; i < scopes_.size(); i++) { - dataSize += computeStringSizeNoTag(scopes_.getRaw(i)); - } - size += dataSize; - size += 1 * getScopesList().size(); - } - size += unknownFields.getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof org.wso2.apk.enforcer.discovery.api.Scopes)) { - return super.equals(obj); - } - org.wso2.apk.enforcer.discovery.api.Scopes other = (org.wso2.apk.enforcer.discovery.api.Scopes) obj; - - if (!getScopesList() - .equals(other.getScopesList())) return false; - if (!unknownFields.equals(other.unknownFields)) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - if (getScopesCount() > 0) { - hash = (37 * hash) + SCOPES_FIELD_NUMBER; - hash = (53 * hash) + getScopesList().hashCode(); - } - hash = (29 * hash) + unknownFields.hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static org.wso2.apk.enforcer.discovery.api.Scopes parseFrom( - java.nio.ByteBuffer data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static org.wso2.apk.enforcer.discovery.api.Scopes parseFrom( - java.nio.ByteBuffer data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static org.wso2.apk.enforcer.discovery.api.Scopes parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static org.wso2.apk.enforcer.discovery.api.Scopes parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static org.wso2.apk.enforcer.discovery.api.Scopes parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static org.wso2.apk.enforcer.discovery.api.Scopes parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static org.wso2.apk.enforcer.discovery.api.Scopes parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static org.wso2.apk.enforcer.discovery.api.Scopes parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - public static org.wso2.apk.enforcer.discovery.api.Scopes parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input); - } - public static org.wso2.apk.enforcer.discovery.api.Scopes parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input, extensionRegistry); - } - public static org.wso2.apk.enforcer.discovery.api.Scopes parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static org.wso2.apk.enforcer.discovery.api.Scopes parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - - @java.lang.Override - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - public static Builder newBuilder(org.wso2.apk.enforcer.discovery.api.Scopes prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE - ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - *
-   * Holds the list of scopes belongs to a particular security schema
-   * 
- * - * Protobuf type {@code wso2.discovery.api.Scopes} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessageV3.Builder implements - // @@protoc_insertion_point(builder_implements:wso2.discovery.api.Scopes) - org.wso2.apk.enforcer.discovery.api.ScopesOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return org.wso2.apk.enforcer.discovery.api.SecuritySchemeProto.internal_static_wso2_discovery_api_Scopes_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return org.wso2.apk.enforcer.discovery.api.SecuritySchemeProto.internal_static_wso2_discovery_api_Scopes_fieldAccessorTable - .ensureFieldAccessorsInitialized( - org.wso2.apk.enforcer.discovery.api.Scopes.class, org.wso2.apk.enforcer.discovery.api.Scopes.Builder.class); - } - - // Construct using org.wso2.apk.enforcer.discovery.api.Scopes.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - } - } - @java.lang.Override - public Builder clear() { - super.clear(); - scopes_ = com.google.protobuf.LazyStringArrayList.EMPTY; - bitField0_ = (bitField0_ & ~0x00000001); - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return org.wso2.apk.enforcer.discovery.api.SecuritySchemeProto.internal_static_wso2_discovery_api_Scopes_descriptor; - } - - @java.lang.Override - public org.wso2.apk.enforcer.discovery.api.Scopes getDefaultInstanceForType() { - return org.wso2.apk.enforcer.discovery.api.Scopes.getDefaultInstance(); - } - - @java.lang.Override - public org.wso2.apk.enforcer.discovery.api.Scopes build() { - org.wso2.apk.enforcer.discovery.api.Scopes result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public org.wso2.apk.enforcer.discovery.api.Scopes buildPartial() { - org.wso2.apk.enforcer.discovery.api.Scopes result = new org.wso2.apk.enforcer.discovery.api.Scopes(this); - int from_bitField0_ = bitField0_; - if (((bitField0_ & 0x00000001) != 0)) { - scopes_ = scopes_.getUnmodifiableView(); - bitField0_ = (bitField0_ & ~0x00000001); - } - result.scopes_ = scopes_; - onBuilt(); - return result; - } - - @java.lang.Override - public Builder clone() { - return super.clone(); - } - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, - java.lang.Object value) { - return super.setField(field, value); - } - @java.lang.Override - public Builder clearField( - com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - @java.lang.Override - public Builder clearOneof( - com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - java.lang.Object value) { - return super.addRepeatedField(field, value); - } - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof org.wso2.apk.enforcer.discovery.api.Scopes) { - return mergeFrom((org.wso2.apk.enforcer.discovery.api.Scopes)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(org.wso2.apk.enforcer.discovery.api.Scopes other) { - if (other == org.wso2.apk.enforcer.discovery.api.Scopes.getDefaultInstance()) return this; - if (!other.scopes_.isEmpty()) { - if (scopes_.isEmpty()) { - scopes_ = other.scopes_; - bitField0_ = (bitField0_ & ~0x00000001); - } else { - ensureScopesIsMutable(); - scopes_.addAll(other.scopes_); - } - onChanged(); - } - this.mergeUnknownFields(other.unknownFields); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - org.wso2.apk.enforcer.discovery.api.Scopes parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (org.wso2.apk.enforcer.discovery.api.Scopes) e.getUnfinishedMessage(); - throw e.unwrapIOException(); - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - private int bitField0_; - - private com.google.protobuf.LazyStringList scopes_ = com.google.protobuf.LazyStringArrayList.EMPTY; - private void ensureScopesIsMutable() { - if (!((bitField0_ & 0x00000001) != 0)) { - scopes_ = new com.google.protobuf.LazyStringArrayList(scopes_); - bitField0_ |= 0x00000001; - } - } - /** - * repeated string scopes = 1; - * @return A list containing the scopes. - */ - public com.google.protobuf.ProtocolStringList - getScopesList() { - return scopes_.getUnmodifiableView(); - } - /** - * repeated string scopes = 1; - * @return The count of scopes. - */ - public int getScopesCount() { - return scopes_.size(); - } - /** - * repeated string scopes = 1; - * @param index The index of the element to return. - * @return The scopes at the given index. - */ - public java.lang.String getScopes(int index) { - return scopes_.get(index); - } - /** - * repeated string scopes = 1; - * @param index The index of the value to return. - * @return The bytes of the scopes at the given index. - */ - public com.google.protobuf.ByteString - getScopesBytes(int index) { - return scopes_.getByteString(index); - } - /** - * repeated string scopes = 1; - * @param index The index to set the value at. - * @param value The scopes to set. - * @return This builder for chaining. - */ - public Builder setScopes( - int index, java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - ensureScopesIsMutable(); - scopes_.set(index, value); - onChanged(); - return this; - } - /** - * repeated string scopes = 1; - * @param value The scopes to add. - * @return This builder for chaining. - */ - public Builder addScopes( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - ensureScopesIsMutable(); - scopes_.add(value); - onChanged(); - return this; - } - /** - * repeated string scopes = 1; - * @param values The scopes to add. - * @return This builder for chaining. - */ - public Builder addAllScopes( - java.lang.Iterable values) { - ensureScopesIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll( - values, scopes_); - onChanged(); - return this; - } - /** - * repeated string scopes = 1; - * @return This builder for chaining. - */ - public Builder clearScopes() { - scopes_ = com.google.protobuf.LazyStringArrayList.EMPTY; - bitField0_ = (bitField0_ & ~0x00000001); - onChanged(); - return this; - } - /** - * repeated string scopes = 1; - * @param value The bytes of the scopes to add. - * @return This builder for chaining. - */ - public Builder addScopesBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - ensureScopesIsMutable(); - scopes_.add(value); - onChanged(); - return this; - } - @java.lang.Override - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - - // @@protoc_insertion_point(builder_scope:wso2.discovery.api.Scopes) - } - - // @@protoc_insertion_point(class_scope:wso2.discovery.api.Scopes) - private static final org.wso2.apk.enforcer.discovery.api.Scopes DEFAULT_INSTANCE; - static { - DEFAULT_INSTANCE = new org.wso2.apk.enforcer.discovery.api.Scopes(); - } - - public static org.wso2.apk.enforcer.discovery.api.Scopes getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser - PARSER = new com.google.protobuf.AbstractParser() { - @java.lang.Override - public Scopes parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new Scopes(input, extensionRegistry); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public org.wso2.apk.enforcer.discovery.api.Scopes getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - -} - diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/api/ScopesOrBuilder.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/api/ScopesOrBuilder.java deleted file mode 100644 index 3a3a4352e..000000000 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/api/ScopesOrBuilder.java +++ /dev/null @@ -1,34 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: wso2/discovery/api/security_scheme.proto - -package org.wso2.apk.enforcer.discovery.api; - -public interface ScopesOrBuilder extends - // @@protoc_insertion_point(interface_extends:wso2.discovery.api.Scopes) - com.google.protobuf.MessageOrBuilder { - - /** - * repeated string scopes = 1; - * @return A list containing the scopes. - */ - java.util.List - getScopesList(); - /** - * repeated string scopes = 1; - * @return The count of scopes. - */ - int getScopesCount(); - /** - * repeated string scopes = 1; - * @param index The index of the element to return. - * @return The scopes at the given index. - */ - java.lang.String getScopes(int index); - /** - * repeated string scopes = 1; - * @param index The index of the value to return. - * @return The bytes of the scopes at the given index. - */ - com.google.protobuf.ByteString - getScopesBytes(int index); -} diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/api/SecurityList.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/api/SecurityList.java deleted file mode 100644 index ff6c1c689..000000000 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/api/SecurityList.java +++ /dev/null @@ -1,713 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: wso2/discovery/api/security_scheme.proto - -package org.wso2.apk.enforcer.discovery.api; - -/** - *
- * Represents a single security array item applied at the API level or the API operation level
- * 
- * - * Protobuf type {@code wso2.discovery.api.SecurityList} - */ -public final class SecurityList extends - com.google.protobuf.GeneratedMessageV3 implements - // @@protoc_insertion_point(message_implements:wso2.discovery.api.SecurityList) - SecurityListOrBuilder { -private static final long serialVersionUID = 0L; - // Use SecurityList.newBuilder() to construct. - private SecurityList(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - private SecurityList() { - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance( - UnusedPrivateParameter unused) { - return new SecurityList(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private SecurityList( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: { - if (!((mutable_bitField0_ & 0x00000001) != 0)) { - scopeList_ = com.google.protobuf.MapField.newMapField( - ScopeListDefaultEntryHolder.defaultEntry); - mutable_bitField0_ |= 0x00000001; - } - com.google.protobuf.MapEntry - scopeList__ = input.readMessage( - ScopeListDefaultEntryHolder.defaultEntry.getParserForType(), extensionRegistry); - scopeList_.getMutableMap().put( - scopeList__.getKey(), scopeList__.getValue()); - break; - } - default: { - if (!parseUnknownField( - input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return org.wso2.apk.enforcer.discovery.api.SecuritySchemeProto.internal_static_wso2_discovery_api_SecurityList_descriptor; - } - - @SuppressWarnings({"rawtypes"}) - @java.lang.Override - protected com.google.protobuf.MapField internalGetMapField( - int number) { - switch (number) { - case 1: - return internalGetScopeList(); - default: - throw new RuntimeException( - "Invalid map field number: " + number); - } - } - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return org.wso2.apk.enforcer.discovery.api.SecuritySchemeProto.internal_static_wso2_discovery_api_SecurityList_fieldAccessorTable - .ensureFieldAccessorsInitialized( - org.wso2.apk.enforcer.discovery.api.SecurityList.class, org.wso2.apk.enforcer.discovery.api.SecurityList.Builder.class); - } - - public static final int SCOPELIST_FIELD_NUMBER = 1; - private static final class ScopeListDefaultEntryHolder { - static final com.google.protobuf.MapEntry< - java.lang.String, org.wso2.apk.enforcer.discovery.api.Scopes> defaultEntry = - com.google.protobuf.MapEntry - .newDefaultInstance( - org.wso2.apk.enforcer.discovery.api.SecuritySchemeProto.internal_static_wso2_discovery_api_SecurityList_ScopeListEntry_descriptor, - com.google.protobuf.WireFormat.FieldType.STRING, - "", - com.google.protobuf.WireFormat.FieldType.MESSAGE, - org.wso2.apk.enforcer.discovery.api.Scopes.getDefaultInstance()); - } - private com.google.protobuf.MapField< - java.lang.String, org.wso2.apk.enforcer.discovery.api.Scopes> scopeList_; - private com.google.protobuf.MapField - internalGetScopeList() { - if (scopeList_ == null) { - return com.google.protobuf.MapField.emptyMapField( - ScopeListDefaultEntryHolder.defaultEntry); - } - return scopeList_; - } - - public int getScopeListCount() { - return internalGetScopeList().getMap().size(); - } - /** - * map<string, .wso2.discovery.api.Scopes> scopeList = 1; - */ - - @java.lang.Override - public boolean containsScopeList( - java.lang.String key) { - if (key == null) { throw new java.lang.NullPointerException(); } - return internalGetScopeList().getMap().containsKey(key); - } - /** - * Use {@link #getScopeListMap()} instead. - */ - @java.lang.Override - @java.lang.Deprecated - public java.util.Map getScopeList() { - return getScopeListMap(); - } - /** - * map<string, .wso2.discovery.api.Scopes> scopeList = 1; - */ - @java.lang.Override - - public java.util.Map getScopeListMap() { - return internalGetScopeList().getMap(); - } - /** - * map<string, .wso2.discovery.api.Scopes> scopeList = 1; - */ - @java.lang.Override - - public org.wso2.apk.enforcer.discovery.api.Scopes getScopeListOrDefault( - java.lang.String key, - org.wso2.apk.enforcer.discovery.api.Scopes defaultValue) { - if (key == null) { throw new java.lang.NullPointerException(); } - java.util.Map map = - internalGetScopeList().getMap(); - return map.containsKey(key) ? map.get(key) : defaultValue; - } - /** - * map<string, .wso2.discovery.api.Scopes> scopeList = 1; - */ - @java.lang.Override - - public org.wso2.apk.enforcer.discovery.api.Scopes getScopeListOrThrow( - java.lang.String key) { - if (key == null) { throw new java.lang.NullPointerException(); } - java.util.Map map = - internalGetScopeList().getMap(); - if (!map.containsKey(key)) { - throw new java.lang.IllegalArgumentException(); - } - return map.get(key); - } - - private byte memoizedIsInitialized = -1; - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - com.google.protobuf.GeneratedMessageV3 - .serializeStringMapTo( - output, - internalGetScopeList(), - ScopeListDefaultEntryHolder.defaultEntry, - 1); - unknownFields.writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - for (java.util.Map.Entry entry - : internalGetScopeList().getMap().entrySet()) { - com.google.protobuf.MapEntry - scopeList__ = ScopeListDefaultEntryHolder.defaultEntry.newBuilderForType() - .setKey(entry.getKey()) - .setValue(entry.getValue()) - .build(); - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(1, scopeList__); - } - size += unknownFields.getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof org.wso2.apk.enforcer.discovery.api.SecurityList)) { - return super.equals(obj); - } - org.wso2.apk.enforcer.discovery.api.SecurityList other = (org.wso2.apk.enforcer.discovery.api.SecurityList) obj; - - if (!internalGetScopeList().equals( - other.internalGetScopeList())) return false; - if (!unknownFields.equals(other.unknownFields)) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - if (!internalGetScopeList().getMap().isEmpty()) { - hash = (37 * hash) + SCOPELIST_FIELD_NUMBER; - hash = (53 * hash) + internalGetScopeList().hashCode(); - } - hash = (29 * hash) + unknownFields.hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static org.wso2.apk.enforcer.discovery.api.SecurityList parseFrom( - java.nio.ByteBuffer data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static org.wso2.apk.enforcer.discovery.api.SecurityList parseFrom( - java.nio.ByteBuffer data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static org.wso2.apk.enforcer.discovery.api.SecurityList parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static org.wso2.apk.enforcer.discovery.api.SecurityList parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static org.wso2.apk.enforcer.discovery.api.SecurityList parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static org.wso2.apk.enforcer.discovery.api.SecurityList parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static org.wso2.apk.enforcer.discovery.api.SecurityList parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static org.wso2.apk.enforcer.discovery.api.SecurityList parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - public static org.wso2.apk.enforcer.discovery.api.SecurityList parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input); - } - public static org.wso2.apk.enforcer.discovery.api.SecurityList parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input, extensionRegistry); - } - public static org.wso2.apk.enforcer.discovery.api.SecurityList parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static org.wso2.apk.enforcer.discovery.api.SecurityList parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - - @java.lang.Override - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - public static Builder newBuilder(org.wso2.apk.enforcer.discovery.api.SecurityList prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE - ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - *
-   * Represents a single security array item applied at the API level or the API operation level
-   * 
- * - * Protobuf type {@code wso2.discovery.api.SecurityList} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessageV3.Builder implements - // @@protoc_insertion_point(builder_implements:wso2.discovery.api.SecurityList) - org.wso2.apk.enforcer.discovery.api.SecurityListOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return org.wso2.apk.enforcer.discovery.api.SecuritySchemeProto.internal_static_wso2_discovery_api_SecurityList_descriptor; - } - - @SuppressWarnings({"rawtypes"}) - protected com.google.protobuf.MapField internalGetMapField( - int number) { - switch (number) { - case 1: - return internalGetScopeList(); - default: - throw new RuntimeException( - "Invalid map field number: " + number); - } - } - @SuppressWarnings({"rawtypes"}) - protected com.google.protobuf.MapField internalGetMutableMapField( - int number) { - switch (number) { - case 1: - return internalGetMutableScopeList(); - default: - throw new RuntimeException( - "Invalid map field number: " + number); - } - } - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return org.wso2.apk.enforcer.discovery.api.SecuritySchemeProto.internal_static_wso2_discovery_api_SecurityList_fieldAccessorTable - .ensureFieldAccessorsInitialized( - org.wso2.apk.enforcer.discovery.api.SecurityList.class, org.wso2.apk.enforcer.discovery.api.SecurityList.Builder.class); - } - - // Construct using org.wso2.apk.enforcer.discovery.api.SecurityList.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - } - } - @java.lang.Override - public Builder clear() { - super.clear(); - internalGetMutableScopeList().clear(); - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return org.wso2.apk.enforcer.discovery.api.SecuritySchemeProto.internal_static_wso2_discovery_api_SecurityList_descriptor; - } - - @java.lang.Override - public org.wso2.apk.enforcer.discovery.api.SecurityList getDefaultInstanceForType() { - return org.wso2.apk.enforcer.discovery.api.SecurityList.getDefaultInstance(); - } - - @java.lang.Override - public org.wso2.apk.enforcer.discovery.api.SecurityList build() { - org.wso2.apk.enforcer.discovery.api.SecurityList result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public org.wso2.apk.enforcer.discovery.api.SecurityList buildPartial() { - org.wso2.apk.enforcer.discovery.api.SecurityList result = new org.wso2.apk.enforcer.discovery.api.SecurityList(this); - int from_bitField0_ = bitField0_; - result.scopeList_ = internalGetScopeList(); - result.scopeList_.makeImmutable(); - onBuilt(); - return result; - } - - @java.lang.Override - public Builder clone() { - return super.clone(); - } - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, - java.lang.Object value) { - return super.setField(field, value); - } - @java.lang.Override - public Builder clearField( - com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - @java.lang.Override - public Builder clearOneof( - com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - java.lang.Object value) { - return super.addRepeatedField(field, value); - } - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof org.wso2.apk.enforcer.discovery.api.SecurityList) { - return mergeFrom((org.wso2.apk.enforcer.discovery.api.SecurityList)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(org.wso2.apk.enforcer.discovery.api.SecurityList other) { - if (other == org.wso2.apk.enforcer.discovery.api.SecurityList.getDefaultInstance()) return this; - internalGetMutableScopeList().mergeFrom( - other.internalGetScopeList()); - this.mergeUnknownFields(other.unknownFields); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - org.wso2.apk.enforcer.discovery.api.SecurityList parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (org.wso2.apk.enforcer.discovery.api.SecurityList) e.getUnfinishedMessage(); - throw e.unwrapIOException(); - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - private int bitField0_; - - private com.google.protobuf.MapField< - java.lang.String, org.wso2.apk.enforcer.discovery.api.Scopes> scopeList_; - private com.google.protobuf.MapField - internalGetScopeList() { - if (scopeList_ == null) { - return com.google.protobuf.MapField.emptyMapField( - ScopeListDefaultEntryHolder.defaultEntry); - } - return scopeList_; - } - private com.google.protobuf.MapField - internalGetMutableScopeList() { - onChanged();; - if (scopeList_ == null) { - scopeList_ = com.google.protobuf.MapField.newMapField( - ScopeListDefaultEntryHolder.defaultEntry); - } - if (!scopeList_.isMutable()) { - scopeList_ = scopeList_.copy(); - } - return scopeList_; - } - - public int getScopeListCount() { - return internalGetScopeList().getMap().size(); - } - /** - * map<string, .wso2.discovery.api.Scopes> scopeList = 1; - */ - - @java.lang.Override - public boolean containsScopeList( - java.lang.String key) { - if (key == null) { throw new java.lang.NullPointerException(); } - return internalGetScopeList().getMap().containsKey(key); - } - /** - * Use {@link #getScopeListMap()} instead. - */ - @java.lang.Override - @java.lang.Deprecated - public java.util.Map getScopeList() { - return getScopeListMap(); - } - /** - * map<string, .wso2.discovery.api.Scopes> scopeList = 1; - */ - @java.lang.Override - - public java.util.Map getScopeListMap() { - return internalGetScopeList().getMap(); - } - /** - * map<string, .wso2.discovery.api.Scopes> scopeList = 1; - */ - @java.lang.Override - - public org.wso2.apk.enforcer.discovery.api.Scopes getScopeListOrDefault( - java.lang.String key, - org.wso2.apk.enforcer.discovery.api.Scopes defaultValue) { - if (key == null) { throw new java.lang.NullPointerException(); } - java.util.Map map = - internalGetScopeList().getMap(); - return map.containsKey(key) ? map.get(key) : defaultValue; - } - /** - * map<string, .wso2.discovery.api.Scopes> scopeList = 1; - */ - @java.lang.Override - - public org.wso2.apk.enforcer.discovery.api.Scopes getScopeListOrThrow( - java.lang.String key) { - if (key == null) { throw new java.lang.NullPointerException(); } - java.util.Map map = - internalGetScopeList().getMap(); - if (!map.containsKey(key)) { - throw new java.lang.IllegalArgumentException(); - } - return map.get(key); - } - - public Builder clearScopeList() { - internalGetMutableScopeList().getMutableMap() - .clear(); - return this; - } - /** - * map<string, .wso2.discovery.api.Scopes> scopeList = 1; - */ - - public Builder removeScopeList( - java.lang.String key) { - if (key == null) { throw new java.lang.NullPointerException(); } - internalGetMutableScopeList().getMutableMap() - .remove(key); - return this; - } - /** - * Use alternate mutation accessors instead. - */ - @java.lang.Deprecated - public java.util.Map - getMutableScopeList() { - return internalGetMutableScopeList().getMutableMap(); - } - /** - * map<string, .wso2.discovery.api.Scopes> scopeList = 1; - */ - public Builder putScopeList( - java.lang.String key, - org.wso2.apk.enforcer.discovery.api.Scopes value) { - if (key == null) { throw new java.lang.NullPointerException(); } - if (value == null) { throw new java.lang.NullPointerException(); } - internalGetMutableScopeList().getMutableMap() - .put(key, value); - return this; - } - /** - * map<string, .wso2.discovery.api.Scopes> scopeList = 1; - */ - - public Builder putAllScopeList( - java.util.Map values) { - internalGetMutableScopeList().getMutableMap() - .putAll(values); - return this; - } - @java.lang.Override - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - - // @@protoc_insertion_point(builder_scope:wso2.discovery.api.SecurityList) - } - - // @@protoc_insertion_point(class_scope:wso2.discovery.api.SecurityList) - private static final org.wso2.apk.enforcer.discovery.api.SecurityList DEFAULT_INSTANCE; - static { - DEFAULT_INSTANCE = new org.wso2.apk.enforcer.discovery.api.SecurityList(); - } - - public static org.wso2.apk.enforcer.discovery.api.SecurityList getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser - PARSER = new com.google.protobuf.AbstractParser() { - @java.lang.Override - public SecurityList parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new SecurityList(input, extensionRegistry); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public org.wso2.apk.enforcer.discovery.api.SecurityList getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - -} - diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/api/SecurityListOrBuilder.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/api/SecurityListOrBuilder.java deleted file mode 100644 index 5c6a040aa..000000000 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/api/SecurityListOrBuilder.java +++ /dev/null @@ -1,43 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: wso2/discovery/api/security_scheme.proto - -package org.wso2.apk.enforcer.discovery.api; - -public interface SecurityListOrBuilder extends - // @@protoc_insertion_point(interface_extends:wso2.discovery.api.SecurityList) - com.google.protobuf.MessageOrBuilder { - - /** - * map<string, .wso2.discovery.api.Scopes> scopeList = 1; - */ - int getScopeListCount(); - /** - * map<string, .wso2.discovery.api.Scopes> scopeList = 1; - */ - boolean containsScopeList( - java.lang.String key); - /** - * Use {@link #getScopeListMap()} instead. - */ - @java.lang.Deprecated - java.util.Map - getScopeList(); - /** - * map<string, .wso2.discovery.api.Scopes> scopeList = 1; - */ - java.util.Map - getScopeListMap(); - /** - * map<string, .wso2.discovery.api.Scopes> scopeList = 1; - */ - - org.wso2.apk.enforcer.discovery.api.Scopes getScopeListOrDefault( - java.lang.String key, - org.wso2.apk.enforcer.discovery.api.Scopes defaultValue); - /** - * map<string, .wso2.discovery.api.Scopes> scopeList = 1; - */ - - org.wso2.apk.enforcer.discovery.api.Scopes getScopeListOrThrow( - java.lang.String key); -} diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/api/SecurityScheme.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/api/SecurityScheme.java deleted file mode 100644 index a65aefad6..000000000 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/api/SecurityScheme.java +++ /dev/null @@ -1,1091 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: wso2/discovery/api/security_scheme.proto - -package org.wso2.apk.enforcer.discovery.api; - -/** - *
- * SecurityScheme config model
- * 
- * - * Protobuf type {@code wso2.discovery.api.SecurityScheme} - */ -public final class SecurityScheme extends - com.google.protobuf.GeneratedMessageV3 implements - // @@protoc_insertion_point(message_implements:wso2.discovery.api.SecurityScheme) - SecuritySchemeOrBuilder { -private static final long serialVersionUID = 0L; - // Use SecurityScheme.newBuilder() to construct. - private SecurityScheme(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - private SecurityScheme() { - definitionName_ = ""; - type_ = ""; - name_ = ""; - in_ = ""; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance( - UnusedPrivateParameter unused) { - return new SecurityScheme(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private SecurityScheme( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: { - java.lang.String s = input.readStringRequireUtf8(); - - definitionName_ = s; - break; - } - case 18: { - java.lang.String s = input.readStringRequireUtf8(); - - type_ = s; - break; - } - case 26: { - java.lang.String s = input.readStringRequireUtf8(); - - name_ = s; - break; - } - case 34: { - java.lang.String s = input.readStringRequireUtf8(); - - in_ = s; - break; - } - default: { - if (!parseUnknownField( - input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return org.wso2.apk.enforcer.discovery.api.SecuritySchemeProto.internal_static_wso2_discovery_api_SecurityScheme_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return org.wso2.apk.enforcer.discovery.api.SecuritySchemeProto.internal_static_wso2_discovery_api_SecurityScheme_fieldAccessorTable - .ensureFieldAccessorsInitialized( - org.wso2.apk.enforcer.discovery.api.SecurityScheme.class, org.wso2.apk.enforcer.discovery.api.SecurityScheme.Builder.class); - } - - public static final int DEFINITIONNAME_FIELD_NUMBER = 1; - private volatile java.lang.Object definitionName_; - /** - *
-   * name used to define security scheme
-   * 
- * - * string definitionName = 1; - * @return The definitionName. - */ - @java.lang.Override - public java.lang.String getDefinitionName() { - java.lang.Object ref = definitionName_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - definitionName_ = s; - return s; - } - } - /** - *
-   * name used to define security scheme
-   * 
- * - * string definitionName = 1; - * @return The bytes for definitionName. - */ - @java.lang.Override - public com.google.protobuf.ByteString - getDefinitionNameBytes() { - java.lang.Object ref = definitionName_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - definitionName_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int TYPE_FIELD_NUMBER = 2; - private volatile java.lang.Object type_; - /** - *
-   * type of the security scheme
-   * 
- * - * string type = 2; - * @return The type. - */ - @java.lang.Override - public java.lang.String getType() { - java.lang.Object ref = type_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - type_ = s; - return s; - } - } - /** - *
-   * type of the security scheme
-   * 
- * - * string type = 2; - * @return The bytes for type. - */ - @java.lang.Override - public com.google.protobuf.ByteString - getTypeBytes() { - java.lang.Object ref = type_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - type_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int NAME_FIELD_NUMBER = 3; - private volatile java.lang.Object name_; - /** - *
-   * name of the security scheme
-   * 
- * - * string name = 3; - * @return The name. - */ - @java.lang.Override - public java.lang.String getName() { - java.lang.Object ref = name_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - name_ = s; - return s; - } - } - /** - *
-   * name of the security scheme
-   * 
- * - * string name = 3; - * @return The bytes for name. - */ - @java.lang.Override - public com.google.protobuf.ByteString - getNameBytes() { - java.lang.Object ref = name_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - name_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int IN_FIELD_NUMBER = 4; - private volatile java.lang.Object in_; - /** - *
-   * location of the API key in request
-   * 
- * - * string in = 4; - * @return The in. - */ - @java.lang.Override - public java.lang.String getIn() { - java.lang.Object ref = in_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - in_ = s; - return s; - } - } - /** - *
-   * location of the API key in request
-   * 
- * - * string in = 4; - * @return The bytes for in. - */ - @java.lang.Override - public com.google.protobuf.ByteString - getInBytes() { - java.lang.Object ref = in_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - in_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - private byte memoizedIsInitialized = -1; - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - if (!getDefinitionNameBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, definitionName_); - } - if (!getTypeBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 2, type_); - } - if (!getNameBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 3, name_); - } - if (!getInBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 4, in_); - } - unknownFields.writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (!getDefinitionNameBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, definitionName_); - } - if (!getTypeBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, type_); - } - if (!getNameBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, name_); - } - if (!getInBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, in_); - } - size += unknownFields.getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof org.wso2.apk.enforcer.discovery.api.SecurityScheme)) { - return super.equals(obj); - } - org.wso2.apk.enforcer.discovery.api.SecurityScheme other = (org.wso2.apk.enforcer.discovery.api.SecurityScheme) obj; - - if (!getDefinitionName() - .equals(other.getDefinitionName())) return false; - if (!getType() - .equals(other.getType())) return false; - if (!getName() - .equals(other.getName())) return false; - if (!getIn() - .equals(other.getIn())) return false; - if (!unknownFields.equals(other.unknownFields)) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + DEFINITIONNAME_FIELD_NUMBER; - hash = (53 * hash) + getDefinitionName().hashCode(); - hash = (37 * hash) + TYPE_FIELD_NUMBER; - hash = (53 * hash) + getType().hashCode(); - hash = (37 * hash) + NAME_FIELD_NUMBER; - hash = (53 * hash) + getName().hashCode(); - hash = (37 * hash) + IN_FIELD_NUMBER; - hash = (53 * hash) + getIn().hashCode(); - hash = (29 * hash) + unknownFields.hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static org.wso2.apk.enforcer.discovery.api.SecurityScheme parseFrom( - java.nio.ByteBuffer data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static org.wso2.apk.enforcer.discovery.api.SecurityScheme parseFrom( - java.nio.ByteBuffer data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static org.wso2.apk.enforcer.discovery.api.SecurityScheme parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static org.wso2.apk.enforcer.discovery.api.SecurityScheme parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static org.wso2.apk.enforcer.discovery.api.SecurityScheme parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static org.wso2.apk.enforcer.discovery.api.SecurityScheme parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static org.wso2.apk.enforcer.discovery.api.SecurityScheme parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static org.wso2.apk.enforcer.discovery.api.SecurityScheme parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - public static org.wso2.apk.enforcer.discovery.api.SecurityScheme parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input); - } - public static org.wso2.apk.enforcer.discovery.api.SecurityScheme parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input, extensionRegistry); - } - public static org.wso2.apk.enforcer.discovery.api.SecurityScheme parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static org.wso2.apk.enforcer.discovery.api.SecurityScheme parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - - @java.lang.Override - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - public static Builder newBuilder(org.wso2.apk.enforcer.discovery.api.SecurityScheme prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE - ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - *
-   * SecurityScheme config model
-   * 
- * - * Protobuf type {@code wso2.discovery.api.SecurityScheme} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessageV3.Builder implements - // @@protoc_insertion_point(builder_implements:wso2.discovery.api.SecurityScheme) - org.wso2.apk.enforcer.discovery.api.SecuritySchemeOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return org.wso2.apk.enforcer.discovery.api.SecuritySchemeProto.internal_static_wso2_discovery_api_SecurityScheme_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return org.wso2.apk.enforcer.discovery.api.SecuritySchemeProto.internal_static_wso2_discovery_api_SecurityScheme_fieldAccessorTable - .ensureFieldAccessorsInitialized( - org.wso2.apk.enforcer.discovery.api.SecurityScheme.class, org.wso2.apk.enforcer.discovery.api.SecurityScheme.Builder.class); - } - - // Construct using org.wso2.apk.enforcer.discovery.api.SecurityScheme.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - } - } - @java.lang.Override - public Builder clear() { - super.clear(); - definitionName_ = ""; - - type_ = ""; - - name_ = ""; - - in_ = ""; - - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return org.wso2.apk.enforcer.discovery.api.SecuritySchemeProto.internal_static_wso2_discovery_api_SecurityScheme_descriptor; - } - - @java.lang.Override - public org.wso2.apk.enforcer.discovery.api.SecurityScheme getDefaultInstanceForType() { - return org.wso2.apk.enforcer.discovery.api.SecurityScheme.getDefaultInstance(); - } - - @java.lang.Override - public org.wso2.apk.enforcer.discovery.api.SecurityScheme build() { - org.wso2.apk.enforcer.discovery.api.SecurityScheme result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public org.wso2.apk.enforcer.discovery.api.SecurityScheme buildPartial() { - org.wso2.apk.enforcer.discovery.api.SecurityScheme result = new org.wso2.apk.enforcer.discovery.api.SecurityScheme(this); - result.definitionName_ = definitionName_; - result.type_ = type_; - result.name_ = name_; - result.in_ = in_; - onBuilt(); - return result; - } - - @java.lang.Override - public Builder clone() { - return super.clone(); - } - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, - java.lang.Object value) { - return super.setField(field, value); - } - @java.lang.Override - public Builder clearField( - com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - @java.lang.Override - public Builder clearOneof( - com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - java.lang.Object value) { - return super.addRepeatedField(field, value); - } - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof org.wso2.apk.enforcer.discovery.api.SecurityScheme) { - return mergeFrom((org.wso2.apk.enforcer.discovery.api.SecurityScheme)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(org.wso2.apk.enforcer.discovery.api.SecurityScheme other) { - if (other == org.wso2.apk.enforcer.discovery.api.SecurityScheme.getDefaultInstance()) return this; - if (!other.getDefinitionName().isEmpty()) { - definitionName_ = other.definitionName_; - onChanged(); - } - if (!other.getType().isEmpty()) { - type_ = other.type_; - onChanged(); - } - if (!other.getName().isEmpty()) { - name_ = other.name_; - onChanged(); - } - if (!other.getIn().isEmpty()) { - in_ = other.in_; - onChanged(); - } - this.mergeUnknownFields(other.unknownFields); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - org.wso2.apk.enforcer.discovery.api.SecurityScheme parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (org.wso2.apk.enforcer.discovery.api.SecurityScheme) e.getUnfinishedMessage(); - throw e.unwrapIOException(); - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - - private java.lang.Object definitionName_ = ""; - /** - *
-     * name used to define security scheme
-     * 
- * - * string definitionName = 1; - * @return The definitionName. - */ - public java.lang.String getDefinitionName() { - java.lang.Object ref = definitionName_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - definitionName_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - *
-     * name used to define security scheme
-     * 
- * - * string definitionName = 1; - * @return The bytes for definitionName. - */ - public com.google.protobuf.ByteString - getDefinitionNameBytes() { - java.lang.Object ref = definitionName_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - definitionName_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - *
-     * name used to define security scheme
-     * 
- * - * string definitionName = 1; - * @param value The definitionName to set. - * @return This builder for chaining. - */ - public Builder setDefinitionName( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - - definitionName_ = value; - onChanged(); - return this; - } - /** - *
-     * name used to define security scheme
-     * 
- * - * string definitionName = 1; - * @return This builder for chaining. - */ - public Builder clearDefinitionName() { - - definitionName_ = getDefaultInstance().getDefinitionName(); - onChanged(); - return this; - } - /** - *
-     * name used to define security scheme
-     * 
- * - * string definitionName = 1; - * @param value The bytes for definitionName to set. - * @return This builder for chaining. - */ - public Builder setDefinitionNameBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - definitionName_ = value; - onChanged(); - return this; - } - - private java.lang.Object type_ = ""; - /** - *
-     * type of the security scheme
-     * 
- * - * string type = 2; - * @return The type. - */ - public java.lang.String getType() { - java.lang.Object ref = type_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - type_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - *
-     * type of the security scheme
-     * 
- * - * string type = 2; - * @return The bytes for type. - */ - public com.google.protobuf.ByteString - getTypeBytes() { - java.lang.Object ref = type_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - type_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - *
-     * type of the security scheme
-     * 
- * - * string type = 2; - * @param value The type to set. - * @return This builder for chaining. - */ - public Builder setType( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - - type_ = value; - onChanged(); - return this; - } - /** - *
-     * type of the security scheme
-     * 
- * - * string type = 2; - * @return This builder for chaining. - */ - public Builder clearType() { - - type_ = getDefaultInstance().getType(); - onChanged(); - return this; - } - /** - *
-     * type of the security scheme
-     * 
- * - * string type = 2; - * @param value The bytes for type to set. - * @return This builder for chaining. - */ - public Builder setTypeBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - type_ = value; - onChanged(); - return this; - } - - private java.lang.Object name_ = ""; - /** - *
-     * name of the security scheme
-     * 
- * - * string name = 3; - * @return The name. - */ - public java.lang.String getName() { - java.lang.Object ref = name_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - name_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - *
-     * name of the security scheme
-     * 
- * - * string name = 3; - * @return The bytes for name. - */ - public com.google.protobuf.ByteString - getNameBytes() { - java.lang.Object ref = name_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - name_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - *
-     * name of the security scheme
-     * 
- * - * string name = 3; - * @param value The name to set. - * @return This builder for chaining. - */ - public Builder setName( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - - name_ = value; - onChanged(); - return this; - } - /** - *
-     * name of the security scheme
-     * 
- * - * string name = 3; - * @return This builder for chaining. - */ - public Builder clearName() { - - name_ = getDefaultInstance().getName(); - onChanged(); - return this; - } - /** - *
-     * name of the security scheme
-     * 
- * - * string name = 3; - * @param value The bytes for name to set. - * @return This builder for chaining. - */ - public Builder setNameBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - name_ = value; - onChanged(); - return this; - } - - private java.lang.Object in_ = ""; - /** - *
-     * location of the API key in request
-     * 
- * - * string in = 4; - * @return The in. - */ - public java.lang.String getIn() { - java.lang.Object ref = in_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - in_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - *
-     * location of the API key in request
-     * 
- * - * string in = 4; - * @return The bytes for in. - */ - public com.google.protobuf.ByteString - getInBytes() { - java.lang.Object ref = in_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - in_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - *
-     * location of the API key in request
-     * 
- * - * string in = 4; - * @param value The in to set. - * @return This builder for chaining. - */ - public Builder setIn( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - - in_ = value; - onChanged(); - return this; - } - /** - *
-     * location of the API key in request
-     * 
- * - * string in = 4; - * @return This builder for chaining. - */ - public Builder clearIn() { - - in_ = getDefaultInstance().getIn(); - onChanged(); - return this; - } - /** - *
-     * location of the API key in request
-     * 
- * - * string in = 4; - * @param value The bytes for in to set. - * @return This builder for chaining. - */ - public Builder setInBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - in_ = value; - onChanged(); - return this; - } - @java.lang.Override - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - - // @@protoc_insertion_point(builder_scope:wso2.discovery.api.SecurityScheme) - } - - // @@protoc_insertion_point(class_scope:wso2.discovery.api.SecurityScheme) - private static final org.wso2.apk.enforcer.discovery.api.SecurityScheme DEFAULT_INSTANCE; - static { - DEFAULT_INSTANCE = new org.wso2.apk.enforcer.discovery.api.SecurityScheme(); - } - - public static org.wso2.apk.enforcer.discovery.api.SecurityScheme getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser - PARSER = new com.google.protobuf.AbstractParser() { - @java.lang.Override - public SecurityScheme parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new SecurityScheme(input, extensionRegistry); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public org.wso2.apk.enforcer.discovery.api.SecurityScheme getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - -} - diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/api/SecuritySchemeOrBuilder.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/api/SecuritySchemeOrBuilder.java deleted file mode 100644 index 5c85b6dde..000000000 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/api/SecuritySchemeOrBuilder.java +++ /dev/null @@ -1,89 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: wso2/discovery/api/security_scheme.proto - -package org.wso2.apk.enforcer.discovery.api; - -public interface SecuritySchemeOrBuilder extends - // @@protoc_insertion_point(interface_extends:wso2.discovery.api.SecurityScheme) - com.google.protobuf.MessageOrBuilder { - - /** - *
-   * name used to define security scheme
-   * 
- * - * string definitionName = 1; - * @return The definitionName. - */ - java.lang.String getDefinitionName(); - /** - *
-   * name used to define security scheme
-   * 
- * - * string definitionName = 1; - * @return The bytes for definitionName. - */ - com.google.protobuf.ByteString - getDefinitionNameBytes(); - - /** - *
-   * type of the security scheme
-   * 
- * - * string type = 2; - * @return The type. - */ - java.lang.String getType(); - /** - *
-   * type of the security scheme
-   * 
- * - * string type = 2; - * @return The bytes for type. - */ - com.google.protobuf.ByteString - getTypeBytes(); - - /** - *
-   * name of the security scheme
-   * 
- * - * string name = 3; - * @return The name. - */ - java.lang.String getName(); - /** - *
-   * name of the security scheme
-   * 
- * - * string name = 3; - * @return The bytes for name. - */ - com.google.protobuf.ByteString - getNameBytes(); - - /** - *
-   * location of the API key in request
-   * 
- * - * string in = 4; - * @return The in. - */ - java.lang.String getIn(); - /** - *
-   * location of the API key in request
-   * 
- * - * string in = 4; - * @return The bytes for in. - */ - com.google.protobuf.ByteString - getInBytes(); -} diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/api/SecuritySchemeProto.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/api/SecuritySchemeProto.java deleted file mode 100644 index ba0531180..000000000 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/api/SecuritySchemeProto.java +++ /dev/null @@ -1,90 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: wso2/discovery/api/security_scheme.proto - -package org.wso2.apk.enforcer.discovery.api; - -public final class SecuritySchemeProto { - private SecuritySchemeProto() {} - public static void registerAllExtensions( - com.google.protobuf.ExtensionRegistryLite registry) { - } - - public static void registerAllExtensions( - com.google.protobuf.ExtensionRegistry registry) { - registerAllExtensions( - (com.google.protobuf.ExtensionRegistryLite) registry); - } - static final com.google.protobuf.Descriptors.Descriptor - internal_static_wso2_discovery_api_SecurityScheme_descriptor; - static final - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_wso2_discovery_api_SecurityScheme_fieldAccessorTable; - static final com.google.protobuf.Descriptors.Descriptor - internal_static_wso2_discovery_api_SecurityList_descriptor; - static final - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_wso2_discovery_api_SecurityList_fieldAccessorTable; - static final com.google.protobuf.Descriptors.Descriptor - internal_static_wso2_discovery_api_SecurityList_ScopeListEntry_descriptor; - static final - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_wso2_discovery_api_SecurityList_ScopeListEntry_fieldAccessorTable; - static final com.google.protobuf.Descriptors.Descriptor - internal_static_wso2_discovery_api_Scopes_descriptor; - static final - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_wso2_discovery_api_Scopes_fieldAccessorTable; - - public static com.google.protobuf.Descriptors.FileDescriptor - getDescriptor() { - return descriptor; - } - private static com.google.protobuf.Descriptors.FileDescriptor - descriptor; - static { - java.lang.String[] descriptorData = { - "\n(wso2/discovery/api/security_scheme.pro" + - "to\022\022wso2.discovery.api\"P\n\016SecurityScheme" + - "\022\026\n\016definitionName\030\001 \001(\t\022\014\n\004type\030\002 \001(\t\022\014" + - "\n\004name\030\003 \001(\t\022\n\n\002in\030\004 \001(\t\"\240\001\n\014SecurityLis" + - "t\022B\n\tscopeList\030\001 \003(\0132/.wso2.discovery.ap" + - "i.SecurityList.ScopeListEntry\032L\n\016ScopeLi" + - "stEntry\022\013\n\003key\030\001 \001(\t\022)\n\005value\030\002 \001(\0132\032.ws" + - "o2.discovery.api.Scopes:\0028\001\"\030\n\006Scopes\022\016\n" + - "\006scopes\030\001 \003(\tB{\n#org.wso2.apk.enforcer.d" + - "iscovery.apiB\023SecuritySchemeProtoP\001Z=git" + - "hub.com/envoyproxy/go-control-plane/wso2" + - "/discovery/api;apib\006proto3" - }; - descriptor = com.google.protobuf.Descriptors.FileDescriptor - .internalBuildGeneratedFileFrom(descriptorData, - new com.google.protobuf.Descriptors.FileDescriptor[] { - }); - internal_static_wso2_discovery_api_SecurityScheme_descriptor = - getDescriptor().getMessageTypes().get(0); - internal_static_wso2_discovery_api_SecurityScheme_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_wso2_discovery_api_SecurityScheme_descriptor, - new java.lang.String[] { "DefinitionName", "Type", "Name", "In", }); - internal_static_wso2_discovery_api_SecurityList_descriptor = - getDescriptor().getMessageTypes().get(1); - internal_static_wso2_discovery_api_SecurityList_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_wso2_discovery_api_SecurityList_descriptor, - new java.lang.String[] { "ScopeList", }); - internal_static_wso2_discovery_api_SecurityList_ScopeListEntry_descriptor = - internal_static_wso2_discovery_api_SecurityList_descriptor.getNestedTypes().get(0); - internal_static_wso2_discovery_api_SecurityList_ScopeListEntry_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_wso2_discovery_api_SecurityList_ScopeListEntry_descriptor, - new java.lang.String[] { "Key", "Value", }); - internal_static_wso2_discovery_api_Scopes_descriptor = - getDescriptor().getMessageTypes().get(2); - internal_static_wso2_discovery_api_Scopes_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_wso2_discovery_api_Scopes_descriptor, - new java.lang.String[] { "Scopes", }); - } - - // @@protoc_insertion_point(outer_class_scope) -} diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/scheduler/XdsSchedulerManager.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/scheduler/XdsSchedulerManager.java index aeff25ec6..3ed73dcce 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/scheduler/XdsSchedulerManager.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/scheduler/XdsSchedulerManager.java @@ -20,7 +20,6 @@ import org.wso2.apk.enforcer.config.EnvVarConfig; import org.wso2.apk.enforcer.discovery.ApiDiscoveryClient; -import org.wso2.apk.enforcer.discovery.ApiListDiscoveryClient; import org.wso2.apk.enforcer.discovery.ConfigDiscoveryClient; import org.wso2.apk.enforcer.discovery.JWTIssuerDiscoveryClient; import org.wso2.apk.enforcer.subscription.EventingGrpcClient; @@ -40,7 +39,6 @@ public class XdsSchedulerManager { private static ScheduledExecutorService discoveryClientScheduler; private static ScheduledExecutorService eventingScheduler; private ScheduledFuture apiDiscoveryScheduledFuture; - private ScheduledFuture apiDiscoveryListScheduledFuture; private ScheduledFuture jwtIssuerDiscoveryScheduledFuture; private ScheduledFuture eventingScheduledFuture; @@ -76,21 +74,6 @@ public synchronized void stopAPIDiscoveryScheduling() { } } - public synchronized void startAPIListDiscoveryScheduling() { - - if (apiDiscoveryListScheduledFuture == null || apiDiscoveryListScheduledFuture.isDone()) { - apiDiscoveryListScheduledFuture = discoveryClientScheduler - .scheduleWithFixedDelay(ApiListDiscoveryClient.getInstance(), 1, retryPeriod, TimeUnit.SECONDS); - } - } - - public synchronized void stopAPIListDiscoveryScheduling() { - - if (apiDiscoveryListScheduledFuture != null && !apiDiscoveryListScheduledFuture.isDone()) { - apiDiscoveryListScheduledFuture.cancel(false); - } - } - public synchronized void startJWTIssuerDiscoveryScheduling() { if (jwtIssuerDiscoveryScheduledFuture == null || jwtIssuerDiscoveryScheduledFuture.isDone()) { diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/ApiListDSProto.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/ApiListDSProto.java deleted file mode 100644 index 840d4d1a4..000000000 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/ApiListDSProto.java +++ /dev/null @@ -1,47 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: wso2/discovery/service/subscription/apids.proto - -package org.wso2.apk.enforcer.discovery.service.subscription; - -public final class ApiListDSProto { - private ApiListDSProto() {} - public static void registerAllExtensions( - com.google.protobuf.ExtensionRegistryLite registry) { - } - - public static void registerAllExtensions( - com.google.protobuf.ExtensionRegistry registry) { - registerAllExtensions( - (com.google.protobuf.ExtensionRegistryLite) registry); - } - - public static com.google.protobuf.Descriptors.FileDescriptor - getDescriptor() { - return descriptor; - } - private static com.google.protobuf.Descriptors.FileDescriptor - descriptor; - static { - java.lang.String[] descriptorData = { - "\n/wso2/discovery/service/subscription/ap" + - "ids.proto\022\036discovery.service.subscriptio" + - "n\032*envoy/service/discovery/v3/discovery." + - "proto2\215\001\n\027ApiListDiscoveryService\022r\n\rStr" + - "eamApiList\022,.envoy.service.discovery.v3." + - "DiscoveryRequest\032-.envoy.service.discove" + - "ry.v3.DiscoveryResponse\"\000(\0010\001B\227\001\n4org.ws" + - "o2.apk.enforcer.discovery.service.subscr" + - "iptionB\016ApiListDSProtoP\001ZJgithub.com/env" + - "oyproxy/go-control-plane/wso2/discovery/" + - "service/subscription\210\001\001b\006proto3" - }; - descriptor = com.google.protobuf.Descriptors.FileDescriptor - .internalBuildGeneratedFileFrom(descriptorData, - new com.google.protobuf.Descriptors.FileDescriptor[] { - io.envoyproxy.envoy.service.discovery.v3.DiscoveryProto.getDescriptor(), - }); - io.envoyproxy.envoy.service.discovery.v3.DiscoveryProto.getDescriptor(); - } - - // @@protoc_insertion_point(outer_class_scope) -} diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/ApiListDiscoveryService.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/ApiListDiscoveryService.java deleted file mode 100644 index 5555e77a7..000000000 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/ApiListDiscoveryService.java +++ /dev/null @@ -1,241 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: wso2/discovery/service/subscription/apids.proto - -package org.wso2.apk.enforcer.discovery.service.subscription; - -/** - *
- * [#protodoc-title: ApiListDS]
- * 
- * - * Protobuf service {@code discovery.service.subscription.ApiListDiscoveryService} - */ -public abstract class ApiListDiscoveryService - implements com.google.protobuf.Service { - protected ApiListDiscoveryService() {} - - public interface Interface { - /** - * rpc StreamApiList(stream .envoy.service.discovery.v3.DiscoveryRequest) returns (stream .envoy.service.discovery.v3.DiscoveryResponse); - */ - public abstract void streamApiList( - com.google.protobuf.RpcController controller, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest request, - com.google.protobuf.RpcCallback done); - - } - - public static com.google.protobuf.Service newReflectiveService( - final Interface impl) { - return new ApiListDiscoveryService() { - @java.lang.Override - public void streamApiList( - com.google.protobuf.RpcController controller, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest request, - com.google.protobuf.RpcCallback done) { - impl.streamApiList(controller, request, done); - } - - }; - } - - public static com.google.protobuf.BlockingService - newReflectiveBlockingService(final BlockingInterface impl) { - return new com.google.protobuf.BlockingService() { - public final com.google.protobuf.Descriptors.ServiceDescriptor - getDescriptorForType() { - return getDescriptor(); - } - - public final com.google.protobuf.Message callBlockingMethod( - com.google.protobuf.Descriptors.MethodDescriptor method, - com.google.protobuf.RpcController controller, - com.google.protobuf.Message request) - throws com.google.protobuf.ServiceException { - if (method.getService() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "Service.callBlockingMethod() given method descriptor for " + - "wrong service type."); - } - switch(method.getIndex()) { - case 0: - return impl.streamApiList(controller, (io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest)request); - default: - throw new java.lang.AssertionError("Can't get here."); - } - } - - public final com.google.protobuf.Message - getRequestPrototype( - com.google.protobuf.Descriptors.MethodDescriptor method) { - if (method.getService() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "Service.getRequestPrototype() given method " + - "descriptor for wrong service type."); - } - switch(method.getIndex()) { - case 0: - return io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest.getDefaultInstance(); - default: - throw new java.lang.AssertionError("Can't get here."); - } - } - - public final com.google.protobuf.Message - getResponsePrototype( - com.google.protobuf.Descriptors.MethodDescriptor method) { - if (method.getService() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "Service.getResponsePrototype() given method " + - "descriptor for wrong service type."); - } - switch(method.getIndex()) { - case 0: - return io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse.getDefaultInstance(); - default: - throw new java.lang.AssertionError("Can't get here."); - } - } - - }; - } - - /** - * rpc StreamApiList(stream .envoy.service.discovery.v3.DiscoveryRequest) returns (stream .envoy.service.discovery.v3.DiscoveryResponse); - */ - public abstract void streamApiList( - com.google.protobuf.RpcController controller, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest request, - com.google.protobuf.RpcCallback done); - - public static final - com.google.protobuf.Descriptors.ServiceDescriptor - getDescriptor() { - return org.wso2.apk.enforcer.discovery.service.subscription.ApiListDSProto.getDescriptor().getServices().get(0); - } - public final com.google.protobuf.Descriptors.ServiceDescriptor - getDescriptorForType() { - return getDescriptor(); - } - - public final void callMethod( - com.google.protobuf.Descriptors.MethodDescriptor method, - com.google.protobuf.RpcController controller, - com.google.protobuf.Message request, - com.google.protobuf.RpcCallback< - com.google.protobuf.Message> done) { - if (method.getService() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "Service.callMethod() given method descriptor for wrong " + - "service type."); - } - switch(method.getIndex()) { - case 0: - this.streamApiList(controller, (io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest)request, - com.google.protobuf.RpcUtil.specializeCallback( - done)); - return; - default: - throw new java.lang.AssertionError("Can't get here."); - } - } - - public final com.google.protobuf.Message - getRequestPrototype( - com.google.protobuf.Descriptors.MethodDescriptor method) { - if (method.getService() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "Service.getRequestPrototype() given method " + - "descriptor for wrong service type."); - } - switch(method.getIndex()) { - case 0: - return io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest.getDefaultInstance(); - default: - throw new java.lang.AssertionError("Can't get here."); - } - } - - public final com.google.protobuf.Message - getResponsePrototype( - com.google.protobuf.Descriptors.MethodDescriptor method) { - if (method.getService() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "Service.getResponsePrototype() given method " + - "descriptor for wrong service type."); - } - switch(method.getIndex()) { - case 0: - return io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse.getDefaultInstance(); - default: - throw new java.lang.AssertionError("Can't get here."); - } - } - - public static Stub newStub( - com.google.protobuf.RpcChannel channel) { - return new Stub(channel); - } - - public static final class Stub extends org.wso2.apk.enforcer.discovery.service.subscription.ApiListDiscoveryService implements Interface { - private Stub(com.google.protobuf.RpcChannel channel) { - this.channel = channel; - } - - private final com.google.protobuf.RpcChannel channel; - - public com.google.protobuf.RpcChannel getChannel() { - return channel; - } - - public void streamApiList( - com.google.protobuf.RpcController controller, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest request, - com.google.protobuf.RpcCallback done) { - channel.callMethod( - getDescriptor().getMethods().get(0), - controller, - request, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse.getDefaultInstance(), - com.google.protobuf.RpcUtil.generalizeCallback( - done, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse.class, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse.getDefaultInstance())); - } - } - - public static BlockingInterface newBlockingStub( - com.google.protobuf.BlockingRpcChannel channel) { - return new BlockingStub(channel); - } - - public interface BlockingInterface { - public io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse streamApiList( - com.google.protobuf.RpcController controller, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest request) - throws com.google.protobuf.ServiceException; - } - - private static final class BlockingStub implements BlockingInterface { - private BlockingStub(com.google.protobuf.BlockingRpcChannel channel) { - this.channel = channel; - } - - private final com.google.protobuf.BlockingRpcChannel channel; - - public io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse streamApiList( - com.google.protobuf.RpcController controller, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest request) - throws com.google.protobuf.ServiceException { - return (io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse) channel.callBlockingMethod( - getDescriptor().getMethods().get(0), - controller, - request, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse.getDefaultInstance()); - } - - } - - // @@protoc_insertion_point(class_scope:discovery.service.subscription.ApiListDiscoveryService) -} - diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/ApiListDiscoveryServiceGrpc.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/ApiListDiscoveryServiceGrpc.java deleted file mode 100644 index 71f3220bc..000000000 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/ApiListDiscoveryServiceGrpc.java +++ /dev/null @@ -1,287 +0,0 @@ -package org.wso2.apk.enforcer.discovery.service.subscription; - -import static io.grpc.MethodDescriptor.generateFullMethodName; -import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall; -import static io.grpc.stub.ClientCalls.asyncClientStreamingCall; -import static io.grpc.stub.ClientCalls.asyncServerStreamingCall; -import static io.grpc.stub.ClientCalls.asyncUnaryCall; -import static io.grpc.stub.ClientCalls.blockingServerStreamingCall; -import static io.grpc.stub.ClientCalls.blockingUnaryCall; -import static io.grpc.stub.ClientCalls.futureUnaryCall; -import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall; -import static io.grpc.stub.ServerCalls.asyncClientStreamingCall; -import static io.grpc.stub.ServerCalls.asyncServerStreamingCall; -import static io.grpc.stub.ServerCalls.asyncUnaryCall; -import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall; -import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall; - -/** - *
- * [#protodoc-title: ApiListDS]
- * 
- */ -@javax.annotation.Generated( - value = "by gRPC proto compiler", - comments = "Source: wso2/discovery/service/subscription/apids.proto") -public final class ApiListDiscoveryServiceGrpc { - - private ApiListDiscoveryServiceGrpc() {} - - public static final String SERVICE_NAME = "discovery.service.subscription.ApiListDiscoveryService"; - - // Static method descriptors that strictly reflect the proto. - private static volatile io.grpc.MethodDescriptor getStreamApiListMethod; - - @io.grpc.stub.annotations.RpcMethod( - fullMethodName = SERVICE_NAME + '/' + "StreamApiList", - requestType = io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest.class, - responseType = io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse.class, - methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) - public static io.grpc.MethodDescriptor getStreamApiListMethod() { - io.grpc.MethodDescriptor getStreamApiListMethod; - if ((getStreamApiListMethod = ApiListDiscoveryServiceGrpc.getStreamApiListMethod) == null) { - synchronized (ApiListDiscoveryServiceGrpc.class) { - if ((getStreamApiListMethod = ApiListDiscoveryServiceGrpc.getStreamApiListMethod) == null) { - ApiListDiscoveryServiceGrpc.getStreamApiListMethod = getStreamApiListMethod = - io.grpc.MethodDescriptor.newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) - .setFullMethodName(generateFullMethodName(SERVICE_NAME, "StreamApiList")) - .setSampledToLocalTracing(true) - .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest.getDefaultInstance())) - .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse.getDefaultInstance())) - .setSchemaDescriptor(new ApiListDiscoveryServiceMethodDescriptorSupplier("StreamApiList")) - .build(); - } - } - } - return getStreamApiListMethod; - } - - /** - * Creates a new async stub that supports all call types for the service - */ - public static ApiListDiscoveryServiceStub newStub(io.grpc.Channel channel) { - io.grpc.stub.AbstractStub.StubFactory factory = - new io.grpc.stub.AbstractStub.StubFactory() { - @java.lang.Override - public ApiListDiscoveryServiceStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new ApiListDiscoveryServiceStub(channel, callOptions); - } - }; - return ApiListDiscoveryServiceStub.newStub(factory, channel); - } - - /** - * Creates a new blocking-style stub that supports unary and streaming output calls on the service - */ - public static ApiListDiscoveryServiceBlockingStub newBlockingStub( - io.grpc.Channel channel) { - io.grpc.stub.AbstractStub.StubFactory factory = - new io.grpc.stub.AbstractStub.StubFactory() { - @java.lang.Override - public ApiListDiscoveryServiceBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new ApiListDiscoveryServiceBlockingStub(channel, callOptions); - } - }; - return ApiListDiscoveryServiceBlockingStub.newStub(factory, channel); - } - - /** - * Creates a new ListenableFuture-style stub that supports unary calls on the service - */ - public static ApiListDiscoveryServiceFutureStub newFutureStub( - io.grpc.Channel channel) { - io.grpc.stub.AbstractStub.StubFactory factory = - new io.grpc.stub.AbstractStub.StubFactory() { - @java.lang.Override - public ApiListDiscoveryServiceFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new ApiListDiscoveryServiceFutureStub(channel, callOptions); - } - }; - return ApiListDiscoveryServiceFutureStub.newStub(factory, channel); - } - - /** - *
-   * [#protodoc-title: ApiListDS]
-   * 
- */ - public static abstract class ApiListDiscoveryServiceImplBase implements io.grpc.BindableService { - - /** - */ - public io.grpc.stub.StreamObserver streamApiList( - io.grpc.stub.StreamObserver responseObserver) { - return asyncUnimplementedStreamingCall(getStreamApiListMethod(), responseObserver); - } - - @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() { - return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) - .addMethod( - getStreamApiListMethod(), - asyncBidiStreamingCall( - new MethodHandlers< - io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse>( - this, METHODID_STREAM_API_LIST))) - .build(); - } - } - - /** - *
-   * [#protodoc-title: ApiListDS]
-   * 
- */ - public static final class ApiListDiscoveryServiceStub extends io.grpc.stub.AbstractAsyncStub { - private ApiListDiscoveryServiceStub( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - super(channel, callOptions); - } - - @java.lang.Override - protected ApiListDiscoveryServiceStub build( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new ApiListDiscoveryServiceStub(channel, callOptions); - } - - /** - */ - public io.grpc.stub.StreamObserver streamApiList( - io.grpc.stub.StreamObserver responseObserver) { - return asyncBidiStreamingCall( - getChannel().newCall(getStreamApiListMethod(), getCallOptions()), responseObserver); - } - } - - /** - *
-   * [#protodoc-title: ApiListDS]
-   * 
- */ - public static final class ApiListDiscoveryServiceBlockingStub extends io.grpc.stub.AbstractBlockingStub { - private ApiListDiscoveryServiceBlockingStub( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - super(channel, callOptions); - } - - @java.lang.Override - protected ApiListDiscoveryServiceBlockingStub build( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new ApiListDiscoveryServiceBlockingStub(channel, callOptions); - } - } - - /** - *
-   * [#protodoc-title: ApiListDS]
-   * 
- */ - public static final class ApiListDiscoveryServiceFutureStub extends io.grpc.stub.AbstractFutureStub { - private ApiListDiscoveryServiceFutureStub( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - super(channel, callOptions); - } - - @java.lang.Override - protected ApiListDiscoveryServiceFutureStub build( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new ApiListDiscoveryServiceFutureStub(channel, callOptions); - } - } - - private static final int METHODID_STREAM_API_LIST = 0; - - private static final class MethodHandlers implements - io.grpc.stub.ServerCalls.UnaryMethod, - io.grpc.stub.ServerCalls.ServerStreamingMethod, - io.grpc.stub.ServerCalls.ClientStreamingMethod, - io.grpc.stub.ServerCalls.BidiStreamingMethod { - private final ApiListDiscoveryServiceImplBase serviceImpl; - private final int methodId; - - MethodHandlers(ApiListDiscoveryServiceImplBase serviceImpl, int methodId) { - this.serviceImpl = serviceImpl; - this.methodId = methodId; - } - - @java.lang.Override - @java.lang.SuppressWarnings("unchecked") - public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) { - switch (methodId) { - default: - throw new AssertionError(); - } - } - - @java.lang.Override - @java.lang.SuppressWarnings("unchecked") - public io.grpc.stub.StreamObserver invoke( - io.grpc.stub.StreamObserver responseObserver) { - switch (methodId) { - case METHODID_STREAM_API_LIST: - return (io.grpc.stub.StreamObserver) serviceImpl.streamApiList( - (io.grpc.stub.StreamObserver) responseObserver); - default: - throw new AssertionError(); - } - } - } - - private static abstract class ApiListDiscoveryServiceBaseDescriptorSupplier - implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier { - ApiListDiscoveryServiceBaseDescriptorSupplier() {} - - @java.lang.Override - public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { - return org.wso2.apk.enforcer.discovery.service.subscription.ApiListDSProto.getDescriptor(); - } - - @java.lang.Override - public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { - return getFileDescriptor().findServiceByName("ApiListDiscoveryService"); - } - } - - private static final class ApiListDiscoveryServiceFileDescriptorSupplier - extends ApiListDiscoveryServiceBaseDescriptorSupplier { - ApiListDiscoveryServiceFileDescriptorSupplier() {} - } - - private static final class ApiListDiscoveryServiceMethodDescriptorSupplier - extends ApiListDiscoveryServiceBaseDescriptorSupplier - implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { - private final String methodName; - - ApiListDiscoveryServiceMethodDescriptorSupplier(String methodName) { - this.methodName = methodName; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() { - return getServiceDescriptor().findMethodByName(methodName); - } - } - - private static volatile io.grpc.ServiceDescriptor serviceDescriptor; - - public static io.grpc.ServiceDescriptor getServiceDescriptor() { - io.grpc.ServiceDescriptor result = serviceDescriptor; - if (result == null) { - synchronized (ApiListDiscoveryServiceGrpc.class) { - result = serviceDescriptor; - if (result == null) { - serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) - .setSchemaDescriptor(new ApiListDiscoveryServiceFileDescriptorSupplier()) - .addMethod(getStreamApiListMethod()) - .build(); - } - } - } - return result; - } -} diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/AppDSProto.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/AppDSProto.java deleted file mode 100644 index 94878bc04..000000000 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/AppDSProto.java +++ /dev/null @@ -1,47 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: wso2/discovery/service/subscription/appds.proto - -package org.wso2.apk.enforcer.discovery.service.subscription; - -public final class AppDSProto { - private AppDSProto() {} - public static void registerAllExtensions( - com.google.protobuf.ExtensionRegistryLite registry) { - } - - public static void registerAllExtensions( - com.google.protobuf.ExtensionRegistry registry) { - registerAllExtensions( - (com.google.protobuf.ExtensionRegistryLite) registry); - } - - public static com.google.protobuf.Descriptors.FileDescriptor - getDescriptor() { - return descriptor; - } - private static com.google.protobuf.Descriptors.FileDescriptor - descriptor; - static { - java.lang.String[] descriptorData = { - "\n/wso2/discovery/service/subscription/ap" + - "pds.proto\022\036discovery.service.subscriptio" + - "n\032*envoy/service/discovery/v3/discovery." + - "proto2\226\001\n\033ApplicationDiscoveryService\022w\n" + - "\022StreamApplications\022,.envoy.service.disc" + - "overy.v3.DiscoveryRequest\032-.envoy.servic" + - "e.discovery.v3.DiscoveryResponse\"\000(\0010\001B\223" + - "\001\n4org.wso2.apk.enforcer.discovery.servi" + - "ce.subscriptionB\nAppDSProtoP\001ZJgithub.co" + - "m/envoyproxy/go-control-plane/wso2/disco" + - "very/service/subscription\210\001\001b\006proto3" - }; - descriptor = com.google.protobuf.Descriptors.FileDescriptor - .internalBuildGeneratedFileFrom(descriptorData, - new com.google.protobuf.Descriptors.FileDescriptor[] { - io.envoyproxy.envoy.service.discovery.v3.DiscoveryProto.getDescriptor(), - }); - io.envoyproxy.envoy.service.discovery.v3.DiscoveryProto.getDescriptor(); - } - - // @@protoc_insertion_point(outer_class_scope) -} diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/AppKeyMappingDSProto.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/AppKeyMappingDSProto.java deleted file mode 100644 index e96b490a8..000000000 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/AppKeyMappingDSProto.java +++ /dev/null @@ -1,48 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: wso2/discovery/service/subscription/app_key_mapping_ds.proto - -package org.wso2.apk.enforcer.discovery.service.subscription; - -public final class AppKeyMappingDSProto { - private AppKeyMappingDSProto() {} - public static void registerAllExtensions( - com.google.protobuf.ExtensionRegistryLite registry) { - } - - public static void registerAllExtensions( - com.google.protobuf.ExtensionRegistry registry) { - registerAllExtensions( - (com.google.protobuf.ExtensionRegistryLite) registry); - } - - public static com.google.protobuf.Descriptors.FileDescriptor - getDescriptor() { - return descriptor; - } - private static com.google.protobuf.Descriptors.FileDescriptor - descriptor; - static { - java.lang.String[] descriptorData = { - "\n - * [#protodoc-title: AppDS] - * - * - * Protobuf service {@code discovery.service.subscription.ApplicationDiscoveryService} - */ -public abstract class ApplicationDiscoveryService - implements com.google.protobuf.Service { - protected ApplicationDiscoveryService() {} - - public interface Interface { - /** - * rpc StreamApplications(stream .envoy.service.discovery.v3.DiscoveryRequest) returns (stream .envoy.service.discovery.v3.DiscoveryResponse); - */ - public abstract void streamApplications( - com.google.protobuf.RpcController controller, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest request, - com.google.protobuf.RpcCallback done); - - } - - public static com.google.protobuf.Service newReflectiveService( - final Interface impl) { - return new ApplicationDiscoveryService() { - @java.lang.Override - public void streamApplications( - com.google.protobuf.RpcController controller, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest request, - com.google.protobuf.RpcCallback done) { - impl.streamApplications(controller, request, done); - } - - }; - } - - public static com.google.protobuf.BlockingService - newReflectiveBlockingService(final BlockingInterface impl) { - return new com.google.protobuf.BlockingService() { - public final com.google.protobuf.Descriptors.ServiceDescriptor - getDescriptorForType() { - return getDescriptor(); - } - - public final com.google.protobuf.Message callBlockingMethod( - com.google.protobuf.Descriptors.MethodDescriptor method, - com.google.protobuf.RpcController controller, - com.google.protobuf.Message request) - throws com.google.protobuf.ServiceException { - if (method.getService() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "Service.callBlockingMethod() given method descriptor for " + - "wrong service type."); - } - switch(method.getIndex()) { - case 0: - return impl.streamApplications(controller, (io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest)request); - default: - throw new java.lang.AssertionError("Can't get here."); - } - } - - public final com.google.protobuf.Message - getRequestPrototype( - com.google.protobuf.Descriptors.MethodDescriptor method) { - if (method.getService() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "Service.getRequestPrototype() given method " + - "descriptor for wrong service type."); - } - switch(method.getIndex()) { - case 0: - return io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest.getDefaultInstance(); - default: - throw new java.lang.AssertionError("Can't get here."); - } - } - - public final com.google.protobuf.Message - getResponsePrototype( - com.google.protobuf.Descriptors.MethodDescriptor method) { - if (method.getService() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "Service.getResponsePrototype() given method " + - "descriptor for wrong service type."); - } - switch(method.getIndex()) { - case 0: - return io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse.getDefaultInstance(); - default: - throw new java.lang.AssertionError("Can't get here."); - } - } - - }; - } - - /** - * rpc StreamApplications(stream .envoy.service.discovery.v3.DiscoveryRequest) returns (stream .envoy.service.discovery.v3.DiscoveryResponse); - */ - public abstract void streamApplications( - com.google.protobuf.RpcController controller, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest request, - com.google.protobuf.RpcCallback done); - - public static final - com.google.protobuf.Descriptors.ServiceDescriptor - getDescriptor() { - return org.wso2.apk.enforcer.discovery.service.subscription.AppDSProto.getDescriptor().getServices().get(0); - } - public final com.google.protobuf.Descriptors.ServiceDescriptor - getDescriptorForType() { - return getDescriptor(); - } - - public final void callMethod( - com.google.protobuf.Descriptors.MethodDescriptor method, - com.google.protobuf.RpcController controller, - com.google.protobuf.Message request, - com.google.protobuf.RpcCallback< - com.google.protobuf.Message> done) { - if (method.getService() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "Service.callMethod() given method descriptor for wrong " + - "service type."); - } - switch(method.getIndex()) { - case 0: - this.streamApplications(controller, (io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest)request, - com.google.protobuf.RpcUtil.specializeCallback( - done)); - return; - default: - throw new java.lang.AssertionError("Can't get here."); - } - } - - public final com.google.protobuf.Message - getRequestPrototype( - com.google.protobuf.Descriptors.MethodDescriptor method) { - if (method.getService() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "Service.getRequestPrototype() given method " + - "descriptor for wrong service type."); - } - switch(method.getIndex()) { - case 0: - return io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest.getDefaultInstance(); - default: - throw new java.lang.AssertionError("Can't get here."); - } - } - - public final com.google.protobuf.Message - getResponsePrototype( - com.google.protobuf.Descriptors.MethodDescriptor method) { - if (method.getService() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "Service.getResponsePrototype() given method " + - "descriptor for wrong service type."); - } - switch(method.getIndex()) { - case 0: - return io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse.getDefaultInstance(); - default: - throw new java.lang.AssertionError("Can't get here."); - } - } - - public static Stub newStub( - com.google.protobuf.RpcChannel channel) { - return new Stub(channel); - } - - public static final class Stub extends org.wso2.apk.enforcer.discovery.service.subscription.ApplicationDiscoveryService implements Interface { - private Stub(com.google.protobuf.RpcChannel channel) { - this.channel = channel; - } - - private final com.google.protobuf.RpcChannel channel; - - public com.google.protobuf.RpcChannel getChannel() { - return channel; - } - - public void streamApplications( - com.google.protobuf.RpcController controller, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest request, - com.google.protobuf.RpcCallback done) { - channel.callMethod( - getDescriptor().getMethods().get(0), - controller, - request, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse.getDefaultInstance(), - com.google.protobuf.RpcUtil.generalizeCallback( - done, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse.class, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse.getDefaultInstance())); - } - } - - public static BlockingInterface newBlockingStub( - com.google.protobuf.BlockingRpcChannel channel) { - return new BlockingStub(channel); - } - - public interface BlockingInterface { - public io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse streamApplications( - com.google.protobuf.RpcController controller, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest request) - throws com.google.protobuf.ServiceException; - } - - private static final class BlockingStub implements BlockingInterface { - private BlockingStub(com.google.protobuf.BlockingRpcChannel channel) { - this.channel = channel; - } - - private final com.google.protobuf.BlockingRpcChannel channel; - - public io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse streamApplications( - com.google.protobuf.RpcController controller, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest request) - throws com.google.protobuf.ServiceException { - return (io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse) channel.callBlockingMethod( - getDescriptor().getMethods().get(0), - controller, - request, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse.getDefaultInstance()); - } - - } - - // @@protoc_insertion_point(class_scope:discovery.service.subscription.ApplicationDiscoveryService) -} - diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/ApplicationDiscoveryServiceGrpc.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/ApplicationDiscoveryServiceGrpc.java deleted file mode 100644 index 34a79d0f3..000000000 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/ApplicationDiscoveryServiceGrpc.java +++ /dev/null @@ -1,287 +0,0 @@ -package org.wso2.apk.enforcer.discovery.service.subscription; - -import static io.grpc.MethodDescriptor.generateFullMethodName; -import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall; -import static io.grpc.stub.ClientCalls.asyncClientStreamingCall; -import static io.grpc.stub.ClientCalls.asyncServerStreamingCall; -import static io.grpc.stub.ClientCalls.asyncUnaryCall; -import static io.grpc.stub.ClientCalls.blockingServerStreamingCall; -import static io.grpc.stub.ClientCalls.blockingUnaryCall; -import static io.grpc.stub.ClientCalls.futureUnaryCall; -import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall; -import static io.grpc.stub.ServerCalls.asyncClientStreamingCall; -import static io.grpc.stub.ServerCalls.asyncServerStreamingCall; -import static io.grpc.stub.ServerCalls.asyncUnaryCall; -import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall; -import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall; - -/** - *
- * [#protodoc-title: AppDS]
- * 
- */ -@javax.annotation.Generated( - value = "by gRPC proto compiler", - comments = "Source: wso2/discovery/service/subscription/appds.proto") -public final class ApplicationDiscoveryServiceGrpc { - - private ApplicationDiscoveryServiceGrpc() {} - - public static final String SERVICE_NAME = "discovery.service.subscription.ApplicationDiscoveryService"; - - // Static method descriptors that strictly reflect the proto. - private static volatile io.grpc.MethodDescriptor getStreamApplicationsMethod; - - @io.grpc.stub.annotations.RpcMethod( - fullMethodName = SERVICE_NAME + '/' + "StreamApplications", - requestType = io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest.class, - responseType = io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse.class, - methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) - public static io.grpc.MethodDescriptor getStreamApplicationsMethod() { - io.grpc.MethodDescriptor getStreamApplicationsMethod; - if ((getStreamApplicationsMethod = ApplicationDiscoveryServiceGrpc.getStreamApplicationsMethod) == null) { - synchronized (ApplicationDiscoveryServiceGrpc.class) { - if ((getStreamApplicationsMethod = ApplicationDiscoveryServiceGrpc.getStreamApplicationsMethod) == null) { - ApplicationDiscoveryServiceGrpc.getStreamApplicationsMethod = getStreamApplicationsMethod = - io.grpc.MethodDescriptor.newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) - .setFullMethodName(generateFullMethodName(SERVICE_NAME, "StreamApplications")) - .setSampledToLocalTracing(true) - .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest.getDefaultInstance())) - .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse.getDefaultInstance())) - .setSchemaDescriptor(new ApplicationDiscoveryServiceMethodDescriptorSupplier("StreamApplications")) - .build(); - } - } - } - return getStreamApplicationsMethod; - } - - /** - * Creates a new async stub that supports all call types for the service - */ - public static ApplicationDiscoveryServiceStub newStub(io.grpc.Channel channel) { - io.grpc.stub.AbstractStub.StubFactory factory = - new io.grpc.stub.AbstractStub.StubFactory() { - @java.lang.Override - public ApplicationDiscoveryServiceStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new ApplicationDiscoveryServiceStub(channel, callOptions); - } - }; - return ApplicationDiscoveryServiceStub.newStub(factory, channel); - } - - /** - * Creates a new blocking-style stub that supports unary and streaming output calls on the service - */ - public static ApplicationDiscoveryServiceBlockingStub newBlockingStub( - io.grpc.Channel channel) { - io.grpc.stub.AbstractStub.StubFactory factory = - new io.grpc.stub.AbstractStub.StubFactory() { - @java.lang.Override - public ApplicationDiscoveryServiceBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new ApplicationDiscoveryServiceBlockingStub(channel, callOptions); - } - }; - return ApplicationDiscoveryServiceBlockingStub.newStub(factory, channel); - } - - /** - * Creates a new ListenableFuture-style stub that supports unary calls on the service - */ - public static ApplicationDiscoveryServiceFutureStub newFutureStub( - io.grpc.Channel channel) { - io.grpc.stub.AbstractStub.StubFactory factory = - new io.grpc.stub.AbstractStub.StubFactory() { - @java.lang.Override - public ApplicationDiscoveryServiceFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new ApplicationDiscoveryServiceFutureStub(channel, callOptions); - } - }; - return ApplicationDiscoveryServiceFutureStub.newStub(factory, channel); - } - - /** - *
-   * [#protodoc-title: AppDS]
-   * 
- */ - public static abstract class ApplicationDiscoveryServiceImplBase implements io.grpc.BindableService { - - /** - */ - public io.grpc.stub.StreamObserver streamApplications( - io.grpc.stub.StreamObserver responseObserver) { - return asyncUnimplementedStreamingCall(getStreamApplicationsMethod(), responseObserver); - } - - @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() { - return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) - .addMethod( - getStreamApplicationsMethod(), - asyncBidiStreamingCall( - new MethodHandlers< - io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse>( - this, METHODID_STREAM_APPLICATIONS))) - .build(); - } - } - - /** - *
-   * [#protodoc-title: AppDS]
-   * 
- */ - public static final class ApplicationDiscoveryServiceStub extends io.grpc.stub.AbstractAsyncStub { - private ApplicationDiscoveryServiceStub( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - super(channel, callOptions); - } - - @java.lang.Override - protected ApplicationDiscoveryServiceStub build( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new ApplicationDiscoveryServiceStub(channel, callOptions); - } - - /** - */ - public io.grpc.stub.StreamObserver streamApplications( - io.grpc.stub.StreamObserver responseObserver) { - return asyncBidiStreamingCall( - getChannel().newCall(getStreamApplicationsMethod(), getCallOptions()), responseObserver); - } - } - - /** - *
-   * [#protodoc-title: AppDS]
-   * 
- */ - public static final class ApplicationDiscoveryServiceBlockingStub extends io.grpc.stub.AbstractBlockingStub { - private ApplicationDiscoveryServiceBlockingStub( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - super(channel, callOptions); - } - - @java.lang.Override - protected ApplicationDiscoveryServiceBlockingStub build( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new ApplicationDiscoveryServiceBlockingStub(channel, callOptions); - } - } - - /** - *
-   * [#protodoc-title: AppDS]
-   * 
- */ - public static final class ApplicationDiscoveryServiceFutureStub extends io.grpc.stub.AbstractFutureStub { - private ApplicationDiscoveryServiceFutureStub( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - super(channel, callOptions); - } - - @java.lang.Override - protected ApplicationDiscoveryServiceFutureStub build( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new ApplicationDiscoveryServiceFutureStub(channel, callOptions); - } - } - - private static final int METHODID_STREAM_APPLICATIONS = 0; - - private static final class MethodHandlers implements - io.grpc.stub.ServerCalls.UnaryMethod, - io.grpc.stub.ServerCalls.ServerStreamingMethod, - io.grpc.stub.ServerCalls.ClientStreamingMethod, - io.grpc.stub.ServerCalls.BidiStreamingMethod { - private final ApplicationDiscoveryServiceImplBase serviceImpl; - private final int methodId; - - MethodHandlers(ApplicationDiscoveryServiceImplBase serviceImpl, int methodId) { - this.serviceImpl = serviceImpl; - this.methodId = methodId; - } - - @java.lang.Override - @java.lang.SuppressWarnings("unchecked") - public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) { - switch (methodId) { - default: - throw new AssertionError(); - } - } - - @java.lang.Override - @java.lang.SuppressWarnings("unchecked") - public io.grpc.stub.StreamObserver invoke( - io.grpc.stub.StreamObserver responseObserver) { - switch (methodId) { - case METHODID_STREAM_APPLICATIONS: - return (io.grpc.stub.StreamObserver) serviceImpl.streamApplications( - (io.grpc.stub.StreamObserver) responseObserver); - default: - throw new AssertionError(); - } - } - } - - private static abstract class ApplicationDiscoveryServiceBaseDescriptorSupplier - implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier { - ApplicationDiscoveryServiceBaseDescriptorSupplier() {} - - @java.lang.Override - public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { - return org.wso2.apk.enforcer.discovery.service.subscription.AppDSProto.getDescriptor(); - } - - @java.lang.Override - public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { - return getFileDescriptor().findServiceByName("ApplicationDiscoveryService"); - } - } - - private static final class ApplicationDiscoveryServiceFileDescriptorSupplier - extends ApplicationDiscoveryServiceBaseDescriptorSupplier { - ApplicationDiscoveryServiceFileDescriptorSupplier() {} - } - - private static final class ApplicationDiscoveryServiceMethodDescriptorSupplier - extends ApplicationDiscoveryServiceBaseDescriptorSupplier - implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { - private final String methodName; - - ApplicationDiscoveryServiceMethodDescriptorSupplier(String methodName) { - this.methodName = methodName; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() { - return getServiceDescriptor().findMethodByName(methodName); - } - } - - private static volatile io.grpc.ServiceDescriptor serviceDescriptor; - - public static io.grpc.ServiceDescriptor getServiceDescriptor() { - io.grpc.ServiceDescriptor result = serviceDescriptor; - if (result == null) { - synchronized (ApplicationDiscoveryServiceGrpc.class) { - result = serviceDescriptor; - if (result == null) { - serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) - .setSchemaDescriptor(new ApplicationDiscoveryServiceFileDescriptorSupplier()) - .addMethod(getStreamApplicationsMethod()) - .build(); - } - } - } - return result; - } -} diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/ApplicationKeyMappingDiscoveryService.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/ApplicationKeyMappingDiscoveryService.java deleted file mode 100644 index 4401bb5b7..000000000 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/ApplicationKeyMappingDiscoveryService.java +++ /dev/null @@ -1,241 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: wso2/discovery/service/subscription/app_key_mapping_ds.proto - -package org.wso2.apk.enforcer.discovery.service.subscription; - -/** - *
- * [#protodoc-title: AppKeyMappingDS]
- * 
- * - * Protobuf service {@code discovery.service.subscription.ApplicationKeyMappingDiscoveryService} - */ -public abstract class ApplicationKeyMappingDiscoveryService - implements com.google.protobuf.Service { - protected ApplicationKeyMappingDiscoveryService() {} - - public interface Interface { - /** - * rpc StreamApplicationKeyMappings(stream .envoy.service.discovery.v3.DiscoveryRequest) returns (stream .envoy.service.discovery.v3.DiscoveryResponse); - */ - public abstract void streamApplicationKeyMappings( - com.google.protobuf.RpcController controller, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest request, - com.google.protobuf.RpcCallback done); - - } - - public static com.google.protobuf.Service newReflectiveService( - final Interface impl) { - return new ApplicationKeyMappingDiscoveryService() { - @java.lang.Override - public void streamApplicationKeyMappings( - com.google.protobuf.RpcController controller, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest request, - com.google.protobuf.RpcCallback done) { - impl.streamApplicationKeyMappings(controller, request, done); - } - - }; - } - - public static com.google.protobuf.BlockingService - newReflectiveBlockingService(final BlockingInterface impl) { - return new com.google.protobuf.BlockingService() { - public final com.google.protobuf.Descriptors.ServiceDescriptor - getDescriptorForType() { - return getDescriptor(); - } - - public final com.google.protobuf.Message callBlockingMethod( - com.google.protobuf.Descriptors.MethodDescriptor method, - com.google.protobuf.RpcController controller, - com.google.protobuf.Message request) - throws com.google.protobuf.ServiceException { - if (method.getService() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "Service.callBlockingMethod() given method descriptor for " + - "wrong service type."); - } - switch(method.getIndex()) { - case 0: - return impl.streamApplicationKeyMappings(controller, (io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest)request); - default: - throw new java.lang.AssertionError("Can't get here."); - } - } - - public final com.google.protobuf.Message - getRequestPrototype( - com.google.protobuf.Descriptors.MethodDescriptor method) { - if (method.getService() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "Service.getRequestPrototype() given method " + - "descriptor for wrong service type."); - } - switch(method.getIndex()) { - case 0: - return io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest.getDefaultInstance(); - default: - throw new java.lang.AssertionError("Can't get here."); - } - } - - public final com.google.protobuf.Message - getResponsePrototype( - com.google.protobuf.Descriptors.MethodDescriptor method) { - if (method.getService() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "Service.getResponsePrototype() given method " + - "descriptor for wrong service type."); - } - switch(method.getIndex()) { - case 0: - return io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse.getDefaultInstance(); - default: - throw new java.lang.AssertionError("Can't get here."); - } - } - - }; - } - - /** - * rpc StreamApplicationKeyMappings(stream .envoy.service.discovery.v3.DiscoveryRequest) returns (stream .envoy.service.discovery.v3.DiscoveryResponse); - */ - public abstract void streamApplicationKeyMappings( - com.google.protobuf.RpcController controller, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest request, - com.google.protobuf.RpcCallback done); - - public static final - com.google.protobuf.Descriptors.ServiceDescriptor - getDescriptor() { - return org.wso2.apk.enforcer.discovery.service.subscription.AppKeyMappingDSProto.getDescriptor().getServices().get(0); - } - public final com.google.protobuf.Descriptors.ServiceDescriptor - getDescriptorForType() { - return getDescriptor(); - } - - public final void callMethod( - com.google.protobuf.Descriptors.MethodDescriptor method, - com.google.protobuf.RpcController controller, - com.google.protobuf.Message request, - com.google.protobuf.RpcCallback< - com.google.protobuf.Message> done) { - if (method.getService() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "Service.callMethod() given method descriptor for wrong " + - "service type."); - } - switch(method.getIndex()) { - case 0: - this.streamApplicationKeyMappings(controller, (io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest)request, - com.google.protobuf.RpcUtil.specializeCallback( - done)); - return; - default: - throw new java.lang.AssertionError("Can't get here."); - } - } - - public final com.google.protobuf.Message - getRequestPrototype( - com.google.protobuf.Descriptors.MethodDescriptor method) { - if (method.getService() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "Service.getRequestPrototype() given method " + - "descriptor for wrong service type."); - } - switch(method.getIndex()) { - case 0: - return io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest.getDefaultInstance(); - default: - throw new java.lang.AssertionError("Can't get here."); - } - } - - public final com.google.protobuf.Message - getResponsePrototype( - com.google.protobuf.Descriptors.MethodDescriptor method) { - if (method.getService() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "Service.getResponsePrototype() given method " + - "descriptor for wrong service type."); - } - switch(method.getIndex()) { - case 0: - return io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse.getDefaultInstance(); - default: - throw new java.lang.AssertionError("Can't get here."); - } - } - - public static Stub newStub( - com.google.protobuf.RpcChannel channel) { - return new Stub(channel); - } - - public static final class Stub extends org.wso2.apk.enforcer.discovery.service.subscription.ApplicationKeyMappingDiscoveryService implements Interface { - private Stub(com.google.protobuf.RpcChannel channel) { - this.channel = channel; - } - - private final com.google.protobuf.RpcChannel channel; - - public com.google.protobuf.RpcChannel getChannel() { - return channel; - } - - public void streamApplicationKeyMappings( - com.google.protobuf.RpcController controller, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest request, - com.google.protobuf.RpcCallback done) { - channel.callMethod( - getDescriptor().getMethods().get(0), - controller, - request, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse.getDefaultInstance(), - com.google.protobuf.RpcUtil.generalizeCallback( - done, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse.class, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse.getDefaultInstance())); - } - } - - public static BlockingInterface newBlockingStub( - com.google.protobuf.BlockingRpcChannel channel) { - return new BlockingStub(channel); - } - - public interface BlockingInterface { - public io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse streamApplicationKeyMappings( - com.google.protobuf.RpcController controller, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest request) - throws com.google.protobuf.ServiceException; - } - - private static final class BlockingStub implements BlockingInterface { - private BlockingStub(com.google.protobuf.BlockingRpcChannel channel) { - this.channel = channel; - } - - private final com.google.protobuf.BlockingRpcChannel channel; - - public io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse streamApplicationKeyMappings( - com.google.protobuf.RpcController controller, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest request) - throws com.google.protobuf.ServiceException { - return (io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse) channel.callBlockingMethod( - getDescriptor().getMethods().get(0), - controller, - request, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse.getDefaultInstance()); - } - - } - - // @@protoc_insertion_point(class_scope:discovery.service.subscription.ApplicationKeyMappingDiscoveryService) -} - diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/ApplicationKeyMappingDiscoveryServiceGrpc.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/ApplicationKeyMappingDiscoveryServiceGrpc.java deleted file mode 100644 index a29a26412..000000000 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/ApplicationKeyMappingDiscoveryServiceGrpc.java +++ /dev/null @@ -1,287 +0,0 @@ -package org.wso2.apk.enforcer.discovery.service.subscription; - -import static io.grpc.MethodDescriptor.generateFullMethodName; -import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall; -import static io.grpc.stub.ClientCalls.asyncClientStreamingCall; -import static io.grpc.stub.ClientCalls.asyncServerStreamingCall; -import static io.grpc.stub.ClientCalls.asyncUnaryCall; -import static io.grpc.stub.ClientCalls.blockingServerStreamingCall; -import static io.grpc.stub.ClientCalls.blockingUnaryCall; -import static io.grpc.stub.ClientCalls.futureUnaryCall; -import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall; -import static io.grpc.stub.ServerCalls.asyncClientStreamingCall; -import static io.grpc.stub.ServerCalls.asyncServerStreamingCall; -import static io.grpc.stub.ServerCalls.asyncUnaryCall; -import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall; -import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall; - -/** - *
- * [#protodoc-title: AppKeyMappingDS]
- * 
- */ -@javax.annotation.Generated( - value = "by gRPC proto compiler", - comments = "Source: wso2/discovery/service/subscription/app_key_mapping_ds.proto") -public final class ApplicationKeyMappingDiscoveryServiceGrpc { - - private ApplicationKeyMappingDiscoveryServiceGrpc() {} - - public static final String SERVICE_NAME = "discovery.service.subscription.ApplicationKeyMappingDiscoveryService"; - - // Static method descriptors that strictly reflect the proto. - private static volatile io.grpc.MethodDescriptor getStreamApplicationKeyMappingsMethod; - - @io.grpc.stub.annotations.RpcMethod( - fullMethodName = SERVICE_NAME + '/' + "StreamApplicationKeyMappings", - requestType = io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest.class, - responseType = io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse.class, - methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) - public static io.grpc.MethodDescriptor getStreamApplicationKeyMappingsMethod() { - io.grpc.MethodDescriptor getStreamApplicationKeyMappingsMethod; - if ((getStreamApplicationKeyMappingsMethod = ApplicationKeyMappingDiscoveryServiceGrpc.getStreamApplicationKeyMappingsMethod) == null) { - synchronized (ApplicationKeyMappingDiscoveryServiceGrpc.class) { - if ((getStreamApplicationKeyMappingsMethod = ApplicationKeyMappingDiscoveryServiceGrpc.getStreamApplicationKeyMappingsMethod) == null) { - ApplicationKeyMappingDiscoveryServiceGrpc.getStreamApplicationKeyMappingsMethod = getStreamApplicationKeyMappingsMethod = - io.grpc.MethodDescriptor.newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) - .setFullMethodName(generateFullMethodName(SERVICE_NAME, "StreamApplicationKeyMappings")) - .setSampledToLocalTracing(true) - .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest.getDefaultInstance())) - .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse.getDefaultInstance())) - .setSchemaDescriptor(new ApplicationKeyMappingDiscoveryServiceMethodDescriptorSupplier("StreamApplicationKeyMappings")) - .build(); - } - } - } - return getStreamApplicationKeyMappingsMethod; - } - - /** - * Creates a new async stub that supports all call types for the service - */ - public static ApplicationKeyMappingDiscoveryServiceStub newStub(io.grpc.Channel channel) { - io.grpc.stub.AbstractStub.StubFactory factory = - new io.grpc.stub.AbstractStub.StubFactory() { - @java.lang.Override - public ApplicationKeyMappingDiscoveryServiceStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new ApplicationKeyMappingDiscoveryServiceStub(channel, callOptions); - } - }; - return ApplicationKeyMappingDiscoveryServiceStub.newStub(factory, channel); - } - - /** - * Creates a new blocking-style stub that supports unary and streaming output calls on the service - */ - public static ApplicationKeyMappingDiscoveryServiceBlockingStub newBlockingStub( - io.grpc.Channel channel) { - io.grpc.stub.AbstractStub.StubFactory factory = - new io.grpc.stub.AbstractStub.StubFactory() { - @java.lang.Override - public ApplicationKeyMappingDiscoveryServiceBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new ApplicationKeyMappingDiscoveryServiceBlockingStub(channel, callOptions); - } - }; - return ApplicationKeyMappingDiscoveryServiceBlockingStub.newStub(factory, channel); - } - - /** - * Creates a new ListenableFuture-style stub that supports unary calls on the service - */ - public static ApplicationKeyMappingDiscoveryServiceFutureStub newFutureStub( - io.grpc.Channel channel) { - io.grpc.stub.AbstractStub.StubFactory factory = - new io.grpc.stub.AbstractStub.StubFactory() { - @java.lang.Override - public ApplicationKeyMappingDiscoveryServiceFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new ApplicationKeyMappingDiscoveryServiceFutureStub(channel, callOptions); - } - }; - return ApplicationKeyMappingDiscoveryServiceFutureStub.newStub(factory, channel); - } - - /** - *
-   * [#protodoc-title: AppKeyMappingDS]
-   * 
- */ - public static abstract class ApplicationKeyMappingDiscoveryServiceImplBase implements io.grpc.BindableService { - - /** - */ - public io.grpc.stub.StreamObserver streamApplicationKeyMappings( - io.grpc.stub.StreamObserver responseObserver) { - return asyncUnimplementedStreamingCall(getStreamApplicationKeyMappingsMethod(), responseObserver); - } - - @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() { - return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) - .addMethod( - getStreamApplicationKeyMappingsMethod(), - asyncBidiStreamingCall( - new MethodHandlers< - io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse>( - this, METHODID_STREAM_APPLICATION_KEY_MAPPINGS))) - .build(); - } - } - - /** - *
-   * [#protodoc-title: AppKeyMappingDS]
-   * 
- */ - public static final class ApplicationKeyMappingDiscoveryServiceStub extends io.grpc.stub.AbstractAsyncStub { - private ApplicationKeyMappingDiscoveryServiceStub( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - super(channel, callOptions); - } - - @java.lang.Override - protected ApplicationKeyMappingDiscoveryServiceStub build( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new ApplicationKeyMappingDiscoveryServiceStub(channel, callOptions); - } - - /** - */ - public io.grpc.stub.StreamObserver streamApplicationKeyMappings( - io.grpc.stub.StreamObserver responseObserver) { - return asyncBidiStreamingCall( - getChannel().newCall(getStreamApplicationKeyMappingsMethod(), getCallOptions()), responseObserver); - } - } - - /** - *
-   * [#protodoc-title: AppKeyMappingDS]
-   * 
- */ - public static final class ApplicationKeyMappingDiscoveryServiceBlockingStub extends io.grpc.stub.AbstractBlockingStub { - private ApplicationKeyMappingDiscoveryServiceBlockingStub( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - super(channel, callOptions); - } - - @java.lang.Override - protected ApplicationKeyMappingDiscoveryServiceBlockingStub build( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new ApplicationKeyMappingDiscoveryServiceBlockingStub(channel, callOptions); - } - } - - /** - *
-   * [#protodoc-title: AppKeyMappingDS]
-   * 
- */ - public static final class ApplicationKeyMappingDiscoveryServiceFutureStub extends io.grpc.stub.AbstractFutureStub { - private ApplicationKeyMappingDiscoveryServiceFutureStub( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - super(channel, callOptions); - } - - @java.lang.Override - protected ApplicationKeyMappingDiscoveryServiceFutureStub build( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new ApplicationKeyMappingDiscoveryServiceFutureStub(channel, callOptions); - } - } - - private static final int METHODID_STREAM_APPLICATION_KEY_MAPPINGS = 0; - - private static final class MethodHandlers implements - io.grpc.stub.ServerCalls.UnaryMethod, - io.grpc.stub.ServerCalls.ServerStreamingMethod, - io.grpc.stub.ServerCalls.ClientStreamingMethod, - io.grpc.stub.ServerCalls.BidiStreamingMethod { - private final ApplicationKeyMappingDiscoveryServiceImplBase serviceImpl; - private final int methodId; - - MethodHandlers(ApplicationKeyMappingDiscoveryServiceImplBase serviceImpl, int methodId) { - this.serviceImpl = serviceImpl; - this.methodId = methodId; - } - - @java.lang.Override - @java.lang.SuppressWarnings("unchecked") - public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) { - switch (methodId) { - default: - throw new AssertionError(); - } - } - - @java.lang.Override - @java.lang.SuppressWarnings("unchecked") - public io.grpc.stub.StreamObserver invoke( - io.grpc.stub.StreamObserver responseObserver) { - switch (methodId) { - case METHODID_STREAM_APPLICATION_KEY_MAPPINGS: - return (io.grpc.stub.StreamObserver) serviceImpl.streamApplicationKeyMappings( - (io.grpc.stub.StreamObserver) responseObserver); - default: - throw new AssertionError(); - } - } - } - - private static abstract class ApplicationKeyMappingDiscoveryServiceBaseDescriptorSupplier - implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier { - ApplicationKeyMappingDiscoveryServiceBaseDescriptorSupplier() {} - - @java.lang.Override - public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { - return org.wso2.apk.enforcer.discovery.service.subscription.AppKeyMappingDSProto.getDescriptor(); - } - - @java.lang.Override - public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { - return getFileDescriptor().findServiceByName("ApplicationKeyMappingDiscoveryService"); - } - } - - private static final class ApplicationKeyMappingDiscoveryServiceFileDescriptorSupplier - extends ApplicationKeyMappingDiscoveryServiceBaseDescriptorSupplier { - ApplicationKeyMappingDiscoveryServiceFileDescriptorSupplier() {} - } - - private static final class ApplicationKeyMappingDiscoveryServiceMethodDescriptorSupplier - extends ApplicationKeyMappingDiscoveryServiceBaseDescriptorSupplier - implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { - private final String methodName; - - ApplicationKeyMappingDiscoveryServiceMethodDescriptorSupplier(String methodName) { - this.methodName = methodName; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() { - return getServiceDescriptor().findMethodByName(methodName); - } - } - - private static volatile io.grpc.ServiceDescriptor serviceDescriptor; - - public static io.grpc.ServiceDescriptor getServiceDescriptor() { - io.grpc.ServiceDescriptor result = serviceDescriptor; - if (result == null) { - synchronized (ApplicationKeyMappingDiscoveryServiceGrpc.class) { - result = serviceDescriptor; - if (result == null) { - serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) - .setSchemaDescriptor(new ApplicationKeyMappingDiscoveryServiceFileDescriptorSupplier()) - .addMethod(getStreamApplicationKeyMappingsMethod()) - .build(); - } - } - } - return result; - } -} diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/ApplicationMappingDiscoveryService.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/ApplicationMappingDiscoveryService.java deleted file mode 100644 index c68493ec9..000000000 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/ApplicationMappingDiscoveryService.java +++ /dev/null @@ -1,241 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: wso2/discovery/service/subscription/app_mapping_ds.proto - -package org.wso2.apk.enforcer.discovery.service.subscription; - -/** - *
- * [#protodoc-title: AppMappingDS]
- * 
- * - * Protobuf service {@code discovery.service.subscription.ApplicationMappingDiscoveryService} - */ -public abstract class ApplicationMappingDiscoveryService - implements com.google.protobuf.Service { - protected ApplicationMappingDiscoveryService() {} - - public interface Interface { - /** - * rpc StreamApplicationMappings(stream .envoy.service.discovery.v3.DiscoveryRequest) returns (stream .envoy.service.discovery.v3.DiscoveryResponse); - */ - public abstract void streamApplicationMappings( - com.google.protobuf.RpcController controller, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest request, - com.google.protobuf.RpcCallback done); - - } - - public static com.google.protobuf.Service newReflectiveService( - final Interface impl) { - return new ApplicationMappingDiscoveryService() { - @java.lang.Override - public void streamApplicationMappings( - com.google.protobuf.RpcController controller, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest request, - com.google.protobuf.RpcCallback done) { - impl.streamApplicationMappings(controller, request, done); - } - - }; - } - - public static com.google.protobuf.BlockingService - newReflectiveBlockingService(final BlockingInterface impl) { - return new com.google.protobuf.BlockingService() { - public final com.google.protobuf.Descriptors.ServiceDescriptor - getDescriptorForType() { - return getDescriptor(); - } - - public final com.google.protobuf.Message callBlockingMethod( - com.google.protobuf.Descriptors.MethodDescriptor method, - com.google.protobuf.RpcController controller, - com.google.protobuf.Message request) - throws com.google.protobuf.ServiceException { - if (method.getService() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "Service.callBlockingMethod() given method descriptor for " + - "wrong service type."); - } - switch(method.getIndex()) { - case 0: - return impl.streamApplicationMappings(controller, (io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest)request); - default: - throw new java.lang.AssertionError("Can't get here."); - } - } - - public final com.google.protobuf.Message - getRequestPrototype( - com.google.protobuf.Descriptors.MethodDescriptor method) { - if (method.getService() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "Service.getRequestPrototype() given method " + - "descriptor for wrong service type."); - } - switch(method.getIndex()) { - case 0: - return io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest.getDefaultInstance(); - default: - throw new java.lang.AssertionError("Can't get here."); - } - } - - public final com.google.protobuf.Message - getResponsePrototype( - com.google.protobuf.Descriptors.MethodDescriptor method) { - if (method.getService() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "Service.getResponsePrototype() given method " + - "descriptor for wrong service type."); - } - switch(method.getIndex()) { - case 0: - return io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse.getDefaultInstance(); - default: - throw new java.lang.AssertionError("Can't get here."); - } - } - - }; - } - - /** - * rpc StreamApplicationMappings(stream .envoy.service.discovery.v3.DiscoveryRequest) returns (stream .envoy.service.discovery.v3.DiscoveryResponse); - */ - public abstract void streamApplicationMappings( - com.google.protobuf.RpcController controller, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest request, - com.google.protobuf.RpcCallback done); - - public static final - com.google.protobuf.Descriptors.ServiceDescriptor - getDescriptor() { - return org.wso2.apk.enforcer.discovery.service.subscription.AppMappingDSProto.getDescriptor().getServices().get(0); - } - public final com.google.protobuf.Descriptors.ServiceDescriptor - getDescriptorForType() { - return getDescriptor(); - } - - public final void callMethod( - com.google.protobuf.Descriptors.MethodDescriptor method, - com.google.protobuf.RpcController controller, - com.google.protobuf.Message request, - com.google.protobuf.RpcCallback< - com.google.protobuf.Message> done) { - if (method.getService() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "Service.callMethod() given method descriptor for wrong " + - "service type."); - } - switch(method.getIndex()) { - case 0: - this.streamApplicationMappings(controller, (io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest)request, - com.google.protobuf.RpcUtil.specializeCallback( - done)); - return; - default: - throw new java.lang.AssertionError("Can't get here."); - } - } - - public final com.google.protobuf.Message - getRequestPrototype( - com.google.protobuf.Descriptors.MethodDescriptor method) { - if (method.getService() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "Service.getRequestPrototype() given method " + - "descriptor for wrong service type."); - } - switch(method.getIndex()) { - case 0: - return io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest.getDefaultInstance(); - default: - throw new java.lang.AssertionError("Can't get here."); - } - } - - public final com.google.protobuf.Message - getResponsePrototype( - com.google.protobuf.Descriptors.MethodDescriptor method) { - if (method.getService() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "Service.getResponsePrototype() given method " + - "descriptor for wrong service type."); - } - switch(method.getIndex()) { - case 0: - return io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse.getDefaultInstance(); - default: - throw new java.lang.AssertionError("Can't get here."); - } - } - - public static Stub newStub( - com.google.protobuf.RpcChannel channel) { - return new Stub(channel); - } - - public static final class Stub extends org.wso2.apk.enforcer.discovery.service.subscription.ApplicationMappingDiscoveryService implements Interface { - private Stub(com.google.protobuf.RpcChannel channel) { - this.channel = channel; - } - - private final com.google.protobuf.RpcChannel channel; - - public com.google.protobuf.RpcChannel getChannel() { - return channel; - } - - public void streamApplicationMappings( - com.google.protobuf.RpcController controller, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest request, - com.google.protobuf.RpcCallback done) { - channel.callMethod( - getDescriptor().getMethods().get(0), - controller, - request, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse.getDefaultInstance(), - com.google.protobuf.RpcUtil.generalizeCallback( - done, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse.class, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse.getDefaultInstance())); - } - } - - public static BlockingInterface newBlockingStub( - com.google.protobuf.BlockingRpcChannel channel) { - return new BlockingStub(channel); - } - - public interface BlockingInterface { - public io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse streamApplicationMappings( - com.google.protobuf.RpcController controller, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest request) - throws com.google.protobuf.ServiceException; - } - - private static final class BlockingStub implements BlockingInterface { - private BlockingStub(com.google.protobuf.BlockingRpcChannel channel) { - this.channel = channel; - } - - private final com.google.protobuf.BlockingRpcChannel channel; - - public io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse streamApplicationMappings( - com.google.protobuf.RpcController controller, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest request) - throws com.google.protobuf.ServiceException { - return (io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse) channel.callBlockingMethod( - getDescriptor().getMethods().get(0), - controller, - request, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse.getDefaultInstance()); - } - - } - - // @@protoc_insertion_point(class_scope:discovery.service.subscription.ApplicationMappingDiscoveryService) -} - diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/ApplicationMappingDiscoveryServiceGrpc.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/ApplicationMappingDiscoveryServiceGrpc.java deleted file mode 100644 index 8e973639c..000000000 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/ApplicationMappingDiscoveryServiceGrpc.java +++ /dev/null @@ -1,287 +0,0 @@ -package org.wso2.apk.enforcer.discovery.service.subscription; - -import static io.grpc.MethodDescriptor.generateFullMethodName; -import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall; -import static io.grpc.stub.ClientCalls.asyncClientStreamingCall; -import static io.grpc.stub.ClientCalls.asyncServerStreamingCall; -import static io.grpc.stub.ClientCalls.asyncUnaryCall; -import static io.grpc.stub.ClientCalls.blockingServerStreamingCall; -import static io.grpc.stub.ClientCalls.blockingUnaryCall; -import static io.grpc.stub.ClientCalls.futureUnaryCall; -import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall; -import static io.grpc.stub.ServerCalls.asyncClientStreamingCall; -import static io.grpc.stub.ServerCalls.asyncServerStreamingCall; -import static io.grpc.stub.ServerCalls.asyncUnaryCall; -import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall; -import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall; - -/** - *
- * [#protodoc-title: AppMappingDS]
- * 
- */ -@javax.annotation.Generated( - value = "by gRPC proto compiler", - comments = "Source: wso2/discovery/service/subscription/app_mapping_ds.proto") -public final class ApplicationMappingDiscoveryServiceGrpc { - - private ApplicationMappingDiscoveryServiceGrpc() {} - - public static final String SERVICE_NAME = "discovery.service.subscription.ApplicationMappingDiscoveryService"; - - // Static method descriptors that strictly reflect the proto. - private static volatile io.grpc.MethodDescriptor getStreamApplicationMappingsMethod; - - @io.grpc.stub.annotations.RpcMethod( - fullMethodName = SERVICE_NAME + '/' + "StreamApplicationMappings", - requestType = io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest.class, - responseType = io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse.class, - methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) - public static io.grpc.MethodDescriptor getStreamApplicationMappingsMethod() { - io.grpc.MethodDescriptor getStreamApplicationMappingsMethod; - if ((getStreamApplicationMappingsMethod = ApplicationMappingDiscoveryServiceGrpc.getStreamApplicationMappingsMethod) == null) { - synchronized (ApplicationMappingDiscoveryServiceGrpc.class) { - if ((getStreamApplicationMappingsMethod = ApplicationMappingDiscoveryServiceGrpc.getStreamApplicationMappingsMethod) == null) { - ApplicationMappingDiscoveryServiceGrpc.getStreamApplicationMappingsMethod = getStreamApplicationMappingsMethod = - io.grpc.MethodDescriptor.newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) - .setFullMethodName(generateFullMethodName(SERVICE_NAME, "StreamApplicationMappings")) - .setSampledToLocalTracing(true) - .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest.getDefaultInstance())) - .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse.getDefaultInstance())) - .setSchemaDescriptor(new ApplicationMappingDiscoveryServiceMethodDescriptorSupplier("StreamApplicationMappings")) - .build(); - } - } - } - return getStreamApplicationMappingsMethod; - } - - /** - * Creates a new async stub that supports all call types for the service - */ - public static ApplicationMappingDiscoveryServiceStub newStub(io.grpc.Channel channel) { - io.grpc.stub.AbstractStub.StubFactory factory = - new io.grpc.stub.AbstractStub.StubFactory() { - @java.lang.Override - public ApplicationMappingDiscoveryServiceStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new ApplicationMappingDiscoveryServiceStub(channel, callOptions); - } - }; - return ApplicationMappingDiscoveryServiceStub.newStub(factory, channel); - } - - /** - * Creates a new blocking-style stub that supports unary and streaming output calls on the service - */ - public static ApplicationMappingDiscoveryServiceBlockingStub newBlockingStub( - io.grpc.Channel channel) { - io.grpc.stub.AbstractStub.StubFactory factory = - new io.grpc.stub.AbstractStub.StubFactory() { - @java.lang.Override - public ApplicationMappingDiscoveryServiceBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new ApplicationMappingDiscoveryServiceBlockingStub(channel, callOptions); - } - }; - return ApplicationMappingDiscoveryServiceBlockingStub.newStub(factory, channel); - } - - /** - * Creates a new ListenableFuture-style stub that supports unary calls on the service - */ - public static ApplicationMappingDiscoveryServiceFutureStub newFutureStub( - io.grpc.Channel channel) { - io.grpc.stub.AbstractStub.StubFactory factory = - new io.grpc.stub.AbstractStub.StubFactory() { - @java.lang.Override - public ApplicationMappingDiscoveryServiceFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new ApplicationMappingDiscoveryServiceFutureStub(channel, callOptions); - } - }; - return ApplicationMappingDiscoveryServiceFutureStub.newStub(factory, channel); - } - - /** - *
-   * [#protodoc-title: AppMappingDS]
-   * 
- */ - public static abstract class ApplicationMappingDiscoveryServiceImplBase implements io.grpc.BindableService { - - /** - */ - public io.grpc.stub.StreamObserver streamApplicationMappings( - io.grpc.stub.StreamObserver responseObserver) { - return asyncUnimplementedStreamingCall(getStreamApplicationMappingsMethod(), responseObserver); - } - - @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() { - return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) - .addMethod( - getStreamApplicationMappingsMethod(), - asyncBidiStreamingCall( - new MethodHandlers< - io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse>( - this, METHODID_STREAM_APPLICATION_MAPPINGS))) - .build(); - } - } - - /** - *
-   * [#protodoc-title: AppMappingDS]
-   * 
- */ - public static final class ApplicationMappingDiscoveryServiceStub extends io.grpc.stub.AbstractAsyncStub { - private ApplicationMappingDiscoveryServiceStub( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - super(channel, callOptions); - } - - @java.lang.Override - protected ApplicationMappingDiscoveryServiceStub build( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new ApplicationMappingDiscoveryServiceStub(channel, callOptions); - } - - /** - */ - public io.grpc.stub.StreamObserver streamApplicationMappings( - io.grpc.stub.StreamObserver responseObserver) { - return asyncBidiStreamingCall( - getChannel().newCall(getStreamApplicationMappingsMethod(), getCallOptions()), responseObserver); - } - } - - /** - *
-   * [#protodoc-title: AppMappingDS]
-   * 
- */ - public static final class ApplicationMappingDiscoveryServiceBlockingStub extends io.grpc.stub.AbstractBlockingStub { - private ApplicationMappingDiscoveryServiceBlockingStub( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - super(channel, callOptions); - } - - @java.lang.Override - protected ApplicationMappingDiscoveryServiceBlockingStub build( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new ApplicationMappingDiscoveryServiceBlockingStub(channel, callOptions); - } - } - - /** - *
-   * [#protodoc-title: AppMappingDS]
-   * 
- */ - public static final class ApplicationMappingDiscoveryServiceFutureStub extends io.grpc.stub.AbstractFutureStub { - private ApplicationMappingDiscoveryServiceFutureStub( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - super(channel, callOptions); - } - - @java.lang.Override - protected ApplicationMappingDiscoveryServiceFutureStub build( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new ApplicationMappingDiscoveryServiceFutureStub(channel, callOptions); - } - } - - private static final int METHODID_STREAM_APPLICATION_MAPPINGS = 0; - - private static final class MethodHandlers implements - io.grpc.stub.ServerCalls.UnaryMethod, - io.grpc.stub.ServerCalls.ServerStreamingMethod, - io.grpc.stub.ServerCalls.ClientStreamingMethod, - io.grpc.stub.ServerCalls.BidiStreamingMethod { - private final ApplicationMappingDiscoveryServiceImplBase serviceImpl; - private final int methodId; - - MethodHandlers(ApplicationMappingDiscoveryServiceImplBase serviceImpl, int methodId) { - this.serviceImpl = serviceImpl; - this.methodId = methodId; - } - - @java.lang.Override - @java.lang.SuppressWarnings("unchecked") - public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) { - switch (methodId) { - default: - throw new AssertionError(); - } - } - - @java.lang.Override - @java.lang.SuppressWarnings("unchecked") - public io.grpc.stub.StreamObserver invoke( - io.grpc.stub.StreamObserver responseObserver) { - switch (methodId) { - case METHODID_STREAM_APPLICATION_MAPPINGS: - return (io.grpc.stub.StreamObserver) serviceImpl.streamApplicationMappings( - (io.grpc.stub.StreamObserver) responseObserver); - default: - throw new AssertionError(); - } - } - } - - private static abstract class ApplicationMappingDiscoveryServiceBaseDescriptorSupplier - implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier { - ApplicationMappingDiscoveryServiceBaseDescriptorSupplier() {} - - @java.lang.Override - public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { - return org.wso2.apk.enforcer.discovery.service.subscription.AppMappingDSProto.getDescriptor(); - } - - @java.lang.Override - public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { - return getFileDescriptor().findServiceByName("ApplicationMappingDiscoveryService"); - } - } - - private static final class ApplicationMappingDiscoveryServiceFileDescriptorSupplier - extends ApplicationMappingDiscoveryServiceBaseDescriptorSupplier { - ApplicationMappingDiscoveryServiceFileDescriptorSupplier() {} - } - - private static final class ApplicationMappingDiscoveryServiceMethodDescriptorSupplier - extends ApplicationMappingDiscoveryServiceBaseDescriptorSupplier - implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { - private final String methodName; - - ApplicationMappingDiscoveryServiceMethodDescriptorSupplier(String methodName) { - this.methodName = methodName; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() { - return getServiceDescriptor().findMethodByName(methodName); - } - } - - private static volatile io.grpc.ServiceDescriptor serviceDescriptor; - - public static io.grpc.ServiceDescriptor getServiceDescriptor() { - io.grpc.ServiceDescriptor result = serviceDescriptor; - if (result == null) { - synchronized (ApplicationMappingDiscoveryServiceGrpc.class) { - result = serviceDescriptor; - if (result == null) { - serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) - .setSchemaDescriptor(new ApplicationMappingDiscoveryServiceFileDescriptorSupplier()) - .addMethod(getStreamApplicationMappingsMethod()) - .build(); - } - } - } - return result; - } -} diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/ApplicationPolicyDiscoveryService.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/ApplicationPolicyDiscoveryService.java deleted file mode 100644 index 875f64921..000000000 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/ApplicationPolicyDiscoveryService.java +++ /dev/null @@ -1,241 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: wso2/discovery/service/subscription/app_policy_ds.proto - -package org.wso2.apk.enforcer.discovery.service.subscription; - -/** - *
- * [#protodoc-title: AppPolicyDS]
- * 
- * - * Protobuf service {@code discovery.service.subscription.ApplicationPolicyDiscoveryService} - */ -public abstract class ApplicationPolicyDiscoveryService - implements com.google.protobuf.Service { - protected ApplicationPolicyDiscoveryService() {} - - public interface Interface { - /** - * rpc StreamApplicationPolicies(stream .envoy.service.discovery.v3.DiscoveryRequest) returns (stream .envoy.service.discovery.v3.DiscoveryResponse); - */ - public abstract void streamApplicationPolicies( - com.google.protobuf.RpcController controller, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest request, - com.google.protobuf.RpcCallback done); - - } - - public static com.google.protobuf.Service newReflectiveService( - final Interface impl) { - return new ApplicationPolicyDiscoveryService() { - @java.lang.Override - public void streamApplicationPolicies( - com.google.protobuf.RpcController controller, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest request, - com.google.protobuf.RpcCallback done) { - impl.streamApplicationPolicies(controller, request, done); - } - - }; - } - - public static com.google.protobuf.BlockingService - newReflectiveBlockingService(final BlockingInterface impl) { - return new com.google.protobuf.BlockingService() { - public final com.google.protobuf.Descriptors.ServiceDescriptor - getDescriptorForType() { - return getDescriptor(); - } - - public final com.google.protobuf.Message callBlockingMethod( - com.google.protobuf.Descriptors.MethodDescriptor method, - com.google.protobuf.RpcController controller, - com.google.protobuf.Message request) - throws com.google.protobuf.ServiceException { - if (method.getService() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "Service.callBlockingMethod() given method descriptor for " + - "wrong service type."); - } - switch(method.getIndex()) { - case 0: - return impl.streamApplicationPolicies(controller, (io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest)request); - default: - throw new java.lang.AssertionError("Can't get here."); - } - } - - public final com.google.protobuf.Message - getRequestPrototype( - com.google.protobuf.Descriptors.MethodDescriptor method) { - if (method.getService() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "Service.getRequestPrototype() given method " + - "descriptor for wrong service type."); - } - switch(method.getIndex()) { - case 0: - return io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest.getDefaultInstance(); - default: - throw new java.lang.AssertionError("Can't get here."); - } - } - - public final com.google.protobuf.Message - getResponsePrototype( - com.google.protobuf.Descriptors.MethodDescriptor method) { - if (method.getService() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "Service.getResponsePrototype() given method " + - "descriptor for wrong service type."); - } - switch(method.getIndex()) { - case 0: - return io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse.getDefaultInstance(); - default: - throw new java.lang.AssertionError("Can't get here."); - } - } - - }; - } - - /** - * rpc StreamApplicationPolicies(stream .envoy.service.discovery.v3.DiscoveryRequest) returns (stream .envoy.service.discovery.v3.DiscoveryResponse); - */ - public abstract void streamApplicationPolicies( - com.google.protobuf.RpcController controller, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest request, - com.google.protobuf.RpcCallback done); - - public static final - com.google.protobuf.Descriptors.ServiceDescriptor - getDescriptor() { - return org.wso2.apk.enforcer.discovery.service.subscription.AppPolicyDSProto.getDescriptor().getServices().get(0); - } - public final com.google.protobuf.Descriptors.ServiceDescriptor - getDescriptorForType() { - return getDescriptor(); - } - - public final void callMethod( - com.google.protobuf.Descriptors.MethodDescriptor method, - com.google.protobuf.RpcController controller, - com.google.protobuf.Message request, - com.google.protobuf.RpcCallback< - com.google.protobuf.Message> done) { - if (method.getService() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "Service.callMethod() given method descriptor for wrong " + - "service type."); - } - switch(method.getIndex()) { - case 0: - this.streamApplicationPolicies(controller, (io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest)request, - com.google.protobuf.RpcUtil.specializeCallback( - done)); - return; - default: - throw new java.lang.AssertionError("Can't get here."); - } - } - - public final com.google.protobuf.Message - getRequestPrototype( - com.google.protobuf.Descriptors.MethodDescriptor method) { - if (method.getService() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "Service.getRequestPrototype() given method " + - "descriptor for wrong service type."); - } - switch(method.getIndex()) { - case 0: - return io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest.getDefaultInstance(); - default: - throw new java.lang.AssertionError("Can't get here."); - } - } - - public final com.google.protobuf.Message - getResponsePrototype( - com.google.protobuf.Descriptors.MethodDescriptor method) { - if (method.getService() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "Service.getResponsePrototype() given method " + - "descriptor for wrong service type."); - } - switch(method.getIndex()) { - case 0: - return io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse.getDefaultInstance(); - default: - throw new java.lang.AssertionError("Can't get here."); - } - } - - public static Stub newStub( - com.google.protobuf.RpcChannel channel) { - return new Stub(channel); - } - - public static final class Stub extends org.wso2.apk.enforcer.discovery.service.subscription.ApplicationPolicyDiscoveryService implements Interface { - private Stub(com.google.protobuf.RpcChannel channel) { - this.channel = channel; - } - - private final com.google.protobuf.RpcChannel channel; - - public com.google.protobuf.RpcChannel getChannel() { - return channel; - } - - public void streamApplicationPolicies( - com.google.protobuf.RpcController controller, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest request, - com.google.protobuf.RpcCallback done) { - channel.callMethod( - getDescriptor().getMethods().get(0), - controller, - request, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse.getDefaultInstance(), - com.google.protobuf.RpcUtil.generalizeCallback( - done, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse.class, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse.getDefaultInstance())); - } - } - - public static BlockingInterface newBlockingStub( - com.google.protobuf.BlockingRpcChannel channel) { - return new BlockingStub(channel); - } - - public interface BlockingInterface { - public io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse streamApplicationPolicies( - com.google.protobuf.RpcController controller, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest request) - throws com.google.protobuf.ServiceException; - } - - private static final class BlockingStub implements BlockingInterface { - private BlockingStub(com.google.protobuf.BlockingRpcChannel channel) { - this.channel = channel; - } - - private final com.google.protobuf.BlockingRpcChannel channel; - - public io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse streamApplicationPolicies( - com.google.protobuf.RpcController controller, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest request) - throws com.google.protobuf.ServiceException { - return (io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse) channel.callBlockingMethod( - getDescriptor().getMethods().get(0), - controller, - request, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse.getDefaultInstance()); - } - - } - - // @@protoc_insertion_point(class_scope:discovery.service.subscription.ApplicationPolicyDiscoveryService) -} - diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/ApplicationPolicyDiscoveryServiceGrpc.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/ApplicationPolicyDiscoveryServiceGrpc.java deleted file mode 100644 index 3790c552f..000000000 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/ApplicationPolicyDiscoveryServiceGrpc.java +++ /dev/null @@ -1,287 +0,0 @@ -package org.wso2.apk.enforcer.discovery.service.subscription; - -import static io.grpc.MethodDescriptor.generateFullMethodName; -import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall; -import static io.grpc.stub.ClientCalls.asyncClientStreamingCall; -import static io.grpc.stub.ClientCalls.asyncServerStreamingCall; -import static io.grpc.stub.ClientCalls.asyncUnaryCall; -import static io.grpc.stub.ClientCalls.blockingServerStreamingCall; -import static io.grpc.stub.ClientCalls.blockingUnaryCall; -import static io.grpc.stub.ClientCalls.futureUnaryCall; -import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall; -import static io.grpc.stub.ServerCalls.asyncClientStreamingCall; -import static io.grpc.stub.ServerCalls.asyncServerStreamingCall; -import static io.grpc.stub.ServerCalls.asyncUnaryCall; -import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall; -import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall; - -/** - *
- * [#protodoc-title: AppPolicyDS]
- * 
- */ -@javax.annotation.Generated( - value = "by gRPC proto compiler", - comments = "Source: wso2/discovery/service/subscription/app_policy_ds.proto") -public final class ApplicationPolicyDiscoveryServiceGrpc { - - private ApplicationPolicyDiscoveryServiceGrpc() {} - - public static final String SERVICE_NAME = "discovery.service.subscription.ApplicationPolicyDiscoveryService"; - - // Static method descriptors that strictly reflect the proto. - private static volatile io.grpc.MethodDescriptor getStreamApplicationPoliciesMethod; - - @io.grpc.stub.annotations.RpcMethod( - fullMethodName = SERVICE_NAME + '/' + "StreamApplicationPolicies", - requestType = io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest.class, - responseType = io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse.class, - methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) - public static io.grpc.MethodDescriptor getStreamApplicationPoliciesMethod() { - io.grpc.MethodDescriptor getStreamApplicationPoliciesMethod; - if ((getStreamApplicationPoliciesMethod = ApplicationPolicyDiscoveryServiceGrpc.getStreamApplicationPoliciesMethod) == null) { - synchronized (ApplicationPolicyDiscoveryServiceGrpc.class) { - if ((getStreamApplicationPoliciesMethod = ApplicationPolicyDiscoveryServiceGrpc.getStreamApplicationPoliciesMethod) == null) { - ApplicationPolicyDiscoveryServiceGrpc.getStreamApplicationPoliciesMethod = getStreamApplicationPoliciesMethod = - io.grpc.MethodDescriptor.newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) - .setFullMethodName(generateFullMethodName(SERVICE_NAME, "StreamApplicationPolicies")) - .setSampledToLocalTracing(true) - .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest.getDefaultInstance())) - .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse.getDefaultInstance())) - .setSchemaDescriptor(new ApplicationPolicyDiscoveryServiceMethodDescriptorSupplier("StreamApplicationPolicies")) - .build(); - } - } - } - return getStreamApplicationPoliciesMethod; - } - - /** - * Creates a new async stub that supports all call types for the service - */ - public static ApplicationPolicyDiscoveryServiceStub newStub(io.grpc.Channel channel) { - io.grpc.stub.AbstractStub.StubFactory factory = - new io.grpc.stub.AbstractStub.StubFactory() { - @java.lang.Override - public ApplicationPolicyDiscoveryServiceStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new ApplicationPolicyDiscoveryServiceStub(channel, callOptions); - } - }; - return ApplicationPolicyDiscoveryServiceStub.newStub(factory, channel); - } - - /** - * Creates a new blocking-style stub that supports unary and streaming output calls on the service - */ - public static ApplicationPolicyDiscoveryServiceBlockingStub newBlockingStub( - io.grpc.Channel channel) { - io.grpc.stub.AbstractStub.StubFactory factory = - new io.grpc.stub.AbstractStub.StubFactory() { - @java.lang.Override - public ApplicationPolicyDiscoveryServiceBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new ApplicationPolicyDiscoveryServiceBlockingStub(channel, callOptions); - } - }; - return ApplicationPolicyDiscoveryServiceBlockingStub.newStub(factory, channel); - } - - /** - * Creates a new ListenableFuture-style stub that supports unary calls on the service - */ - public static ApplicationPolicyDiscoveryServiceFutureStub newFutureStub( - io.grpc.Channel channel) { - io.grpc.stub.AbstractStub.StubFactory factory = - new io.grpc.stub.AbstractStub.StubFactory() { - @java.lang.Override - public ApplicationPolicyDiscoveryServiceFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new ApplicationPolicyDiscoveryServiceFutureStub(channel, callOptions); - } - }; - return ApplicationPolicyDiscoveryServiceFutureStub.newStub(factory, channel); - } - - /** - *
-   * [#protodoc-title: AppPolicyDS]
-   * 
- */ - public static abstract class ApplicationPolicyDiscoveryServiceImplBase implements io.grpc.BindableService { - - /** - */ - public io.grpc.stub.StreamObserver streamApplicationPolicies( - io.grpc.stub.StreamObserver responseObserver) { - return asyncUnimplementedStreamingCall(getStreamApplicationPoliciesMethod(), responseObserver); - } - - @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() { - return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) - .addMethod( - getStreamApplicationPoliciesMethod(), - asyncBidiStreamingCall( - new MethodHandlers< - io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse>( - this, METHODID_STREAM_APPLICATION_POLICIES))) - .build(); - } - } - - /** - *
-   * [#protodoc-title: AppPolicyDS]
-   * 
- */ - public static final class ApplicationPolicyDiscoveryServiceStub extends io.grpc.stub.AbstractAsyncStub { - private ApplicationPolicyDiscoveryServiceStub( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - super(channel, callOptions); - } - - @java.lang.Override - protected ApplicationPolicyDiscoveryServiceStub build( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new ApplicationPolicyDiscoveryServiceStub(channel, callOptions); - } - - /** - */ - public io.grpc.stub.StreamObserver streamApplicationPolicies( - io.grpc.stub.StreamObserver responseObserver) { - return asyncBidiStreamingCall( - getChannel().newCall(getStreamApplicationPoliciesMethod(), getCallOptions()), responseObserver); - } - } - - /** - *
-   * [#protodoc-title: AppPolicyDS]
-   * 
- */ - public static final class ApplicationPolicyDiscoveryServiceBlockingStub extends io.grpc.stub.AbstractBlockingStub { - private ApplicationPolicyDiscoveryServiceBlockingStub( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - super(channel, callOptions); - } - - @java.lang.Override - protected ApplicationPolicyDiscoveryServiceBlockingStub build( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new ApplicationPolicyDiscoveryServiceBlockingStub(channel, callOptions); - } - } - - /** - *
-   * [#protodoc-title: AppPolicyDS]
-   * 
- */ - public static final class ApplicationPolicyDiscoveryServiceFutureStub extends io.grpc.stub.AbstractFutureStub { - private ApplicationPolicyDiscoveryServiceFutureStub( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - super(channel, callOptions); - } - - @java.lang.Override - protected ApplicationPolicyDiscoveryServiceFutureStub build( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new ApplicationPolicyDiscoveryServiceFutureStub(channel, callOptions); - } - } - - private static final int METHODID_STREAM_APPLICATION_POLICIES = 0; - - private static final class MethodHandlers implements - io.grpc.stub.ServerCalls.UnaryMethod, - io.grpc.stub.ServerCalls.ServerStreamingMethod, - io.grpc.stub.ServerCalls.ClientStreamingMethod, - io.grpc.stub.ServerCalls.BidiStreamingMethod { - private final ApplicationPolicyDiscoveryServiceImplBase serviceImpl; - private final int methodId; - - MethodHandlers(ApplicationPolicyDiscoveryServiceImplBase serviceImpl, int methodId) { - this.serviceImpl = serviceImpl; - this.methodId = methodId; - } - - @java.lang.Override - @java.lang.SuppressWarnings("unchecked") - public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) { - switch (methodId) { - default: - throw new AssertionError(); - } - } - - @java.lang.Override - @java.lang.SuppressWarnings("unchecked") - public io.grpc.stub.StreamObserver invoke( - io.grpc.stub.StreamObserver responseObserver) { - switch (methodId) { - case METHODID_STREAM_APPLICATION_POLICIES: - return (io.grpc.stub.StreamObserver) serviceImpl.streamApplicationPolicies( - (io.grpc.stub.StreamObserver) responseObserver); - default: - throw new AssertionError(); - } - } - } - - private static abstract class ApplicationPolicyDiscoveryServiceBaseDescriptorSupplier - implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier { - ApplicationPolicyDiscoveryServiceBaseDescriptorSupplier() {} - - @java.lang.Override - public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { - return org.wso2.apk.enforcer.discovery.service.subscription.AppPolicyDSProto.getDescriptor(); - } - - @java.lang.Override - public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { - return getFileDescriptor().findServiceByName("ApplicationPolicyDiscoveryService"); - } - } - - private static final class ApplicationPolicyDiscoveryServiceFileDescriptorSupplier - extends ApplicationPolicyDiscoveryServiceBaseDescriptorSupplier { - ApplicationPolicyDiscoveryServiceFileDescriptorSupplier() {} - } - - private static final class ApplicationPolicyDiscoveryServiceMethodDescriptorSupplier - extends ApplicationPolicyDiscoveryServiceBaseDescriptorSupplier - implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { - private final String methodName; - - ApplicationPolicyDiscoveryServiceMethodDescriptorSupplier(String methodName) { - this.methodName = methodName; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() { - return getServiceDescriptor().findMethodByName(methodName); - } - } - - private static volatile io.grpc.ServiceDescriptor serviceDescriptor; - - public static io.grpc.ServiceDescriptor getServiceDescriptor() { - io.grpc.ServiceDescriptor result = serviceDescriptor; - if (result == null) { - synchronized (ApplicationPolicyDiscoveryServiceGrpc.class) { - result = serviceDescriptor; - if (result == null) { - serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) - .setSchemaDescriptor(new ApplicationPolicyDiscoveryServiceFileDescriptorSupplier()) - .addMethod(getStreamApplicationPoliciesMethod()) - .build(); - } - } - } - return result; - } -} diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/EventServiceProto.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/EventServiceProto.java deleted file mode 100644 index f671cf88a..000000000 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/EventServiceProto.java +++ /dev/null @@ -1,58 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: wso2/discovery/service/apkmgt/eventds.proto - -package org.wso2.apk.enforcer.discovery.service.subscription; - -public final class EventServiceProto { - private EventServiceProto() {} - public static void registerAllExtensions( - com.google.protobuf.ExtensionRegistryLite registry) { - } - - public static void registerAllExtensions( - com.google.protobuf.ExtensionRegistry registry) { - registerAllExtensions( - (com.google.protobuf.ExtensionRegistryLite) registry); - } - static final com.google.protobuf.Descriptors.Descriptor - internal_static_discovery_service_apkmgt_Request_descriptor; - static final - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_discovery_service_apkmgt_Request_fieldAccessorTable; - - public static com.google.protobuf.Descriptors.FileDescriptor - getDescriptor() { - return descriptor; - } - private static com.google.protobuf.Descriptors.FileDescriptor - descriptor; - static { - java.lang.String[] descriptorData = { - "\n+wso2/discovery/service/apkmgt/eventds." + - "proto\022\030discovery.service.apkmgt\032\'wso2/di" + - "scovery/subscription/event.proto\"\030\n\007Requ" + - "est\022\r\n\005event\030\001 \001(\t2o\n\022EventStreamService" + - "\022Y\n\014StreamEvents\022!.discovery.service.apk" + - "mgt.Request\032\".wso2.discovery.subscriptio" + - "n.Event\"\0000\001B\232\001\n4org.wso2.apk.enforcer.di" + - "scovery.service.subscriptionB\021EventServi" + - "ceProtoP\001ZJgithub.com/envoyproxy/go-cont" + - "rol-plane/wso2/discovery/service/subscri" + - "ption\210\001\001b\006proto3" - }; - descriptor = com.google.protobuf.Descriptors.FileDescriptor - .internalBuildGeneratedFileFrom(descriptorData, - new com.google.protobuf.Descriptors.FileDescriptor[] { - org.wso2.apk.enforcer.discovery.subscription.EventProto.getDescriptor(), - }); - internal_static_discovery_service_apkmgt_Request_descriptor = - getDescriptor().getMessageTypes().get(0); - internal_static_discovery_service_apkmgt_Request_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_discovery_service_apkmgt_Request_descriptor, - new java.lang.String[] { "Event", }); - org.wso2.apk.enforcer.discovery.subscription.EventProto.getDescriptor(); - } - - // @@protoc_insertion_point(outer_class_scope) -} diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/EventStreamService.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/EventStreamService.java deleted file mode 100644 index 29506a60f..000000000 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/EventStreamService.java +++ /dev/null @@ -1,241 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: wso2/discovery/service/apkmgt/eventds.proto - -package org.wso2.apk.enforcer.discovery.service.subscription; - -/** - *
- * [#protodoc-title: EventStreamDS]
- * 
- * - * Protobuf service {@code discovery.service.apkmgt.EventStreamService} - */ -public abstract class EventStreamService - implements com.google.protobuf.Service { - protected EventStreamService() {} - - public interface Interface { - /** - * rpc StreamEvents(.discovery.service.apkmgt.Request) returns (stream .wso2.discovery.subscription.Event); - */ - public abstract void streamEvents( - com.google.protobuf.RpcController controller, - org.wso2.apk.enforcer.discovery.service.subscription.Request request, - com.google.protobuf.RpcCallback done); - - } - - public static com.google.protobuf.Service newReflectiveService( - final Interface impl) { - return new EventStreamService() { - @java.lang.Override - public void streamEvents( - com.google.protobuf.RpcController controller, - org.wso2.apk.enforcer.discovery.service.subscription.Request request, - com.google.protobuf.RpcCallback done) { - impl.streamEvents(controller, request, done); - } - - }; - } - - public static com.google.protobuf.BlockingService - newReflectiveBlockingService(final BlockingInterface impl) { - return new com.google.protobuf.BlockingService() { - public final com.google.protobuf.Descriptors.ServiceDescriptor - getDescriptorForType() { - return getDescriptor(); - } - - public final com.google.protobuf.Message callBlockingMethod( - com.google.protobuf.Descriptors.MethodDescriptor method, - com.google.protobuf.RpcController controller, - com.google.protobuf.Message request) - throws com.google.protobuf.ServiceException { - if (method.getService() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "Service.callBlockingMethod() given method descriptor for " + - "wrong service type."); - } - switch(method.getIndex()) { - case 0: - return impl.streamEvents(controller, (org.wso2.apk.enforcer.discovery.service.subscription.Request)request); - default: - throw new java.lang.AssertionError("Can't get here."); - } - } - - public final com.google.protobuf.Message - getRequestPrototype( - com.google.protobuf.Descriptors.MethodDescriptor method) { - if (method.getService() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "Service.getRequestPrototype() given method " + - "descriptor for wrong service type."); - } - switch(method.getIndex()) { - case 0: - return org.wso2.apk.enforcer.discovery.service.subscription.Request.getDefaultInstance(); - default: - throw new java.lang.AssertionError("Can't get here."); - } - } - - public final com.google.protobuf.Message - getResponsePrototype( - com.google.protobuf.Descriptors.MethodDescriptor method) { - if (method.getService() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "Service.getResponsePrototype() given method " + - "descriptor for wrong service type."); - } - switch(method.getIndex()) { - case 0: - return org.wso2.apk.enforcer.discovery.subscription.Event.getDefaultInstance(); - default: - throw new java.lang.AssertionError("Can't get here."); - } - } - - }; - } - - /** - * rpc StreamEvents(.discovery.service.apkmgt.Request) returns (stream .wso2.discovery.subscription.Event); - */ - public abstract void streamEvents( - com.google.protobuf.RpcController controller, - org.wso2.apk.enforcer.discovery.service.subscription.Request request, - com.google.protobuf.RpcCallback done); - - public static final - com.google.protobuf.Descriptors.ServiceDescriptor - getDescriptor() { - return org.wso2.apk.enforcer.discovery.service.subscription.EventServiceProto.getDescriptor().getServices().get(0); - } - public final com.google.protobuf.Descriptors.ServiceDescriptor - getDescriptorForType() { - return getDescriptor(); - } - - public final void callMethod( - com.google.protobuf.Descriptors.MethodDescriptor method, - com.google.protobuf.RpcController controller, - com.google.protobuf.Message request, - com.google.protobuf.RpcCallback< - com.google.protobuf.Message> done) { - if (method.getService() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "Service.callMethod() given method descriptor for wrong " + - "service type."); - } - switch(method.getIndex()) { - case 0: - this.streamEvents(controller, (org.wso2.apk.enforcer.discovery.service.subscription.Request)request, - com.google.protobuf.RpcUtil.specializeCallback( - done)); - return; - default: - throw new java.lang.AssertionError("Can't get here."); - } - } - - public final com.google.protobuf.Message - getRequestPrototype( - com.google.protobuf.Descriptors.MethodDescriptor method) { - if (method.getService() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "Service.getRequestPrototype() given method " + - "descriptor for wrong service type."); - } - switch(method.getIndex()) { - case 0: - return org.wso2.apk.enforcer.discovery.service.subscription.Request.getDefaultInstance(); - default: - throw new java.lang.AssertionError("Can't get here."); - } - } - - public final com.google.protobuf.Message - getResponsePrototype( - com.google.protobuf.Descriptors.MethodDescriptor method) { - if (method.getService() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "Service.getResponsePrototype() given method " + - "descriptor for wrong service type."); - } - switch(method.getIndex()) { - case 0: - return org.wso2.apk.enforcer.discovery.subscription.Event.getDefaultInstance(); - default: - throw new java.lang.AssertionError("Can't get here."); - } - } - - public static Stub newStub( - com.google.protobuf.RpcChannel channel) { - return new Stub(channel); - } - - public static final class Stub extends org.wso2.apk.enforcer.discovery.service.subscription.EventStreamService implements Interface { - private Stub(com.google.protobuf.RpcChannel channel) { - this.channel = channel; - } - - private final com.google.protobuf.RpcChannel channel; - - public com.google.protobuf.RpcChannel getChannel() { - return channel; - } - - public void streamEvents( - com.google.protobuf.RpcController controller, - org.wso2.apk.enforcer.discovery.service.subscription.Request request, - com.google.protobuf.RpcCallback done) { - channel.callMethod( - getDescriptor().getMethods().get(0), - controller, - request, - org.wso2.apk.enforcer.discovery.subscription.Event.getDefaultInstance(), - com.google.protobuf.RpcUtil.generalizeCallback( - done, - org.wso2.apk.enforcer.discovery.subscription.Event.class, - org.wso2.apk.enforcer.discovery.subscription.Event.getDefaultInstance())); - } - } - - public static BlockingInterface newBlockingStub( - com.google.protobuf.BlockingRpcChannel channel) { - return new BlockingStub(channel); - } - - public interface BlockingInterface { - public org.wso2.apk.enforcer.discovery.subscription.Event streamEvents( - com.google.protobuf.RpcController controller, - org.wso2.apk.enforcer.discovery.service.subscription.Request request) - throws com.google.protobuf.ServiceException; - } - - private static final class BlockingStub implements BlockingInterface { - private BlockingStub(com.google.protobuf.BlockingRpcChannel channel) { - this.channel = channel; - } - - private final com.google.protobuf.BlockingRpcChannel channel; - - public org.wso2.apk.enforcer.discovery.subscription.Event streamEvents( - com.google.protobuf.RpcController controller, - org.wso2.apk.enforcer.discovery.service.subscription.Request request) - throws com.google.protobuf.ServiceException { - return (org.wso2.apk.enforcer.discovery.subscription.Event) channel.callBlockingMethod( - getDescriptor().getMethods().get(0), - controller, - request, - org.wso2.apk.enforcer.discovery.subscription.Event.getDefaultInstance()); - } - - } - - // @@protoc_insertion_point(class_scope:discovery.service.apkmgt.EventStreamService) -} - diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/EventStreamServiceGrpc.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/EventStreamServiceGrpc.java deleted file mode 100644 index 5ae47c183..000000000 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/EventStreamServiceGrpc.java +++ /dev/null @@ -1,296 +0,0 @@ -package org.wso2.apk.enforcer.discovery.service.subscription; - -import static io.grpc.MethodDescriptor.generateFullMethodName; -import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall; -import static io.grpc.stub.ClientCalls.asyncClientStreamingCall; -import static io.grpc.stub.ClientCalls.asyncServerStreamingCall; -import static io.grpc.stub.ClientCalls.asyncUnaryCall; -import static io.grpc.stub.ClientCalls.blockingServerStreamingCall; -import static io.grpc.stub.ClientCalls.blockingUnaryCall; -import static io.grpc.stub.ClientCalls.futureUnaryCall; -import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall; -import static io.grpc.stub.ServerCalls.asyncClientStreamingCall; -import static io.grpc.stub.ServerCalls.asyncServerStreamingCall; -import static io.grpc.stub.ServerCalls.asyncUnaryCall; -import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall; -import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall; - -/** - *
- * [#protodoc-title: EventStreamDS]
- * 
- */ -@javax.annotation.Generated( - value = "by gRPC proto compiler", - comments = "Source: wso2/discovery/service/apkmgt/eventds.proto") -public final class EventStreamServiceGrpc { - - private EventStreamServiceGrpc() {} - - public static final String SERVICE_NAME = "discovery.service.apkmgt.EventStreamService"; - - // Static method descriptors that strictly reflect the proto. - private static volatile io.grpc.MethodDescriptor getStreamEventsMethod; - - @io.grpc.stub.annotations.RpcMethod( - fullMethodName = SERVICE_NAME + '/' + "StreamEvents", - requestType = org.wso2.apk.enforcer.discovery.service.subscription.Request.class, - responseType = org.wso2.apk.enforcer.discovery.subscription.Event.class, - methodType = io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING) - public static io.grpc.MethodDescriptor getStreamEventsMethod() { - io.grpc.MethodDescriptor getStreamEventsMethod; - if ((getStreamEventsMethod = EventStreamServiceGrpc.getStreamEventsMethod) == null) { - synchronized (EventStreamServiceGrpc.class) { - if ((getStreamEventsMethod = EventStreamServiceGrpc.getStreamEventsMethod) == null) { - EventStreamServiceGrpc.getStreamEventsMethod = getStreamEventsMethod = - io.grpc.MethodDescriptor.newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING) - .setFullMethodName(generateFullMethodName(SERVICE_NAME, "StreamEvents")) - .setSampledToLocalTracing(true) - .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - org.wso2.apk.enforcer.discovery.service.subscription.Request.getDefaultInstance())) - .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - org.wso2.apk.enforcer.discovery.subscription.Event.getDefaultInstance())) - .setSchemaDescriptor(new EventStreamServiceMethodDescriptorSupplier("StreamEvents")) - .build(); - } - } - } - return getStreamEventsMethod; - } - - /** - * Creates a new async stub that supports all call types for the service - */ - public static EventStreamServiceStub newStub(io.grpc.Channel channel) { - io.grpc.stub.AbstractStub.StubFactory factory = - new io.grpc.stub.AbstractStub.StubFactory() { - @java.lang.Override - public EventStreamServiceStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new EventStreamServiceStub(channel, callOptions); - } - }; - return EventStreamServiceStub.newStub(factory, channel); - } - - /** - * Creates a new blocking-style stub that supports unary and streaming output calls on the service - */ - public static EventStreamServiceBlockingStub newBlockingStub( - io.grpc.Channel channel) { - io.grpc.stub.AbstractStub.StubFactory factory = - new io.grpc.stub.AbstractStub.StubFactory() { - @java.lang.Override - public EventStreamServiceBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new EventStreamServiceBlockingStub(channel, callOptions); - } - }; - return EventStreamServiceBlockingStub.newStub(factory, channel); - } - - /** - * Creates a new ListenableFuture-style stub that supports unary calls on the service - */ - public static EventStreamServiceFutureStub newFutureStub( - io.grpc.Channel channel) { - io.grpc.stub.AbstractStub.StubFactory factory = - new io.grpc.stub.AbstractStub.StubFactory() { - @java.lang.Override - public EventStreamServiceFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new EventStreamServiceFutureStub(channel, callOptions); - } - }; - return EventStreamServiceFutureStub.newStub(factory, channel); - } - - /** - *
-   * [#protodoc-title: EventStreamDS]
-   * 
- */ - public static abstract class EventStreamServiceImplBase implements io.grpc.BindableService { - - /** - */ - public void streamEvents(org.wso2.apk.enforcer.discovery.service.subscription.Request request, - io.grpc.stub.StreamObserver responseObserver) { - asyncUnimplementedUnaryCall(getStreamEventsMethod(), responseObserver); - } - - @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() { - return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) - .addMethod( - getStreamEventsMethod(), - asyncServerStreamingCall( - new MethodHandlers< - org.wso2.apk.enforcer.discovery.service.subscription.Request, - org.wso2.apk.enforcer.discovery.subscription.Event>( - this, METHODID_STREAM_EVENTS))) - .build(); - } - } - - /** - *
-   * [#protodoc-title: EventStreamDS]
-   * 
- */ - public static final class EventStreamServiceStub extends io.grpc.stub.AbstractAsyncStub { - private EventStreamServiceStub( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - super(channel, callOptions); - } - - @java.lang.Override - protected EventStreamServiceStub build( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new EventStreamServiceStub(channel, callOptions); - } - - /** - */ - public void streamEvents(org.wso2.apk.enforcer.discovery.service.subscription.Request request, - io.grpc.stub.StreamObserver responseObserver) { - asyncServerStreamingCall( - getChannel().newCall(getStreamEventsMethod(), getCallOptions()), request, responseObserver); - } - } - - /** - *
-   * [#protodoc-title: EventStreamDS]
-   * 
- */ - public static final class EventStreamServiceBlockingStub extends io.grpc.stub.AbstractBlockingStub { - private EventStreamServiceBlockingStub( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - super(channel, callOptions); - } - - @java.lang.Override - protected EventStreamServiceBlockingStub build( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new EventStreamServiceBlockingStub(channel, callOptions); - } - - /** - */ - public java.util.Iterator streamEvents( - org.wso2.apk.enforcer.discovery.service.subscription.Request request) { - return blockingServerStreamingCall( - getChannel(), getStreamEventsMethod(), getCallOptions(), request); - } - } - - /** - *
-   * [#protodoc-title: EventStreamDS]
-   * 
- */ - public static final class EventStreamServiceFutureStub extends io.grpc.stub.AbstractFutureStub { - private EventStreamServiceFutureStub( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - super(channel, callOptions); - } - - @java.lang.Override - protected EventStreamServiceFutureStub build( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new EventStreamServiceFutureStub(channel, callOptions); - } - } - - private static final int METHODID_STREAM_EVENTS = 0; - - private static final class MethodHandlers implements - io.grpc.stub.ServerCalls.UnaryMethod, - io.grpc.stub.ServerCalls.ServerStreamingMethod, - io.grpc.stub.ServerCalls.ClientStreamingMethod, - io.grpc.stub.ServerCalls.BidiStreamingMethod { - private final EventStreamServiceImplBase serviceImpl; - private final int methodId; - - MethodHandlers(EventStreamServiceImplBase serviceImpl, int methodId) { - this.serviceImpl = serviceImpl; - this.methodId = methodId; - } - - @java.lang.Override - @java.lang.SuppressWarnings("unchecked") - public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) { - switch (methodId) { - case METHODID_STREAM_EVENTS: - serviceImpl.streamEvents((org.wso2.apk.enforcer.discovery.service.subscription.Request) request, - (io.grpc.stub.StreamObserver) responseObserver); - break; - default: - throw new AssertionError(); - } - } - - @java.lang.Override - @java.lang.SuppressWarnings("unchecked") - public io.grpc.stub.StreamObserver invoke( - io.grpc.stub.StreamObserver responseObserver) { - switch (methodId) { - default: - throw new AssertionError(); - } - } - } - - private static abstract class EventStreamServiceBaseDescriptorSupplier - implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier { - EventStreamServiceBaseDescriptorSupplier() {} - - @java.lang.Override - public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { - return org.wso2.apk.enforcer.discovery.service.subscription.EventServiceProto.getDescriptor(); - } - - @java.lang.Override - public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { - return getFileDescriptor().findServiceByName("EventStreamService"); - } - } - - private static final class EventStreamServiceFileDescriptorSupplier - extends EventStreamServiceBaseDescriptorSupplier { - EventStreamServiceFileDescriptorSupplier() {} - } - - private static final class EventStreamServiceMethodDescriptorSupplier - extends EventStreamServiceBaseDescriptorSupplier - implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { - private final String methodName; - - EventStreamServiceMethodDescriptorSupplier(String methodName) { - this.methodName = methodName; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() { - return getServiceDescriptor().findMethodByName(methodName); - } - } - - private static volatile io.grpc.ServiceDescriptor serviceDescriptor; - - public static io.grpc.ServiceDescriptor getServiceDescriptor() { - io.grpc.ServiceDescriptor result = serviceDescriptor; - if (result == null) { - synchronized (EventStreamServiceGrpc.class) { - result = serviceDescriptor; - if (result == null) { - serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) - .setSchemaDescriptor(new EventStreamServiceFileDescriptorSupplier()) - .addMethod(getStreamEventsMethod()) - .build(); - } - } - } - return result; - } -} diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/Request.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/Request.java deleted file mode 100644 index 14694e3e4..000000000 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/Request.java +++ /dev/null @@ -1,557 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: wso2/discovery/service/apkmgt/eventds.proto - -package org.wso2.apk.enforcer.discovery.service.subscription; - -/** - * Protobuf type {@code discovery.service.apkmgt.Request} - */ -public final class Request extends - com.google.protobuf.GeneratedMessageV3 implements - // @@protoc_insertion_point(message_implements:discovery.service.apkmgt.Request) - RequestOrBuilder { -private static final long serialVersionUID = 0L; - // Use Request.newBuilder() to construct. - private Request(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - private Request() { - event_ = ""; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance( - UnusedPrivateParameter unused) { - return new Request(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private Request( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: { - java.lang.String s = input.readStringRequireUtf8(); - - event_ = s; - break; - } - default: { - if (!parseUnknownField( - input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return org.wso2.apk.enforcer.discovery.service.subscription.EventServiceProto.internal_static_discovery_service_apkmgt_Request_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return org.wso2.apk.enforcer.discovery.service.subscription.EventServiceProto.internal_static_discovery_service_apkmgt_Request_fieldAccessorTable - .ensureFieldAccessorsInitialized( - org.wso2.apk.enforcer.discovery.service.subscription.Request.class, org.wso2.apk.enforcer.discovery.service.subscription.Request.Builder.class); - } - - public static final int EVENT_FIELD_NUMBER = 1; - private volatile java.lang.Object event_; - /** - * string event = 1; - * @return The event. - */ - @java.lang.Override - public java.lang.String getEvent() { - java.lang.Object ref = event_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - event_ = s; - return s; - } - } - /** - * string event = 1; - * @return The bytes for event. - */ - @java.lang.Override - public com.google.protobuf.ByteString - getEventBytes() { - java.lang.Object ref = event_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - event_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - private byte memoizedIsInitialized = -1; - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - if (!getEventBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, event_); - } - unknownFields.writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (!getEventBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, event_); - } - size += unknownFields.getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof org.wso2.apk.enforcer.discovery.service.subscription.Request)) { - return super.equals(obj); - } - org.wso2.apk.enforcer.discovery.service.subscription.Request other = (org.wso2.apk.enforcer.discovery.service.subscription.Request) obj; - - if (!getEvent() - .equals(other.getEvent())) return false; - if (!unknownFields.equals(other.unknownFields)) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + EVENT_FIELD_NUMBER; - hash = (53 * hash) + getEvent().hashCode(); - hash = (29 * hash) + unknownFields.hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static org.wso2.apk.enforcer.discovery.service.subscription.Request parseFrom( - java.nio.ByteBuffer data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static org.wso2.apk.enforcer.discovery.service.subscription.Request parseFrom( - java.nio.ByteBuffer data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static org.wso2.apk.enforcer.discovery.service.subscription.Request parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static org.wso2.apk.enforcer.discovery.service.subscription.Request parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static org.wso2.apk.enforcer.discovery.service.subscription.Request parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static org.wso2.apk.enforcer.discovery.service.subscription.Request parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static org.wso2.apk.enforcer.discovery.service.subscription.Request parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static org.wso2.apk.enforcer.discovery.service.subscription.Request parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - public static org.wso2.apk.enforcer.discovery.service.subscription.Request parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input); - } - public static org.wso2.apk.enforcer.discovery.service.subscription.Request parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input, extensionRegistry); - } - public static org.wso2.apk.enforcer.discovery.service.subscription.Request parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static org.wso2.apk.enforcer.discovery.service.subscription.Request parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - - @java.lang.Override - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - public static Builder newBuilder(org.wso2.apk.enforcer.discovery.service.subscription.Request prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE - ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * Protobuf type {@code discovery.service.apkmgt.Request} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessageV3.Builder implements - // @@protoc_insertion_point(builder_implements:discovery.service.apkmgt.Request) - org.wso2.apk.enforcer.discovery.service.subscription.RequestOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return org.wso2.apk.enforcer.discovery.service.subscription.EventServiceProto.internal_static_discovery_service_apkmgt_Request_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return org.wso2.apk.enforcer.discovery.service.subscription.EventServiceProto.internal_static_discovery_service_apkmgt_Request_fieldAccessorTable - .ensureFieldAccessorsInitialized( - org.wso2.apk.enforcer.discovery.service.subscription.Request.class, org.wso2.apk.enforcer.discovery.service.subscription.Request.Builder.class); - } - - // Construct using org.wso2.apk.enforcer.discovery.service.subscription.Request.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - } - } - @java.lang.Override - public Builder clear() { - super.clear(); - event_ = ""; - - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return org.wso2.apk.enforcer.discovery.service.subscription.EventServiceProto.internal_static_discovery_service_apkmgt_Request_descriptor; - } - - @java.lang.Override - public org.wso2.apk.enforcer.discovery.service.subscription.Request getDefaultInstanceForType() { - return org.wso2.apk.enforcer.discovery.service.subscription.Request.getDefaultInstance(); - } - - @java.lang.Override - public org.wso2.apk.enforcer.discovery.service.subscription.Request build() { - org.wso2.apk.enforcer.discovery.service.subscription.Request result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public org.wso2.apk.enforcer.discovery.service.subscription.Request buildPartial() { - org.wso2.apk.enforcer.discovery.service.subscription.Request result = new org.wso2.apk.enforcer.discovery.service.subscription.Request(this); - result.event_ = event_; - onBuilt(); - return result; - } - - @java.lang.Override - public Builder clone() { - return super.clone(); - } - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, - java.lang.Object value) { - return super.setField(field, value); - } - @java.lang.Override - public Builder clearField( - com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - @java.lang.Override - public Builder clearOneof( - com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - java.lang.Object value) { - return super.addRepeatedField(field, value); - } - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof org.wso2.apk.enforcer.discovery.service.subscription.Request) { - return mergeFrom((org.wso2.apk.enforcer.discovery.service.subscription.Request)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(org.wso2.apk.enforcer.discovery.service.subscription.Request other) { - if (other == org.wso2.apk.enforcer.discovery.service.subscription.Request.getDefaultInstance()) return this; - if (!other.getEvent().isEmpty()) { - event_ = other.event_; - onChanged(); - } - this.mergeUnknownFields(other.unknownFields); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - org.wso2.apk.enforcer.discovery.service.subscription.Request parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (org.wso2.apk.enforcer.discovery.service.subscription.Request) e.getUnfinishedMessage(); - throw e.unwrapIOException(); - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - - private java.lang.Object event_ = ""; - /** - * string event = 1; - * @return The event. - */ - public java.lang.String getEvent() { - java.lang.Object ref = event_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - event_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * string event = 1; - * @return The bytes for event. - */ - public com.google.protobuf.ByteString - getEventBytes() { - java.lang.Object ref = event_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - event_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * string event = 1; - * @param value The event to set. - * @return This builder for chaining. - */ - public Builder setEvent( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - - event_ = value; - onChanged(); - return this; - } - /** - * string event = 1; - * @return This builder for chaining. - */ - public Builder clearEvent() { - - event_ = getDefaultInstance().getEvent(); - onChanged(); - return this; - } - /** - * string event = 1; - * @param value The bytes for event to set. - * @return This builder for chaining. - */ - public Builder setEventBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - event_ = value; - onChanged(); - return this; - } - @java.lang.Override - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - - // @@protoc_insertion_point(builder_scope:discovery.service.apkmgt.Request) - } - - // @@protoc_insertion_point(class_scope:discovery.service.apkmgt.Request) - private static final org.wso2.apk.enforcer.discovery.service.subscription.Request DEFAULT_INSTANCE; - static { - DEFAULT_INSTANCE = new org.wso2.apk.enforcer.discovery.service.subscription.Request(); - } - - public static org.wso2.apk.enforcer.discovery.service.subscription.Request getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser - PARSER = new com.google.protobuf.AbstractParser() { - @java.lang.Override - public Request parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new Request(input, extensionRegistry); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public org.wso2.apk.enforcer.discovery.service.subscription.Request getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - -} - diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/RequestOrBuilder.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/RequestOrBuilder.java deleted file mode 100644 index d4e1e8ad1..000000000 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/RequestOrBuilder.java +++ /dev/null @@ -1,21 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: wso2/discovery/service/apkmgt/eventds.proto - -package org.wso2.apk.enforcer.discovery.service.subscription; - -public interface RequestOrBuilder extends - // @@protoc_insertion_point(interface_extends:discovery.service.apkmgt.Request) - com.google.protobuf.MessageOrBuilder { - - /** - * string event = 1; - * @return The event. - */ - java.lang.String getEvent(); - /** - * string event = 1; - * @return The bytes for event. - */ - com.google.protobuf.ByteString - getEventBytes(); -} diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/SdsProto.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/SdsProto.java deleted file mode 100644 index 7d8ea5ce6..000000000 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/SdsProto.java +++ /dev/null @@ -1,47 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: wso2/discovery/service/subscription/sds.proto - -package org.wso2.apk.enforcer.discovery.service.subscription; - -public final class SdsProto { - private SdsProto() {} - public static void registerAllExtensions( - com.google.protobuf.ExtensionRegistryLite registry) { - } - - public static void registerAllExtensions( - com.google.protobuf.ExtensionRegistry registry) { - registerAllExtensions( - (com.google.protobuf.ExtensionRegistryLite) registry); - } - - public static com.google.protobuf.Descriptors.FileDescriptor - getDescriptor() { - return descriptor; - } - private static com.google.protobuf.Descriptors.FileDescriptor - descriptor; - static { - java.lang.String[] descriptorData = { - "\n-wso2/discovery/service/subscription/sd" + - "s.proto\022\036discovery.service.subscription\032" + - "*envoy/service/discovery/v3/discovery.pr" + - "oto2\230\001\n\034SubscriptionDiscoveryService\022x\n\023" + - "StreamSubscriptions\022,.envoy.service.disc" + - "overy.v3.DiscoveryRequest\032-.envoy.servic" + - "e.discovery.v3.DiscoveryResponse\"\000(\0010\001B\221" + - "\001\n4org.wso2.apk.enforcer.discovery.servi" + - "ce.subscriptionB\010SdsProtoP\001ZJgithub.com/" + - "envoyproxy/go-control-plane/wso2/discove" + - "ry/service/subscription\210\001\001b\006proto3" - }; - descriptor = com.google.protobuf.Descriptors.FileDescriptor - .internalBuildGeneratedFileFrom(descriptorData, - new com.google.protobuf.Descriptors.FileDescriptor[] { - io.envoyproxy.envoy.service.discovery.v3.DiscoveryProto.getDescriptor(), - }); - io.envoyproxy.envoy.service.discovery.v3.DiscoveryProto.getDescriptor(); - } - - // @@protoc_insertion_point(outer_class_scope) -} diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/SubPolicyDSProto.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/SubPolicyDSProto.java deleted file mode 100644 index 2886298c1..000000000 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/SubPolicyDSProto.java +++ /dev/null @@ -1,48 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: wso2/discovery/service/subscription/sub_policy_ds.proto - -package org.wso2.apk.enforcer.discovery.service.subscription; - -public final class SubPolicyDSProto { - private SubPolicyDSProto() {} - public static void registerAllExtensions( - com.google.protobuf.ExtensionRegistryLite registry) { - } - - public static void registerAllExtensions( - com.google.protobuf.ExtensionRegistry registry) { - registerAllExtensions( - (com.google.protobuf.ExtensionRegistryLite) registry); - } - - public static com.google.protobuf.Descriptors.FileDescriptor - getDescriptor() { - return descriptor; - } - private static com.google.protobuf.Descriptors.FileDescriptor - descriptor; - static { - java.lang.String[] descriptorData = { - "\n7wso2/discovery/service/subscription/su" + - "b_policy_ds.proto\022\036discovery.service.sub" + - "scription\032*envoy/service/discovery/v3/di" + - "scovery.proto2\245\001\n\"SubscriptionPolicyDisc" + - "overyService\022\177\n\032StreamSubscriptionPolici" + - "es\022,.envoy.service.discovery.v3.Discover" + - "yRequest\032-.envoy.service.discovery.v3.Di" + - "scoveryResponse\"\000(\0010\001B\231\001\n4org.wso2.apk.e" + - "nforcer.discovery.service.subscriptionB\020" + - "SubPolicyDSProtoP\001ZJgithub.com/envoyprox" + - "y/go-control-plane/wso2/discovery/servic" + - "e/subscription\210\001\001b\006proto3" - }; - descriptor = com.google.protobuf.Descriptors.FileDescriptor - .internalBuildGeneratedFileFrom(descriptorData, - new com.google.protobuf.Descriptors.FileDescriptor[] { - io.envoyproxy.envoy.service.discovery.v3.DiscoveryProto.getDescriptor(), - }); - io.envoyproxy.envoy.service.discovery.v3.DiscoveryProto.getDescriptor(); - } - - // @@protoc_insertion_point(outer_class_scope) -} diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/SubscriptionDiscoveryService.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/SubscriptionDiscoveryService.java deleted file mode 100644 index 61387c2f0..000000000 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/SubscriptionDiscoveryService.java +++ /dev/null @@ -1,241 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: wso2/discovery/service/subscription/sds.proto - -package org.wso2.apk.enforcer.discovery.service.subscription; - -/** - *
- * [#protodoc-title: SDS]
- * 
- * - * Protobuf service {@code discovery.service.subscription.SubscriptionDiscoveryService} - */ -public abstract class SubscriptionDiscoveryService - implements com.google.protobuf.Service { - protected SubscriptionDiscoveryService() {} - - public interface Interface { - /** - * rpc StreamSubscriptions(stream .envoy.service.discovery.v3.DiscoveryRequest) returns (stream .envoy.service.discovery.v3.DiscoveryResponse); - */ - public abstract void streamSubscriptions( - com.google.protobuf.RpcController controller, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest request, - com.google.protobuf.RpcCallback done); - - } - - public static com.google.protobuf.Service newReflectiveService( - final Interface impl) { - return new SubscriptionDiscoveryService() { - @java.lang.Override - public void streamSubscriptions( - com.google.protobuf.RpcController controller, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest request, - com.google.protobuf.RpcCallback done) { - impl.streamSubscriptions(controller, request, done); - } - - }; - } - - public static com.google.protobuf.BlockingService - newReflectiveBlockingService(final BlockingInterface impl) { - return new com.google.protobuf.BlockingService() { - public final com.google.protobuf.Descriptors.ServiceDescriptor - getDescriptorForType() { - return getDescriptor(); - } - - public final com.google.protobuf.Message callBlockingMethod( - com.google.protobuf.Descriptors.MethodDescriptor method, - com.google.protobuf.RpcController controller, - com.google.protobuf.Message request) - throws com.google.protobuf.ServiceException { - if (method.getService() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "Service.callBlockingMethod() given method descriptor for " + - "wrong service type."); - } - switch(method.getIndex()) { - case 0: - return impl.streamSubscriptions(controller, (io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest)request); - default: - throw new java.lang.AssertionError("Can't get here."); - } - } - - public final com.google.protobuf.Message - getRequestPrototype( - com.google.protobuf.Descriptors.MethodDescriptor method) { - if (method.getService() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "Service.getRequestPrototype() given method " + - "descriptor for wrong service type."); - } - switch(method.getIndex()) { - case 0: - return io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest.getDefaultInstance(); - default: - throw new java.lang.AssertionError("Can't get here."); - } - } - - public final com.google.protobuf.Message - getResponsePrototype( - com.google.protobuf.Descriptors.MethodDescriptor method) { - if (method.getService() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "Service.getResponsePrototype() given method " + - "descriptor for wrong service type."); - } - switch(method.getIndex()) { - case 0: - return io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse.getDefaultInstance(); - default: - throw new java.lang.AssertionError("Can't get here."); - } - } - - }; - } - - /** - * rpc StreamSubscriptions(stream .envoy.service.discovery.v3.DiscoveryRequest) returns (stream .envoy.service.discovery.v3.DiscoveryResponse); - */ - public abstract void streamSubscriptions( - com.google.protobuf.RpcController controller, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest request, - com.google.protobuf.RpcCallback done); - - public static final - com.google.protobuf.Descriptors.ServiceDescriptor - getDescriptor() { - return org.wso2.apk.enforcer.discovery.service.subscription.SdsProto.getDescriptor().getServices().get(0); - } - public final com.google.protobuf.Descriptors.ServiceDescriptor - getDescriptorForType() { - return getDescriptor(); - } - - public final void callMethod( - com.google.protobuf.Descriptors.MethodDescriptor method, - com.google.protobuf.RpcController controller, - com.google.protobuf.Message request, - com.google.protobuf.RpcCallback< - com.google.protobuf.Message> done) { - if (method.getService() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "Service.callMethod() given method descriptor for wrong " + - "service type."); - } - switch(method.getIndex()) { - case 0: - this.streamSubscriptions(controller, (io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest)request, - com.google.protobuf.RpcUtil.specializeCallback( - done)); - return; - default: - throw new java.lang.AssertionError("Can't get here."); - } - } - - public final com.google.protobuf.Message - getRequestPrototype( - com.google.protobuf.Descriptors.MethodDescriptor method) { - if (method.getService() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "Service.getRequestPrototype() given method " + - "descriptor for wrong service type."); - } - switch(method.getIndex()) { - case 0: - return io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest.getDefaultInstance(); - default: - throw new java.lang.AssertionError("Can't get here."); - } - } - - public final com.google.protobuf.Message - getResponsePrototype( - com.google.protobuf.Descriptors.MethodDescriptor method) { - if (method.getService() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "Service.getResponsePrototype() given method " + - "descriptor for wrong service type."); - } - switch(method.getIndex()) { - case 0: - return io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse.getDefaultInstance(); - default: - throw new java.lang.AssertionError("Can't get here."); - } - } - - public static Stub newStub( - com.google.protobuf.RpcChannel channel) { - return new Stub(channel); - } - - public static final class Stub extends org.wso2.apk.enforcer.discovery.service.subscription.SubscriptionDiscoveryService implements Interface { - private Stub(com.google.protobuf.RpcChannel channel) { - this.channel = channel; - } - - private final com.google.protobuf.RpcChannel channel; - - public com.google.protobuf.RpcChannel getChannel() { - return channel; - } - - public void streamSubscriptions( - com.google.protobuf.RpcController controller, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest request, - com.google.protobuf.RpcCallback done) { - channel.callMethod( - getDescriptor().getMethods().get(0), - controller, - request, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse.getDefaultInstance(), - com.google.protobuf.RpcUtil.generalizeCallback( - done, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse.class, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse.getDefaultInstance())); - } - } - - public static BlockingInterface newBlockingStub( - com.google.protobuf.BlockingRpcChannel channel) { - return new BlockingStub(channel); - } - - public interface BlockingInterface { - public io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse streamSubscriptions( - com.google.protobuf.RpcController controller, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest request) - throws com.google.protobuf.ServiceException; - } - - private static final class BlockingStub implements BlockingInterface { - private BlockingStub(com.google.protobuf.BlockingRpcChannel channel) { - this.channel = channel; - } - - private final com.google.protobuf.BlockingRpcChannel channel; - - public io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse streamSubscriptions( - com.google.protobuf.RpcController controller, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest request) - throws com.google.protobuf.ServiceException { - return (io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse) channel.callBlockingMethod( - getDescriptor().getMethods().get(0), - controller, - request, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse.getDefaultInstance()); - } - - } - - // @@protoc_insertion_point(class_scope:discovery.service.subscription.SubscriptionDiscoveryService) -} - diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/SubscriptionDiscoveryServiceGrpc.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/SubscriptionDiscoveryServiceGrpc.java deleted file mode 100644 index 5ee18cb3d..000000000 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/SubscriptionDiscoveryServiceGrpc.java +++ /dev/null @@ -1,287 +0,0 @@ -package org.wso2.apk.enforcer.discovery.service.subscription; - -import static io.grpc.MethodDescriptor.generateFullMethodName; -import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall; -import static io.grpc.stub.ClientCalls.asyncClientStreamingCall; -import static io.grpc.stub.ClientCalls.asyncServerStreamingCall; -import static io.grpc.stub.ClientCalls.asyncUnaryCall; -import static io.grpc.stub.ClientCalls.blockingServerStreamingCall; -import static io.grpc.stub.ClientCalls.blockingUnaryCall; -import static io.grpc.stub.ClientCalls.futureUnaryCall; -import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall; -import static io.grpc.stub.ServerCalls.asyncClientStreamingCall; -import static io.grpc.stub.ServerCalls.asyncServerStreamingCall; -import static io.grpc.stub.ServerCalls.asyncUnaryCall; -import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall; -import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall; - -/** - *
- * [#protodoc-title: SDS]
- * 
- */ -@javax.annotation.Generated( - value = "by gRPC proto compiler", - comments = "Source: wso2/discovery/service/subscription/sds.proto") -public final class SubscriptionDiscoveryServiceGrpc { - - private SubscriptionDiscoveryServiceGrpc() {} - - public static final String SERVICE_NAME = "discovery.service.subscription.SubscriptionDiscoveryService"; - - // Static method descriptors that strictly reflect the proto. - private static volatile io.grpc.MethodDescriptor getStreamSubscriptionsMethod; - - @io.grpc.stub.annotations.RpcMethod( - fullMethodName = SERVICE_NAME + '/' + "StreamSubscriptions", - requestType = io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest.class, - responseType = io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse.class, - methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) - public static io.grpc.MethodDescriptor getStreamSubscriptionsMethod() { - io.grpc.MethodDescriptor getStreamSubscriptionsMethod; - if ((getStreamSubscriptionsMethod = SubscriptionDiscoveryServiceGrpc.getStreamSubscriptionsMethod) == null) { - synchronized (SubscriptionDiscoveryServiceGrpc.class) { - if ((getStreamSubscriptionsMethod = SubscriptionDiscoveryServiceGrpc.getStreamSubscriptionsMethod) == null) { - SubscriptionDiscoveryServiceGrpc.getStreamSubscriptionsMethod = getStreamSubscriptionsMethod = - io.grpc.MethodDescriptor.newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) - .setFullMethodName(generateFullMethodName(SERVICE_NAME, "StreamSubscriptions")) - .setSampledToLocalTracing(true) - .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest.getDefaultInstance())) - .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse.getDefaultInstance())) - .setSchemaDescriptor(new SubscriptionDiscoveryServiceMethodDescriptorSupplier("StreamSubscriptions")) - .build(); - } - } - } - return getStreamSubscriptionsMethod; - } - - /** - * Creates a new async stub that supports all call types for the service - */ - public static SubscriptionDiscoveryServiceStub newStub(io.grpc.Channel channel) { - io.grpc.stub.AbstractStub.StubFactory factory = - new io.grpc.stub.AbstractStub.StubFactory() { - @java.lang.Override - public SubscriptionDiscoveryServiceStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new SubscriptionDiscoveryServiceStub(channel, callOptions); - } - }; - return SubscriptionDiscoveryServiceStub.newStub(factory, channel); - } - - /** - * Creates a new blocking-style stub that supports unary and streaming output calls on the service - */ - public static SubscriptionDiscoveryServiceBlockingStub newBlockingStub( - io.grpc.Channel channel) { - io.grpc.stub.AbstractStub.StubFactory factory = - new io.grpc.stub.AbstractStub.StubFactory() { - @java.lang.Override - public SubscriptionDiscoveryServiceBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new SubscriptionDiscoveryServiceBlockingStub(channel, callOptions); - } - }; - return SubscriptionDiscoveryServiceBlockingStub.newStub(factory, channel); - } - - /** - * Creates a new ListenableFuture-style stub that supports unary calls on the service - */ - public static SubscriptionDiscoveryServiceFutureStub newFutureStub( - io.grpc.Channel channel) { - io.grpc.stub.AbstractStub.StubFactory factory = - new io.grpc.stub.AbstractStub.StubFactory() { - @java.lang.Override - public SubscriptionDiscoveryServiceFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new SubscriptionDiscoveryServiceFutureStub(channel, callOptions); - } - }; - return SubscriptionDiscoveryServiceFutureStub.newStub(factory, channel); - } - - /** - *
-   * [#protodoc-title: SDS]
-   * 
- */ - public static abstract class SubscriptionDiscoveryServiceImplBase implements io.grpc.BindableService { - - /** - */ - public io.grpc.stub.StreamObserver streamSubscriptions( - io.grpc.stub.StreamObserver responseObserver) { - return asyncUnimplementedStreamingCall(getStreamSubscriptionsMethod(), responseObserver); - } - - @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() { - return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) - .addMethod( - getStreamSubscriptionsMethod(), - asyncBidiStreamingCall( - new MethodHandlers< - io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse>( - this, METHODID_STREAM_SUBSCRIPTIONS))) - .build(); - } - } - - /** - *
-   * [#protodoc-title: SDS]
-   * 
- */ - public static final class SubscriptionDiscoveryServiceStub extends io.grpc.stub.AbstractAsyncStub { - private SubscriptionDiscoveryServiceStub( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - super(channel, callOptions); - } - - @java.lang.Override - protected SubscriptionDiscoveryServiceStub build( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new SubscriptionDiscoveryServiceStub(channel, callOptions); - } - - /** - */ - public io.grpc.stub.StreamObserver streamSubscriptions( - io.grpc.stub.StreamObserver responseObserver) { - return asyncBidiStreamingCall( - getChannel().newCall(getStreamSubscriptionsMethod(), getCallOptions()), responseObserver); - } - } - - /** - *
-   * [#protodoc-title: SDS]
-   * 
- */ - public static final class SubscriptionDiscoveryServiceBlockingStub extends io.grpc.stub.AbstractBlockingStub { - private SubscriptionDiscoveryServiceBlockingStub( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - super(channel, callOptions); - } - - @java.lang.Override - protected SubscriptionDiscoveryServiceBlockingStub build( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new SubscriptionDiscoveryServiceBlockingStub(channel, callOptions); - } - } - - /** - *
-   * [#protodoc-title: SDS]
-   * 
- */ - public static final class SubscriptionDiscoveryServiceFutureStub extends io.grpc.stub.AbstractFutureStub { - private SubscriptionDiscoveryServiceFutureStub( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - super(channel, callOptions); - } - - @java.lang.Override - protected SubscriptionDiscoveryServiceFutureStub build( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new SubscriptionDiscoveryServiceFutureStub(channel, callOptions); - } - } - - private static final int METHODID_STREAM_SUBSCRIPTIONS = 0; - - private static final class MethodHandlers implements - io.grpc.stub.ServerCalls.UnaryMethod, - io.grpc.stub.ServerCalls.ServerStreamingMethod, - io.grpc.stub.ServerCalls.ClientStreamingMethod, - io.grpc.stub.ServerCalls.BidiStreamingMethod { - private final SubscriptionDiscoveryServiceImplBase serviceImpl; - private final int methodId; - - MethodHandlers(SubscriptionDiscoveryServiceImplBase serviceImpl, int methodId) { - this.serviceImpl = serviceImpl; - this.methodId = methodId; - } - - @java.lang.Override - @java.lang.SuppressWarnings("unchecked") - public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) { - switch (methodId) { - default: - throw new AssertionError(); - } - } - - @java.lang.Override - @java.lang.SuppressWarnings("unchecked") - public io.grpc.stub.StreamObserver invoke( - io.grpc.stub.StreamObserver responseObserver) { - switch (methodId) { - case METHODID_STREAM_SUBSCRIPTIONS: - return (io.grpc.stub.StreamObserver) serviceImpl.streamSubscriptions( - (io.grpc.stub.StreamObserver) responseObserver); - default: - throw new AssertionError(); - } - } - } - - private static abstract class SubscriptionDiscoveryServiceBaseDescriptorSupplier - implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier { - SubscriptionDiscoveryServiceBaseDescriptorSupplier() {} - - @java.lang.Override - public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { - return org.wso2.apk.enforcer.discovery.service.subscription.SdsProto.getDescriptor(); - } - - @java.lang.Override - public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { - return getFileDescriptor().findServiceByName("SubscriptionDiscoveryService"); - } - } - - private static final class SubscriptionDiscoveryServiceFileDescriptorSupplier - extends SubscriptionDiscoveryServiceBaseDescriptorSupplier { - SubscriptionDiscoveryServiceFileDescriptorSupplier() {} - } - - private static final class SubscriptionDiscoveryServiceMethodDescriptorSupplier - extends SubscriptionDiscoveryServiceBaseDescriptorSupplier - implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { - private final String methodName; - - SubscriptionDiscoveryServiceMethodDescriptorSupplier(String methodName) { - this.methodName = methodName; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() { - return getServiceDescriptor().findMethodByName(methodName); - } - } - - private static volatile io.grpc.ServiceDescriptor serviceDescriptor; - - public static io.grpc.ServiceDescriptor getServiceDescriptor() { - io.grpc.ServiceDescriptor result = serviceDescriptor; - if (result == null) { - synchronized (SubscriptionDiscoveryServiceGrpc.class) { - result = serviceDescriptor; - if (result == null) { - serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) - .setSchemaDescriptor(new SubscriptionDiscoveryServiceFileDescriptorSupplier()) - .addMethod(getStreamSubscriptionsMethod()) - .build(); - } - } - } - return result; - } -} diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/SubscriptionPolicyDiscoveryService.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/SubscriptionPolicyDiscoveryService.java deleted file mode 100644 index ac9207699..000000000 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/SubscriptionPolicyDiscoveryService.java +++ /dev/null @@ -1,241 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: wso2/discovery/service/subscription/sub_policy_ds.proto - -package org.wso2.apk.enforcer.discovery.service.subscription; - -/** - *
- * [#protodoc-title: SubPolicyDS]
- * 
- * - * Protobuf service {@code discovery.service.subscription.SubscriptionPolicyDiscoveryService} - */ -public abstract class SubscriptionPolicyDiscoveryService - implements com.google.protobuf.Service { - protected SubscriptionPolicyDiscoveryService() {} - - public interface Interface { - /** - * rpc StreamSubscriptionPolicies(stream .envoy.service.discovery.v3.DiscoveryRequest) returns (stream .envoy.service.discovery.v3.DiscoveryResponse); - */ - public abstract void streamSubscriptionPolicies( - com.google.protobuf.RpcController controller, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest request, - com.google.protobuf.RpcCallback done); - - } - - public static com.google.protobuf.Service newReflectiveService( - final Interface impl) { - return new SubscriptionPolicyDiscoveryService() { - @java.lang.Override - public void streamSubscriptionPolicies( - com.google.protobuf.RpcController controller, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest request, - com.google.protobuf.RpcCallback done) { - impl.streamSubscriptionPolicies(controller, request, done); - } - - }; - } - - public static com.google.protobuf.BlockingService - newReflectiveBlockingService(final BlockingInterface impl) { - return new com.google.protobuf.BlockingService() { - public final com.google.protobuf.Descriptors.ServiceDescriptor - getDescriptorForType() { - return getDescriptor(); - } - - public final com.google.protobuf.Message callBlockingMethod( - com.google.protobuf.Descriptors.MethodDescriptor method, - com.google.protobuf.RpcController controller, - com.google.protobuf.Message request) - throws com.google.protobuf.ServiceException { - if (method.getService() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "Service.callBlockingMethod() given method descriptor for " + - "wrong service type."); - } - switch(method.getIndex()) { - case 0: - return impl.streamSubscriptionPolicies(controller, (io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest)request); - default: - throw new java.lang.AssertionError("Can't get here."); - } - } - - public final com.google.protobuf.Message - getRequestPrototype( - com.google.protobuf.Descriptors.MethodDescriptor method) { - if (method.getService() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "Service.getRequestPrototype() given method " + - "descriptor for wrong service type."); - } - switch(method.getIndex()) { - case 0: - return io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest.getDefaultInstance(); - default: - throw new java.lang.AssertionError("Can't get here."); - } - } - - public final com.google.protobuf.Message - getResponsePrototype( - com.google.protobuf.Descriptors.MethodDescriptor method) { - if (method.getService() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "Service.getResponsePrototype() given method " + - "descriptor for wrong service type."); - } - switch(method.getIndex()) { - case 0: - return io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse.getDefaultInstance(); - default: - throw new java.lang.AssertionError("Can't get here."); - } - } - - }; - } - - /** - * rpc StreamSubscriptionPolicies(stream .envoy.service.discovery.v3.DiscoveryRequest) returns (stream .envoy.service.discovery.v3.DiscoveryResponse); - */ - public abstract void streamSubscriptionPolicies( - com.google.protobuf.RpcController controller, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest request, - com.google.protobuf.RpcCallback done); - - public static final - com.google.protobuf.Descriptors.ServiceDescriptor - getDescriptor() { - return org.wso2.apk.enforcer.discovery.service.subscription.SubPolicyDSProto.getDescriptor().getServices().get(0); - } - public final com.google.protobuf.Descriptors.ServiceDescriptor - getDescriptorForType() { - return getDescriptor(); - } - - public final void callMethod( - com.google.protobuf.Descriptors.MethodDescriptor method, - com.google.protobuf.RpcController controller, - com.google.protobuf.Message request, - com.google.protobuf.RpcCallback< - com.google.protobuf.Message> done) { - if (method.getService() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "Service.callMethod() given method descriptor for wrong " + - "service type."); - } - switch(method.getIndex()) { - case 0: - this.streamSubscriptionPolicies(controller, (io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest)request, - com.google.protobuf.RpcUtil.specializeCallback( - done)); - return; - default: - throw new java.lang.AssertionError("Can't get here."); - } - } - - public final com.google.protobuf.Message - getRequestPrototype( - com.google.protobuf.Descriptors.MethodDescriptor method) { - if (method.getService() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "Service.getRequestPrototype() given method " + - "descriptor for wrong service type."); - } - switch(method.getIndex()) { - case 0: - return io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest.getDefaultInstance(); - default: - throw new java.lang.AssertionError("Can't get here."); - } - } - - public final com.google.protobuf.Message - getResponsePrototype( - com.google.protobuf.Descriptors.MethodDescriptor method) { - if (method.getService() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "Service.getResponsePrototype() given method " + - "descriptor for wrong service type."); - } - switch(method.getIndex()) { - case 0: - return io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse.getDefaultInstance(); - default: - throw new java.lang.AssertionError("Can't get here."); - } - } - - public static Stub newStub( - com.google.protobuf.RpcChannel channel) { - return new Stub(channel); - } - - public static final class Stub extends org.wso2.apk.enforcer.discovery.service.subscription.SubscriptionPolicyDiscoveryService implements Interface { - private Stub(com.google.protobuf.RpcChannel channel) { - this.channel = channel; - } - - private final com.google.protobuf.RpcChannel channel; - - public com.google.protobuf.RpcChannel getChannel() { - return channel; - } - - public void streamSubscriptionPolicies( - com.google.protobuf.RpcController controller, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest request, - com.google.protobuf.RpcCallback done) { - channel.callMethod( - getDescriptor().getMethods().get(0), - controller, - request, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse.getDefaultInstance(), - com.google.protobuf.RpcUtil.generalizeCallback( - done, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse.class, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse.getDefaultInstance())); - } - } - - public static BlockingInterface newBlockingStub( - com.google.protobuf.BlockingRpcChannel channel) { - return new BlockingStub(channel); - } - - public interface BlockingInterface { - public io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse streamSubscriptionPolicies( - com.google.protobuf.RpcController controller, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest request) - throws com.google.protobuf.ServiceException; - } - - private static final class BlockingStub implements BlockingInterface { - private BlockingStub(com.google.protobuf.BlockingRpcChannel channel) { - this.channel = channel; - } - - private final com.google.protobuf.BlockingRpcChannel channel; - - public io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse streamSubscriptionPolicies( - com.google.protobuf.RpcController controller, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest request) - throws com.google.protobuf.ServiceException { - return (io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse) channel.callBlockingMethod( - getDescriptor().getMethods().get(0), - controller, - request, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse.getDefaultInstance()); - } - - } - - // @@protoc_insertion_point(class_scope:discovery.service.subscription.SubscriptionPolicyDiscoveryService) -} - diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/SubscriptionPolicyDiscoveryServiceGrpc.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/SubscriptionPolicyDiscoveryServiceGrpc.java deleted file mode 100644 index 53395bd13..000000000 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/subscription/SubscriptionPolicyDiscoveryServiceGrpc.java +++ /dev/null @@ -1,287 +0,0 @@ -package org.wso2.apk.enforcer.discovery.service.subscription; - -import static io.grpc.MethodDescriptor.generateFullMethodName; -import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall; -import static io.grpc.stub.ClientCalls.asyncClientStreamingCall; -import static io.grpc.stub.ClientCalls.asyncServerStreamingCall; -import static io.grpc.stub.ClientCalls.asyncUnaryCall; -import static io.grpc.stub.ClientCalls.blockingServerStreamingCall; -import static io.grpc.stub.ClientCalls.blockingUnaryCall; -import static io.grpc.stub.ClientCalls.futureUnaryCall; -import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall; -import static io.grpc.stub.ServerCalls.asyncClientStreamingCall; -import static io.grpc.stub.ServerCalls.asyncServerStreamingCall; -import static io.grpc.stub.ServerCalls.asyncUnaryCall; -import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall; -import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall; - -/** - *
- * [#protodoc-title: SubPolicyDS]
- * 
- */ -@javax.annotation.Generated( - value = "by gRPC proto compiler", - comments = "Source: wso2/discovery/service/subscription/sub_policy_ds.proto") -public final class SubscriptionPolicyDiscoveryServiceGrpc { - - private SubscriptionPolicyDiscoveryServiceGrpc() {} - - public static final String SERVICE_NAME = "discovery.service.subscription.SubscriptionPolicyDiscoveryService"; - - // Static method descriptors that strictly reflect the proto. - private static volatile io.grpc.MethodDescriptor getStreamSubscriptionPoliciesMethod; - - @io.grpc.stub.annotations.RpcMethod( - fullMethodName = SERVICE_NAME + '/' + "StreamSubscriptionPolicies", - requestType = io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest.class, - responseType = io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse.class, - methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) - public static io.grpc.MethodDescriptor getStreamSubscriptionPoliciesMethod() { - io.grpc.MethodDescriptor getStreamSubscriptionPoliciesMethod; - if ((getStreamSubscriptionPoliciesMethod = SubscriptionPolicyDiscoveryServiceGrpc.getStreamSubscriptionPoliciesMethod) == null) { - synchronized (SubscriptionPolicyDiscoveryServiceGrpc.class) { - if ((getStreamSubscriptionPoliciesMethod = SubscriptionPolicyDiscoveryServiceGrpc.getStreamSubscriptionPoliciesMethod) == null) { - SubscriptionPolicyDiscoveryServiceGrpc.getStreamSubscriptionPoliciesMethod = getStreamSubscriptionPoliciesMethod = - io.grpc.MethodDescriptor.newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) - .setFullMethodName(generateFullMethodName(SERVICE_NAME, "StreamSubscriptionPolicies")) - .setSampledToLocalTracing(true) - .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest.getDefaultInstance())) - .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse.getDefaultInstance())) - .setSchemaDescriptor(new SubscriptionPolicyDiscoveryServiceMethodDescriptorSupplier("StreamSubscriptionPolicies")) - .build(); - } - } - } - return getStreamSubscriptionPoliciesMethod; - } - - /** - * Creates a new async stub that supports all call types for the service - */ - public static SubscriptionPolicyDiscoveryServiceStub newStub(io.grpc.Channel channel) { - io.grpc.stub.AbstractStub.StubFactory factory = - new io.grpc.stub.AbstractStub.StubFactory() { - @java.lang.Override - public SubscriptionPolicyDiscoveryServiceStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new SubscriptionPolicyDiscoveryServiceStub(channel, callOptions); - } - }; - return SubscriptionPolicyDiscoveryServiceStub.newStub(factory, channel); - } - - /** - * Creates a new blocking-style stub that supports unary and streaming output calls on the service - */ - public static SubscriptionPolicyDiscoveryServiceBlockingStub newBlockingStub( - io.grpc.Channel channel) { - io.grpc.stub.AbstractStub.StubFactory factory = - new io.grpc.stub.AbstractStub.StubFactory() { - @java.lang.Override - public SubscriptionPolicyDiscoveryServiceBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new SubscriptionPolicyDiscoveryServiceBlockingStub(channel, callOptions); - } - }; - return SubscriptionPolicyDiscoveryServiceBlockingStub.newStub(factory, channel); - } - - /** - * Creates a new ListenableFuture-style stub that supports unary calls on the service - */ - public static SubscriptionPolicyDiscoveryServiceFutureStub newFutureStub( - io.grpc.Channel channel) { - io.grpc.stub.AbstractStub.StubFactory factory = - new io.grpc.stub.AbstractStub.StubFactory() { - @java.lang.Override - public SubscriptionPolicyDiscoveryServiceFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new SubscriptionPolicyDiscoveryServiceFutureStub(channel, callOptions); - } - }; - return SubscriptionPolicyDiscoveryServiceFutureStub.newStub(factory, channel); - } - - /** - *
-   * [#protodoc-title: SubPolicyDS]
-   * 
- */ - public static abstract class SubscriptionPolicyDiscoveryServiceImplBase implements io.grpc.BindableService { - - /** - */ - public io.grpc.stub.StreamObserver streamSubscriptionPolicies( - io.grpc.stub.StreamObserver responseObserver) { - return asyncUnimplementedStreamingCall(getStreamSubscriptionPoliciesMethod(), responseObserver); - } - - @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() { - return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) - .addMethod( - getStreamSubscriptionPoliciesMethod(), - asyncBidiStreamingCall( - new MethodHandlers< - io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest, - io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse>( - this, METHODID_STREAM_SUBSCRIPTION_POLICIES))) - .build(); - } - } - - /** - *
-   * [#protodoc-title: SubPolicyDS]
-   * 
- */ - public static final class SubscriptionPolicyDiscoveryServiceStub extends io.grpc.stub.AbstractAsyncStub { - private SubscriptionPolicyDiscoveryServiceStub( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - super(channel, callOptions); - } - - @java.lang.Override - protected SubscriptionPolicyDiscoveryServiceStub build( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new SubscriptionPolicyDiscoveryServiceStub(channel, callOptions); - } - - /** - */ - public io.grpc.stub.StreamObserver streamSubscriptionPolicies( - io.grpc.stub.StreamObserver responseObserver) { - return asyncBidiStreamingCall( - getChannel().newCall(getStreamSubscriptionPoliciesMethod(), getCallOptions()), responseObserver); - } - } - - /** - *
-   * [#protodoc-title: SubPolicyDS]
-   * 
- */ - public static final class SubscriptionPolicyDiscoveryServiceBlockingStub extends io.grpc.stub.AbstractBlockingStub { - private SubscriptionPolicyDiscoveryServiceBlockingStub( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - super(channel, callOptions); - } - - @java.lang.Override - protected SubscriptionPolicyDiscoveryServiceBlockingStub build( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new SubscriptionPolicyDiscoveryServiceBlockingStub(channel, callOptions); - } - } - - /** - *
-   * [#protodoc-title: SubPolicyDS]
-   * 
- */ - public static final class SubscriptionPolicyDiscoveryServiceFutureStub extends io.grpc.stub.AbstractFutureStub { - private SubscriptionPolicyDiscoveryServiceFutureStub( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - super(channel, callOptions); - } - - @java.lang.Override - protected SubscriptionPolicyDiscoveryServiceFutureStub build( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new SubscriptionPolicyDiscoveryServiceFutureStub(channel, callOptions); - } - } - - private static final int METHODID_STREAM_SUBSCRIPTION_POLICIES = 0; - - private static final class MethodHandlers implements - io.grpc.stub.ServerCalls.UnaryMethod, - io.grpc.stub.ServerCalls.ServerStreamingMethod, - io.grpc.stub.ServerCalls.ClientStreamingMethod, - io.grpc.stub.ServerCalls.BidiStreamingMethod { - private final SubscriptionPolicyDiscoveryServiceImplBase serviceImpl; - private final int methodId; - - MethodHandlers(SubscriptionPolicyDiscoveryServiceImplBase serviceImpl, int methodId) { - this.serviceImpl = serviceImpl; - this.methodId = methodId; - } - - @java.lang.Override - @java.lang.SuppressWarnings("unchecked") - public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) { - switch (methodId) { - default: - throw new AssertionError(); - } - } - - @java.lang.Override - @java.lang.SuppressWarnings("unchecked") - public io.grpc.stub.StreamObserver invoke( - io.grpc.stub.StreamObserver responseObserver) { - switch (methodId) { - case METHODID_STREAM_SUBSCRIPTION_POLICIES: - return (io.grpc.stub.StreamObserver) serviceImpl.streamSubscriptionPolicies( - (io.grpc.stub.StreamObserver) responseObserver); - default: - throw new AssertionError(); - } - } - } - - private static abstract class SubscriptionPolicyDiscoveryServiceBaseDescriptorSupplier - implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier { - SubscriptionPolicyDiscoveryServiceBaseDescriptorSupplier() {} - - @java.lang.Override - public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { - return org.wso2.apk.enforcer.discovery.service.subscription.SubPolicyDSProto.getDescriptor(); - } - - @java.lang.Override - public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { - return getFileDescriptor().findServiceByName("SubscriptionPolicyDiscoveryService"); - } - } - - private static final class SubscriptionPolicyDiscoveryServiceFileDescriptorSupplier - extends SubscriptionPolicyDiscoveryServiceBaseDescriptorSupplier { - SubscriptionPolicyDiscoveryServiceFileDescriptorSupplier() {} - } - - private static final class SubscriptionPolicyDiscoveryServiceMethodDescriptorSupplier - extends SubscriptionPolicyDiscoveryServiceBaseDescriptorSupplier - implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { - private final String methodName; - - SubscriptionPolicyDiscoveryServiceMethodDescriptorSupplier(String methodName) { - this.methodName = methodName; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() { - return getServiceDescriptor().findMethodByName(methodName); - } - } - - private static volatile io.grpc.ServiceDescriptor serviceDescriptor; - - public static io.grpc.ServiceDescriptor getServiceDescriptor() { - io.grpc.ServiceDescriptor result = serviceDescriptor; - if (result == null) { - synchronized (SubscriptionPolicyDiscoveryServiceGrpc.class) { - result = serviceDescriptor; - if (result == null) { - serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) - .setSchemaDescriptor(new SubscriptionPolicyDiscoveryServiceFileDescriptorSupplier()) - .addMethod(getStreamSubscriptionPoliciesMethod()) - .build(); - } - } - } - return result; - } -} diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/APIList.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/APIList.java deleted file mode 100644 index 4c3a19791..000000000 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/APIList.java +++ /dev/null @@ -1,778 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: wso2/discovery/subscription/api_list.proto - -package org.wso2.apk.enforcer.discovery.subscription; - -/** - *
- * APIList data model
- * 
- * - * Protobuf type {@code wso2.discovery.subscription.APIList} - */ -public final class APIList extends - com.google.protobuf.GeneratedMessageV3 implements - // @@protoc_insertion_point(message_implements:wso2.discovery.subscription.APIList) - APIListOrBuilder { -private static final long serialVersionUID = 0L; - // Use APIList.newBuilder() to construct. - private APIList(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - private APIList() { - list_ = java.util.Collections.emptyList(); - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance( - UnusedPrivateParameter unused) { - return new APIList(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private APIList( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 18: { - if (!((mutable_bitField0_ & 0x00000001) != 0)) { - list_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000001; - } - list_.add( - input.readMessage(org.wso2.apk.enforcer.discovery.subscription.APIs.parser(), extensionRegistry)); - break; - } - default: { - if (!parseUnknownField( - input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - if (((mutable_bitField0_ & 0x00000001) != 0)) { - list_ = java.util.Collections.unmodifiableList(list_); - } - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return org.wso2.apk.enforcer.discovery.subscription.APIListProto.internal_static_wso2_discovery_subscription_APIList_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return org.wso2.apk.enforcer.discovery.subscription.APIListProto.internal_static_wso2_discovery_subscription_APIList_fieldAccessorTable - .ensureFieldAccessorsInitialized( - org.wso2.apk.enforcer.discovery.subscription.APIList.class, org.wso2.apk.enforcer.discovery.subscription.APIList.Builder.class); - } - - public static final int LIST_FIELD_NUMBER = 2; - private java.util.List list_; - /** - * repeated .wso2.discovery.subscription.APIs list = 2; - */ - @java.lang.Override - public java.util.List getListList() { - return list_; - } - /** - * repeated .wso2.discovery.subscription.APIs list = 2; - */ - @java.lang.Override - public java.util.List - getListOrBuilderList() { - return list_; - } - /** - * repeated .wso2.discovery.subscription.APIs list = 2; - */ - @java.lang.Override - public int getListCount() { - return list_.size(); - } - /** - * repeated .wso2.discovery.subscription.APIs list = 2; - */ - @java.lang.Override - public org.wso2.apk.enforcer.discovery.subscription.APIs getList(int index) { - return list_.get(index); - } - /** - * repeated .wso2.discovery.subscription.APIs list = 2; - */ - @java.lang.Override - public org.wso2.apk.enforcer.discovery.subscription.APIsOrBuilder getListOrBuilder( - int index) { - return list_.get(index); - } - - private byte memoizedIsInitialized = -1; - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - for (int i = 0; i < list_.size(); i++) { - output.writeMessage(2, list_.get(i)); - } - unknownFields.writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - for (int i = 0; i < list_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(2, list_.get(i)); - } - size += unknownFields.getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof org.wso2.apk.enforcer.discovery.subscription.APIList)) { - return super.equals(obj); - } - org.wso2.apk.enforcer.discovery.subscription.APIList other = (org.wso2.apk.enforcer.discovery.subscription.APIList) obj; - - if (!getListList() - .equals(other.getListList())) return false; - if (!unknownFields.equals(other.unknownFields)) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - if (getListCount() > 0) { - hash = (37 * hash) + LIST_FIELD_NUMBER; - hash = (53 * hash) + getListList().hashCode(); - } - hash = (29 * hash) + unknownFields.hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static org.wso2.apk.enforcer.discovery.subscription.APIList parseFrom( - java.nio.ByteBuffer data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static org.wso2.apk.enforcer.discovery.subscription.APIList parseFrom( - java.nio.ByteBuffer data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static org.wso2.apk.enforcer.discovery.subscription.APIList parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static org.wso2.apk.enforcer.discovery.subscription.APIList parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static org.wso2.apk.enforcer.discovery.subscription.APIList parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static org.wso2.apk.enforcer.discovery.subscription.APIList parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static org.wso2.apk.enforcer.discovery.subscription.APIList parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static org.wso2.apk.enforcer.discovery.subscription.APIList parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - public static org.wso2.apk.enforcer.discovery.subscription.APIList parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input); - } - public static org.wso2.apk.enforcer.discovery.subscription.APIList parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input, extensionRegistry); - } - public static org.wso2.apk.enforcer.discovery.subscription.APIList parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static org.wso2.apk.enforcer.discovery.subscription.APIList parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - - @java.lang.Override - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - public static Builder newBuilder(org.wso2.apk.enforcer.discovery.subscription.APIList prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE - ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - *
-   * APIList data model
-   * 
- * - * Protobuf type {@code wso2.discovery.subscription.APIList} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessageV3.Builder implements - // @@protoc_insertion_point(builder_implements:wso2.discovery.subscription.APIList) - org.wso2.apk.enforcer.discovery.subscription.APIListOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return org.wso2.apk.enforcer.discovery.subscription.APIListProto.internal_static_wso2_discovery_subscription_APIList_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return org.wso2.apk.enforcer.discovery.subscription.APIListProto.internal_static_wso2_discovery_subscription_APIList_fieldAccessorTable - .ensureFieldAccessorsInitialized( - org.wso2.apk.enforcer.discovery.subscription.APIList.class, org.wso2.apk.enforcer.discovery.subscription.APIList.Builder.class); - } - - // Construct using org.wso2.apk.enforcer.discovery.subscription.APIList.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - getListFieldBuilder(); - } - } - @java.lang.Override - public Builder clear() { - super.clear(); - if (listBuilder_ == null) { - list_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000001); - } else { - listBuilder_.clear(); - } - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return org.wso2.apk.enforcer.discovery.subscription.APIListProto.internal_static_wso2_discovery_subscription_APIList_descriptor; - } - - @java.lang.Override - public org.wso2.apk.enforcer.discovery.subscription.APIList getDefaultInstanceForType() { - return org.wso2.apk.enforcer.discovery.subscription.APIList.getDefaultInstance(); - } - - @java.lang.Override - public org.wso2.apk.enforcer.discovery.subscription.APIList build() { - org.wso2.apk.enforcer.discovery.subscription.APIList result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public org.wso2.apk.enforcer.discovery.subscription.APIList buildPartial() { - org.wso2.apk.enforcer.discovery.subscription.APIList result = new org.wso2.apk.enforcer.discovery.subscription.APIList(this); - int from_bitField0_ = bitField0_; - if (listBuilder_ == null) { - if (((bitField0_ & 0x00000001) != 0)) { - list_ = java.util.Collections.unmodifiableList(list_); - bitField0_ = (bitField0_ & ~0x00000001); - } - result.list_ = list_; - } else { - result.list_ = listBuilder_.build(); - } - onBuilt(); - return result; - } - - @java.lang.Override - public Builder clone() { - return super.clone(); - } - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, - java.lang.Object value) { - return super.setField(field, value); - } - @java.lang.Override - public Builder clearField( - com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - @java.lang.Override - public Builder clearOneof( - com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - java.lang.Object value) { - return super.addRepeatedField(field, value); - } - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof org.wso2.apk.enforcer.discovery.subscription.APIList) { - return mergeFrom((org.wso2.apk.enforcer.discovery.subscription.APIList)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(org.wso2.apk.enforcer.discovery.subscription.APIList other) { - if (other == org.wso2.apk.enforcer.discovery.subscription.APIList.getDefaultInstance()) return this; - if (listBuilder_ == null) { - if (!other.list_.isEmpty()) { - if (list_.isEmpty()) { - list_ = other.list_; - bitField0_ = (bitField0_ & ~0x00000001); - } else { - ensureListIsMutable(); - list_.addAll(other.list_); - } - onChanged(); - } - } else { - if (!other.list_.isEmpty()) { - if (listBuilder_.isEmpty()) { - listBuilder_.dispose(); - listBuilder_ = null; - list_ = other.list_; - bitField0_ = (bitField0_ & ~0x00000001); - listBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? - getListFieldBuilder() : null; - } else { - listBuilder_.addAllMessages(other.list_); - } - } - } - this.mergeUnknownFields(other.unknownFields); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - org.wso2.apk.enforcer.discovery.subscription.APIList parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (org.wso2.apk.enforcer.discovery.subscription.APIList) e.getUnfinishedMessage(); - throw e.unwrapIOException(); - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - private int bitField0_; - - private java.util.List list_ = - java.util.Collections.emptyList(); - private void ensureListIsMutable() { - if (!((bitField0_ & 0x00000001) != 0)) { - list_ = new java.util.ArrayList(list_); - bitField0_ |= 0x00000001; - } - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - org.wso2.apk.enforcer.discovery.subscription.APIs, org.wso2.apk.enforcer.discovery.subscription.APIs.Builder, org.wso2.apk.enforcer.discovery.subscription.APIsOrBuilder> listBuilder_; - - /** - * repeated .wso2.discovery.subscription.APIs list = 2; - */ - public java.util.List getListList() { - if (listBuilder_ == null) { - return java.util.Collections.unmodifiableList(list_); - } else { - return listBuilder_.getMessageList(); - } - } - /** - * repeated .wso2.discovery.subscription.APIs list = 2; - */ - public int getListCount() { - if (listBuilder_ == null) { - return list_.size(); - } else { - return listBuilder_.getCount(); - } - } - /** - * repeated .wso2.discovery.subscription.APIs list = 2; - */ - public org.wso2.apk.enforcer.discovery.subscription.APIs getList(int index) { - if (listBuilder_ == null) { - return list_.get(index); - } else { - return listBuilder_.getMessage(index); - } - } - /** - * repeated .wso2.discovery.subscription.APIs list = 2; - */ - public Builder setList( - int index, org.wso2.apk.enforcer.discovery.subscription.APIs value) { - if (listBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureListIsMutable(); - list_.set(index, value); - onChanged(); - } else { - listBuilder_.setMessage(index, value); - } - return this; - } - /** - * repeated .wso2.discovery.subscription.APIs list = 2; - */ - public Builder setList( - int index, org.wso2.apk.enforcer.discovery.subscription.APIs.Builder builderForValue) { - if (listBuilder_ == null) { - ensureListIsMutable(); - list_.set(index, builderForValue.build()); - onChanged(); - } else { - listBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * repeated .wso2.discovery.subscription.APIs list = 2; - */ - public Builder addList(org.wso2.apk.enforcer.discovery.subscription.APIs value) { - if (listBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureListIsMutable(); - list_.add(value); - onChanged(); - } else { - listBuilder_.addMessage(value); - } - return this; - } - /** - * repeated .wso2.discovery.subscription.APIs list = 2; - */ - public Builder addList( - int index, org.wso2.apk.enforcer.discovery.subscription.APIs value) { - if (listBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureListIsMutable(); - list_.add(index, value); - onChanged(); - } else { - listBuilder_.addMessage(index, value); - } - return this; - } - /** - * repeated .wso2.discovery.subscription.APIs list = 2; - */ - public Builder addList( - org.wso2.apk.enforcer.discovery.subscription.APIs.Builder builderForValue) { - if (listBuilder_ == null) { - ensureListIsMutable(); - list_.add(builderForValue.build()); - onChanged(); - } else { - listBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - * repeated .wso2.discovery.subscription.APIs list = 2; - */ - public Builder addList( - int index, org.wso2.apk.enforcer.discovery.subscription.APIs.Builder builderForValue) { - if (listBuilder_ == null) { - ensureListIsMutable(); - list_.add(index, builderForValue.build()); - onChanged(); - } else { - listBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - * repeated .wso2.discovery.subscription.APIs list = 2; - */ - public Builder addAllList( - java.lang.Iterable values) { - if (listBuilder_ == null) { - ensureListIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll( - values, list_); - onChanged(); - } else { - listBuilder_.addAllMessages(values); - } - return this; - } - /** - * repeated .wso2.discovery.subscription.APIs list = 2; - */ - public Builder clearList() { - if (listBuilder_ == null) { - list_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000001); - onChanged(); - } else { - listBuilder_.clear(); - } - return this; - } - /** - * repeated .wso2.discovery.subscription.APIs list = 2; - */ - public Builder removeList(int index) { - if (listBuilder_ == null) { - ensureListIsMutable(); - list_.remove(index); - onChanged(); - } else { - listBuilder_.remove(index); - } - return this; - } - /** - * repeated .wso2.discovery.subscription.APIs list = 2; - */ - public org.wso2.apk.enforcer.discovery.subscription.APIs.Builder getListBuilder( - int index) { - return getListFieldBuilder().getBuilder(index); - } - /** - * repeated .wso2.discovery.subscription.APIs list = 2; - */ - public org.wso2.apk.enforcer.discovery.subscription.APIsOrBuilder getListOrBuilder( - int index) { - if (listBuilder_ == null) { - return list_.get(index); } else { - return listBuilder_.getMessageOrBuilder(index); - } - } - /** - * repeated .wso2.discovery.subscription.APIs list = 2; - */ - public java.util.List - getListOrBuilderList() { - if (listBuilder_ != null) { - return listBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(list_); - } - } - /** - * repeated .wso2.discovery.subscription.APIs list = 2; - */ - public org.wso2.apk.enforcer.discovery.subscription.APIs.Builder addListBuilder() { - return getListFieldBuilder().addBuilder( - org.wso2.apk.enforcer.discovery.subscription.APIs.getDefaultInstance()); - } - /** - * repeated .wso2.discovery.subscription.APIs list = 2; - */ - public org.wso2.apk.enforcer.discovery.subscription.APIs.Builder addListBuilder( - int index) { - return getListFieldBuilder().addBuilder( - index, org.wso2.apk.enforcer.discovery.subscription.APIs.getDefaultInstance()); - } - /** - * repeated .wso2.discovery.subscription.APIs list = 2; - */ - public java.util.List - getListBuilderList() { - return getListFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilderV3< - org.wso2.apk.enforcer.discovery.subscription.APIs, org.wso2.apk.enforcer.discovery.subscription.APIs.Builder, org.wso2.apk.enforcer.discovery.subscription.APIsOrBuilder> - getListFieldBuilder() { - if (listBuilder_ == null) { - listBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< - org.wso2.apk.enforcer.discovery.subscription.APIs, org.wso2.apk.enforcer.discovery.subscription.APIs.Builder, org.wso2.apk.enforcer.discovery.subscription.APIsOrBuilder>( - list_, - ((bitField0_ & 0x00000001) != 0), - getParentForChildren(), - isClean()); - list_ = null; - } - return listBuilder_; - } - @java.lang.Override - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - - // @@protoc_insertion_point(builder_scope:wso2.discovery.subscription.APIList) - } - - // @@protoc_insertion_point(class_scope:wso2.discovery.subscription.APIList) - private static final org.wso2.apk.enforcer.discovery.subscription.APIList DEFAULT_INSTANCE; - static { - DEFAULT_INSTANCE = new org.wso2.apk.enforcer.discovery.subscription.APIList(); - } - - public static org.wso2.apk.enforcer.discovery.subscription.APIList getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser - PARSER = new com.google.protobuf.AbstractParser() { - @java.lang.Override - public APIList parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new APIList(input, extensionRegistry); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public org.wso2.apk.enforcer.discovery.subscription.APIList getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - -} - diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/APIListOrBuilder.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/APIListOrBuilder.java deleted file mode 100644 index a67eabf21..000000000 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/APIListOrBuilder.java +++ /dev/null @@ -1,33 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: wso2/discovery/subscription/api_list.proto - -package org.wso2.apk.enforcer.discovery.subscription; - -public interface APIListOrBuilder extends - // @@protoc_insertion_point(interface_extends:wso2.discovery.subscription.APIList) - com.google.protobuf.MessageOrBuilder { - - /** - * repeated .wso2.discovery.subscription.APIs list = 2; - */ - java.util.List - getListList(); - /** - * repeated .wso2.discovery.subscription.APIs list = 2; - */ - org.wso2.apk.enforcer.discovery.subscription.APIs getList(int index); - /** - * repeated .wso2.discovery.subscription.APIs list = 2; - */ - int getListCount(); - /** - * repeated .wso2.discovery.subscription.APIs list = 2; - */ - java.util.List - getListOrBuilderList(); - /** - * repeated .wso2.discovery.subscription.APIs list = 2; - */ - org.wso2.apk.enforcer.discovery.subscription.APIsOrBuilder getListOrBuilder( - int index); -} diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/APIListProto.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/APIListProto.java deleted file mode 100644 index 2aa6d6c86..000000000 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/APIListProto.java +++ /dev/null @@ -1,56 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: wso2/discovery/subscription/api_list.proto - -package org.wso2.apk.enforcer.discovery.subscription; - -public final class APIListProto { - private APIListProto() {} - public static void registerAllExtensions( - com.google.protobuf.ExtensionRegistryLite registry) { - } - - public static void registerAllExtensions( - com.google.protobuf.ExtensionRegistry registry) { - registerAllExtensions( - (com.google.protobuf.ExtensionRegistryLite) registry); - } - static final com.google.protobuf.Descriptors.Descriptor - internal_static_wso2_discovery_subscription_APIList_descriptor; - static final - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_wso2_discovery_subscription_APIList_fieldAccessorTable; - - public static com.google.protobuf.Descriptors.FileDescriptor - getDescriptor() { - return descriptor; - } - private static com.google.protobuf.Descriptors.FileDescriptor - descriptor; - static { - java.lang.String[] descriptorData = { - "\n*wso2/discovery/subscription/api_list.p" + - "roto\022\033wso2.discovery.subscription\032%wso2/" + - "discovery/subscription/api.proto\":\n\007APIL" + - "ist\022/\n\004list\030\002 \003(\0132!.wso2.discovery.subsc" + - "ription.APIsB\217\001\n,org.wso2.apk.enforcer.d" + - "iscovery.subscriptionB\014APIListProtoP\001ZOg" + - "ithub.com/envoyproxy/go-control-plane/ws" + - "o2/discovery/subscription;subscriptionb\006" + - "proto3" - }; - descriptor = com.google.protobuf.Descriptors.FileDescriptor - .internalBuildGeneratedFileFrom(descriptorData, - new com.google.protobuf.Descriptors.FileDescriptor[] { - org.wso2.apk.enforcer.discovery.subscription.APIsProto.getDescriptor(), - }); - internal_static_wso2_discovery_subscription_APIList_descriptor = - getDescriptor().getMessageTypes().get(0); - internal_static_wso2_discovery_subscription_APIList_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_wso2_discovery_subscription_APIList_descriptor, - new java.lang.String[] { "List", }); - org.wso2.apk.enforcer.discovery.subscription.APIsProto.getDescriptor(); - } - - // @@protoc_insertion_point(outer_class_scope) -} diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/APIs.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/APIs.java deleted file mode 100644 index 2902eac49..000000000 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/APIs.java +++ /dev/null @@ -1,1922 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: wso2/discovery/subscription/api.proto - -package org.wso2.apk.enforcer.discovery.subscription; - -/** - *
- * APIs data model
- * 
- * - * Protobuf type {@code wso2.discovery.subscription.APIs} - */ -public final class APIs extends - com.google.protobuf.GeneratedMessageV3 implements - // @@protoc_insertion_point(message_implements:wso2.discovery.subscription.APIs) - APIsOrBuilder { -private static final long serialVersionUID = 0L; - // Use APIs.newBuilder() to construct. - private APIs(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - private APIs() { - apiId_ = ""; - name_ = ""; - provider_ = ""; - version_ = ""; - basePath_ = ""; - policy_ = ""; - apiType_ = ""; - uuid_ = ""; - lcState_ = ""; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance( - UnusedPrivateParameter unused) { - return new APIs(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private APIs( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: { - java.lang.String s = input.readStringRequireUtf8(); - - apiId_ = s; - break; - } - case 18: { - java.lang.String s = input.readStringRequireUtf8(); - - name_ = s; - break; - } - case 26: { - java.lang.String s = input.readStringRequireUtf8(); - - provider_ = s; - break; - } - case 34: { - java.lang.String s = input.readStringRequireUtf8(); - - version_ = s; - break; - } - case 42: { - java.lang.String s = input.readStringRequireUtf8(); - - basePath_ = s; - break; - } - case 50: { - java.lang.String s = input.readStringRequireUtf8(); - - policy_ = s; - break; - } - case 58: { - java.lang.String s = input.readStringRequireUtf8(); - - apiType_ = s; - break; - } - case 64: { - - isDefaultVersion_ = input.readBool(); - break; - } - case 74: { - org.wso2.apk.enforcer.discovery.subscription.URLMapping.Builder subBuilder = null; - if (urlMappings_ != null) { - subBuilder = urlMappings_.toBuilder(); - } - urlMappings_ = input.readMessage(org.wso2.apk.enforcer.discovery.subscription.URLMapping.parser(), extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(urlMappings_); - urlMappings_ = subBuilder.buildPartial(); - } - - break; - } - case 82: { - java.lang.String s = input.readStringRequireUtf8(); - - uuid_ = s; - break; - } - case 90: { - java.lang.String s = input.readStringRequireUtf8(); - - lcState_ = s; - break; - } - default: { - if (!parseUnknownField( - input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return org.wso2.apk.enforcer.discovery.subscription.APIsProto.internal_static_wso2_discovery_subscription_APIs_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return org.wso2.apk.enforcer.discovery.subscription.APIsProto.internal_static_wso2_discovery_subscription_APIs_fieldAccessorTable - .ensureFieldAccessorsInitialized( - org.wso2.apk.enforcer.discovery.subscription.APIs.class, org.wso2.apk.enforcer.discovery.subscription.APIs.Builder.class); - } - - public static final int APIID_FIELD_NUMBER = 1; - private volatile java.lang.Object apiId_; - /** - * string apiId = 1; - * @return The apiId. - */ - @java.lang.Override - public java.lang.String getApiId() { - java.lang.Object ref = apiId_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - apiId_ = s; - return s; - } - } - /** - * string apiId = 1; - * @return The bytes for apiId. - */ - @java.lang.Override - public com.google.protobuf.ByteString - getApiIdBytes() { - java.lang.Object ref = apiId_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - apiId_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int NAME_FIELD_NUMBER = 2; - private volatile java.lang.Object name_; - /** - * string name = 2; - * @return The name. - */ - @java.lang.Override - public java.lang.String getName() { - java.lang.Object ref = name_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - name_ = s; - return s; - } - } - /** - * string name = 2; - * @return The bytes for name. - */ - @java.lang.Override - public com.google.protobuf.ByteString - getNameBytes() { - java.lang.Object ref = name_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - name_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int PROVIDER_FIELD_NUMBER = 3; - private volatile java.lang.Object provider_; - /** - * string provider = 3; - * @return The provider. - */ - @java.lang.Override - public java.lang.String getProvider() { - java.lang.Object ref = provider_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - provider_ = s; - return s; - } - } - /** - * string provider = 3; - * @return The bytes for provider. - */ - @java.lang.Override - public com.google.protobuf.ByteString - getProviderBytes() { - java.lang.Object ref = provider_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - provider_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int VERSION_FIELD_NUMBER = 4; - private volatile java.lang.Object version_; - /** - * string version = 4; - * @return The version. - */ - @java.lang.Override - public java.lang.String getVersion() { - java.lang.Object ref = version_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - version_ = s; - return s; - } - } - /** - * string version = 4; - * @return The bytes for version. - */ - @java.lang.Override - public com.google.protobuf.ByteString - getVersionBytes() { - java.lang.Object ref = version_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - version_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int BASEPATH_FIELD_NUMBER = 5; - private volatile java.lang.Object basePath_; - /** - * string basePath = 5; - * @return The basePath. - */ - @java.lang.Override - public java.lang.String getBasePath() { - java.lang.Object ref = basePath_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - basePath_ = s; - return s; - } - } - /** - * string basePath = 5; - * @return The bytes for basePath. - */ - @java.lang.Override - public com.google.protobuf.ByteString - getBasePathBytes() { - java.lang.Object ref = basePath_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - basePath_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int POLICY_FIELD_NUMBER = 6; - private volatile java.lang.Object policy_; - /** - * string policy = 6; - * @return The policy. - */ - @java.lang.Override - public java.lang.String getPolicy() { - java.lang.Object ref = policy_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - policy_ = s; - return s; - } - } - /** - * string policy = 6; - * @return The bytes for policy. - */ - @java.lang.Override - public com.google.protobuf.ByteString - getPolicyBytes() { - java.lang.Object ref = policy_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - policy_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int APITYPE_FIELD_NUMBER = 7; - private volatile java.lang.Object apiType_; - /** - * string apiType = 7; - * @return The apiType. - */ - @java.lang.Override - public java.lang.String getApiType() { - java.lang.Object ref = apiType_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - apiType_ = s; - return s; - } - } - /** - * string apiType = 7; - * @return The bytes for apiType. - */ - @java.lang.Override - public com.google.protobuf.ByteString - getApiTypeBytes() { - java.lang.Object ref = apiType_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - apiType_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int ISDEFAULTVERSION_FIELD_NUMBER = 8; - private boolean isDefaultVersion_; - /** - * bool isDefaultVersion = 8; - * @return The isDefaultVersion. - */ - @java.lang.Override - public boolean getIsDefaultVersion() { - return isDefaultVersion_; - } - - public static final int URLMAPPINGS_FIELD_NUMBER = 9; - private org.wso2.apk.enforcer.discovery.subscription.URLMapping urlMappings_; - /** - * .wso2.discovery.subscription.URLMapping urlMappings = 9; - * @return Whether the urlMappings field is set. - */ - @java.lang.Override - public boolean hasUrlMappings() { - return urlMappings_ != null; - } - /** - * .wso2.discovery.subscription.URLMapping urlMappings = 9; - * @return The urlMappings. - */ - @java.lang.Override - public org.wso2.apk.enforcer.discovery.subscription.URLMapping getUrlMappings() { - return urlMappings_ == null ? org.wso2.apk.enforcer.discovery.subscription.URLMapping.getDefaultInstance() : urlMappings_; - } - /** - * .wso2.discovery.subscription.URLMapping urlMappings = 9; - */ - @java.lang.Override - public org.wso2.apk.enforcer.discovery.subscription.URLMappingOrBuilder getUrlMappingsOrBuilder() { - return getUrlMappings(); - } - - public static final int UUID_FIELD_NUMBER = 10; - private volatile java.lang.Object uuid_; - /** - * string uuid = 10; - * @return The uuid. - */ - @java.lang.Override - public java.lang.String getUuid() { - java.lang.Object ref = uuid_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - uuid_ = s; - return s; - } - } - /** - * string uuid = 10; - * @return The bytes for uuid. - */ - @java.lang.Override - public com.google.protobuf.ByteString - getUuidBytes() { - java.lang.Object ref = uuid_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - uuid_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int LCSTATE_FIELD_NUMBER = 11; - private volatile java.lang.Object lcState_; - /** - * string lcState = 11; - * @return The lcState. - */ - @java.lang.Override - public java.lang.String getLcState() { - java.lang.Object ref = lcState_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - lcState_ = s; - return s; - } - } - /** - * string lcState = 11; - * @return The bytes for lcState. - */ - @java.lang.Override - public com.google.protobuf.ByteString - getLcStateBytes() { - java.lang.Object ref = lcState_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - lcState_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - private byte memoizedIsInitialized = -1; - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - if (!getApiIdBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, apiId_); - } - if (!getNameBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 2, name_); - } - if (!getProviderBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 3, provider_); - } - if (!getVersionBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 4, version_); - } - if (!getBasePathBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 5, basePath_); - } - if (!getPolicyBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 6, policy_); - } - if (!getApiTypeBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 7, apiType_); - } - if (isDefaultVersion_ != false) { - output.writeBool(8, isDefaultVersion_); - } - if (urlMappings_ != null) { - output.writeMessage(9, getUrlMappings()); - } - if (!getUuidBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 10, uuid_); - } - if (!getLcStateBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 11, lcState_); - } - unknownFields.writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (!getApiIdBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, apiId_); - } - if (!getNameBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, name_); - } - if (!getProviderBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, provider_); - } - if (!getVersionBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, version_); - } - if (!getBasePathBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, basePath_); - } - if (!getPolicyBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(6, policy_); - } - if (!getApiTypeBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(7, apiType_); - } - if (isDefaultVersion_ != false) { - size += com.google.protobuf.CodedOutputStream - .computeBoolSize(8, isDefaultVersion_); - } - if (urlMappings_ != null) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(9, getUrlMappings()); - } - if (!getUuidBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(10, uuid_); - } - if (!getLcStateBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(11, lcState_); - } - size += unknownFields.getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof org.wso2.apk.enforcer.discovery.subscription.APIs)) { - return super.equals(obj); - } - org.wso2.apk.enforcer.discovery.subscription.APIs other = (org.wso2.apk.enforcer.discovery.subscription.APIs) obj; - - if (!getApiId() - .equals(other.getApiId())) return false; - if (!getName() - .equals(other.getName())) return false; - if (!getProvider() - .equals(other.getProvider())) return false; - if (!getVersion() - .equals(other.getVersion())) return false; - if (!getBasePath() - .equals(other.getBasePath())) return false; - if (!getPolicy() - .equals(other.getPolicy())) return false; - if (!getApiType() - .equals(other.getApiType())) return false; - if (getIsDefaultVersion() - != other.getIsDefaultVersion()) return false; - if (hasUrlMappings() != other.hasUrlMappings()) return false; - if (hasUrlMappings()) { - if (!getUrlMappings() - .equals(other.getUrlMappings())) return false; - } - if (!getUuid() - .equals(other.getUuid())) return false; - if (!getLcState() - .equals(other.getLcState())) return false; - if (!unknownFields.equals(other.unknownFields)) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + APIID_FIELD_NUMBER; - hash = (53 * hash) + getApiId().hashCode(); - hash = (37 * hash) + NAME_FIELD_NUMBER; - hash = (53 * hash) + getName().hashCode(); - hash = (37 * hash) + PROVIDER_FIELD_NUMBER; - hash = (53 * hash) + getProvider().hashCode(); - hash = (37 * hash) + VERSION_FIELD_NUMBER; - hash = (53 * hash) + getVersion().hashCode(); - hash = (37 * hash) + BASEPATH_FIELD_NUMBER; - hash = (53 * hash) + getBasePath().hashCode(); - hash = (37 * hash) + POLICY_FIELD_NUMBER; - hash = (53 * hash) + getPolicy().hashCode(); - hash = (37 * hash) + APITYPE_FIELD_NUMBER; - hash = (53 * hash) + getApiType().hashCode(); - hash = (37 * hash) + ISDEFAULTVERSION_FIELD_NUMBER; - hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean( - getIsDefaultVersion()); - if (hasUrlMappings()) { - hash = (37 * hash) + URLMAPPINGS_FIELD_NUMBER; - hash = (53 * hash) + getUrlMappings().hashCode(); - } - hash = (37 * hash) + UUID_FIELD_NUMBER; - hash = (53 * hash) + getUuid().hashCode(); - hash = (37 * hash) + LCSTATE_FIELD_NUMBER; - hash = (53 * hash) + getLcState().hashCode(); - hash = (29 * hash) + unknownFields.hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static org.wso2.apk.enforcer.discovery.subscription.APIs parseFrom( - java.nio.ByteBuffer data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static org.wso2.apk.enforcer.discovery.subscription.APIs parseFrom( - java.nio.ByteBuffer data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static org.wso2.apk.enforcer.discovery.subscription.APIs parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static org.wso2.apk.enforcer.discovery.subscription.APIs parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static org.wso2.apk.enforcer.discovery.subscription.APIs parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static org.wso2.apk.enforcer.discovery.subscription.APIs parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static org.wso2.apk.enforcer.discovery.subscription.APIs parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static org.wso2.apk.enforcer.discovery.subscription.APIs parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - public static org.wso2.apk.enforcer.discovery.subscription.APIs parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input); - } - public static org.wso2.apk.enforcer.discovery.subscription.APIs parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input, extensionRegistry); - } - public static org.wso2.apk.enforcer.discovery.subscription.APIs parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static org.wso2.apk.enforcer.discovery.subscription.APIs parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - - @java.lang.Override - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - public static Builder newBuilder(org.wso2.apk.enforcer.discovery.subscription.APIs prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE - ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - *
-   * APIs data model
-   * 
- * - * Protobuf type {@code wso2.discovery.subscription.APIs} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessageV3.Builder implements - // @@protoc_insertion_point(builder_implements:wso2.discovery.subscription.APIs) - org.wso2.apk.enforcer.discovery.subscription.APIsOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return org.wso2.apk.enforcer.discovery.subscription.APIsProto.internal_static_wso2_discovery_subscription_APIs_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return org.wso2.apk.enforcer.discovery.subscription.APIsProto.internal_static_wso2_discovery_subscription_APIs_fieldAccessorTable - .ensureFieldAccessorsInitialized( - org.wso2.apk.enforcer.discovery.subscription.APIs.class, org.wso2.apk.enforcer.discovery.subscription.APIs.Builder.class); - } - - // Construct using org.wso2.apk.enforcer.discovery.subscription.APIs.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - } - } - @java.lang.Override - public Builder clear() { - super.clear(); - apiId_ = ""; - - name_ = ""; - - provider_ = ""; - - version_ = ""; - - basePath_ = ""; - - policy_ = ""; - - apiType_ = ""; - - isDefaultVersion_ = false; - - if (urlMappingsBuilder_ == null) { - urlMappings_ = null; - } else { - urlMappings_ = null; - urlMappingsBuilder_ = null; - } - uuid_ = ""; - - lcState_ = ""; - - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return org.wso2.apk.enforcer.discovery.subscription.APIsProto.internal_static_wso2_discovery_subscription_APIs_descriptor; - } - - @java.lang.Override - public org.wso2.apk.enforcer.discovery.subscription.APIs getDefaultInstanceForType() { - return org.wso2.apk.enforcer.discovery.subscription.APIs.getDefaultInstance(); - } - - @java.lang.Override - public org.wso2.apk.enforcer.discovery.subscription.APIs build() { - org.wso2.apk.enforcer.discovery.subscription.APIs result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public org.wso2.apk.enforcer.discovery.subscription.APIs buildPartial() { - org.wso2.apk.enforcer.discovery.subscription.APIs result = new org.wso2.apk.enforcer.discovery.subscription.APIs(this); - result.apiId_ = apiId_; - result.name_ = name_; - result.provider_ = provider_; - result.version_ = version_; - result.basePath_ = basePath_; - result.policy_ = policy_; - result.apiType_ = apiType_; - result.isDefaultVersion_ = isDefaultVersion_; - if (urlMappingsBuilder_ == null) { - result.urlMappings_ = urlMappings_; - } else { - result.urlMappings_ = urlMappingsBuilder_.build(); - } - result.uuid_ = uuid_; - result.lcState_ = lcState_; - onBuilt(); - return result; - } - - @java.lang.Override - public Builder clone() { - return super.clone(); - } - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, - java.lang.Object value) { - return super.setField(field, value); - } - @java.lang.Override - public Builder clearField( - com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - @java.lang.Override - public Builder clearOneof( - com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - java.lang.Object value) { - return super.addRepeatedField(field, value); - } - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof org.wso2.apk.enforcer.discovery.subscription.APIs) { - return mergeFrom((org.wso2.apk.enforcer.discovery.subscription.APIs)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(org.wso2.apk.enforcer.discovery.subscription.APIs other) { - if (other == org.wso2.apk.enforcer.discovery.subscription.APIs.getDefaultInstance()) return this; - if (!other.getApiId().isEmpty()) { - apiId_ = other.apiId_; - onChanged(); - } - if (!other.getName().isEmpty()) { - name_ = other.name_; - onChanged(); - } - if (!other.getProvider().isEmpty()) { - provider_ = other.provider_; - onChanged(); - } - if (!other.getVersion().isEmpty()) { - version_ = other.version_; - onChanged(); - } - if (!other.getBasePath().isEmpty()) { - basePath_ = other.basePath_; - onChanged(); - } - if (!other.getPolicy().isEmpty()) { - policy_ = other.policy_; - onChanged(); - } - if (!other.getApiType().isEmpty()) { - apiType_ = other.apiType_; - onChanged(); - } - if (other.getIsDefaultVersion() != false) { - setIsDefaultVersion(other.getIsDefaultVersion()); - } - if (other.hasUrlMappings()) { - mergeUrlMappings(other.getUrlMappings()); - } - if (!other.getUuid().isEmpty()) { - uuid_ = other.uuid_; - onChanged(); - } - if (!other.getLcState().isEmpty()) { - lcState_ = other.lcState_; - onChanged(); - } - this.mergeUnknownFields(other.unknownFields); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - org.wso2.apk.enforcer.discovery.subscription.APIs parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (org.wso2.apk.enforcer.discovery.subscription.APIs) e.getUnfinishedMessage(); - throw e.unwrapIOException(); - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - - private java.lang.Object apiId_ = ""; - /** - * string apiId = 1; - * @return The apiId. - */ - public java.lang.String getApiId() { - java.lang.Object ref = apiId_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - apiId_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * string apiId = 1; - * @return The bytes for apiId. - */ - public com.google.protobuf.ByteString - getApiIdBytes() { - java.lang.Object ref = apiId_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - apiId_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * string apiId = 1; - * @param value The apiId to set. - * @return This builder for chaining. - */ - public Builder setApiId( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - - apiId_ = value; - onChanged(); - return this; - } - /** - * string apiId = 1; - * @return This builder for chaining. - */ - public Builder clearApiId() { - - apiId_ = getDefaultInstance().getApiId(); - onChanged(); - return this; - } - /** - * string apiId = 1; - * @param value The bytes for apiId to set. - * @return This builder for chaining. - */ - public Builder setApiIdBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - apiId_ = value; - onChanged(); - return this; - } - - private java.lang.Object name_ = ""; - /** - * string name = 2; - * @return The name. - */ - public java.lang.String getName() { - java.lang.Object ref = name_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - name_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * string name = 2; - * @return The bytes for name. - */ - public com.google.protobuf.ByteString - getNameBytes() { - java.lang.Object ref = name_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - name_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * string name = 2; - * @param value The name to set. - * @return This builder for chaining. - */ - public Builder setName( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - - name_ = value; - onChanged(); - return this; - } - /** - * string name = 2; - * @return This builder for chaining. - */ - public Builder clearName() { - - name_ = getDefaultInstance().getName(); - onChanged(); - return this; - } - /** - * string name = 2; - * @param value The bytes for name to set. - * @return This builder for chaining. - */ - public Builder setNameBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - name_ = value; - onChanged(); - return this; - } - - private java.lang.Object provider_ = ""; - /** - * string provider = 3; - * @return The provider. - */ - public java.lang.String getProvider() { - java.lang.Object ref = provider_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - provider_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * string provider = 3; - * @return The bytes for provider. - */ - public com.google.protobuf.ByteString - getProviderBytes() { - java.lang.Object ref = provider_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - provider_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * string provider = 3; - * @param value The provider to set. - * @return This builder for chaining. - */ - public Builder setProvider( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - - provider_ = value; - onChanged(); - return this; - } - /** - * string provider = 3; - * @return This builder for chaining. - */ - public Builder clearProvider() { - - provider_ = getDefaultInstance().getProvider(); - onChanged(); - return this; - } - /** - * string provider = 3; - * @param value The bytes for provider to set. - * @return This builder for chaining. - */ - public Builder setProviderBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - provider_ = value; - onChanged(); - return this; - } - - private java.lang.Object version_ = ""; - /** - * string version = 4; - * @return The version. - */ - public java.lang.String getVersion() { - java.lang.Object ref = version_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - version_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * string version = 4; - * @return The bytes for version. - */ - public com.google.protobuf.ByteString - getVersionBytes() { - java.lang.Object ref = version_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - version_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * string version = 4; - * @param value The version to set. - * @return This builder for chaining. - */ - public Builder setVersion( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - - version_ = value; - onChanged(); - return this; - } - /** - * string version = 4; - * @return This builder for chaining. - */ - public Builder clearVersion() { - - version_ = getDefaultInstance().getVersion(); - onChanged(); - return this; - } - /** - * string version = 4; - * @param value The bytes for version to set. - * @return This builder for chaining. - */ - public Builder setVersionBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - version_ = value; - onChanged(); - return this; - } - - private java.lang.Object basePath_ = ""; - /** - * string basePath = 5; - * @return The basePath. - */ - public java.lang.String getBasePath() { - java.lang.Object ref = basePath_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - basePath_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * string basePath = 5; - * @return The bytes for basePath. - */ - public com.google.protobuf.ByteString - getBasePathBytes() { - java.lang.Object ref = basePath_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - basePath_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * string basePath = 5; - * @param value The basePath to set. - * @return This builder for chaining. - */ - public Builder setBasePath( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - - basePath_ = value; - onChanged(); - return this; - } - /** - * string basePath = 5; - * @return This builder for chaining. - */ - public Builder clearBasePath() { - - basePath_ = getDefaultInstance().getBasePath(); - onChanged(); - return this; - } - /** - * string basePath = 5; - * @param value The bytes for basePath to set. - * @return This builder for chaining. - */ - public Builder setBasePathBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - basePath_ = value; - onChanged(); - return this; - } - - private java.lang.Object policy_ = ""; - /** - * string policy = 6; - * @return The policy. - */ - public java.lang.String getPolicy() { - java.lang.Object ref = policy_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - policy_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * string policy = 6; - * @return The bytes for policy. - */ - public com.google.protobuf.ByteString - getPolicyBytes() { - java.lang.Object ref = policy_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - policy_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * string policy = 6; - * @param value The policy to set. - * @return This builder for chaining. - */ - public Builder setPolicy( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - - policy_ = value; - onChanged(); - return this; - } - /** - * string policy = 6; - * @return This builder for chaining. - */ - public Builder clearPolicy() { - - policy_ = getDefaultInstance().getPolicy(); - onChanged(); - return this; - } - /** - * string policy = 6; - * @param value The bytes for policy to set. - * @return This builder for chaining. - */ - public Builder setPolicyBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - policy_ = value; - onChanged(); - return this; - } - - private java.lang.Object apiType_ = ""; - /** - * string apiType = 7; - * @return The apiType. - */ - public java.lang.String getApiType() { - java.lang.Object ref = apiType_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - apiType_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * string apiType = 7; - * @return The bytes for apiType. - */ - public com.google.protobuf.ByteString - getApiTypeBytes() { - java.lang.Object ref = apiType_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - apiType_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * string apiType = 7; - * @param value The apiType to set. - * @return This builder for chaining. - */ - public Builder setApiType( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - - apiType_ = value; - onChanged(); - return this; - } - /** - * string apiType = 7; - * @return This builder for chaining. - */ - public Builder clearApiType() { - - apiType_ = getDefaultInstance().getApiType(); - onChanged(); - return this; - } - /** - * string apiType = 7; - * @param value The bytes for apiType to set. - * @return This builder for chaining. - */ - public Builder setApiTypeBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - apiType_ = value; - onChanged(); - return this; - } - - private boolean isDefaultVersion_ ; - /** - * bool isDefaultVersion = 8; - * @return The isDefaultVersion. - */ - @java.lang.Override - public boolean getIsDefaultVersion() { - return isDefaultVersion_; - } - /** - * bool isDefaultVersion = 8; - * @param value The isDefaultVersion to set. - * @return This builder for chaining. - */ - public Builder setIsDefaultVersion(boolean value) { - - isDefaultVersion_ = value; - onChanged(); - return this; - } - /** - * bool isDefaultVersion = 8; - * @return This builder for chaining. - */ - public Builder clearIsDefaultVersion() { - - isDefaultVersion_ = false; - onChanged(); - return this; - } - - private org.wso2.apk.enforcer.discovery.subscription.URLMapping urlMappings_; - private com.google.protobuf.SingleFieldBuilderV3< - org.wso2.apk.enforcer.discovery.subscription.URLMapping, org.wso2.apk.enforcer.discovery.subscription.URLMapping.Builder, org.wso2.apk.enforcer.discovery.subscription.URLMappingOrBuilder> urlMappingsBuilder_; - /** - * .wso2.discovery.subscription.URLMapping urlMappings = 9; - * @return Whether the urlMappings field is set. - */ - public boolean hasUrlMappings() { - return urlMappingsBuilder_ != null || urlMappings_ != null; - } - /** - * .wso2.discovery.subscription.URLMapping urlMappings = 9; - * @return The urlMappings. - */ - public org.wso2.apk.enforcer.discovery.subscription.URLMapping getUrlMappings() { - if (urlMappingsBuilder_ == null) { - return urlMappings_ == null ? org.wso2.apk.enforcer.discovery.subscription.URLMapping.getDefaultInstance() : urlMappings_; - } else { - return urlMappingsBuilder_.getMessage(); - } - } - /** - * .wso2.discovery.subscription.URLMapping urlMappings = 9; - */ - public Builder setUrlMappings(org.wso2.apk.enforcer.discovery.subscription.URLMapping value) { - if (urlMappingsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - urlMappings_ = value; - onChanged(); - } else { - urlMappingsBuilder_.setMessage(value); - } - - return this; - } - /** - * .wso2.discovery.subscription.URLMapping urlMappings = 9; - */ - public Builder setUrlMappings( - org.wso2.apk.enforcer.discovery.subscription.URLMapping.Builder builderForValue) { - if (urlMappingsBuilder_ == null) { - urlMappings_ = builderForValue.build(); - onChanged(); - } else { - urlMappingsBuilder_.setMessage(builderForValue.build()); - } - - return this; - } - /** - * .wso2.discovery.subscription.URLMapping urlMappings = 9; - */ - public Builder mergeUrlMappings(org.wso2.apk.enforcer.discovery.subscription.URLMapping value) { - if (urlMappingsBuilder_ == null) { - if (urlMappings_ != null) { - urlMappings_ = - org.wso2.apk.enforcer.discovery.subscription.URLMapping.newBuilder(urlMappings_).mergeFrom(value).buildPartial(); - } else { - urlMappings_ = value; - } - onChanged(); - } else { - urlMappingsBuilder_.mergeFrom(value); - } - - return this; - } - /** - * .wso2.discovery.subscription.URLMapping urlMappings = 9; - */ - public Builder clearUrlMappings() { - if (urlMappingsBuilder_ == null) { - urlMappings_ = null; - onChanged(); - } else { - urlMappings_ = null; - urlMappingsBuilder_ = null; - } - - return this; - } - /** - * .wso2.discovery.subscription.URLMapping urlMappings = 9; - */ - public org.wso2.apk.enforcer.discovery.subscription.URLMapping.Builder getUrlMappingsBuilder() { - - onChanged(); - return getUrlMappingsFieldBuilder().getBuilder(); - } - /** - * .wso2.discovery.subscription.URLMapping urlMappings = 9; - */ - public org.wso2.apk.enforcer.discovery.subscription.URLMappingOrBuilder getUrlMappingsOrBuilder() { - if (urlMappingsBuilder_ != null) { - return urlMappingsBuilder_.getMessageOrBuilder(); - } else { - return urlMappings_ == null ? - org.wso2.apk.enforcer.discovery.subscription.URLMapping.getDefaultInstance() : urlMappings_; - } - } - /** - * .wso2.discovery.subscription.URLMapping urlMappings = 9; - */ - private com.google.protobuf.SingleFieldBuilderV3< - org.wso2.apk.enforcer.discovery.subscription.URLMapping, org.wso2.apk.enforcer.discovery.subscription.URLMapping.Builder, org.wso2.apk.enforcer.discovery.subscription.URLMappingOrBuilder> - getUrlMappingsFieldBuilder() { - if (urlMappingsBuilder_ == null) { - urlMappingsBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< - org.wso2.apk.enforcer.discovery.subscription.URLMapping, org.wso2.apk.enforcer.discovery.subscription.URLMapping.Builder, org.wso2.apk.enforcer.discovery.subscription.URLMappingOrBuilder>( - getUrlMappings(), - getParentForChildren(), - isClean()); - urlMappings_ = null; - } - return urlMappingsBuilder_; - } - - private java.lang.Object uuid_ = ""; - /** - * string uuid = 10; - * @return The uuid. - */ - public java.lang.String getUuid() { - java.lang.Object ref = uuid_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - uuid_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * string uuid = 10; - * @return The bytes for uuid. - */ - public com.google.protobuf.ByteString - getUuidBytes() { - java.lang.Object ref = uuid_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - uuid_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * string uuid = 10; - * @param value The uuid to set. - * @return This builder for chaining. - */ - public Builder setUuid( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - - uuid_ = value; - onChanged(); - return this; - } - /** - * string uuid = 10; - * @return This builder for chaining. - */ - public Builder clearUuid() { - - uuid_ = getDefaultInstance().getUuid(); - onChanged(); - return this; - } - /** - * string uuid = 10; - * @param value The bytes for uuid to set. - * @return This builder for chaining. - */ - public Builder setUuidBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - uuid_ = value; - onChanged(); - return this; - } - - private java.lang.Object lcState_ = ""; - /** - * string lcState = 11; - * @return The lcState. - */ - public java.lang.String getLcState() { - java.lang.Object ref = lcState_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - lcState_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * string lcState = 11; - * @return The bytes for lcState. - */ - public com.google.protobuf.ByteString - getLcStateBytes() { - java.lang.Object ref = lcState_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - lcState_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * string lcState = 11; - * @param value The lcState to set. - * @return This builder for chaining. - */ - public Builder setLcState( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - - lcState_ = value; - onChanged(); - return this; - } - /** - * string lcState = 11; - * @return This builder for chaining. - */ - public Builder clearLcState() { - - lcState_ = getDefaultInstance().getLcState(); - onChanged(); - return this; - } - /** - * string lcState = 11; - * @param value The bytes for lcState to set. - * @return This builder for chaining. - */ - public Builder setLcStateBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - lcState_ = value; - onChanged(); - return this; - } - @java.lang.Override - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - - // @@protoc_insertion_point(builder_scope:wso2.discovery.subscription.APIs) - } - - // @@protoc_insertion_point(class_scope:wso2.discovery.subscription.APIs) - private static final org.wso2.apk.enforcer.discovery.subscription.APIs DEFAULT_INSTANCE; - static { - DEFAULT_INSTANCE = new org.wso2.apk.enforcer.discovery.subscription.APIs(); - } - - public static org.wso2.apk.enforcer.discovery.subscription.APIs getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser - PARSER = new com.google.protobuf.AbstractParser() { - @java.lang.Override - public APIs parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new APIs(input, extensionRegistry); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public org.wso2.apk.enforcer.discovery.subscription.APIs getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - -} - diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/APIsOrBuilder.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/APIsOrBuilder.java deleted file mode 100644 index 04f93c9cc..000000000 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/APIsOrBuilder.java +++ /dev/null @@ -1,138 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: wso2/discovery/subscription/api.proto - -package org.wso2.apk.enforcer.discovery.subscription; - -public interface APIsOrBuilder extends - // @@protoc_insertion_point(interface_extends:wso2.discovery.subscription.APIs) - com.google.protobuf.MessageOrBuilder { - - /** - * string apiId = 1; - * @return The apiId. - */ - java.lang.String getApiId(); - /** - * string apiId = 1; - * @return The bytes for apiId. - */ - com.google.protobuf.ByteString - getApiIdBytes(); - - /** - * string name = 2; - * @return The name. - */ - java.lang.String getName(); - /** - * string name = 2; - * @return The bytes for name. - */ - com.google.protobuf.ByteString - getNameBytes(); - - /** - * string provider = 3; - * @return The provider. - */ - java.lang.String getProvider(); - /** - * string provider = 3; - * @return The bytes for provider. - */ - com.google.protobuf.ByteString - getProviderBytes(); - - /** - * string version = 4; - * @return The version. - */ - java.lang.String getVersion(); - /** - * string version = 4; - * @return The bytes for version. - */ - com.google.protobuf.ByteString - getVersionBytes(); - - /** - * string basePath = 5; - * @return The basePath. - */ - java.lang.String getBasePath(); - /** - * string basePath = 5; - * @return The bytes for basePath. - */ - com.google.protobuf.ByteString - getBasePathBytes(); - - /** - * string policy = 6; - * @return The policy. - */ - java.lang.String getPolicy(); - /** - * string policy = 6; - * @return The bytes for policy. - */ - com.google.protobuf.ByteString - getPolicyBytes(); - - /** - * string apiType = 7; - * @return The apiType. - */ - java.lang.String getApiType(); - /** - * string apiType = 7; - * @return The bytes for apiType. - */ - com.google.protobuf.ByteString - getApiTypeBytes(); - - /** - * bool isDefaultVersion = 8; - * @return The isDefaultVersion. - */ - boolean getIsDefaultVersion(); - - /** - * .wso2.discovery.subscription.URLMapping urlMappings = 9; - * @return Whether the urlMappings field is set. - */ - boolean hasUrlMappings(); - /** - * .wso2.discovery.subscription.URLMapping urlMappings = 9; - * @return The urlMappings. - */ - org.wso2.apk.enforcer.discovery.subscription.URLMapping getUrlMappings(); - /** - * .wso2.discovery.subscription.URLMapping urlMappings = 9; - */ - org.wso2.apk.enforcer.discovery.subscription.URLMappingOrBuilder getUrlMappingsOrBuilder(); - - /** - * string uuid = 10; - * @return The uuid. - */ - java.lang.String getUuid(); - /** - * string uuid = 10; - * @return The bytes for uuid. - */ - com.google.protobuf.ByteString - getUuidBytes(); - - /** - * string lcState = 11; - * @return The lcState. - */ - java.lang.String getLcState(); - /** - * string lcState = 11; - * @return The bytes for lcState. - */ - com.google.protobuf.ByteString - getLcStateBytes(); -} diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/APIsProto.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/APIsProto.java deleted file mode 100644 index 8f70411da..000000000 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/APIsProto.java +++ /dev/null @@ -1,60 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: wso2/discovery/subscription/api.proto - -package org.wso2.apk.enforcer.discovery.subscription; - -public final class APIsProto { - private APIsProto() {} - public static void registerAllExtensions( - com.google.protobuf.ExtensionRegistryLite registry) { - } - - public static void registerAllExtensions( - com.google.protobuf.ExtensionRegistry registry) { - registerAllExtensions( - (com.google.protobuf.ExtensionRegistryLite) registry); - } - static final com.google.protobuf.Descriptors.Descriptor - internal_static_wso2_discovery_subscription_APIs_descriptor; - static final - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_wso2_discovery_subscription_APIs_fieldAccessorTable; - - public static com.google.protobuf.Descriptors.FileDescriptor - getDescriptor() { - return descriptor; - } - private static com.google.protobuf.Descriptors.FileDescriptor - descriptor; - static { - java.lang.String[] descriptorData = { - "\n%wso2/discovery/subscription/api.proto\022" + - "\033wso2.discovery.subscription\032-wso2/disco" + - "very/subscription/url_mapping.proto\"\360\001\n\004" + - "APIs\022\r\n\005apiId\030\001 \001(\t\022\014\n\004name\030\002 \001(\t\022\020\n\010pro" + - "vider\030\003 \001(\t\022\017\n\007version\030\004 \001(\t\022\020\n\010basePath" + - "\030\005 \001(\t\022\016\n\006policy\030\006 \001(\t\022\017\n\007apiType\030\007 \001(\t\022" + - "\030\n\020isDefaultVersion\030\010 \001(\010\022<\n\013urlMappings" + - "\030\t \001(\0132\'.wso2.discovery.subscription.URL" + - "Mapping\022\014\n\004uuid\030\n \001(\t\022\017\n\007lcState\030\013 \001(\tB\214" + - "\001\n,org.wso2.apk.enforcer.discovery.subsc" + - "riptionB\tAPIsProtoP\001ZOgithub.com/envoypr" + - "oxy/go-control-plane/wso2/discovery/subs" + - "cription;subscriptionb\006proto3" - }; - descriptor = com.google.protobuf.Descriptors.FileDescriptor - .internalBuildGeneratedFileFrom(descriptorData, - new com.google.protobuf.Descriptors.FileDescriptor[] { - org.wso2.apk.enforcer.discovery.subscription.URLMappingProto.getDescriptor(), - }); - internal_static_wso2_discovery_subscription_APIs_descriptor = - getDescriptor().getMessageTypes().get(0); - internal_static_wso2_discovery_subscription_APIs_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_wso2_discovery_subscription_APIs_descriptor, - new java.lang.String[] { "ApiId", "Name", "Provider", "Version", "BasePath", "Policy", "ApiType", "IsDefaultVersion", "UrlMappings", "Uuid", "LcState", }); - org.wso2.apk.enforcer.discovery.subscription.URLMappingProto.getDescriptor(); - } - - // @@protoc_insertion_point(outer_class_scope) -} diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/ApplicationKeyMapping.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/ApplicationKeyMapping.java index 1cc9000a2..ef351e1d1 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/ApplicationKeyMapping.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/ApplicationKeyMapping.java @@ -25,6 +25,7 @@ private ApplicationKeyMapping() { applicationIdentifier_ = ""; keyType_ = ""; envID_ = ""; + organization_ = ""; } @java.lang.Override @@ -92,6 +93,12 @@ private ApplicationKeyMapping( timestamp_ = input.readInt64(); break; } + case 58: { + java.lang.String s = input.readStringRequireUtf8(); + + organization_ = s; + break; + } default: { if (!parseUnknownField( input, unknownFields, extensionRegistry, tag)) { @@ -325,6 +332,44 @@ public long getTimestamp() { return timestamp_; } + public static final int ORGANIZATION_FIELD_NUMBER = 7; + private volatile java.lang.Object organization_; + /** + * string organization = 7; + * @return The organization. + */ + @java.lang.Override + public java.lang.String getOrganization() { + java.lang.Object ref = organization_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + organization_ = s; + return s; + } + } + /** + * string organization = 7; + * @return The bytes for organization. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getOrganizationBytes() { + java.lang.Object ref = organization_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + organization_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + private byte memoizedIsInitialized = -1; @java.lang.Override public final boolean isInitialized() { @@ -357,6 +402,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) if (timestamp_ != 0L) { output.writeInt64(6, timestamp_); } + if (!getOrganizationBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 7, organization_); + } unknownFields.writeTo(output); } @@ -385,6 +433,9 @@ public int getSerializedSize() { size += com.google.protobuf.CodedOutputStream .computeInt64Size(6, timestamp_); } + if (!getOrganizationBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(7, organization_); + } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; @@ -412,6 +463,8 @@ public boolean equals(final java.lang.Object obj) { .equals(other.getEnvID())) return false; if (getTimestamp() != other.getTimestamp()) return false; + if (!getOrganization() + .equals(other.getOrganization())) return false; if (!unknownFields.equals(other.unknownFields)) return false; return true; } @@ -436,6 +489,8 @@ public int hashCode() { hash = (37 * hash) + TIMESTAMP_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashLong( getTimestamp()); + hash = (37 * hash) + ORGANIZATION_FIELD_NUMBER; + hash = (53 * hash) + getOrganization().hashCode(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; @@ -585,6 +640,8 @@ public Builder clear() { timestamp_ = 0L; + organization_ = ""; + return this; } @@ -617,6 +674,7 @@ public org.wso2.apk.enforcer.discovery.subscription.ApplicationKeyMapping buildP result.keyType_ = keyType_; result.envID_ = envID_; result.timestamp_ = timestamp_; + result.organization_ = organization_; onBuilt(); return result; } @@ -688,6 +746,10 @@ public Builder mergeFrom(org.wso2.apk.enforcer.discovery.subscription.Applicatio if (other.getTimestamp() != 0L) { setTimestamp(other.getTimestamp()); } + if (!other.getOrganization().isEmpty()) { + organization_ = other.organization_; + onChanged(); + } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; @@ -1127,6 +1189,82 @@ public Builder clearTimestamp() { onChanged(); return this; } + + private java.lang.Object organization_ = ""; + /** + * string organization = 7; + * @return The organization. + */ + public java.lang.String getOrganization() { + java.lang.Object ref = organization_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + organization_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string organization = 7; + * @return The bytes for organization. + */ + public com.google.protobuf.ByteString + getOrganizationBytes() { + java.lang.Object ref = organization_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + organization_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string organization = 7; + * @param value The organization to set. + * @return This builder for chaining. + */ + public Builder setOrganization( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + organization_ = value; + onChanged(); + return this; + } + /** + * string organization = 7; + * @return This builder for chaining. + */ + public Builder clearOrganization() { + + organization_ = getDefaultInstance().getOrganization(); + onChanged(); + return this; + } + /** + * string organization = 7; + * @param value The bytes for organization to set. + * @return This builder for chaining. + */ + public Builder setOrganizationBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + organization_ = value; + onChanged(); + return this; + } @java.lang.Override public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/ApplicationKeyMappingOrBuilder.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/ApplicationKeyMappingOrBuilder.java index 9f9d38302..86bb940b7 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/ApplicationKeyMappingOrBuilder.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/ApplicationKeyMappingOrBuilder.java @@ -72,4 +72,16 @@ public interface ApplicationKeyMappingOrBuilder extends * @return The timestamp. */ long getTimestamp(); + + /** + * string organization = 7; + * @return The organization. + */ + java.lang.String getOrganization(); + /** + * string organization = 7; + * @return The bytes for organization. + */ + com.google.protobuf.ByteString + getOrganizationBytes(); } diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/ApplicationKeyMappingProto.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/ApplicationKeyMappingProto.java index 8eb2d71b9..db027867b 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/ApplicationKeyMappingProto.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/ApplicationKeyMappingProto.java @@ -30,15 +30,15 @@ public static void registerAllExtensions( java.lang.String[] descriptorData = { "\n9wso2/discovery/subscription/applicatio" + "n_key_mapping.proto\022\033wso2.discovery.subs" + - "cription\"\232\001\n\025ApplicationKeyMapping\022\027\n\017ap" + + "cription\"\260\001\n\025ApplicationKeyMapping\022\027\n\017ap" + "plicationUUID\030\001 \001(\t\022\026\n\016securityScheme\030\002 " + "\001(\t\022\035\n\025applicationIdentifier\030\003 \001(\t\022\017\n\007ke" + "yType\030\004 \001(\t\022\r\n\005envID\030\005 \001(\t\022\021\n\ttimestamp\030" + - "\006 \001(\003B\227\001\n,org.wso2.apk.enforcer.discover" + - "y.subscriptionB\032ApplicationKeyMappingPro" + - "toP\001ZIgithub.com/wso2/apk/adapter/pkg/di" + - "scovery/api/wso2/discovery/subscriptionb" + - "\006proto3" + "\006 \001(\003\022\024\n\014organization\030\007 \001(\tB\227\001\n,org.wso2" + + ".apk.enforcer.discovery.subscriptionB\032Ap" + + "plicationKeyMappingProtoP\001ZIgithub.com/w" + + "so2/apk/adapter/pkg/discovery/api/wso2/d" + + "iscovery/subscriptionb\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, @@ -49,7 +49,7 @@ public static void registerAllExtensions( internal_static_wso2_discovery_subscription_ApplicationKeyMapping_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_wso2_discovery_subscription_ApplicationKeyMapping_descriptor, - new java.lang.String[] { "ApplicationUUID", "SecurityScheme", "ApplicationIdentifier", "KeyType", "EnvID", "Timestamp", }); + new java.lang.String[] { "ApplicationUUID", "SecurityScheme", "ApplicationIdentifier", "KeyType", "EnvID", "Timestamp", "Organization", }); } // @@protoc_insertion_point(outer_class_scope) diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/ApplicationMapping.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/ApplicationMapping.java index 5cf0522e1..7d32e21c7 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/ApplicationMapping.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/ApplicationMapping.java @@ -23,6 +23,7 @@ private ApplicationMapping() { uuid_ = ""; applicationRef_ = ""; subscriptionRef_ = ""; + organization_ = ""; } @java.lang.Override @@ -73,6 +74,12 @@ private ApplicationMapping( subscriptionRef_ = s; break; } + case 34: { + java.lang.String s = input.readStringRequireUtf8(); + + organization_ = s; + break; + } default: { if (!parseUnknownField( input, unknownFields, extensionRegistry, tag)) { @@ -219,6 +226,44 @@ public java.lang.String getSubscriptionRef() { } } + public static final int ORGANIZATION_FIELD_NUMBER = 4; + private volatile java.lang.Object organization_; + /** + * string organization = 4; + * @return The organization. + */ + @java.lang.Override + public java.lang.String getOrganization() { + java.lang.Object ref = organization_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + organization_ = s; + return s; + } + } + /** + * string organization = 4; + * @return The bytes for organization. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getOrganizationBytes() { + java.lang.Object ref = organization_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + organization_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + private byte memoizedIsInitialized = -1; @java.lang.Override public final boolean isInitialized() { @@ -242,6 +287,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) if (!getSubscriptionRefBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 3, subscriptionRef_); } + if (!getOrganizationBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 4, organization_); + } unknownFields.writeTo(output); } @@ -260,6 +308,9 @@ public int getSerializedSize() { if (!getSubscriptionRefBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, subscriptionRef_); } + if (!getOrganizationBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, organization_); + } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; @@ -281,6 +332,8 @@ public boolean equals(final java.lang.Object obj) { .equals(other.getApplicationRef())) return false; if (!getSubscriptionRef() .equals(other.getSubscriptionRef())) return false; + if (!getOrganization() + .equals(other.getOrganization())) return false; if (!unknownFields.equals(other.unknownFields)) return false; return true; } @@ -298,6 +351,8 @@ public int hashCode() { hash = (53 * hash) + getApplicationRef().hashCode(); hash = (37 * hash) + SUBSCRIPTIONREF_FIELD_NUMBER; hash = (53 * hash) + getSubscriptionRef().hashCode(); + hash = (37 * hash) + ORGANIZATION_FIELD_NUMBER; + hash = (53 * hash) + getOrganization().hashCode(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; @@ -441,6 +496,8 @@ public Builder clear() { subscriptionRef_ = ""; + organization_ = ""; + return this; } @@ -470,6 +527,7 @@ public org.wso2.apk.enforcer.discovery.subscription.ApplicationMapping buildPart result.uuid_ = uuid_; result.applicationRef_ = applicationRef_; result.subscriptionRef_ = subscriptionRef_; + result.organization_ = organization_; onBuilt(); return result; } @@ -530,6 +588,10 @@ public Builder mergeFrom(org.wso2.apk.enforcer.discovery.subscription.Applicatio subscriptionRef_ = other.subscriptionRef_; onChanged(); } + if (!other.getOrganization().isEmpty()) { + organization_ = other.organization_; + onChanged(); + } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; @@ -786,6 +848,82 @@ public Builder setSubscriptionRefBytes( onChanged(); return this; } + + private java.lang.Object organization_ = ""; + /** + * string organization = 4; + * @return The organization. + */ + public java.lang.String getOrganization() { + java.lang.Object ref = organization_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + organization_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string organization = 4; + * @return The bytes for organization. + */ + public com.google.protobuf.ByteString + getOrganizationBytes() { + java.lang.Object ref = organization_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + organization_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string organization = 4; + * @param value The organization to set. + * @return This builder for chaining. + */ + public Builder setOrganization( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + organization_ = value; + onChanged(); + return this; + } + /** + * string organization = 4; + * @return This builder for chaining. + */ + public Builder clearOrganization() { + + organization_ = getDefaultInstance().getOrganization(); + onChanged(); + return this; + } + /** + * string organization = 4; + * @param value The bytes for organization to set. + * @return This builder for chaining. + */ + public Builder setOrganizationBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + organization_ = value; + onChanged(); + return this; + } @java.lang.Override public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/ApplicationMappingOrBuilder.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/ApplicationMappingOrBuilder.java index 429a38bfd..1bc44878c 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/ApplicationMappingOrBuilder.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/ApplicationMappingOrBuilder.java @@ -42,4 +42,16 @@ public interface ApplicationMappingOrBuilder extends */ com.google.protobuf.ByteString getSubscriptionRefBytes(); + + /** + * string organization = 4; + * @return The organization. + */ + java.lang.String getOrganization(); + /** + * string organization = 4; + * @return The bytes for organization. + */ + com.google.protobuf.ByteString + getOrganizationBytes(); } diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/ApplicationMappingProto.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/ApplicationMappingProto.java index 16a0503f2..db924973b 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/ApplicationMappingProto.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/ApplicationMappingProto.java @@ -30,13 +30,13 @@ public static void registerAllExtensions( java.lang.String[] descriptorData = { "\n4wso2/discovery/subscription/applicatio" + "nmapping.proto\022\033wso2.discovery.subscript" + - "ion\"S\n\022ApplicationMapping\022\014\n\004uuid\030\001 \001(\t\022" + + "ion\"i\n\022ApplicationMapping\022\014\n\004uuid\030\001 \001(\t\022" + "\026\n\016applicationRef\030\002 \001(\t\022\027\n\017subscriptionR" + - "ef\030\003 \001(\tB\224\001\n,org.wso2.apk.enforcer.disco" + - "very.subscriptionB\027ApplicationMappingPro" + - "toP\001ZIgithub.com/wso2/apk/adapter/pkg/di" + - "scovery/api/wso2/discovery/subscriptionb" + - "\006proto3" + "ef\030\003 \001(\t\022\024\n\014organization\030\004 \001(\tB\224\001\n,org.w" + + "so2.apk.enforcer.discovery.subscriptionB" + + "\027ApplicationMappingProtoP\001ZIgithub.com/w" + + "so2/apk/adapter/pkg/discovery/api/wso2/d" + + "iscovery/subscriptionb\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, @@ -47,7 +47,7 @@ public static void registerAllExtensions( internal_static_wso2_discovery_subscription_ApplicationMapping_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_wso2_discovery_subscription_ApplicationMapping_descriptor, - new java.lang.String[] { "Uuid", "ApplicationRef", "SubscriptionRef", }); + new java.lang.String[] { "Uuid", "ApplicationRef", "SubscriptionRef", "Organization", }); } // @@protoc_insertion_point(outer_class_scope) diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/dto/APIKeyValidationInfoDTO.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/dto/APIKeyValidationInfoDTO.java index f9fe0dfd2..8f4342809 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/dto/APIKeyValidationInfoDTO.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/dto/APIKeyValidationInfoDTO.java @@ -30,6 +30,8 @@ public class APIKeyValidationInfoDTO implements Serializable { private static final long serialVersionUID = 12345L; + private String organization; + private boolean authorized; private String subscriber; private String tier; @@ -65,11 +67,23 @@ public class APIKeyValidationInfoDTO implements Serializable { private String applicationUUID; private Map appAttributes; + public String getOrganization() { + + return organization; + } + + public void setOrganization(String organization) { + + this.organization = organization; + } + public boolean isContentAware() { + return contentAware; } public void setContentAware(boolean contentAware) { + this.contentAware = contentAware; } @@ -81,176 +95,189 @@ public void setContentAware(boolean contentAware) { private String securityScheme; public boolean isAuthorized() { + return authorized; } public void setAuthorized(boolean authorized) { + this.authorized = authorized; } public String getTier() { + return tier; } public void setTier(String tier) { + this.tier = tier; } public String getSubscriber() { + return subscriber; } public void setSubscriber(String subscriber) { + this.subscriber = subscriber; } public String getType() { + return type; } public void setType(String type) { + this.type = type; } public String getEndUserToken() { + return endUserToken; } public void setEndUserToken(String endUserToken) { + this.endUserToken = endUserToken; } public String getEndUserName() { + return endUserName; } public void setEndUserName(String endUserName) { + this.endUserName = endUserName; } public String getApplicationName() { + return applicationName; } public void setApplicationName(String applicationName) { + this.applicationName = applicationName; } public int getValidationStatus() { + return validationStatus; } public void setValidationStatus(int validationStatus) { + this.validationStatus = validationStatus; } public long getValidityPeriod() { + return validityPeriod; } public void setValidityPeriod(long validityPeriod) { + this.validityPeriod = validityPeriod; } public long getIssuedTime() { + return issuedTime; } public void setIssuedTime(long issuedTime) { + this.issuedTime = issuedTime; } public List getAuthorizedDomains() { + return authorizedDomains; } public void setAuthorizedDomains(List authorizedDomains) { + this.authorizedDomains = authorizedDomains; } public String getUserType() { + return userType; } public void setUserType(String userType) { + this.userType = userType; } public String getApiName() { + return apiName; } public void setApiName(String apiName) { + this.apiName = apiName; } public String getApiContext() { + return apiContext; } public void setApiContext(String apiContext) { + this.apiContext = apiContext; } public String getConsumerKey() { + return consumerKey; } public void setConsumerKey(String consumerKey) { + this.consumerKey = consumerKey; } public String getApiPublisher() { + return apiPublisher; } public void setApiPublisher(String apiPublisher) { + this.apiPublisher = apiPublisher; } public String getSecurityScheme() { + return securityScheme; } public void setSecurityScheme(String securityScheme) { + this.securityScheme = securityScheme; } public Set getScopes() { + return scopes; } public void setScopes(Set scopes) { + this.scopes = scopes; } public String toString() { StringBuilder builder = new StringBuilder(20); - builder.append("APIKeyValidationInfoDTO = { authorized:").append(authorized). - append(" , subscriber:").append(subscriber). - append(" , tier:").append(tier). - append(" , type:").append(type). - append(" , userType:").append(userType). - append(" , endUserToken:").append(endUserToken). - append(" , endUserName:").append(endUserName). - append(" , applicationName:").append(applicationName). - append(" , validationStatus:").append(validationStatus). - append(" , validityPeriod:").append(validityPeriod). - append(" , issuedTime:").append(issuedTime). - append(" , apiName:").append(apiName). - append(" , apiContext:").append(apiContext). - append(" , consumerKey:").append(consumerKey). - append(" , spikeArrestLimit:").append(spikeArrestLimit). - append(" , spikeArrestUnit:").append(spikeArrestUnit). - append(" , subscriberOrganization:").append(subscriberOrganization). - append(" , stopOnQuotaReach:").append(stopOnQuotaReach). - append(" , productName:").append(productName). - append(" , productProvider:").append(productProvider). - append(" , apiPublisher:").append(apiPublisher). - append(" , securityScheme:").append(securityScheme). - append(" , graphQLMaxDepth:").append(graphQLMaxDepth). - append(" , graphQLMaxComplexity:").append(graphQLMaxComplexity); + builder.append("APIKeyValidationInfoDTO = { authorized:").append(authorized).append(" , subscriber:").append(subscriber).append(" , tier:").append(tier).append(" , type:").append(type).append(" , userType:").append(userType).append(" , endUserToken:").append(endUserToken).append(" , endUserName:").append(endUserName).append(" , applicationName:").append(applicationName).append(" , validationStatus:").append(validationStatus).append(" , validityPeriod:").append(validityPeriod).append(" , issuedTime:").append(issuedTime).append(" , apiName:").append(apiName).append(" , apiContext:").append(apiContext).append(" , consumerKey:").append(consumerKey).append(" , spikeArrestLimit:").append(spikeArrestLimit).append(" , spikeArrestUnit:").append(spikeArrestUnit).append(" , subscriberOrganization:").append(subscriberOrganization).append(" , stopOnQuotaReach:").append(stopOnQuotaReach).append(" , productName:").append(productName).append(" , productProvider:").append(productProvider).append(" , apiPublisher:").append(apiPublisher).append(" , securityScheme:").append(securityScheme).append(" , graphQLMaxDepth:").append(graphQLMaxDepth).append(" , graphQLMaxComplexity:").append(graphQLMaxComplexity); if (authorizedDomains != null && !authorizedDomains.isEmpty()) { builder.append(" , authorizedDomains:["); @@ -276,50 +303,62 @@ public String toString() { } public int getSpikeArrestLimit() { + return spikeArrestLimit; } public void setSpikeArrestLimit(int spikeArrestLimit) { + this.spikeArrestLimit = spikeArrestLimit; } public String getSpikeArrestUnit() { + return spikeArrestUnit; } public void setSpikeArrestUnit(String spikeArrestUnit) { + this.spikeArrestUnit = spikeArrestUnit; } public boolean isStopOnQuotaReach() { + return stopOnQuotaReach; } public void setStopOnQuotaReach(boolean stopOnQuotaReach) { + this.stopOnQuotaReach = stopOnQuotaReach; } public String getSubscriberOrganization() { + return subscriberOrganization; } public void setSubscriberOrganization(String subscriberOrganization) { + this.subscriberOrganization = subscriberOrganization; } public void setProductName(String productName) { + this.productName = productName; } public String getProductName() { + return productName; } public void setProductProvider(String productProvider) { + this.productProvider = productProvider; } public String getProductProvider() { + return productProvider; } @@ -334,26 +373,32 @@ public String getKeyManager() { } public int getGraphQLMaxDepth() { + return graphQLMaxDepth; } public void setGraphQLMaxDepth(int graphQLMaxDepth) { + this.graphQLMaxDepth = graphQLMaxDepth; } public int getGraphQLMaxComplexity() { + return graphQLMaxComplexity; } public void setGraphQLMaxComplexity(int graphQLMaxComplexity) { + this.graphQLMaxComplexity = graphQLMaxComplexity; } public String getApiVersion() { + return apiVersion; } public void setApiVersion(String apiVersion) { + this.apiVersion = apiVersion; } @@ -378,10 +423,12 @@ public void setAppAttributes(Map appAttributes) { } public String getApiUUID() { + return apiUUID; } public void setApiUUID(String apiUUID) { + this.apiUUID = apiUUID; } } diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/models/ApplicationMapping.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/models/ApplicationMapping.java index ade548e22..1975839d4 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/models/ApplicationMapping.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/models/ApplicationMapping.java @@ -26,8 +26,10 @@ public class ApplicationMapping implements CacheableEntity { private String uuid = null; - private String applicationRef = null; - private String subscriptionRef = null; + private String applicationUUID = null; + private String subscriptionUUID = null; + + private String organization; public String getUuid() { @@ -39,33 +41,39 @@ public void setUuid(String uuid) { this.uuid = uuid; } - public String getApplicationRef() { + public String getApplicationUUID() { - return applicationRef; + return applicationUUID; } - public void setApplicationRef(String applicationRef) { + public void setApplicationUUID(String applicationUUID) { - this.applicationRef = applicationRef; + this.applicationUUID = applicationUUID; } - public String getSubscriptionRef() { + public String getSubscriptionUUID() { - return subscriptionRef; + return subscriptionUUID; } - public void setSubscriptionRef(String subscriptionRef) { + public void setSubscriptionUUID(String subscriptionUUID) { - this.subscriptionRef = subscriptionRef; + this.subscriptionUUID = subscriptionUUID; } - public String getCacheKey() { - return uuid; + public String getOrganization() { + + return organization; + } + + public void setOrganization(String organization) { + + this.organization = organization; } @Override - public String toString() { - return "ApplicationMapping [uuid=" + uuid + ", applicationRef=" + applicationRef + ", subscriptionRef=" - + subscriptionRef + "]"; + public String getCacheKey() { + + return organization + ":" + applicationUUID+ ":" + subscriptionUUID; } } diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/security/KeyValidator.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/security/KeyValidator.java index fb5ad9306..6ff936dfc 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/security/KeyValidator.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/security/KeyValidator.java @@ -23,14 +23,13 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.wso2.apk.enforcer.commons.exception.APISecurityException; -import org.wso2.apk.enforcer.commons.exception.EnforcerException; import org.wso2.apk.enforcer.commons.logging.ErrorDetails; import org.wso2.apk.enforcer.commons.logging.LoggingConstants; +import org.wso2.apk.enforcer.commons.model.APIConfig; import org.wso2.apk.enforcer.commons.model.ResourceConfig; import org.wso2.apk.enforcer.constants.APIConstants; import org.wso2.apk.enforcer.constants.APISecurityConstants; import org.wso2.apk.enforcer.dto.APIKeyValidationInfoDTO; -import org.wso2.apk.enforcer.models.API; import org.wso2.apk.enforcer.models.Application; import org.wso2.apk.enforcer.models.ApplicationKeyMapping; import org.wso2.apk.enforcer.models.ApplicationMapping; @@ -47,6 +46,7 @@ * Does the subscription and scope validation. */ public class KeyValidator { + private static final Logger log = LogManager.getLogger(KeyValidator.class); /** @@ -54,8 +54,7 @@ public class KeyValidator { * * @param validationContext the token validation context * @return true is the scopes are valid - * @throws EnforcerException throws if token validation fails. - * this will indicate the message body for the error response + * this will indicate the message body for the error response */ public static boolean validateScopes(TokenValidationContext validationContext) throws APISecurityException { @@ -118,7 +117,7 @@ public static boolean validateScopes(TokenValidationContext validationContext) t */ public static void validateSubscriptionUsingConsumerKey(APIKeyValidationInfoDTO validationInfo) throws APISecurityException { - API api; + Application app; Subscription sub; ApplicationKeyMapping keyMapping; @@ -134,53 +133,50 @@ public static void validateSubscriptionUsingConsumerKey(APIKeyValidationInfoDTO log.debug("Validation Info : { name : {}, context : {}, version : {}, consumerKey : {} }", apiName, apiContext, apiVersion, consumerKey); - SubscriptionDataStore datastore = SubscriptionDataHolder.getInstance().getSubscriptionDataStore(); + SubscriptionDataStore datastore = + SubscriptionDataHolder.getInstance().getSubscriptionDataStore(validationInfo.getSubscriberOrganization()); if (datastore != null) { - api = datastore.getMatchingAPI(apiContext, apiVersion); - if (api != null) { - // Get application key mapping using the consumer key, key type and security scheme - keyMapping = datastore.getMatchingApplicationKeyMapping(consumerKey, keyType, securityScheme); + // Get application key mapping using the consumer key, key type and security scheme + keyMapping = datastore.getMatchingApplicationKeyMapping(consumerKey, keyType, securityScheme); - if (keyMapping != null) { - // Get application and application mapping using application UUID - String applicationUUID = keyMapping.getApplicationUUID(); - app = datastore.getMatchingApplication(applicationUUID); - appMapping = datastore.getMatchingApplicationMapping(applicationUUID); + if (keyMapping != null) { + // Get application and application mapping using application UUID + String applicationUUID = keyMapping.getApplicationUUID(); + app = datastore.getMatchingApplication(applicationUUID); + appMapping = datastore.getMatchingApplicationMapping(applicationUUID); - if (appMapping != null && app != null) { - // Get subscription using the subscription UUID - String subscriptionUUID = appMapping.getSubscriptionRef(); - sub = datastore.getMatchingSubscription(subscriptionUUID); + if (appMapping != null && app != null) { + // Get subscription using the subscription UUID + String subscriptionUUID = appMapping.getSubscriptionUUID(); + sub = datastore.getMatchingSubscription(subscriptionUUID); - // Validate subscription - if (sub != null) { - validate(validationInfo, api, app, sub); - if (!validationInfo.isAuthorized() && validationInfo.getValidationStatus() == 0) { - // Scenario where validation failed and message is not set - validationInfo.setValidationStatus( - APIConstants.KeyValidationStatus.API_AUTH_RESOURCE_FORBIDDEN); - } - log.debug("After validating subscriptions"); - return; - } else { - log.error( - "Valid subscription not found for access token. " + - "application: {}, app_UUID: {}, API name: {}, API context: {} API version : {}", - app.getName(), app.getUUID(), apiName, apiContext, apiVersion); + // Validate subscription + if (sub != null) { + validate(validationInfo, app, sub); + if (!validationInfo.isAuthorized() && validationInfo.getValidationStatus() == 0) { + // Scenario where validation failed and message is not set + validationInfo.setValidationStatus( + APIConstants.KeyValidationStatus.API_AUTH_RESOURCE_FORBIDDEN); } + log.debug("After validating subscriptions"); + return; } else { log.error( - "Valid application and / or application mapping not found for application uuid : " + applicationUUID); + "Valid subscription not found for access token. " + + "application: {}, app_UUID: {}, API name: {}, API context: {} API version" + + " : {}", + app.getName(), app.getUUID(), apiName, apiContext, apiVersion); } } else { log.error( - "Valid application key mapping not found in the data store for access token. " + - "Application identifier: {}, key type : {}, security scheme : {}", - consumerKey, keyType, securityScheme); + "Valid application and / or application mapping not found for application uuid : " + applicationUUID); } } else { - log.error("API not found for API context : {} and API version : {}", apiContext, apiVersion); + log.error( + "Valid application key mapping not found in the data store for access token. " + + "Application identifier: {}, key type : {}, security scheme : {}", + consumerKey, keyType, securityScheme); } } else { log.error("Subscription data store is null"); @@ -191,7 +187,10 @@ public static void validateSubscriptionUsingConsumerKey(APIKeyValidationInfoDTO // If the execution reaches this point, it means that the subscription validation has failed. log.error("User is NOT authorized to access the API. Subscription validation failed for consumer key : " + consumerKey); - throw new APISecurityException(APIConstants.StatusCodes.UNAUTHORIZED.getCode(), + throw new + + APISecurityException(APIConstants.StatusCodes.UNAUTHORIZED.getCode(), + APISecurityConstants.API_AUTH_FORBIDDEN, APISecurityConstants.API_AUTH_FORBIDDEN_MESSAGE); } @@ -203,50 +202,44 @@ public static void validateSubscriptionUsingConsumerKey(APIKeyValidationInfoDTO * @param payload JWT claims set extracted from the API key * @return validation information about the request */ - public static APIKeyValidationInfoDTO validateSubscription(String apiUuid, String apiContext, - JWTClaimsSet payload) { + public static APIKeyValidationInfoDTO validateSubscription(String apiUuid, String apiContext, APIConfig api, + JWTClaimsSet payload) { + log.debug("Before validating subscriptions with API key. API_uuid: {}, context: {}", apiUuid, apiContext); - API api = null; Application app = null; Subscription sub = null; - SubscriptionDataStore datastore = SubscriptionDataHolder.getInstance().getSubscriptionDataStore(); - //TODO add a check to see whether datastore is initialized an load data using rest api if it is not loaded - // TODO: (VirajSalaka) Handle the scenario where the event is dropped. + SubscriptionDataStore datastore = + SubscriptionDataHolder.getInstance().getSubscriptionDataStore(api.getOrganizationId()); if (datastore != null) { - api = datastore.getApiByContextAndVersion(apiUuid); - if (api != null) { - JSONObject appObject = (JSONObject) payload.getClaim(APIConstants.JwtTokenConstants.APPLICATION); - String appUuid = appObject.getAsString("uuid"); - if (!appObject.isEmpty() && !appUuid.isEmpty()) { - app = datastore.getApplicationById(appUuid); - if (app != null) { - sub = datastore.getSubscriptionById(app.getUUID(), api.getApiUUID()); - if (sub != null) { - log.debug("All information is retrieved from the in memory data store."); - } else { - log.info( - "Valid subscription not found for API key. " + - "application: {} app_UUID: {} API_name: {} API_UUID : {}", - app.getName(), app.getUUID(), api.getApiName(), api.getApiUUID()); - } + JSONObject appObject = (JSONObject) payload.getClaim(APIConstants.JwtTokenConstants.APPLICATION); + String appUuid = appObject.getAsString("uuid"); + if (!appObject.isEmpty() && !appUuid.isEmpty()) { + app = datastore.getApplicationById(appUuid); + if (app != null) { + sub = datastore.getSubscriptionById(app.getUUID(), api.getUuid()); + if (sub != null) { + log.debug("All information is retrieved from the in memory data store."); } else { - log.info("Application not found in the data store for uuid {}", appUuid); + log.info( + "Valid subscription not found for API key. " + + "application: {} app_UUID: {} API_name: {} API_UUID : {}", + app.getName(), app.getUUID(), api.getName(), api.getUuid()); } } else { - log.info("Application claim not found in jwt for uuid"); + log.info("Application not found in the data store for uuid {}", appUuid); } } else { - log.info("API not found in the data store for API UUID :" + apiUuid); + log.info("Application claim not found in jwt for uuid"); } } else { log.error("Subscription data store is null"); } APIKeyValidationInfoDTO infoDTO = new APIKeyValidationInfoDTO(); - if (api != null && app != null && sub != null) { - validate(infoDTO, api, app, sub); + if (app != null && sub != null) { + validate(infoDTO, app, sub); } if (!infoDTO.isAuthorized() && infoDTO.getValidationStatus() == 0) { //Scenario where validation failed and message is not set @@ -256,7 +249,7 @@ public static APIKeyValidationInfoDTO validateSubscription(String apiUuid, Strin return infoDTO; } - private static void validate(APIKeyValidationInfoDTO infoDTO, API api, Application app, Subscription sub) { + private static void validate(APIKeyValidationInfoDTO infoDTO, Application app, Subscription sub) { // Validate subscription status String subscriptionStatus = sub.getSubscriptionStatus(); @@ -265,26 +258,6 @@ private static void validate(APIKeyValidationInfoDTO infoDTO, API api, Applicati infoDTO.setAuthorized(false); return; } -// if (APIConstants.SubscriptionStatus.BLOCKED.equals(subscriptionStatus)) { -// infoDTO.setValidationStatus(APIConstants.KeyValidationStatus.API_BLOCKED); -// infoDTO.setAuthorized(false); -// return; -// } else if (APIConstants.SubscriptionStatus.ON_HOLD.equals(subscriptionStatus) -// || APIConstants.SubscriptionStatus.REJECTED.equals(subscriptionStatus)) { -// infoDTO.setValidationStatus(APIConstants.KeyValidationStatus.SUBSCRIPTION_INACTIVE); -// infoDTO.setAuthorized(false); -// return; -// } else if (APIConstants.SubscriptionStatus.PROD_ONLY_BLOCKED.equals(subscriptionStatus) -// && !APIConstants.API_KEY_TYPE_SANDBOX.equals(keyType)) { -// infoDTO.setValidationStatus(APIConstants.KeyValidationStatus.API_BLOCKED); -// infoDTO.setType(keyType); -// infoDTO.setAuthorized(false); -// return; -// } else if (APIConstants.LifecycleStatus.BLOCKED.equals(api.getLcState())) { -// infoDTO.setValidationStatus(GeneralErrorCodeConstants.API_BLOCKED_CODE); -// infoDTO.setAuthorized(false); -// return; -// } // Validate API details embedded within the subscription // Validate API name @@ -304,12 +277,8 @@ private static void validate(APIKeyValidationInfoDTO infoDTO, API api, Applicati infoDTO.setApplicationUUID(app.getUUID()); infoDTO.setSubscriber(app.getOwner()); - infoDTO.setApiName(api.getApiName()); - infoDTO.setApiVersion(api.getApiVersion()); - infoDTO.setApiPublisher(api.getApiProvider()); infoDTO.setApplicationName(app.getName()); infoDTO.setAppAttributes(app.getAttributes()); - infoDTO.setApiUUID(api.getApiUUID()); infoDTO.setAuthorized(true); } } diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/security/jwt/APIKeyAuthenticator.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/security/jwt/APIKeyAuthenticator.java index 431bb7a4b..caa7696ce 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/security/jwt/APIKeyAuthenticator.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/security/jwt/APIKeyAuthenticator.java @@ -209,7 +209,8 @@ private AuthenticationContext processAPIKey(RequestContext requestContext, Strin APIKeyValidationInfoDTO validationInfoDto; log.debug("Validating subscription for API Key against subscription store." + " context: {} version: {}", apiContext, apiVersion); - validationInfoDto = KeyValidator.validateSubscription(apiUuid, apiContext, payload); + validationInfoDto = KeyValidator.validateSubscription(apiUuid, apiContext, + requestContext.getMatchedAPI(), payload); if (!requestContext.getMatchedAPI().isSystemAPI()) { log.debug("Validating subscription for API Key using JWT claims against invoked API info." + " context: {} version: {}", apiContext, apiVersion); diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/security/jwt/InternalAPIKeyAuthenticator.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/security/jwt/InternalAPIKeyAuthenticator.java index 78c33ae5c..54fa21740 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/security/jwt/InternalAPIKeyAuthenticator.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/security/jwt/InternalAPIKeyAuthenticator.java @@ -40,12 +40,8 @@ import org.wso2.apk.enforcer.config.dto.APIKeyIssuerDto; import org.wso2.apk.enforcer.constants.APIConstants; import org.wso2.apk.enforcer.constants.APISecurityConstants; -import org.wso2.apk.enforcer.constants.GeneralErrorCodeConstants; import org.wso2.apk.enforcer.dto.APIKeyValidationInfoDTO; import org.wso2.apk.enforcer.dto.JWTTokenPayloadInfo; -import org.wso2.apk.enforcer.models.API; -import org.wso2.apk.enforcer.subscription.SubscriptionDataHolder; -import org.wso2.apk.enforcer.subscription.SubscriptionDataStore; import org.wso2.apk.enforcer.tracing.TracingConstants; import org.wso2.apk.enforcer.tracing.TracingSpan; import org.wso2.apk.enforcer.tracing.TracingTracer; @@ -229,26 +225,8 @@ public AuthenticationContext authenticate(RequestContext requestContext) throws api = validateAPISubscription(apiContext, apiVersion, payload, splitToken, false); if (api != null) { - String uuid = requestContext.getMatchedAPI().getUuid(); - SubscriptionDataStore datastore = SubscriptionDataHolder.getInstance() - .getSubscriptionDataStore(); - API subscriptionDataStoreAPI = datastore.getApiByContextAndVersion(uuid); - if (subscriptionDataStoreAPI != null && - APIConstants.LifecycleStatus.BLOCKED - .equals(subscriptionDataStoreAPI.getLcState())) { - FilterUtils.setErrorToContext(requestContext, - GeneralErrorCodeConstants.API_BLOCKED_CODE, - APIConstants.StatusCodes.SERVICE_UNAVAILABLE.getCode(), - GeneralErrorCodeConstants.API_BLOCKED_MESSAGE, - GeneralErrorCodeConstants.API_BLOCKED_DESCRIPTION); - throw new APISecurityException(APIConstants.StatusCodes.SERVICE_UNAVAILABLE.getCode(), - GeneralErrorCodeConstants.API_BLOCKED_CODE, - GeneralErrorCodeConstants.API_BLOCKED_MESSAGE); - } log.debug("Internal Key Authentication is successful."); } - } catch (APISecurityException e) { - throw e; } finally { log.debug("Internal Key authentication is completed."); if (Utils.tracingEnabled()) { diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/security/jwt/JWTAuthenticator.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/security/jwt/JWTAuthenticator.java index 2e8ee6b1b..17f74bb93 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/security/jwt/JWTAuthenticator.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/security/jwt/JWTAuthenticator.java @@ -33,6 +33,7 @@ import org.wso2.apk.enforcer.commons.jwtgenerator.AbstractAPIMgtGatewayJWTGenerator; import org.wso2.apk.enforcer.commons.exception.APISecurityException; import org.wso2.apk.enforcer.commons.exception.EnforcerException; +import org.wso2.apk.enforcer.commons.model.APIConfig; import org.wso2.apk.enforcer.commons.model.AuthenticationContext; import org.wso2.apk.enforcer.commons.model.JWTAuthenticationConfig; import org.wso2.apk.enforcer.commons.model.RequestContext; @@ -139,7 +140,8 @@ public AuthenticationContext authenticate(RequestContext requestContext) throws if (RevokedTokenRedisClient.getRevokedTokens().contains(validationInfo.getIdentifier())) { log.info("Revoked JWT token. ", validationInfo.getIdentifier()); throw new APISecurityException(APIConstants.StatusCodes.UNAUTHENTICATED.getCode(), - APISecurityConstants.API_AUTH_INVALID_CREDENTIALS, APISecurityConstants.API_AUTH_INVALID_CREDENTIALS_MESSAGE); + APISecurityConstants.API_AUTH_INVALID_CREDENTIALS, + APISecurityConstants.API_AUTH_INVALID_CREDENTIALS_MESSAGE); } if (validationInfo != null) { if (validationInfo.isValid()) { @@ -177,8 +179,8 @@ public AuthenticationContext authenticate(RequestContext requestContext) throws // Subscription validation using consumer key if (consumerKey != null) { validateSubscriptionUsingConsumerKey(apiKeyValidationInfoDTO, name, version, context, - consumerKey, envType, APIConstants.API_SECURITY_OAUTH2, organization, - splitToken); + consumerKey, envType, organization, + splitToken, requestContext.getMatchedAPI()); } else { log.error("Error while extracting consumer key from token"); throw new APISecurityException(APIConstants.StatusCodes.UNAUTHENTICATED.getCode(), @@ -336,23 +338,26 @@ private void validateScopes(String apiContext, String apiVersion, ArrayList() { + stub.streamEvents(request, new StreamObserver<>() { @Override public void onNext(Event event) { + handleNotificationEvent(event); XdsSchedulerManager.getInstance().stopEventStreamScheduling(); } @@ -133,7 +135,9 @@ private void handleNotificationEvent(Event event) { switch (event.getType()) { case "ALL_EVENTS": - subscriptionDataStore.loadStartupArtifacts(); + logger.info("Received all events from the server"); + SubscriptionDataStoreUtil.getInstance().loadStartupArtifacts(); + break; case "APPLICATION_CREATED": Application application = event.getApplication(); subscriptionDataStore.addApplication(application); @@ -167,6 +171,7 @@ private void handleNotificationEvent(Event event) { break; default: logger.error("Unknown event type received from the server"); + break; } } } diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/subscription/SubscriptionDataHolder.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/subscription/SubscriptionDataHolder.java index 26e8b36cd..4454ef588 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/subscription/SubscriptionDataHolder.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/subscription/SubscriptionDataHolder.java @@ -18,18 +18,26 @@ package org.wso2.apk.enforcer.subscription; +import java.util.HashMap; +import java.util.Map; + /** * This class holds tenant wise subscription data stores. */ public class SubscriptionDataHolder { - private static SubscriptionDataHolder instance = new SubscriptionDataHolder(); - + private static final SubscriptionDataHolder instance = new SubscriptionDataHolder(); + Map subscriptionDataStoreMap = new HashMap<>(); public static SubscriptionDataHolder getInstance() { return instance; } - public SubscriptionDataStoreImpl getSubscriptionDataStore() { - return SubscriptionDataStoreImpl.getInstance(); + public SubscriptionDataStore getSubscriptionDataStore(String organization) { + return subscriptionDataStoreMap.get(organization); + } + public SubscriptionDataStore initializeSubscriptionDataStore(String organization) { + SubscriptionDataStore subscriptionDataStore = new SubscriptionDataStoreImpl(); + subscriptionDataStoreMap.put(organization,subscriptionDataStore); + return subscriptionDataStore; } } diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/subscription/SubscriptionDataStore.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/subscription/SubscriptionDataStore.java index bee48039f..4612de959 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/subscription/SubscriptionDataStore.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/subscription/SubscriptionDataStore.java @@ -18,7 +18,6 @@ package org.wso2.apk.enforcer.subscription; -import org.wso2.apk.enforcer.discovery.subscription.APIs; import org.wso2.apk.enforcer.discovery.subscription.JWTIssuer; import org.wso2.apk.enforcer.models.*; import org.wso2.apk.enforcer.security.jwt.validator.JWTValidator; @@ -38,14 +37,6 @@ public interface SubscriptionDataStore { */ Application getApplicationById(String appUUID); - /** - * Get API by Context and Version. - * - * @param uuid UUID of the API - * @return {@link API} entry represented by Context and Version. - */ - API getApiByContextAndVersion(String uuid); - /** * Gets Subscription by ID. * @@ -59,20 +50,10 @@ public interface SubscriptionDataStore { void addApplications(List applicationList); - void addApis(List apisList); void addApplicationKeyMappings( List applicationKeyMappingList); - /** - * Filter the API map according to the provided parameters - * - * @param context API Context - * @param version API Version - * @return Matching list of apis. - */ - API getMatchingAPI(String context, String version); - /** * Filter the applicationMapping map based on the provided application UUID. * @@ -117,7 +98,7 @@ ApplicationKeyMapping getMatchingApplicationKeyMapping(String applicationIdentif * @param environment environment of the Issuer * @return JWTValidator Implementation */ - JWTValidator getJWTValidatorByIssuer(String issuer, String organization, String environment); + JWTValidator getJWTValidatorByIssuer(String issuer, String environment); void addApplication(org.wso2.apk.enforcer.discovery.subscription.Application application); @@ -135,5 +116,6 @@ ApplicationKeyMapping getMatchingApplicationKeyMapping(String applicationIdentif void removeApplication(org.wso2.apk.enforcer.discovery.subscription.Application application); - void loadStartupArtifacts(); + public void addApplicationMappings(List applicationMappingList); + } diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/subscription/SubscriptionDataStoreImpl.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/subscription/SubscriptionDataStoreImpl.java index edbd7d6b5..08d4e2f83 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/subscription/SubscriptionDataStoreImpl.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/subscription/SubscriptionDataStoreImpl.java @@ -18,39 +18,27 @@ package org.wso2.apk.enforcer.subscription; -import feign.Feign; -import feign.gson.GsonDecoder; -import feign.gson.GsonEncoder; -import feign.slf4j.Slf4jLogger; import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.wso2.apk.enforcer.commons.dto.ClaimMappingDto; import org.wso2.apk.enforcer.commons.dto.JWKSConfigurationDTO; import org.wso2.apk.enforcer.commons.exception.EnforcerException; -import org.wso2.apk.enforcer.config.ConfigHolder; import org.wso2.apk.enforcer.config.dto.ExtendedTokenIssuerDto; import org.wso2.apk.enforcer.constants.Constants; -import org.wso2.apk.enforcer.discovery.ApiListDiscoveryClient; -import org.wso2.apk.enforcer.discovery.JWTIssuerDiscoveryClient; -import org.wso2.apk.enforcer.discovery.subscription.APIs; import org.wso2.apk.enforcer.discovery.subscription.Certificate; import org.wso2.apk.enforcer.discovery.subscription.JWTIssuer; -import org.wso2.apk.enforcer.models.API; import org.wso2.apk.enforcer.models.Application; import org.wso2.apk.enforcer.models.ApplicationKeyMapping; import org.wso2.apk.enforcer.models.ApplicationMapping; import org.wso2.apk.enforcer.models.SubscribedAPI; import org.wso2.apk.enforcer.models.Subscription; import org.wso2.apk.enforcer.security.jwt.validator.JWTValidator; -import org.wso2.apk.enforcer.util.ApacheFeignHttpClient; -import org.wso2.apk.enforcer.util.FilterUtils; import org.wso2.apk.enforcer.util.TLSUtils; import java.io.IOException; import java.security.cert.CertificateException; import java.util.ArrayList; -import java.util.Arrays; import java.util.HashMap; import java.util.Iterator; import java.util.List; @@ -68,14 +56,12 @@ public class SubscriptionDataStoreImpl implements SubscriptionDataStore { public static final String DELEM_PERIOD = ":"; // Maps for keeping Subscription related details. - private Map applicationKeyMappingMap; - private Map applicationMappingMap; - private Map applicationMap; - private Map apiMap; - private Map subscriptionMap; + private Map applicationKeyMappingMap = new ConcurrentHashMap<>(); + private Map applicationMappingMap = new ConcurrentHashMap<>(); + private Map applicationMap = new ConcurrentHashMap<>(); + private Map subscriptionMap = new ConcurrentHashMap<>(); - private Map> jwtValidatorMap; - SubscriptionValidationDataRetrievalRestClient subscriptionValidationDataRetrievalRestClient; + private Map jwtValidatorMap = new ConcurrentHashMap<>(); SubscriptionDataStoreImpl() { @@ -86,40 +72,13 @@ public static SubscriptionDataStoreImpl getInstance() { return instance; } - public void initializeStore() { - - String commonControllerHost = ConfigHolder.getInstance().getEnvVarConfig().getCommonControllerHost(); - String commonControllerHostname = ConfigHolder.getInstance().getEnvVarConfig().getCommonControllerHostname(); - int commonControllerRestPort = - Integer.parseInt(ConfigHolder.getInstance().getEnvVarConfig().getCommonControllerRestPort()); - subscriptionValidationDataRetrievalRestClient = Feign.builder() - .encoder(new GsonEncoder()) - .decoder(new GsonDecoder()) - .logger(new Slf4jLogger()) - .client(new ApacheFeignHttpClient(FilterUtils.getMutualSSLHttpClient("https", - Arrays.asList(commonControllerHost, commonControllerHostname)))) - .target(SubscriptionValidationDataRetrievalRestClient.class, - "https://" + commonControllerHost + ":" + commonControllerRestPort); - this.applicationKeyMappingMap = new ConcurrentHashMap<>(); - this.applicationMap = new ConcurrentHashMap<>(); - this.apiMap = new ConcurrentHashMap<>(); - this.subscriptionMap = new ConcurrentHashMap<>(); - this.applicationMappingMap = new ConcurrentHashMap<>(); - this.jwtValidatorMap = new ConcurrentHashMap<>(); - initializeLoadingTasks(); - } - @Override public Application getApplicationById(String appUUID) { return applicationMap.get(appUUID); } - @Override - public API getApiByContextAndVersion(String uuid) { - return apiMap.get(uuid); - } @Override public Subscription getSubscriptionById(String appId, String apiId) { @@ -127,49 +86,6 @@ public Subscription getSubscriptionById(String appId, String apiId) { return subscriptionMap.get(SubscriptionDataStoreUtil.getSubscriptionCacheKey(appId, apiId)); } - private void initializeLoadingTasks() { - - ApiListDiscoveryClient.getInstance().watchApiList(); - JWTIssuerDiscoveryClient.getInstance().watchJWTIssuers(); - EventingGrpcClient.getInstance().watchEvents(); - } - - private void loadApplicationKeyMappings() { - - new Thread(() -> { - ApplicationKeyMappingDtoList applicationKeyMappings = - subscriptionValidationDataRetrievalRestClient.getAllApplicationKeyMappings(); - addApplicationKeyMappings(applicationKeyMappings.getList()); - }).start(); - - } - - private void loadApplicationMappings() { - - new Thread(() -> { - ApplicationMappingDtoList applicationMappings = subscriptionValidationDataRetrievalRestClient - .getAllApplicationMappings(); - addApplicationMappings(applicationMappings.getList()); - }).start(); - - } - - private void loadApplications() { - - new Thread(() -> { - ApplicationListDto applications = subscriptionValidationDataRetrievalRestClient.getAllApplications(); - addApplications(applications.getList()); - }).start(); - } - - private void loadSubscriptions() { - - new Thread(() -> { - SubscriptionListDto subscriptions = subscriptionValidationDataRetrievalRestClient.getAllSubscriptions(); - addSubscriptions(subscriptions.getList()); - }).start(); - } - public void addSubscriptions(List subscriptionList) { Map newSubscriptionMap = new ConcurrentHashMap<>(); @@ -212,36 +128,12 @@ public void addApplications(List applicationList) { this.applicationMap = newApplicationMap; } - public void addApis(List apisList) { - - Map newApiMap = new ConcurrentHashMap<>(); - - for (APIs api : apisList) { - API newApi = new API(); - // newApi.setApiId(Integer.parseInt(api.getApiId())); - newApi.setApiName(api.getName()); - newApi.setApiProvider(api.getProvider()); - newApi.setApiType(api.getApiType()); - newApi.setApiVersion(api.getVersion()); - newApi.setContext(api.getBasePath()); - newApi.setApiTier(api.getPolicy()); - newApi.setApiUUID(api.getUuid()); - newApi.setLcState(api.getLcState()); - newApiMap.put(newApi.getCacheKey(), newApi); - } - if (log.isDebugEnabled()) { - log.debug("Total Apis in new cache: {}", newApiMap.size()); - } - this.apiMap = newApiMap; - } - public void addApplicationKeyMappings( - List applicationKeyMappingList) { + public void addApplicationKeyMappings(List applicationKeyMappingList) { Map newApplicationKeyMappingMap = new ConcurrentHashMap<>(); - for (ApplicationKeyMappingDTO applicationKeyMapping : - applicationKeyMappingList) { + for (ApplicationKeyMappingDTO applicationKeyMapping : applicationKeyMappingList) { ApplicationKeyMapping mapping = new ApplicationKeyMapping(); mapping.setApplicationUUID(applicationKeyMapping.getApplicationUUID()); mapping.setSecurityScheme(applicationKeyMapping.getSecurityScheme()); @@ -256,17 +148,15 @@ public void addApplicationKeyMappings( this.applicationKeyMappingMap = newApplicationKeyMappingMap; } - public void addApplicationMappings( - List applicationMappingList) { + public void addApplicationMappings(List applicationMappingList) { Map newApplicationMappingMap = new ConcurrentHashMap<>(); - - for (ApplicationMappingDto applicationMapping : - applicationMappingList) { + for (ApplicationMappingDto applicationMapping : applicationMappingList) { ApplicationMapping appMapping = new ApplicationMapping(); appMapping.setUuid(applicationMapping.getUuid()); - appMapping.setApplicationRef(applicationMapping.getApplicationRef()); - appMapping.setSubscriptionRef(applicationMapping.getSubscriptionRef()); + appMapping.setApplicationUUID(applicationMapping.getApplicationRef()); + appMapping.setSubscriptionUUID(applicationMapping.getSubscriptionRef()); + appMapping.setOrganization(applicationMapping.getOrganization()); newApplicationMappingMap.put(appMapping.getCacheKey(), appMapping); } if (log.isDebugEnabled()) { @@ -275,19 +165,6 @@ public void addApplicationMappings( this.applicationMappingMap = newApplicationMappingMap; } - @Override - public API getMatchingAPI(String context, String version) { - - for (API api : apiMap.values()) { - if (StringUtils.isNotEmpty(context) && StringUtils.isNotEmpty(version)) { - if (api.getContext().equals(context) && api.getApiVersion().equals(version)) { - return api; - } - } - } - return null; - } - @Override public ApplicationKeyMapping getMatchingApplicationKeyMapping(String applicationIdentifier, String keyType, String securityScheme) { @@ -325,7 +202,7 @@ public ApplicationMapping getMatchingApplicationMapping(String uuid) { for (ApplicationMapping applicationMapping : applicationMappingMap.values()) { if (StringUtils.isNotEmpty(uuid)) { - if (applicationMapping.getApplicationRef().equals(uuid)) { + if (applicationMapping.getApplicationUUID().equals(uuid)) { return applicationMapping; } } @@ -362,7 +239,7 @@ public Subscription getMatchingSubscription(String uuid) { @Override public void addJWTIssuers(List jwtIssuers) { - Map> jwtValidatorMap = new ConcurrentHashMap<>(); + Map jwtValidatorMap = new ConcurrentHashMap<>(); for (JWTIssuer jwtIssuer : jwtIssuers) { try { ExtendedTokenIssuerDto tokenIssuerDto = new ExtendedTokenIssuerDto(jwtIssuer.getIssuer()); @@ -373,8 +250,8 @@ public void addJWTIssuers(List jwtIssuers) { if (StringUtils.isNotEmpty(certificate.getJwks().getUrl())) { JWKSConfigurationDTO jwksConfigurationDTO = new JWKSConfigurationDTO(); if (StringUtils.isNotEmpty(certificate.getJwks().getTls())) { - java.security.cert.Certificate tlsCertificate = TLSUtils - .getCertificateFromContent(certificate.getJwks().getTls()); + java.security.cert.Certificate tlsCertificate = + TLSUtils.getCertificateFromContent(certificate.getJwks().getTls()); jwksConfigurationDTO.setCertificate(tlsCertificate); } jwksConfigurationDTO.setUrl(certificate.getJwks().getUrl()); @@ -382,29 +259,21 @@ public void addJWTIssuers(List jwtIssuers) { tokenIssuerDto.setJwksConfigurationDTO(jwksConfigurationDTO); } if (StringUtils.isNotEmpty(certificate.getCertificate())) { - java.security.cert.Certificate signingCertificate = TLSUtils - .getCertificateFromContent(certificate.getCertificate()); + java.security.cert.Certificate signingCertificate = + TLSUtils.getCertificateFromContent(certificate.getCertificate()); tokenIssuerDto.setCertificate(signingCertificate); } Map claimMappingMap = jwtIssuer.getClaimMappingMap(); Map claimMappingDtos = new HashMap<>(); - claimMappingMap.forEach((remoteClaim, localClaim) -> { - claimMappingDtos.put(remoteClaim, new ClaimMappingDto(remoteClaim, localClaim)); - }); + claimMappingMap.forEach((remoteClaim, localClaim) -> claimMappingDtos.put(remoteClaim, + new ClaimMappingDto(remoteClaim, localClaim))); tokenIssuerDto.setClaimMappings(claimMappingDtos); JWTValidator jwtValidator = new JWTValidator(tokenIssuerDto); - Map orgBasedJWTValidatorMap = new ConcurrentHashMap<>(); - if (jwtValidatorMap.containsKey(jwtIssuer.getOrganization())) { - orgBasedJWTValidatorMap = jwtValidatorMap.get(jwtIssuer.getOrganization()); - } - List environments = getEnvironments(jwtIssuer); for (String environment : environments) { String mapKey = getMapKey(environment, jwtIssuer.getIssuer()); - orgBasedJWTValidatorMap.put(mapKey, jwtValidator); + jwtValidatorMap.put(mapKey, jwtValidator); } - - jwtValidatorMap.put(jwtIssuer.getOrganization(), orgBasedJWTValidatorMap); this.jwtValidatorMap = jwtValidatorMap; } catch (EnforcerException | CertificateException | IOException e) { log.error("Error occurred while configuring JWT Validator for issuer " + jwtIssuer.getIssuer(), e); @@ -413,23 +282,15 @@ public void addJWTIssuers(List jwtIssuers) { } @Override - public JWTValidator getJWTValidatorByIssuer(String issuer, String organization, String environment) { - - Map orgBaseJWTValidators = jwtValidatorMap.get(organization); - - if (orgBaseJWTValidators != null) { + public JWTValidator getJWTValidatorByIssuer(String issuer, String environment) { - String mapKey = getMapKey(Constants.DEFAULT_ALL_ENVIRONMENTS_TOKEN_ISSUER, issuer); - JWTValidator jwtValidator = orgBaseJWTValidators.get(mapKey); - if (jwtValidator != null) { - return jwtValidator; - } - - mapKey = getMapKey(environment, issuer); - return orgBaseJWTValidators.get(mapKey); + String mapKey = getMapKey(Constants.DEFAULT_ALL_ENVIRONMENTS_TOKEN_ISSUER, issuer); + JWTValidator jwtValidator = jwtValidatorMap.get(mapKey); + if (jwtValidator != null) { + return jwtValidator; } - - return null; + mapKey = getMapKey(environment, issuer); + return jwtValidatorMap.get(mapKey); } @Override @@ -468,8 +329,8 @@ public void addApplicationMapping(org.wso2.apk.enforcer.discovery.subscription.A ApplicationMapping resolvedApplicationMapping = new ApplicationMapping(); resolvedApplicationMapping.setUuid(applicationMapping.getUuid()); - resolvedApplicationMapping.setApplicationRef(applicationMapping.getApplicationRef()); - resolvedApplicationMapping.setSubscriptionRef(applicationMapping.getSubscriptionRef()); + resolvedApplicationMapping.setApplicationUUID(applicationMapping.getApplicationRef()); + resolvedApplicationMapping.setSubscriptionUUID(applicationMapping.getSubscriptionRef()); if (applicationMappingMap.containsKey(resolvedApplicationMapping.getUuid())) { applicationMappingMap.replace(resolvedApplicationMapping.getUuid(), resolvedApplicationMapping); } else { @@ -490,11 +351,7 @@ public void addApplicationKeyMapping(org.wso2.apk.enforcer.discovery.subscriptio while (iterator.hasNext()) { Map.Entry cachedApplicationKeyMapping = iterator.next(); ApplicationKeyMapping value = cachedApplicationKeyMapping.getValue(); - if (value.getApplicationIdentifier().equals(resolvedApplicationKeyMapping.getApplicationIdentifier()) && - value.getSecurityScheme().equals(resolvedApplicationKeyMapping.getSecurityScheme()) && - value.getKeyType().equals(resolvedApplicationKeyMapping.getKeyType()) && - value.getEnvId().equals(resolvedApplicationKeyMapping.getEnvId()) && - value.getApplicationUUID().equals(resolvedApplicationKeyMapping.getApplicationUUID())) { + if (value.getApplicationIdentifier().equals(resolvedApplicationKeyMapping.getApplicationIdentifier()) && value.getSecurityScheme().equals(resolvedApplicationKeyMapping.getSecurityScheme()) && value.getKeyType().equals(resolvedApplicationKeyMapping.getKeyType()) && value.getEnvId().equals(resolvedApplicationKeyMapping.getEnvId()) && value.getApplicationUUID().equals(resolvedApplicationKeyMapping.getApplicationUUID())) { iterator.remove(); } } @@ -506,8 +363,8 @@ public void removeApplicationMapping(org.wso2.apk.enforcer.discovery.subscriptio ApplicationMapping resolvedApplicationMapping = new ApplicationMapping(); resolvedApplicationMapping.setUuid(applicationMapping.getUuid()); - resolvedApplicationMapping.setApplicationRef(applicationMapping.getApplicationRef()); - resolvedApplicationMapping.setSubscriptionRef(applicationMapping.getSubscriptionRef()); + resolvedApplicationMapping.setApplicationUUID(applicationMapping.getApplicationRef()); + resolvedApplicationMapping.setSubscriptionUUID(applicationMapping.getSubscriptionRef()); applicationMappingMap.remove(resolvedApplicationMapping.getUuid()); } @@ -524,11 +381,7 @@ public void removeApplicationKeyMapping(org.wso2.apk.enforcer.discovery.subscrip while (iterator.hasNext()) { Map.Entry cachedApplicationKeyMapping = iterator.next(); ApplicationKeyMapping value = cachedApplicationKeyMapping.getValue(); - if (value.getApplicationIdentifier().equals(resolvedApplicationKeyMapping.getApplicationIdentifier()) && - value.getSecurityScheme().equals(resolvedApplicationKeyMapping.getSecurityScheme()) && - value.getKeyType().equals(resolvedApplicationKeyMapping.getKeyType()) && - value.getEnvId().equals(resolvedApplicationKeyMapping.getEnvId()) && - value.getApplicationUUID().equals(resolvedApplicationKeyMapping.getApplicationUUID())) { + if (value.getApplicationIdentifier().equals(resolvedApplicationKeyMapping.getApplicationIdentifier()) && value.getSecurityScheme().equals(resolvedApplicationKeyMapping.getSecurityScheme()) && value.getKeyType().equals(resolvedApplicationKeyMapping.getKeyType()) && value.getEnvId().equals(resolvedApplicationKeyMapping.getEnvId()) && value.getApplicationUUID().equals(resolvedApplicationKeyMapping.getApplicationUUID())) { iterator.remove(); } } @@ -546,15 +399,6 @@ public void removeApplication(org.wso2.apk.enforcer.discovery.subscription.Appli applicationMap.remove(application.getUuid()); } - @Override - public void loadStartupArtifacts() { - - loadSubscriptions(); - loadApplications(); - loadApplicationMappings(); - loadApplicationKeyMappings(); - } - private List getEnvironments(JWTIssuer jwtIssuer) { List environmentsList = new ArrayList<>(); diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/subscription/SubscriptionDataStoreUtil.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/subscription/SubscriptionDataStoreUtil.java index 4b30e14eb..6902c32fb 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/subscription/SubscriptionDataStoreUtil.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/subscription/SubscriptionDataStoreUtil.java @@ -18,11 +18,45 @@ package org.wso2.apk.enforcer.subscription; +import feign.Feign; +import feign.gson.GsonDecoder; +import feign.gson.GsonEncoder; +import feign.slf4j.Slf4jLogger; +import org.wso2.apk.enforcer.config.ConfigHolder; +import org.wso2.apk.enforcer.discovery.JWTIssuerDiscoveryClient; +import org.wso2.apk.enforcer.util.ApacheFeignHttpClient; +import org.wso2.apk.enforcer.util.FilterUtils; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + /** * Utility methods related to subscription data store functionalities. */ public class SubscriptionDataStoreUtil { + private static SubscriptionValidationDataRetrievalRestClient subscriptionValidationDataRetrievalRestClient; + private static SubscriptionDataStoreUtil Instance; + + private SubscriptionDataStoreUtil() { + + String commonControllerHost = ConfigHolder.getInstance().getEnvVarConfig().getCommonControllerHost(); + String commonControllerHostname = ConfigHolder.getInstance().getEnvVarConfig().getCommonControllerHostname(); + int commonControllerRestPort = + Integer.parseInt(ConfigHolder.getInstance().getEnvVarConfig().getCommonControllerRestPort()); + subscriptionValidationDataRetrievalRestClient = Feign.builder() + .encoder(new GsonEncoder()) + .decoder(new GsonDecoder()) + .logger(new Slf4jLogger()) + .client(new ApacheFeignHttpClient(FilterUtils.getMutualSSLHttpClient("https", + Arrays.asList(commonControllerHost, commonControllerHostname)))) + .target(SubscriptionValidationDataRetrievalRestClient.class, + "https://" + commonControllerHost + ":" + commonControllerRestPort); + } + public static final String DELEM_PERIOD = "."; public static String getAPICacheKey(String context, String version) { @@ -40,5 +74,131 @@ public static String getPolicyCacheKey(String tierName) { return tierName; } + public static SubscriptionDataStoreUtil getInstance() { + + if (Instance == null) { + synchronized (SubscriptionDataStoreUtil.class) { + if (Instance == null) { + Instance = new SubscriptionDataStoreUtil(); + } + return Instance; + } + } + return Instance; + } + + private static void loadApplicationKeyMappings() { + + new Thread(() -> { + ApplicationKeyMappingDtoList applicationKeyMappings = + subscriptionValidationDataRetrievalRestClient.getAllApplicationKeyMappings(); + List list = applicationKeyMappings.getList(); + Map> orgWizeMAp = new HashMap<>(); + for (ApplicationKeyMappingDTO applicationKeyMappingDTO : list) { + String organization = applicationKeyMappingDTO.getOrganization(); + List applicationKeyMappingDTOS = orgWizeMAp.computeIfAbsent(organization, + k -> new ArrayList<>()); + applicationKeyMappingDTOS.add(applicationKeyMappingDTO); + } + orgWizeMAp.forEach((k, v) -> { + SubscriptionDataStore subscriptionDataStore = SubscriptionDataHolder.getInstance() + .getSubscriptionDataStore(k); + if (subscriptionDataStore == null) { + subscriptionDataStore = SubscriptionDataHolder.getInstance() + .initializeSubscriptionDataStore(k); + } + subscriptionDataStore.addApplicationKeyMappings(v); + }); + }).start(); + + } + + private static void loadApplicationMappings() { + + new Thread(() -> { + ApplicationMappingDtoList applicationMappings = subscriptionValidationDataRetrievalRestClient + .getAllApplicationMappings(); + List list = applicationMappings.getList(); + Map> orgWizeMAp = new HashMap<>(); + for (ApplicationMappingDto applicationMappingDto : list) { + String organization = applicationMappingDto.getOrganization(); + List applicationMappingDtos = orgWizeMAp.computeIfAbsent(organization, + k -> new ArrayList<>()); + applicationMappingDtos.add(applicationMappingDto); + } + orgWizeMAp.forEach((k, v) -> { + SubscriptionDataStore subscriptionDataStore = SubscriptionDataHolder.getInstance() + .getSubscriptionDataStore(k); + if (subscriptionDataStore == null) { + subscriptionDataStore = SubscriptionDataHolder.getInstance() + .initializeSubscriptionDataStore(k); + } + subscriptionDataStore.addApplicationMappings(v); + }); + }).start(); + + } + + public static void initializeLoadingTasks() { + + JWTIssuerDiscoveryClient.getInstance().watchJWTIssuers(); + EventingGrpcClient.getInstance().watchEvents(); + } + + private static void loadApplications() { + + new Thread(() -> { + ApplicationListDto applications = subscriptionValidationDataRetrievalRestClient.getAllApplications(); + List list = applications.getList(); + Map> orgWizeMAp = new HashMap<>(); + for (ApplicationDto applicationDto : list) { + String organization = applicationDto.getOrganizationId(); + List applicationDtos = orgWizeMAp.computeIfAbsent(organization, + k -> new ArrayList<>()); + applicationDtos.add(applicationDto); + } + orgWizeMAp.forEach((k, v) -> { + SubscriptionDataStore subscriptionDataStore = SubscriptionDataHolder.getInstance() + .getSubscriptionDataStore(k); + if (subscriptionDataStore == null) { + subscriptionDataStore = SubscriptionDataHolder.getInstance() + .initializeSubscriptionDataStore(k); + } + subscriptionDataStore.addApplications(v); + }); + }).start(); + } + + private static void loadSubscriptions() { + + new Thread(() -> { + SubscriptionListDto subscriptions = subscriptionValidationDataRetrievalRestClient.getAllSubscriptions(); + List list = subscriptions.getList(); + Map> orgWizeMAp = new HashMap<>(); + for (SubscriptionDto subscriptionDto : list) { + String organization = subscriptionDto.getOrganization(); + List subscriptionDtos = orgWizeMAp.computeIfAbsent(organization, + k -> new ArrayList<>()); + subscriptionDtos.add(subscriptionDto); + } + orgWizeMAp.forEach((k, v) -> { + SubscriptionDataStore subscriptionDataStore = SubscriptionDataHolder.getInstance() + .getSubscriptionDataStore(k); + if (subscriptionDataStore == null) { + subscriptionDataStore = SubscriptionDataHolder.getInstance() + .initializeSubscriptionDataStore(k); + } + subscriptionDataStore.addSubscriptions(v); + }); + }).start(); + } + + public void loadStartupArtifacts(){ + loadApplications(); + loadSubscriptions(); + loadApplicationMappings(); + loadApplicationKeyMappings(); + + } } diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/util/GRPCUtils.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/util/GRPCUtils.java index a7ec36f00..46bd86dbb 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/util/GRPCUtils.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/util/GRPCUtils.java @@ -32,6 +32,7 @@ import java.io.File; import java.nio.file.Paths; +import java.util.concurrent.TimeUnit; import javax.net.ssl.SSLException; @@ -57,6 +58,7 @@ public static ManagedChannel createSecuredChannel(Logger logger, String host, in return NettyChannelBuilder.forAddress(host, port) .useTransportSecurity() .sslContext(sslContext) + .keepAliveTime(30, TimeUnit.SECONDS) .overrideAuthority(hostname) .build(); } diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/test/java/org/wso2/apk/enforcer/jwt/JWTValidatorTest.java b/gateway/enforcer/org.wso2.apk.enforcer/src/test/java/org/wso2/apk/enforcer/jwt/JWTValidatorTest.java index a7f2c68f7..a527b06c0 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/test/java/org/wso2/apk/enforcer/jwt/JWTValidatorTest.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/test/java/org/wso2/apk/enforcer/jwt/JWTValidatorTest.java @@ -17,11 +17,13 @@ package org.wso2.apk.enforcer.jwt; import com.google.common.cache.LoadingCache; + import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.UUID; + import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.logging.log4j.LogManager; @@ -29,6 +31,7 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; +import org.mockito.Mock; import org.mockito.MockedStatic; import org.mockito.Mockito; import org.wso2.apk.enforcer.common.CacheProvider; @@ -55,17 +58,20 @@ import org.wso2.apk.enforcer.security.jwt.JWTAuthenticator; import org.wso2.apk.enforcer.security.jwt.validator.JWTValidator; import org.wso2.apk.enforcer.server.RevokedTokenRedisClient; -import org.wso2.apk.enforcer.subscription.SubscriptionDataStoreImpl; +import org.wso2.apk.enforcer.subscription.SubscriptionDataHolder; +import org.wso2.apk.enforcer.subscription.SubscriptionDataStore; public class JWTValidatorTest { @Before public void setup() { + RevokedTokenRedisClient.setRevokedTokens(new HashSet<>()); } @Test public void testJWTValidator() throws APISecurityException, EnforcerException { + String organization = "org1"; String environment = "development"; String issuer = "https://localhost:9443/oauth2/token"; @@ -118,14 +124,17 @@ public void testJWTValidator() throws APISecurityException, EnforcerException { LoadingCache invalidTokenCache = Mockito.mock(LoadingCache.class); Mockito.when(cacheProvider.getGatewayKeyCache()).thenReturn(gatewayKeyCache); Mockito.when(cacheProvider.getInvalidTokenCache()).thenReturn(invalidTokenCache); - try (MockedStatic logManagerDummy = Mockito.mockStatic(LogManager.class); MockedStatic logFactoryDummy = Mockito.mockStatic(LogFactory.class); - MockedStatic cacheProviderUtilDummy = Mockito.mockStatic(CacheProviderUtil.class); - MockedStatic configHolderDummy = Mockito.mockStatic(ConfigHolder.class); - MockedStatic subscriptionDataStoreImplDummy = - Mockito.mockStatic(SubscriptionDataStoreImpl.class); - MockedStatic keyValidaterDummy = Mockito.mockStatic(KeyValidator.class)) { + MockedStatic cacheProviderUtilDummy = Mockito.mockStatic(CacheProviderUtil.class); + MockedStatic configHolderDummy = Mockito.mockStatic(ConfigHolder.class); + MockedStatic subscriptionDataHolderMockedStatic = + Mockito.mockStatic(SubscriptionDataHolder.class); + MockedStatic keyValidaterDummy = Mockito.mockStatic(KeyValidator.class)) { + SubscriptionDataStore subscriptionDataStore = Mockito.mock(SubscriptionDataStore.class); + SubscriptionDataHolder subscriptionDataHolder = Mockito.mock(SubscriptionDataHolder.class); + subscriptionDataHolderMockedStatic.when(SubscriptionDataHolder::getInstance).thenReturn(subscriptionDataHolder); + Mockito.when(subscriptionDataHolder.getSubscriptionDataStore(organization)).thenReturn(subscriptionDataStore); Logger logger = Mockito.mock(Logger.class); logManagerDummy.when(() -> LogManager.getLogger(JWTAuthenticator.class)).thenReturn(logger); Log logger2 = Mockito.mock(Log.class); @@ -146,12 +155,9 @@ public void testJWTValidator() throws APISecurityException, EnforcerException { Mockito.when(enforcerConfig.getJwtTransformer(issuer)).thenReturn(jwtTransformer); JWTValidator jwtValidator = Mockito.mock(JWTValidator.class); - SubscriptionDataStoreImpl subscriptionDataStore = Mockito.mock(SubscriptionDataStoreImpl.class); - Mockito.when(subscriptionDataStore.getJWTValidatorByIssuer(issuer, - organization, environment)).thenReturn(jwtValidator); - subscriptionDataStoreImplDummy.when(SubscriptionDataStoreImpl::getInstance).thenReturn(subscriptionDataStore); + Mockito.when(subscriptionDataStore.getJWTValidatorByIssuer(issuer, environment)).thenReturn(jwtValidator); Mockito.when(jwtValidator.validateToken(Mockito.eq(jwt), Mockito.any())).thenReturn(jwtValidationInfo); - keyValidaterDummy.when(()->KeyValidator.validateScopes(Mockito.any())).thenReturn(true); + keyValidaterDummy.when(() -> KeyValidator.validateScopes(Mockito.any())).thenReturn(true); AuthenticationContext authenticate = jwtAuthenticator.authenticate(requestContext); Assert.assertNotNull(authenticate); Mockito.verify(gatewayKeyCache, Mockito.atLeast(1)).put(signature, jwtValidationInfo); @@ -160,6 +166,7 @@ public void testJWTValidator() throws APISecurityException, EnforcerException { @Test public void testRevokedToken() throws APISecurityException, EnforcerException { + HashSet revokedTokens = new HashSet<>(); String revokedTokenJTI = "b8938768-23fd-4dec-8b70-bed45eb7c33d"; revokedTokens.add(revokedTokenJTI); @@ -220,11 +227,15 @@ public void testRevokedToken() throws APISecurityException, EnforcerException { try (MockedStatic logManagerDummy = Mockito.mockStatic(LogManager.class); MockedStatic logFactoryDummy = Mockito.mockStatic(LogFactory.class); - MockedStatic cacheProviderUtilDummy = Mockito.mockStatic(CacheProviderUtil.class); - MockedStatic configHolderDummy = Mockito.mockStatic(ConfigHolder.class); - MockedStatic subscriptionDataStoreImplDummy = - Mockito.mockStatic(SubscriptionDataStoreImpl.class); - MockedStatic keyValidaterDummy = Mockito.mockStatic(KeyValidator.class)) { + MockedStatic cacheProviderUtilDummy = Mockito.mockStatic(CacheProviderUtil.class); + MockedStatic configHolderDummy = Mockito.mockStatic(ConfigHolder.class); + MockedStatic keyValidaterDummy = Mockito.mockStatic(KeyValidator.class); + MockedStatic subscriptionDataHolderMockedStatic = + Mockito.mockStatic(SubscriptionDataHolder.class);) { + SubscriptionDataStore subscriptionDataStore = Mockito.mock(SubscriptionDataStore.class); + SubscriptionDataHolder subscriptionDataHolder = Mockito.mock(SubscriptionDataHolder.class); + subscriptionDataHolderMockedStatic.when(SubscriptionDataHolder::getInstance).thenReturn(subscriptionDataHolder); + Mockito.when(subscriptionDataHolder.getSubscriptionDataStore(organization)).thenReturn(subscriptionDataStore); Logger logger = Mockito.mock(Logger.class); logManagerDummy.when(() -> LogManager.getLogger(JWTAuthenticator.class)).thenReturn(logger); Log logger2 = Mockito.mock(Log.class); @@ -244,18 +255,14 @@ public void testRevokedToken() throws APISecurityException, EnforcerException { JWTTransformer jwtTransformer = new DefaultJWTTransformer(); Mockito.when(enforcerConfig.getJwtTransformer(issuer)).thenReturn(jwtTransformer); JWTValidator jwtValidator = Mockito.mock(JWTValidator.class); - - SubscriptionDataStoreImpl subscriptionDataStore = Mockito.mock(SubscriptionDataStoreImpl.class); - Mockito.when(subscriptionDataStore.getJWTValidatorByIssuer(issuer, - organization, environment)).thenReturn(jwtValidator); - subscriptionDataStoreImplDummy.when(SubscriptionDataStoreImpl::getInstance).thenReturn(subscriptionDataStore); Mockito.when(jwtValidator.validateToken(Mockito.eq(jwt), Mockito.any())).thenReturn(jwtValidationInfo); - keyValidaterDummy.when(()->KeyValidator.validateScopes(Mockito.any())).thenReturn(true); + keyValidaterDummy.when(() -> KeyValidator.validateScopes(Mockito.any())).thenReturn(true); try { jwtAuthenticator.authenticate(requestContext); Assert.fail("Authentication should fail for revoked tokens"); } catch (APISecurityException e) { - Assert.assertEquals(e.getMessage(), e.getMessage(), APISecurityConstants.API_AUTH_INVALID_CREDENTIALS_MESSAGE); + Assert.assertEquals(e.getMessage(), e.getMessage(), + APISecurityConstants.API_AUTH_INVALID_CREDENTIALS_MESSAGE); } } finally { RevokedTokenRedisClient.setRevokedTokens(new HashSet<>()); @@ -264,6 +271,7 @@ public void testRevokedToken() throws APISecurityException, EnforcerException { @Test public void testCachedJWTValidator() throws APISecurityException, EnforcerException { + String organization = "org1"; String environment = "development"; String issuer = "https://localhost:9443/oauth2/token"; @@ -321,15 +329,16 @@ public void testCachedJWTValidator() throws APISecurityException, EnforcerExcept Mockito.when(cacheProvider.getGatewayKeyCache()).thenReturn(gatewayKeyCache); Mockito.when(gatewayKeyCache.getIfPresent(signature)).thenReturn(jwtValidationInfo); try (MockedStatic cacheProviderUtilDummy = Mockito.mockStatic(CacheProviderUtil.class); - MockedStatic subscriptionDataStoreImplDummy = Mockito.mockStatic(SubscriptionDataStoreImpl.class); - MockedStatic keyValidatorDummy = Mockito.mockStatic(KeyValidator.class) - ) { + MockedStatic keyValidatorDummy = Mockito.mockStatic(KeyValidator.class); + MockedStatic subscriptionDataHolderMockedStatic = + Mockito.mockStatic(SubscriptionDataHolder.class);) { + SubscriptionDataStore subscriptionDataStore = Mockito.mock(SubscriptionDataStore.class); + SubscriptionDataHolder subscriptionDataHolder = Mockito.mock(SubscriptionDataHolder.class); + subscriptionDataHolderMockedStatic.when(SubscriptionDataHolder::getInstance).thenReturn(subscriptionDataHolder); + Mockito.when(subscriptionDataHolder.getSubscriptionDataStore(organization)).thenReturn(subscriptionDataStore); cacheProviderUtilDummy.when(() -> CacheProviderUtil.getOrganizationCache(organization)).thenReturn(cacheProvider); JWTValidator jwtValidator = Mockito.mock(JWTValidator.class); - SubscriptionDataStoreImpl subscriptionDataStore = Mockito.mock(SubscriptionDataStoreImpl.class); - Mockito.when(subscriptionDataStore.getJWTValidatorByIssuer(issuer, - organization, environment)).thenReturn(jwtValidator); - subscriptionDataStoreImplDummy.when(SubscriptionDataStoreImpl::getInstance).thenReturn(subscriptionDataStore); + Mockito.when(subscriptionDataStore.getJWTValidatorByIssuer(issuer, environment)).thenReturn(jwtValidator); Mockito.when(jwtValidator.validateToken(Mockito.eq(jwt), Mockito.any())).thenReturn(jwtValidationInfo); keyValidatorDummy.when(() -> KeyValidator.validateScopes(Mockito.any())).thenReturn(true); AuthenticationContext authenticate = jwtAuthenticator.authenticate(requestContext); @@ -341,6 +350,7 @@ public void testCachedJWTValidator() throws APISecurityException, EnforcerExcept @Test public void testNonJTIJWTValidator() throws APISecurityException, EnforcerException { + String organization = "org1"; String environment = "development"; String issuer = "https://localhost:9443/oauth2/token"; @@ -388,13 +398,16 @@ public void testNonJTIJWTValidator() throws APISecurityException, EnforcerExcept Mockito.when(gatewayKeyCache.getIfPresent(signature)).thenReturn(jwtValidationInfo); try (MockedStatic cacheProviderUtilDummy = Mockito.mockStatic(CacheProviderUtil.class); MockedStatic keyValidatorDummy = Mockito.mockStatic(KeyValidator.class); - MockedStatic subscriptionDataStoreImplDummy = Mockito.mockStatic(SubscriptionDataStoreImpl.class);) { + MockedStatic subscriptionDataHolderMockedStatic = + Mockito.mockStatic(SubscriptionDataHolder.class);) { + SubscriptionDataStore subscriptionDataStore = Mockito.mock(SubscriptionDataStore.class); + SubscriptionDataHolder subscriptionDataHolder = Mockito.mock(SubscriptionDataHolder.class); + subscriptionDataHolderMockedStatic.when(SubscriptionDataHolder::getInstance).thenReturn(subscriptionDataHolder); + Mockito.when(subscriptionDataHolder.getSubscriptionDataStore(organization)).thenReturn(subscriptionDataStore); cacheProviderUtilDummy.when(() -> CacheProviderUtil.getOrganizationCache(organization)).thenReturn(cacheProvider); JWTValidator jwtValidator = Mockito.mock(JWTValidator.class); - SubscriptionDataStoreImpl subscriptionDataStore = Mockito.mock(SubscriptionDataStoreImpl.class); - Mockito.when(subscriptionDataStore.getJWTValidatorByIssuer(issuer, organization, environment)) + Mockito.when(subscriptionDataStore.getJWTValidatorByIssuer(issuer, environment)) .thenReturn(jwtValidator); - subscriptionDataStoreImplDummy.when(SubscriptionDataStoreImpl::getInstance).thenReturn(subscriptionDataStore); Mockito.when(jwtValidator.validateToken(Mockito.eq(jwt), Mockito.any())).thenReturn(jwtValidationInfo); keyValidatorDummy.when(() -> KeyValidator.validateScopes(Mockito.any())).thenReturn(true); AuthenticationContext authenticate = jwtAuthenticator.authenticate(requestContext); @@ -406,6 +419,7 @@ public void testNonJTIJWTValidator() throws APISecurityException, EnforcerExcept @Test public void testExpiredJWTValidator() { + String organization = "org1"; String signature = "sBgeoqJn0log5EZflj_G7ADvm6B3KQ9bdfFCEFVQS1U3oY9" + "-cqPwAPyOLLh95pdfjYjakkf1UtjPZjeIupwXnzg0SffIc704RoVlZocAx9Ns2XihjU6Imx2MbXq9ARmQxQkyGVkJUMTwZ8" + @@ -467,7 +481,8 @@ public void testExpiredJWTValidator() { jwtAuthenticator.authenticate(requestContext); Assert.fail("Authentication should fail for expired tokens"); } catch (APISecurityException e) { - Assert.assertEquals(e.getMessage(), e.getMessage(), APISecurityConstants.API_AUTH_ACCESS_TOKEN_EXPIRED_MESSAGE); + Assert.assertEquals(e.getMessage(), e.getMessage(), + APISecurityConstants.API_AUTH_ACCESS_TOKEN_EXPIRED_MESSAGE); Mockito.verify(gatewayKeyCache, Mockito.atLeast(1)).getIfPresent(signature); Mockito.verify(invalidTokenCache, Mockito.atLeast(1)).put(signature, true); } @@ -476,6 +491,7 @@ public void testExpiredJWTValidator() { @Test public void testNoCacheExpiredJWTValidator() throws EnforcerException { + String organization = "org1"; String environment = "development"; String issuer = "https://localhost:9443/oauth2/token"; @@ -534,17 +550,18 @@ public void testNoCacheExpiredJWTValidator() throws EnforcerException { Mockito.when(gatewayKeyCache.getIfPresent(signature)).thenReturn(null); Mockito.when(invalidTokenCache.getIfPresent(signature)).thenReturn(null); try (MockedStatic cacheProviderUtilDummy = Mockito.mockStatic(CacheProviderUtil.class); - MockedStatic subscriptionDataStoreImplDummy = - Mockito.mockStatic(SubscriptionDataStoreImpl.class); - MockedStatic keyValidatorDummy = Mockito.mockStatic(KeyValidator.class) + MockedStatic keyValidatorDummy = Mockito.mockStatic(KeyValidator.class); + MockedStatic subscriptionDataHolderMockedStatic = + Mockito.mockStatic(SubscriptionDataHolder.class); ) { + SubscriptionDataStore subscriptionDataStore = Mockito.mock(SubscriptionDataStore.class); + SubscriptionDataHolder subscriptionDataHolder = Mockito.mock(SubscriptionDataHolder.class); + subscriptionDataHolderMockedStatic.when(SubscriptionDataHolder::getInstance).thenReturn(subscriptionDataHolder); + Mockito.when(subscriptionDataHolder.getSubscriptionDataStore(organization)).thenReturn(subscriptionDataStore); cacheProviderUtilDummy.when(() -> CacheProviderUtil.getOrganizationCache(organization)). thenReturn(cacheProvider); JWTValidator jwtValidator = Mockito.mock(JWTValidator.class); - SubscriptionDataStoreImpl subscriptionDataStore = Mockito.mock(SubscriptionDataStoreImpl.class); - Mockito.when(subscriptionDataStore.getJWTValidatorByIssuer(issuer, organization, environment)) - .thenReturn(jwtValidator); - subscriptionDataStoreImplDummy.when(SubscriptionDataStoreImpl::getInstance).thenReturn(subscriptionDataStore); + Mockito.when(subscriptionDataStore.getJWTValidatorByIssuer(issuer, environment)).thenReturn(jwtValidator); Mockito.when(jwtValidator.validateToken(Mockito.eq(jwt), Mockito.any())).thenReturn(jwtValidationInfo); keyValidatorDummy.when(() -> KeyValidator.validateScopes(Mockito.any())).thenReturn(true); @@ -561,6 +578,7 @@ public void testNoCacheExpiredJWTValidator() throws EnforcerException { @Test public void testTamperedPayloadJWTValidator() throws EnforcerException { + String organization = "org1"; String environment = "development"; String issuer = "https://localhost:9443/oauth2/token"; @@ -623,8 +641,6 @@ public void testTamperedPayloadJWTValidator() throws EnforcerException { Mockito.when(apiConfig.getOrganizationId()).thenReturn(organization); Mockito.when(requestContext.getMatchedAPI()).thenReturn(apiConfig); try (MockedStatic cacheProviderUtilDummy = Mockito.mockStatic(CacheProviderUtil.class); - MockedStatic subscriptionDataStoreImplDummy = - Mockito.mockStatic(SubscriptionDataStoreImpl.class); MockedStatic keyValidatorDummy = Mockito.mockStatic(KeyValidator.class) ) { CacheProvider cacheProvider = Mockito.mock(CacheProvider.class); @@ -638,11 +654,6 @@ public void testTamperedPayloadJWTValidator() throws EnforcerException { .thenReturn(cacheProvider); JWTValidator jwtValidator = Mockito.mock(JWTValidator.class); - SubscriptionDataStoreImpl subscriptionDataStore = Mockito.mock(SubscriptionDataStoreImpl.class); - Mockito.when(subscriptionDataStore.getJWTValidatorByIssuer(issuer, organization, environment)) - .thenReturn(jwtValidator); - - subscriptionDataStoreImplDummy.when(SubscriptionDataStoreImpl::getInstance).thenReturn(subscriptionDataStore); Mockito.when(jwtValidator.validateToken(Mockito.eq(jwt), Mockito.any())).thenReturn(jwtValidationInfo); keyValidatorDummy.when(() -> KeyValidator.validateScopes(Mockito.any())).thenReturn(true); try { diff --git a/helm-charts/templates/data-plane/gateway-components/adapter/adapter-service.yaml b/helm-charts/templates/data-plane/gateway-components/adapter/adapter-service.yaml index f7367391e..8c78ff45c 100644 --- a/helm-charts/templates/data-plane/gateway-components/adapter/adapter-service.yaml +++ b/helm-charts/templates/data-plane/gateway-components/adapter/adapter-service.yaml @@ -38,4 +38,7 @@ spec: - name: https-rate-limiter protocol: TCP port: 18001 + - name: profile-port + protocol: TCP + port: 6060 {{- end -}} diff --git a/helm-charts/values.yaml b/helm-charts/values.yaml index 7c52d2566..7c145466b 100644 --- a/helm-charts/values.yaml +++ b/helm-charts/values.yaml @@ -291,8 +291,8 @@ wso2: memory: "128Mi" cpu: "200m" limits: - memory: "256Mi" - cpu: "500m" + memory: "1028Mi" + cpu: "1000m" readinessProbe: initialDelaySeconds: 20 periodSeconds: 20 diff --git a/test/k8s-resources/gw-interceptor.yaml b/test/k8s-resources/gw-interceptor.yaml index a3b0b5bb7..3d751d8a3 100644 --- a/test/k8s-resources/gw-interceptor.yaml +++ b/test/k8s-resources/gw-interceptor.yaml @@ -76,7 +76,7 @@ spec: value: bob requestsPerUnit: 4 unit: Minute - organization: a3b58ccf-6ecc-4557-b5bb-0a35cce38256 + organization: a3b58ccf-6ecc-4557-b5bb-0a35cce38256 targetRef: kind: Gateway name: default @@ -94,7 +94,7 @@ spec: value: wso2 requestsPerUnit: 10 unit: Minute - organization: a3b58ccf-6ecc-4557-b5bb-0a35cce38256 + organization: a3b58ccf-6ecc-4557-b5bb-0a35cce38256 targetRef: kind: Gateway name: default