From ad5a2abac519636e884743a7c940c64d73e8abf4 Mon Sep 17 00:00:00 2001 From: ruks Date: Thu, 3 Oct 2024 11:57:26 +0530 Subject: [PATCH 1/6] Support Insights access logs and configs --- adapter/internal/discovery/xds/server.go | 24 ++- .../internal/oasparser/config_generator.go | 8 + .../oasparser/envoyconf/access_loggers.go | 61 ++++++ .../internal/oasparser/model/mgw_swagger.go | 15 +- adapter/internal/oasparser/model/types.go | 8 + adapter/pkg/config/log_types.go | 15 +- .../api/wso2/discovery/api/api.pb.go | 48 +++-- .../discovery/api/choreo_component_info.pb.go | 183 ++++++++++++++++++ api/proto/wso2/discovery/api/api.proto | 2 + .../discovery/api/choreo_component_info.proto | 31 +++ 10 files changed, 374 insertions(+), 21 deletions(-) create mode 100644 adapter/pkg/discovery/api/wso2/discovery/api/choreo_component_info.pb.go create mode 100644 api/proto/wso2/discovery/api/choreo_component_info.proto diff --git a/adapter/internal/discovery/xds/server.go b/adapter/internal/discovery/xds/server.go index f2febd605c..6d8df81ca8 100644 --- a/adapter/internal/discovery/xds/server.go +++ b/adapter/internal/discovery/xds/server.go @@ -21,6 +21,7 @@ import ( "context" "crypto/sha1" "encoding/hex" + "encoding/json" "errors" "fmt" "math/rand" @@ -358,6 +359,19 @@ func UpdateAPI(vHost string, apiProject mgw.ProjectAPI, deployedEnvironments []* mgwSwagger.APIProvider = apiProject.APIYaml.Data.Provider mgwSwagger.EnvironmentID = deployedEnvironments[0].ID mgwSwagger.EnvironmentName = deployedEnvironments[0].Name + + choreoComponentInfo := mgw.ChoreoComponentInfo{ + OrganizationID: apiYaml.ChoreoComponentInfo.OrganizationID, + ProjectID: apiYaml.ChoreoComponentInfo.ProjectID, + ComponentID: apiYaml.ChoreoComponentInfo.ComponentID, + VersionID: apiYaml.ChoreoComponentInfo.VersionID, + } + + mgwSwagger.ChoreoComponentInfo = &choreoComponentInfo + + apiYamlJSON, _ := json.Marshal(mgwSwagger) + logger.LoggerOasparser.Info("mgwSwagger.ChoreoComponentInfo", string(apiYamlJSON)) + organizationID := apiProject.OrganizationID apiHashValue := generateHashValue(apiYaml.Name, apiYaml.Version) @@ -511,12 +525,18 @@ func UpdateAPI(vHost string, apiProject mgw.ProjectAPI, deployedEnvironments []* } if _, ok := orgIDOpenAPIEnforcerApisMap[organizationID]; ok { - orgIDOpenAPIEnforcerApisMap[organizationID][apiIdentifier] = oasParser.GetEnforcerAPI(mgwSwagger, + aapi := oasParser.GetEnforcerAPI(mgwSwagger, apiProject.APILifeCycleStatus, vHost) + apiYamlJSON, _ := json.Marshal(aapi) + logger.LoggerOasparser.Info("oasParser.GetEnforcerAPI.api1", string(apiYamlJSON)) + orgIDOpenAPIEnforcerApisMap[organizationID][apiIdentifier] = aapi } else { enforcerAPIMap := make(map[string]types.Resource) - enforcerAPIMap[apiIdentifier] = oasParser.GetEnforcerAPI(mgwSwagger, apiProject.APILifeCycleStatus, + aapi := oasParser.GetEnforcerAPI(mgwSwagger, apiProject.APILifeCycleStatus, vHost) + apiYamlJSON, _ := json.Marshal(aapi) + logger.LoggerOasparser.Info("oasParser.GetEnforcerAPI.api2", string(apiYamlJSON)) + enforcerAPIMap[apiIdentifier] = aapi orgIDOpenAPIEnforcerApisMap[organizationID] = enforcerAPIMap } diff --git a/adapter/internal/oasparser/config_generator.go b/adapter/internal/oasparser/config_generator.go index ec6d4b258b..f4289e5065 100644 --- a/adapter/internal/oasparser/config_generator.go +++ b/adapter/internal/oasparser/config_generator.go @@ -196,6 +196,13 @@ func GetEnforcerAPI(mgwSwagger model.MgwSwagger, lifeCycleState string, vhost st } } + choreoComponentInfo := &api.ChoreoComponentInfo{ + ComponentID: mgwSwagger.ChoreoComponentInfo.ComponentID, + VersionID: mgwSwagger.ChoreoComponentInfo.VersionID, + OrganizationID: mgwSwagger.ChoreoComponentInfo.OrganizationID, + ProjectID: mgwSwagger.ChoreoComponentInfo.ProjectID, + } + return &api.Api{ Id: mgwSwagger.GetID(), Title: mgwSwagger.GetTitle(), @@ -221,6 +228,7 @@ func GetEnforcerAPI(mgwSwagger model.MgwSwagger, lifeCycleState string, vhost st DeploymentType: mgwSwagger.DeploymentType, EnvironmentId: mgwSwagger.EnvironmentID, EnvironmentName: mgwSwagger.EnvironmentName, + ChoreoComponentInfo: choreoComponentInfo, } } diff --git a/adapter/internal/oasparser/envoyconf/access_loggers.go b/adapter/internal/oasparser/envoyconf/access_loggers.go index a8e6b3c4ac..0f994a7d53 100644 --- a/adapter/internal/oasparser/envoyconf/access_loggers.go +++ b/adapter/internal/oasparser/envoyconf/access_loggers.go @@ -36,6 +36,63 @@ import ( "google.golang.org/protobuf/types/known/wrapperspb" ) +// getAccessLogConfigs provides file access log configurations for envoy +func getInsightsAccessLogConfigs() *config_access_logv3.AccessLog { + var logFormat *file_accesslogv3.FileAccessLog_LogFormat + logpath := defaultAccessLogPath //default access log path + + logConf := config.ReadLogConfigs() + + if !logConf.InsightsLogs.Enable { + return nil + } + + formatters := []*corev3.TypedExtensionConfig{ + { + Name: "envoy.formatter.req_without_query", + TypedConfig: &anypb.Any{ + TypeUrl: "type.googleapis.com/envoy.extensions.formatter.req_without_query.v3.ReqWithoutQuery", + }, + }, + } + // Set the default log format + logFormat = &file_accesslogv3.FileAccessLog_LogFormat{ + LogFormat: &corev3.SubstitutionFormatString{ + Format: &corev3.SubstitutionFormatString_TextFormatSource{ + TextFormatSource: &corev3.DataSource{ + Specifier: &corev3.DataSource_InlineString{ + InlineString: logConf.InsightsLogs.LoggingFormat, + }, + }, + }, + OmitEmptyValues: logConf.InsightsLogs.OmitEmptyValues, + Formatters: formatters, + }, + } + + logpath = logConf.InsightsLogs.LogFile + accessLogConf := &file_accesslogv3.FileAccessLog{ + Path: logpath, + AccessLogFormat: logFormat, + } + + accessLogTypedConf, err := anypb.New(accessLogConf) + if err != nil { + logger.LoggerOasparser.Error("Error marshaling access log configs. ", err) + return nil + } + + accessLog := config_access_logv3.AccessLog{ + Name: fileAccessLogName, + Filter: nil, + ConfigType: &config_access_logv3.AccessLog_TypedConfig{ + TypedConfig: accessLogTypedConf, + }, + } + + return &accessLog +} + // getAccessLogConfigs provides file access log configurations for envoy func getFileAccessLogConfigs() *config_access_logv3.AccessLog { var logFormat *file_accesslogv3.FileAccessLog_LogFormat @@ -197,12 +254,16 @@ func getAccessLogs() []*config_access_logv3.AccessLog { var accessLoggers []*config_access_logv3.AccessLog fileAccessLog := getFileAccessLogConfigs() grpcAccessLog := getGRPCAccessLogConfigs(conf) + insightsAccessLog := getInsightsAccessLogConfigs() if fileAccessLog != nil { accessLoggers = append(accessLoggers, fileAccessLog) } if grpcAccessLog != nil { accessLoggers = append(accessLoggers, getGRPCAccessLogConfigs(conf)) } + if insightsAccessLog != nil { + accessLoggers = append(accessLoggers, insightsAccessLog) + } return accessLoggers } diff --git a/adapter/internal/oasparser/model/mgw_swagger.go b/adapter/internal/oasparser/model/mgw_swagger.go index 9afb55ce03..8841258058 100644 --- a/adapter/internal/oasparser/model/mgw_swagger.go +++ b/adapter/internal/oasparser/model/mgw_swagger.go @@ -69,9 +69,18 @@ type MgwSwagger struct { // APIProvider is required for analytics purposes as /apis call is avoided temporarily. APIProvider string // DeploymentType could be either "PRODUCTION" or "SANDBOX" - DeploymentType string - EnvironmentID string - EnvironmentName string + DeploymentType string + EnvironmentID string + EnvironmentName string + ChoreoComponentInfo *ChoreoComponentInfo +} + +// ChoreoComponentInfo represents the information of the Choreo component +type ChoreoComponentInfo struct { + OrganizationID string + ProjectID string + ComponentID string + VersionID string } // EndpointCluster represent an upstream cluster diff --git a/adapter/internal/oasparser/model/types.go b/adapter/internal/oasparser/model/types.go index c1878d1382..5e504a6e80 100644 --- a/adapter/internal/oasparser/model/types.go +++ b/adapter/internal/oasparser/model/types.go @@ -148,6 +148,14 @@ type apiData struct { BackendJWTConfiguration backendJWTConfiguration `json:"backendJWTConfiguration,omitempty"` EndpointConfig endpointConfigStruct `json:"endpointConfig,omitempty"` Operations []OperationYaml `json:"Operations,omitempty"` + ChoreoComponentInfo choreoComponentInfo `json:"choreoComponentInfo,omitempty"` +} + +type choreoComponentInfo struct { + OrganizationID string `json:"organizationId,omitempty"` + ProjectID string `json:"projectId,omitempty"` + ComponentID string `json:"componentId,omitempty"` + VersionID string `json:"versionId,omitempty"` } type backendJWTConfiguration struct { diff --git a/adapter/pkg/config/log_types.go b/adapter/pkg/config/log_types.go index ebaf6e4229..7cd589659b 100644 --- a/adapter/pkg/config/log_types.go +++ b/adapter/pkg/config/log_types.go @@ -35,6 +35,13 @@ type accessLog struct { JSONFormat map[string]string } +type insightsLog struct { + Enable bool + LogFile string + LoggingFormat string + OmitEmptyValues bool +} + // AccessLogExcludes represents the configurations related to excludes from access logs. type AccessLogExcludes struct { SystemHost AccessLogExcludesSystemHost @@ -60,8 +67,9 @@ type LogConfig struct { Compress bool } - Pkg []pkg - AccessLogs *accessLog + Pkg []pkg + AccessLogs *accessLog + InsightsLogs *insightsLog } func getDefaultLogConfig() *LogConfig { @@ -115,6 +123,9 @@ func getDefaultLogConfig() *LogConfig { "extAuthDtls": "%DYNAMIC_METADATA(envoy.filters.http.ext_authz:extAuthDetails)%", }, }, + InsightsLogs: &insightsLog{ + Enable: false, + }, } adapterLogConfig.Rotation.MaxSize = 10 adapterLogConfig.Rotation.MaxAge = 2 diff --git a/adapter/pkg/discovery/api/wso2/discovery/api/api.pb.go b/adapter/pkg/discovery/api/wso2/discovery/api/api.pb.go index 841eb3d669..94836a8b27 100644 --- a/adapter/pkg/discovery/api/wso2/discovery/api/api.pb.go +++ b/adapter/pkg/discovery/api/wso2/discovery/api/api.pb.go @@ -66,6 +66,7 @@ type Api struct { EnvironmentId string `protobuf:"bytes,22,opt,name=environmentId,proto3" json:"environmentId,omitempty"` EnvironmentName string `protobuf:"bytes,23,opt,name=environmentName,proto3" json:"environmentName,omitempty"` BackendJWTConfiguration *BackendJWTConfiguration `protobuf:"bytes,24,opt,name=backendJWTConfiguration,proto3" json:"backendJWTConfiguration,omitempty"` + ChoreoComponentInfo *ChoreoComponentInfo `protobuf:"bytes,25,opt,name=choreoComponentInfo,proto3" json:"choreoComponentInfo,omitempty"` } func (x *Api) Reset() { @@ -268,6 +269,13 @@ func (x *Api) GetBackendJWTConfiguration() *BackendJWTConfiguration { return nil } +func (x *Api) GetChoreoComponentInfo() *ChoreoComponentInfo { + if x != nil { + return x.ChoreoComponentInfo + } + return nil +} + var File_wso2_discovery_api_api_proto protoreflect.FileDescriptor var file_wso2_discovery_api_api_proto_rawDesc = []byte{ @@ -287,7 +295,10 @@ var file_wso2_discovery_api_api_proto_rawDesc = []byte{ 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x32, 0x77, 0x73, 0x6f, 0x32, 0x2f, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x5f, 0x6a, 0x77, 0x74, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe6, 0x08, 0x0a, 0x03, 0x41, + 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2e, 0x77, 0x73, 0x6f, 0x32, + 0x2f, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, + 0x68, 0x6f, 0x72, 0x65, 0x6f, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x5f, + 0x69, 0x6e, 0x66, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xc1, 0x09, 0x0a, 0x03, 0x41, 0x70, 0x69, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, @@ -358,14 +369,20 @@ var file_wso2_discovery_api_api_proto_rawDesc = []byte{ 0x70, 0x69, 0x2e, 0x42, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x4a, 0x57, 0x54, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x17, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x4a, 0x57, 0x54, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x42, 0x72, 0x0a, 0x25, 0x6f, 0x72, 0x67, 0x2e, 0x77, 0x73, 0x6f, 0x32, 0x2e, - 0x63, 0x68, 0x6f, 0x72, 0x65, 0x6f, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x64, - 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x42, 0x08, 0x41, 0x70, - 0x69, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3d, 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, - 0x61, 0x70, 0x69, 0x3b, 0x61, 0x70, 0x69, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x69, 0x6f, 0x6e, 0x12, 0x59, 0x0a, 0x13, 0x63, 0x68, 0x6f, 0x72, 0x65, 0x6f, 0x43, 0x6f, 0x6d, + 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x18, 0x19, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x27, 0x2e, 0x77, 0x73, 0x6f, 0x32, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, + 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x68, 0x6f, 0x72, 0x65, 0x6f, 0x43, 0x6f, 0x6d, 0x70, + 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x13, 0x63, 0x68, 0x6f, 0x72, 0x65, + 0x6f, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x42, 0x72, + 0x0a, 0x25, 0x6f, 0x72, 0x67, 0x2e, 0x77, 0x73, 0x6f, 0x32, 0x2e, 0x63, 0x68, 0x6f, 0x72, 0x65, + 0x6f, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, + 0x65, 0x72, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x42, 0x08, 0x41, 0x70, 0x69, 0x50, 0x72, 0x6f, 0x74, + 0x6f, 0x50, 0x01, 0x5a, 0x3d, 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, 0x61, 0x70, 0x69, 0x3b, 0x61, + 0x70, 0x69, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -389,6 +406,7 @@ var file_wso2_discovery_api_api_proto_goTypes = []interface{}{ (*SecurityList)(nil), // 4: wso2.discovery.api.SecurityList (*EndpointSecurity)(nil), // 5: wso2.discovery.api.EndpointSecurity (*BackendJWTConfiguration)(nil), // 6: wso2.discovery.api.BackendJWTConfiguration + (*ChoreoComponentInfo)(nil), // 7: wso2.discovery.api.ChoreoComponentInfo } var file_wso2_discovery_api_api_proto_depIdxs = []int32{ 1, // 0: wso2.discovery.api.Api.productionEndpoints:type_name -> wso2.discovery.api.EndpointCluster @@ -398,11 +416,12 @@ var file_wso2_discovery_api_api_proto_depIdxs = []int32{ 4, // 4: wso2.discovery.api.Api.security:type_name -> wso2.discovery.api.SecurityList 5, // 5: wso2.discovery.api.Api.endpointSecurity:type_name -> wso2.discovery.api.EndpointSecurity 6, // 6: wso2.discovery.api.Api.backendJWTConfiguration:type_name -> wso2.discovery.api.BackendJWTConfiguration - 7, // [7:7] is the sub-list for method output_type - 7, // [7:7] is the sub-list for method input_type - 7, // [7:7] is the sub-list for extension type_name - 7, // [7:7] is the sub-list for extension extendee - 0, // [0:7] is the sub-list for field type_name + 7, // 7: wso2.discovery.api.Api.choreoComponentInfo:type_name -> wso2.discovery.api.ChoreoComponentInfo + 8, // [8:8] is the sub-list for method output_type + 8, // [8:8] is the sub-list for method input_type + 8, // [8:8] is the sub-list for extension type_name + 8, // [8:8] is the sub-list for extension extendee + 0, // [0:8] is the sub-list for field type_name } func init() { file_wso2_discovery_api_api_proto_init() } @@ -415,6 +434,7 @@ func file_wso2_discovery_api_api_proto_init() { file_wso2_discovery_api_endpoint_security_proto_init() file_wso2_discovery_api_security_scheme_proto_init() file_wso2_discovery_api_backend_jwt_configuration_proto_init() + file_wso2_discovery_api_choreo_component_info_proto_init() if !protoimpl.UnsafeEnabled { file_wso2_discovery_api_api_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Api); i { diff --git a/adapter/pkg/discovery/api/wso2/discovery/api/choreo_component_info.pb.go b/adapter/pkg/discovery/api/wso2/discovery/api/choreo_component_info.pb.go new file mode 100644 index 0000000000..721486adf0 --- /dev/null +++ b/adapter/pkg/discovery/api/wso2/discovery/api/choreo_component_info.pb.go @@ -0,0 +1,183 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0-devel +// protoc v3.13.0 +// source: wso2/discovery/api/choreo_component_info.proto + +package api + +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) +) + +type ChoreoComponentInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + OrganizationID string `protobuf:"bytes,1,opt,name=OrganizationID,proto3" json:"OrganizationID,omitempty"` + ProjectID string `protobuf:"bytes,2,opt,name=ProjectID,proto3" json:"ProjectID,omitempty"` + ComponentID string `protobuf:"bytes,3,opt,name=ComponentID,proto3" json:"ComponentID,omitempty"` + VersionID string `protobuf:"bytes,4,opt,name=VersionID,proto3" json:"VersionID,omitempty"` +} + +func (x *ChoreoComponentInfo) Reset() { + *x = ChoreoComponentInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_wso2_discovery_api_choreo_component_info_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ChoreoComponentInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ChoreoComponentInfo) ProtoMessage() {} + +func (x *ChoreoComponentInfo) ProtoReflect() protoreflect.Message { + mi := &file_wso2_discovery_api_choreo_component_info_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 ChoreoComponentInfo.ProtoReflect.Descriptor instead. +func (*ChoreoComponentInfo) Descriptor() ([]byte, []int) { + return file_wso2_discovery_api_choreo_component_info_proto_rawDescGZIP(), []int{0} +} + +func (x *ChoreoComponentInfo) GetOrganizationID() string { + if x != nil { + return x.OrganizationID + } + return "" +} + +func (x *ChoreoComponentInfo) GetProjectID() string { + if x != nil { + return x.ProjectID + } + return "" +} + +func (x *ChoreoComponentInfo) GetComponentID() string { + if x != nil { + return x.ComponentID + } + return "" +} + +func (x *ChoreoComponentInfo) GetVersionID() string { + if x != nil { + return x.VersionID + } + return "" +} + +var File_wso2_discovery_api_choreo_component_info_proto protoreflect.FileDescriptor + +var file_wso2_discovery_api_choreo_component_info_proto_rawDesc = []byte{ + 0x0a, 0x2e, 0x77, 0x73, 0x6f, 0x32, 0x2f, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, + 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x68, 0x6f, 0x72, 0x65, 0x6f, 0x5f, 0x63, 0x6f, 0x6d, 0x70, + 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x12, 0x77, 0x73, 0x6f, 0x32, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, + 0x2e, 0x61, 0x70, 0x69, 0x22, 0x9b, 0x01, 0x0a, 0x13, 0x43, 0x68, 0x6f, 0x72, 0x65, 0x6f, 0x43, + 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x26, 0x0a, 0x0e, + 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x49, 0x44, 0x12, 0x1c, 0x0a, 0x09, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x49, + 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, + 0x49, 0x44, 0x12, 0x20, 0x0a, 0x0b, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x49, + 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, + 0x6e, 0x74, 0x49, 0x44, 0x12, 0x1c, 0x0a, 0x09, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x49, + 0x44, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x49, 0x44, 0x42, 0x82, 0x01, 0x0a, 0x25, 0x6f, 0x72, 0x67, 0x2e, 0x77, 0x73, 0x6f, 0x32, 0x2e, + 0x63, 0x68, 0x6f, 0x72, 0x65, 0x6f, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x64, + 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x42, 0x18, 0x43, 0x68, + 0x6f, 0x72, 0x65, 0x6f, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x49, 0x6e, 0x66, + 0x6f, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3d, 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, + 0x61, 0x70, 0x69, 0x3b, 0x61, 0x70, 0x69, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_wso2_discovery_api_choreo_component_info_proto_rawDescOnce sync.Once + file_wso2_discovery_api_choreo_component_info_proto_rawDescData = file_wso2_discovery_api_choreo_component_info_proto_rawDesc +) + +func file_wso2_discovery_api_choreo_component_info_proto_rawDescGZIP() []byte { + file_wso2_discovery_api_choreo_component_info_proto_rawDescOnce.Do(func() { + file_wso2_discovery_api_choreo_component_info_proto_rawDescData = protoimpl.X.CompressGZIP(file_wso2_discovery_api_choreo_component_info_proto_rawDescData) + }) + return file_wso2_discovery_api_choreo_component_info_proto_rawDescData +} + +var file_wso2_discovery_api_choreo_component_info_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_wso2_discovery_api_choreo_component_info_proto_goTypes = []interface{}{ + (*ChoreoComponentInfo)(nil), // 0: wso2.discovery.api.ChoreoComponentInfo +} +var file_wso2_discovery_api_choreo_component_info_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] 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_api_choreo_component_info_proto_init() } +func file_wso2_discovery_api_choreo_component_info_proto_init() { + if File_wso2_discovery_api_choreo_component_info_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_wso2_discovery_api_choreo_component_info_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ChoreoComponentInfo); 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_api_choreo_component_info_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_wso2_discovery_api_choreo_component_info_proto_goTypes, + DependencyIndexes: file_wso2_discovery_api_choreo_component_info_proto_depIdxs, + MessageInfos: file_wso2_discovery_api_choreo_component_info_proto_msgTypes, + }.Build() + File_wso2_discovery_api_choreo_component_info_proto = out.File + file_wso2_discovery_api_choreo_component_info_proto_rawDesc = nil + file_wso2_discovery_api_choreo_component_info_proto_goTypes = nil + file_wso2_discovery_api_choreo_component_info_proto_depIdxs = nil +} diff --git a/api/proto/wso2/discovery/api/api.proto b/api/proto/wso2/discovery/api/api.proto index 725a6a498f..9d853e83cd 100644 --- a/api/proto/wso2/discovery/api/api.proto +++ b/api/proto/wso2/discovery/api/api.proto @@ -23,6 +23,7 @@ import "wso2/discovery/api/Resource.proto"; import "wso2/discovery/api/endpoint_security.proto"; import "wso2/discovery/api/security_scheme.proto"; import "wso2/discovery/api/backend_jwt_configuration.proto"; +import "wso2/discovery/api/choreo_component_info.proto"; option go_package = "github.com/envoyproxy/go-control-plane/wso2/discovery/api;api"; option java_package = "org.wso2.choreo.connect.discovery.api"; @@ -57,4 +58,5 @@ message Api { string environmentId = 22; string environmentName = 23; BackendJWTConfiguration backendJWTConfiguration = 24; + ChoreoComponentInfo choreoComponentInfo = 25; } diff --git a/api/proto/wso2/discovery/api/choreo_component_info.proto b/api/proto/wso2/discovery/api/choreo_component_info.proto new file mode 100644 index 0000000000..2f74628204 --- /dev/null +++ b/api/proto/wso2/discovery/api/choreo_component_info.proto @@ -0,0 +1,31 @@ +// Copyright (c) 2024, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. +// +// WSO2 Inc. 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. + +syntax = "proto3"; + +package wso2.discovery.api; + +option go_package = "github.com/envoyproxy/go-control-plane/wso2/discovery/api;api"; +option java_package = "org.wso2.choreo.connect.discovery.api"; +option java_outer_classname = "ChoreoComponentInfoProto"; +option java_multiple_files = true; + +message ChoreoComponentInfo { + string OrganizationID = 1; + string ProjectID = 2; + string ComponentID = 3; + string VersionID = 4; +} \ No newline at end of file From 2cc85b4361ad2d0d5f5b5a39ffb50a91304cdb87 Mon Sep 17 00:00:00 2001 From: ruks Date: Thu, 3 Oct 2024 12:03:32 +0530 Subject: [PATCH 2/6] Fixed formatting issues --- adapter/internal/discovery/xds/server.go | 14 ++------------ .../wso2/discovery/api/choreo_component_info.proto | 2 +- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/adapter/internal/discovery/xds/server.go b/adapter/internal/discovery/xds/server.go index 6d8df81ca8..f48de56534 100644 --- a/adapter/internal/discovery/xds/server.go +++ b/adapter/internal/discovery/xds/server.go @@ -21,7 +21,6 @@ import ( "context" "crypto/sha1" "encoding/hex" - "encoding/json" "errors" "fmt" "math/rand" @@ -369,9 +368,6 @@ func UpdateAPI(vHost string, apiProject mgw.ProjectAPI, deployedEnvironments []* mgwSwagger.ChoreoComponentInfo = &choreoComponentInfo - apiYamlJSON, _ := json.Marshal(mgwSwagger) - logger.LoggerOasparser.Info("mgwSwagger.ChoreoComponentInfo", string(apiYamlJSON)) - organizationID := apiProject.OrganizationID apiHashValue := generateHashValue(apiYaml.Name, apiYaml.Version) @@ -525,18 +521,12 @@ func UpdateAPI(vHost string, apiProject mgw.ProjectAPI, deployedEnvironments []* } if _, ok := orgIDOpenAPIEnforcerApisMap[organizationID]; ok { - aapi := oasParser.GetEnforcerAPI(mgwSwagger, + orgIDOpenAPIEnforcerApisMap[organizationID][apiIdentifier] = oasParser.GetEnforcerAPI(mgwSwagger, apiProject.APILifeCycleStatus, vHost) - apiYamlJSON, _ := json.Marshal(aapi) - logger.LoggerOasparser.Info("oasParser.GetEnforcerAPI.api1", string(apiYamlJSON)) - orgIDOpenAPIEnforcerApisMap[organizationID][apiIdentifier] = aapi } else { enforcerAPIMap := make(map[string]types.Resource) - aapi := oasParser.GetEnforcerAPI(mgwSwagger, apiProject.APILifeCycleStatus, + enforcerAPIMap[apiIdentifier] = oasParser.GetEnforcerAPI(mgwSwagger, apiProject.APILifeCycleStatus, vHost) - apiYamlJSON, _ := json.Marshal(aapi) - logger.LoggerOasparser.Info("oasParser.GetEnforcerAPI.api2", string(apiYamlJSON)) - enforcerAPIMap[apiIdentifier] = aapi orgIDOpenAPIEnforcerApisMap[organizationID] = enforcerAPIMap } diff --git a/api/proto/wso2/discovery/api/choreo_component_info.proto b/api/proto/wso2/discovery/api/choreo_component_info.proto index 2f74628204..02ea345e5b 100644 --- a/api/proto/wso2/discovery/api/choreo_component_info.proto +++ b/api/proto/wso2/discovery/api/choreo_component_info.proto @@ -28,4 +28,4 @@ message ChoreoComponentInfo { string ProjectID = 2; string ComponentID = 3; string VersionID = 4; -} \ No newline at end of file +} From 4899fb480d9df492241a0aa4eb13bd5f2e6e85f3 Mon Sep 17 00:00:00 2001 From: ruks Date: Mon, 7 Oct 2024 09:51:10 +0530 Subject: [PATCH 3/6] Adding review changes and model changes --- adapter/pkg/config/log_types.go | 5 +- .../enforcer/commons/model/APIConfig.java | 12 + .../commons/model/ChoreoComponentInfo.java | 43 + .../choreo/connect/discovery/api/Api.java | 188 ++++ .../connect/discovery/api/ApiOrBuilder.java | 15 + .../connect/discovery/api/ApiProto.java | 55 +- .../discovery/api/ChoreoComponentInfo.java | 971 ++++++++++++++++++ .../api/ChoreoComponentInfoOrBuilder.java | 57 + .../api/ChoreoComponentInfoProto.java | 53 + 9 files changed, 1373 insertions(+), 26 deletions(-) create mode 100644 enforcer-parent/commons/src/main/java/org/wso2/choreo/connect/enforcer/commons/model/ChoreoComponentInfo.java create mode 100644 enforcer-parent/enforcer/src/main/gen/org/wso2/choreo/connect/discovery/api/ChoreoComponentInfo.java create mode 100644 enforcer-parent/enforcer/src/main/gen/org/wso2/choreo/connect/discovery/api/ChoreoComponentInfoOrBuilder.java create mode 100644 enforcer-parent/enforcer/src/main/gen/org/wso2/choreo/connect/discovery/api/ChoreoComponentInfoProto.java diff --git a/adapter/pkg/config/log_types.go b/adapter/pkg/config/log_types.go index 7cd589659b..c28458e2f9 100644 --- a/adapter/pkg/config/log_types.go +++ b/adapter/pkg/config/log_types.go @@ -124,7 +124,10 @@ func getDefaultLogConfig() *LogConfig { }, }, InsightsLogs: &insightsLog{ - Enable: false, + Enable: false, + LogFile: "/dev/stdout", + LoggingFormat: "-", + OmitEmptyValues: true, }, } adapterLogConfig.Rotation.MaxSize = 10 diff --git a/enforcer-parent/commons/src/main/java/org/wso2/choreo/connect/enforcer/commons/model/APIConfig.java b/enforcer-parent/commons/src/main/java/org/wso2/choreo/connect/enforcer/commons/model/APIConfig.java index a1f6d10f05..4abd032061 100644 --- a/enforcer-parent/commons/src/main/java/org/wso2/choreo/connect/enforcer/commons/model/APIConfig.java +++ b/enforcer-parent/commons/src/main/java/org/wso2/choreo/connect/enforcer/commons/model/APIConfig.java @@ -50,6 +50,7 @@ public class APIConfig { private String deploymentType; private String environmentId; private String environmentName; + private ChoreoComponentInfo choreoComponentInfo; /** * getApiType returns the API type. This could be one of the following. @@ -228,6 +229,10 @@ public void setBackendJWTConfiguration(BackendJWTConfiguration backendJWTConfigu this.backendJWTConfiguration = backendJWTConfiguration; } + public ChoreoComponentInfo getChoreoComponentInfo() { + return choreoComponentInfo; + } + /** * Implements builder pattern to build an API Config object. */ @@ -255,6 +260,7 @@ public static class Builder { private String environmentName; private boolean enableBackendJWT; private BackendJWTConfiguration backendJWTConfiguration; + private ChoreoComponentInfo choreoComponentInfo; public Builder(String name) { this.name = name; @@ -371,6 +377,11 @@ public Builder environmentName(String environmentName) { return this; } + public Builder choreoComponentInfo(ChoreoComponentInfo choreoComponentInfo) { + this.choreoComponentInfo = choreoComponentInfo; + return this; + } + public APIConfig build() { APIConfig apiConfig = new APIConfig(); apiConfig.name = this.name; @@ -395,6 +406,7 @@ public APIConfig build() { apiConfig.deploymentType = this.deploymentType; apiConfig.environmentId = this.environmentId; apiConfig.environmentName = this.environmentName; + apiConfig.choreoComponentInfo = this.choreoComponentInfo; return apiConfig; } } diff --git a/enforcer-parent/commons/src/main/java/org/wso2/choreo/connect/enforcer/commons/model/ChoreoComponentInfo.java b/enforcer-parent/commons/src/main/java/org/wso2/choreo/connect/enforcer/commons/model/ChoreoComponentInfo.java new file mode 100644 index 0000000000..9fae9ea82c --- /dev/null +++ b/enforcer-parent/commons/src/main/java/org/wso2/choreo/connect/enforcer/commons/model/ChoreoComponentInfo.java @@ -0,0 +1,43 @@ +package org.wso2.choreo.connect.enforcer.commons.model; + +/** + * ChoreoComponentInfo class contains the information about the component. + */ +public class ChoreoComponentInfo { + private String organizationID; + private String projectID; + private String componentID; + private String versionID; + + public String getOrganizationID() { + return organizationID; + } + + public void setOrganizationID(String organizationID) { + this.organizationID = organizationID; + } + + public String getProjectID() { + return projectID; + } + + public void setProjectID(String projectID) { + this.projectID = projectID; + } + + public String getComponentID() { + return componentID; + } + + public void setComponentID(String componentID) { + this.componentID = componentID; + } + + public String getVersionID() { + return versionID; + } + + public void setVersionID(String versionID) { + this.versionID = versionID; + } +} diff --git a/enforcer-parent/enforcer/src/main/gen/org/wso2/choreo/connect/discovery/api/Api.java b/enforcer-parent/enforcer/src/main/gen/org/wso2/choreo/connect/discovery/api/Api.java index 0dc8987754..14003fe12c 100644 --- a/enforcer-parent/enforcer/src/main/gen/org/wso2/choreo/connect/discovery/api/Api.java +++ b/enforcer-parent/enforcer/src/main/gen/org/wso2/choreo/connect/discovery/api/Api.java @@ -250,6 +250,19 @@ private Api( break; } + case 202: { + org.wso2.choreo.connect.discovery.api.ChoreoComponentInfo.Builder subBuilder = null; + if (choreoComponentInfo_ != null) { + subBuilder = choreoComponentInfo_.toBuilder(); + } + choreoComponentInfo_ = input.readMessage(org.wso2.choreo.connect.discovery.api.ChoreoComponentInfo.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(choreoComponentInfo_); + choreoComponentInfo_ = subBuilder.buildPartial(); + } + + break; + } default: { if (!parseUnknownField( input, unknownFields, extensionRegistry, tag)) { @@ -1107,6 +1120,32 @@ public org.wso2.choreo.connect.discovery.api.BackendJWTConfigurationOrBuilder ge return getBackendJWTConfiguration(); } + public static final int CHOREOCOMPONENTINFO_FIELD_NUMBER = 25; + private org.wso2.choreo.connect.discovery.api.ChoreoComponentInfo choreoComponentInfo_; + /** + * .wso2.discovery.api.ChoreoComponentInfo choreoComponentInfo = 25; + * @return Whether the choreoComponentInfo field is set. + */ + @java.lang.Override + public boolean hasChoreoComponentInfo() { + return choreoComponentInfo_ != null; + } + /** + * .wso2.discovery.api.ChoreoComponentInfo choreoComponentInfo = 25; + * @return The choreoComponentInfo. + */ + @java.lang.Override + public org.wso2.choreo.connect.discovery.api.ChoreoComponentInfo getChoreoComponentInfo() { + return choreoComponentInfo_ == null ? org.wso2.choreo.connect.discovery.api.ChoreoComponentInfo.getDefaultInstance() : choreoComponentInfo_; + } + /** + * .wso2.discovery.api.ChoreoComponentInfo choreoComponentInfo = 25; + */ + @java.lang.Override + public org.wso2.choreo.connect.discovery.api.ChoreoComponentInfoOrBuilder getChoreoComponentInfoOrBuilder() { + return getChoreoComponentInfo(); + } + private byte memoizedIsInitialized = -1; @java.lang.Override public final boolean isInitialized() { @@ -1193,6 +1232,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) if (backendJWTConfiguration_ != null) { output.writeMessage(24, getBackendJWTConfiguration()); } + if (choreoComponentInfo_ != null) { + output.writeMessage(25, getChoreoComponentInfo()); + } unknownFields.writeTo(output); } @@ -1283,6 +1325,10 @@ public int getSerializedSize() { size += com.google.protobuf.CodedOutputStream .computeMessageSize(24, getBackendJWTConfiguration()); } + if (choreoComponentInfo_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(25, getChoreoComponentInfo()); + } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; @@ -1358,6 +1404,11 @@ public boolean equals(final java.lang.Object obj) { if (!getBackendJWTConfiguration() .equals(other.getBackendJWTConfiguration())) return false; } + if (hasChoreoComponentInfo() != other.hasChoreoComponentInfo()) return false; + if (hasChoreoComponentInfo()) { + if (!getChoreoComponentInfo() + .equals(other.getChoreoComponentInfo())) return false; + } if (!unknownFields.equals(other.unknownFields)) return false; return true; } @@ -1433,6 +1484,10 @@ public int hashCode() { hash = (37 * hash) + BACKENDJWTCONFIGURATION_FIELD_NUMBER; hash = (53 * hash) + getBackendJWTConfiguration().hashCode(); } + if (hasChoreoComponentInfo()) { + hash = (37 * hash) + CHOREOCOMPONENTINFO_FIELD_NUMBER; + hash = (53 * hash) + getChoreoComponentInfo().hashCode(); + } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; @@ -1649,6 +1704,12 @@ public Builder clear() { backendJWTConfiguration_ = null; backendJWTConfigurationBuilder_ = null; } + if (choreoComponentInfoBuilder_ == null) { + choreoComponentInfo_ = null; + } else { + choreoComponentInfo_ = null; + choreoComponentInfoBuilder_ = null; + } return this; } @@ -1740,6 +1801,11 @@ public org.wso2.choreo.connect.discovery.api.Api buildPartial() { } else { result.backendJWTConfiguration_ = backendJWTConfigurationBuilder_.build(); } + if (choreoComponentInfoBuilder_ == null) { + result.choreoComponentInfo_ = choreoComponentInfo_; + } else { + result.choreoComponentInfo_ = choreoComponentInfoBuilder_.build(); + } onBuilt(); return result; } @@ -1944,6 +2010,9 @@ public Builder mergeFrom(org.wso2.choreo.connect.discovery.api.Api other) { if (other.hasBackendJWTConfiguration()) { mergeBackendJWTConfiguration(other.getBackendJWTConfiguration()); } + if (other.hasChoreoComponentInfo()) { + mergeChoreoComponentInfo(other.getChoreoComponentInfo()); + } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; @@ -4371,6 +4440,125 @@ public org.wso2.choreo.connect.discovery.api.BackendJWTConfigurationOrBuilder ge } return backendJWTConfigurationBuilder_; } + + private org.wso2.choreo.connect.discovery.api.ChoreoComponentInfo choreoComponentInfo_; + private com.google.protobuf.SingleFieldBuilderV3< + org.wso2.choreo.connect.discovery.api.ChoreoComponentInfo, org.wso2.choreo.connect.discovery.api.ChoreoComponentInfo.Builder, org.wso2.choreo.connect.discovery.api.ChoreoComponentInfoOrBuilder> choreoComponentInfoBuilder_; + /** + * .wso2.discovery.api.ChoreoComponentInfo choreoComponentInfo = 25; + * @return Whether the choreoComponentInfo field is set. + */ + public boolean hasChoreoComponentInfo() { + return choreoComponentInfoBuilder_ != null || choreoComponentInfo_ != null; + } + /** + * .wso2.discovery.api.ChoreoComponentInfo choreoComponentInfo = 25; + * @return The choreoComponentInfo. + */ + public org.wso2.choreo.connect.discovery.api.ChoreoComponentInfo getChoreoComponentInfo() { + if (choreoComponentInfoBuilder_ == null) { + return choreoComponentInfo_ == null ? org.wso2.choreo.connect.discovery.api.ChoreoComponentInfo.getDefaultInstance() : choreoComponentInfo_; + } else { + return choreoComponentInfoBuilder_.getMessage(); + } + } + /** + * .wso2.discovery.api.ChoreoComponentInfo choreoComponentInfo = 25; + */ + public Builder setChoreoComponentInfo(org.wso2.choreo.connect.discovery.api.ChoreoComponentInfo value) { + if (choreoComponentInfoBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + choreoComponentInfo_ = value; + onChanged(); + } else { + choreoComponentInfoBuilder_.setMessage(value); + } + + return this; + } + /** + * .wso2.discovery.api.ChoreoComponentInfo choreoComponentInfo = 25; + */ + public Builder setChoreoComponentInfo( + org.wso2.choreo.connect.discovery.api.ChoreoComponentInfo.Builder builderForValue) { + if (choreoComponentInfoBuilder_ == null) { + choreoComponentInfo_ = builderForValue.build(); + onChanged(); + } else { + choreoComponentInfoBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * .wso2.discovery.api.ChoreoComponentInfo choreoComponentInfo = 25; + */ + public Builder mergeChoreoComponentInfo(org.wso2.choreo.connect.discovery.api.ChoreoComponentInfo value) { + if (choreoComponentInfoBuilder_ == null) { + if (choreoComponentInfo_ != null) { + choreoComponentInfo_ = + org.wso2.choreo.connect.discovery.api.ChoreoComponentInfo.newBuilder(choreoComponentInfo_).mergeFrom(value).buildPartial(); + } else { + choreoComponentInfo_ = value; + } + onChanged(); + } else { + choreoComponentInfoBuilder_.mergeFrom(value); + } + + return this; + } + /** + * .wso2.discovery.api.ChoreoComponentInfo choreoComponentInfo = 25; + */ + public Builder clearChoreoComponentInfo() { + if (choreoComponentInfoBuilder_ == null) { + choreoComponentInfo_ = null; + onChanged(); + } else { + choreoComponentInfo_ = null; + choreoComponentInfoBuilder_ = null; + } + + return this; + } + /** + * .wso2.discovery.api.ChoreoComponentInfo choreoComponentInfo = 25; + */ + public org.wso2.choreo.connect.discovery.api.ChoreoComponentInfo.Builder getChoreoComponentInfoBuilder() { + + onChanged(); + return getChoreoComponentInfoFieldBuilder().getBuilder(); + } + /** + * .wso2.discovery.api.ChoreoComponentInfo choreoComponentInfo = 25; + */ + public org.wso2.choreo.connect.discovery.api.ChoreoComponentInfoOrBuilder getChoreoComponentInfoOrBuilder() { + if (choreoComponentInfoBuilder_ != null) { + return choreoComponentInfoBuilder_.getMessageOrBuilder(); + } else { + return choreoComponentInfo_ == null ? + org.wso2.choreo.connect.discovery.api.ChoreoComponentInfo.getDefaultInstance() : choreoComponentInfo_; + } + } + /** + * .wso2.discovery.api.ChoreoComponentInfo choreoComponentInfo = 25; + */ + private com.google.protobuf.SingleFieldBuilderV3< + org.wso2.choreo.connect.discovery.api.ChoreoComponentInfo, org.wso2.choreo.connect.discovery.api.ChoreoComponentInfo.Builder, org.wso2.choreo.connect.discovery.api.ChoreoComponentInfoOrBuilder> + getChoreoComponentInfoFieldBuilder() { + if (choreoComponentInfoBuilder_ == null) { + choreoComponentInfoBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + org.wso2.choreo.connect.discovery.api.ChoreoComponentInfo, org.wso2.choreo.connect.discovery.api.ChoreoComponentInfo.Builder, org.wso2.choreo.connect.discovery.api.ChoreoComponentInfoOrBuilder>( + getChoreoComponentInfo(), + getParentForChildren(), + isClean()); + choreoComponentInfo_ = null; + } + return choreoComponentInfoBuilder_; + } @java.lang.Override public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { diff --git a/enforcer-parent/enforcer/src/main/gen/org/wso2/choreo/connect/discovery/api/ApiOrBuilder.java b/enforcer-parent/enforcer/src/main/gen/org/wso2/choreo/connect/discovery/api/ApiOrBuilder.java index c883de2fd1..e4be971de3 100644 --- a/enforcer-parent/enforcer/src/main/gen/org/wso2/choreo/connect/discovery/api/ApiOrBuilder.java +++ b/enforcer-parent/enforcer/src/main/gen/org/wso2/choreo/connect/discovery/api/ApiOrBuilder.java @@ -330,4 +330,19 @@ org.wso2.choreo.connect.discovery.api.SecurityListOrBuilder getSecurityOrBuilder * .wso2.discovery.api.BackendJWTConfiguration backendJWTConfiguration = 24; */ org.wso2.choreo.connect.discovery.api.BackendJWTConfigurationOrBuilder getBackendJWTConfigurationOrBuilder(); + + /** + * .wso2.discovery.api.ChoreoComponentInfo choreoComponentInfo = 25; + * @return Whether the choreoComponentInfo field is set. + */ + boolean hasChoreoComponentInfo(); + /** + * .wso2.discovery.api.ChoreoComponentInfo choreoComponentInfo = 25; + * @return The choreoComponentInfo. + */ + org.wso2.choreo.connect.discovery.api.ChoreoComponentInfo getChoreoComponentInfo(); + /** + * .wso2.discovery.api.ChoreoComponentInfo choreoComponentInfo = 25; + */ + org.wso2.choreo.connect.discovery.api.ChoreoComponentInfoOrBuilder getChoreoComponentInfoOrBuilder(); } diff --git a/enforcer-parent/enforcer/src/main/gen/org/wso2/choreo/connect/discovery/api/ApiProto.java b/enforcer-parent/enforcer/src/main/gen/org/wso2/choreo/connect/discovery/api/ApiProto.java index d96b7ffb18..c9c15a9d5f 100644 --- a/enforcer-parent/enforcer/src/main/gen/org/wso2/choreo/connect/discovery/api/ApiProto.java +++ b/enforcer-parent/enforcer/src/main/gen/org/wso2/choreo/connect/discovery/api/ApiProto.java @@ -34,30 +34,33 @@ public static void registerAllExtensions( "ce.proto\032*wso2/discovery/api/endpoint_se" + "curity.proto\032(wso2/discovery/api/securit" + "y_scheme.proto\0322wso2/discovery/api/backe" + - "nd_jwt_configuration.proto\"\226\006\n\003Api\022\n\n\002id" + - "\030\001 \001(\t\022\r\n\005title\030\002 \001(\t\022\017\n\007version\030\003 \001(\t\022\017" + - "\n\007apiType\030\004 \001(\t\022\023\n\013description\030\005 \001(\t\022@\n\023" + - "productionEndpoints\030\006 \001(\0132#.wso2.discove" + - "ry.api.EndpointCluster\022=\n\020sandboxEndpoin" + - "ts\030\007 \001(\0132#.wso2.discovery.api.EndpointCl" + - "uster\022/\n\tresources\030\010 \003(\0132\034.wso2.discover" + - "y.api.Resource\022\020\n\010basePath\030\t \001(\t\022\014\n\004tier" + - "\030\n \001(\t\022\031\n\021apiLifeCycleState\030\013 \001(\t\022:\n\016sec" + - "urityScheme\030\014 \003(\0132\".wso2.discovery.api.S" + - "ecurityScheme\0222\n\010security\030\r \003(\0132 .wso2.d" + - "iscovery.api.SecurityList\022>\n\020endpointSec" + - "urity\030\016 \001(\0132$.wso2.discovery.api.Endpoin" + - "tSecurity\022\033\n\023authorizationHeader\030\017 \001(\t\022\027" + - "\n\017disableSecurity\030\020 \001(\010\022\r\n\005vhost\030\021 \001(\t\022\026" + - "\n\016organizationId\030\022 \001(\t\022\023\n\013apiProvider\030\023 " + - "\001(\t\022\030\n\020enableBackendJWT\030\024 \001(\010\022\026\n\016deploym" + - "entType\030\025 \001(\t\022\025\n\renvironmentId\030\026 \001(\t\022\027\n\017" + - "environmentName\030\027 \001(\t\022L\n\027backendJWTConfi" + - "guration\030\030 \001(\0132+.wso2.discovery.api.Back" + - "endJWTConfigurationBr\n%org.wso2.choreo.c" + - "onnect.discovery.apiB\010ApiProtoP\001Z=github" + - ".com/envoyproxy/go-control-plane/wso2/di" + - "scovery/api;apib\006proto3" + "nd_jwt_configuration.proto\032.wso2/discove" + + "ry/api/choreo_component_info.proto\"\334\006\n\003A" + + "pi\022\n\n\002id\030\001 \001(\t\022\r\n\005title\030\002 \001(\t\022\017\n\007version" + + "\030\003 \001(\t\022\017\n\007apiType\030\004 \001(\t\022\023\n\013description\030\005" + + " \001(\t\022@\n\023productionEndpoints\030\006 \001(\0132#.wso2" + + ".discovery.api.EndpointCluster\022=\n\020sandbo" + + "xEndpoints\030\007 \001(\0132#.wso2.discovery.api.En" + + "dpointCluster\022/\n\tresources\030\010 \003(\0132\034.wso2." + + "discovery.api.Resource\022\020\n\010basePath\030\t \001(\t" + + "\022\014\n\004tier\030\n \001(\t\022\031\n\021apiLifeCycleState\030\013 \001(" + + "\t\022:\n\016securityScheme\030\014 \003(\0132\".wso2.discove" + + "ry.api.SecurityScheme\0222\n\010security\030\r \003(\0132" + + " .wso2.discovery.api.SecurityList\022>\n\020end" + + "pointSecurity\030\016 \001(\0132$.wso2.discovery.api" + + ".EndpointSecurity\022\033\n\023authorizationHeader" + + "\030\017 \001(\t\022\027\n\017disableSecurity\030\020 \001(\010\022\r\n\005vhost" + + "\030\021 \001(\t\022\026\n\016organizationId\030\022 \001(\t\022\023\n\013apiPro" + + "vider\030\023 \001(\t\022\030\n\020enableBackendJWT\030\024 \001(\010\022\026\n" + + "\016deploymentType\030\025 \001(\t\022\025\n\renvironmentId\030\026" + + " \001(\t\022\027\n\017environmentName\030\027 \001(\t\022L\n\027backend" + + "JWTConfiguration\030\030 \001(\0132+.wso2.discovery." + + "api.BackendJWTConfiguration\022D\n\023choreoCom" + + "ponentInfo\030\031 \001(\0132\'.wso2.discovery.api.Ch" + + "oreoComponentInfoBr\n%org.wso2.choreo.con" + + "nect.discovery.apiB\010ApiProtoP\001Z=github.c" + + "om/envoyproxy/go-control-plane/wso2/disc" + + "overy/api;apib\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, @@ -67,18 +70,20 @@ public static void registerAllExtensions( org.wso2.choreo.connect.discovery.api.EndpointSecurityProto.getDescriptor(), org.wso2.choreo.connect.discovery.api.SecuritySchemeProto.getDescriptor(), org.wso2.choreo.connect.discovery.api.BackendJWTConfigurationProto.getDescriptor(), + org.wso2.choreo.connect.discovery.api.ChoreoComponentInfoProto.getDescriptor(), }); internal_static_wso2_discovery_api_Api_descriptor = getDescriptor().getMessageTypes().get(0); internal_static_wso2_discovery_api_Api_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_wso2_discovery_api_Api_descriptor, - new java.lang.String[] { "Id", "Title", "Version", "ApiType", "Description", "ProductionEndpoints", "SandboxEndpoints", "Resources", "BasePath", "Tier", "ApiLifeCycleState", "SecurityScheme", "Security", "EndpointSecurity", "AuthorizationHeader", "DisableSecurity", "Vhost", "OrganizationId", "ApiProvider", "EnableBackendJWT", "DeploymentType", "EnvironmentId", "EnvironmentName", "BackendJWTConfiguration", }); + new java.lang.String[] { "Id", "Title", "Version", "ApiType", "Description", "ProductionEndpoints", "SandboxEndpoints", "Resources", "BasePath", "Tier", "ApiLifeCycleState", "SecurityScheme", "Security", "EndpointSecurity", "AuthorizationHeader", "DisableSecurity", "Vhost", "OrganizationId", "ApiProvider", "EnableBackendJWT", "DeploymentType", "EnvironmentId", "EnvironmentName", "BackendJWTConfiguration", "ChoreoComponentInfo", }); org.wso2.choreo.connect.discovery.api.EndpointClusterProto.getDescriptor(); org.wso2.choreo.connect.discovery.api.ResourceProto.getDescriptor(); org.wso2.choreo.connect.discovery.api.EndpointSecurityProto.getDescriptor(); org.wso2.choreo.connect.discovery.api.SecuritySchemeProto.getDescriptor(); org.wso2.choreo.connect.discovery.api.BackendJWTConfigurationProto.getDescriptor(); + org.wso2.choreo.connect.discovery.api.ChoreoComponentInfoProto.getDescriptor(); } // @@protoc_insertion_point(outer_class_scope) diff --git a/enforcer-parent/enforcer/src/main/gen/org/wso2/choreo/connect/discovery/api/ChoreoComponentInfo.java b/enforcer-parent/enforcer/src/main/gen/org/wso2/choreo/connect/discovery/api/ChoreoComponentInfo.java new file mode 100644 index 0000000000..c174c2e7c0 --- /dev/null +++ b/enforcer-parent/enforcer/src/main/gen/org/wso2/choreo/connect/discovery/api/ChoreoComponentInfo.java @@ -0,0 +1,971 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: wso2/discovery/api/choreo_component_info.proto + +package org.wso2.choreo.connect.discovery.api; + +/** + * Protobuf type {@code wso2.discovery.api.ChoreoComponentInfo} + */ +public final class ChoreoComponentInfo extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:wso2.discovery.api.ChoreoComponentInfo) + ChoreoComponentInfoOrBuilder { +private static final long serialVersionUID = 0L; + // Use ChoreoComponentInfo.newBuilder() to construct. + private ChoreoComponentInfo(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private ChoreoComponentInfo() { + organizationID_ = ""; + projectID_ = ""; + componentID_ = ""; + versionID_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new ChoreoComponentInfo(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private ChoreoComponentInfo( + 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(); + + organizationID_ = s; + break; + } + case 18: { + java.lang.String s = input.readStringRequireUtf8(); + + projectID_ = s; + break; + } + case 26: { + java.lang.String s = input.readStringRequireUtf8(); + + componentID_ = s; + break; + } + case 34: { + java.lang.String s = input.readStringRequireUtf8(); + + versionID_ = 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.choreo.connect.discovery.api.ChoreoComponentInfoProto.internal_static_wso2_discovery_api_ChoreoComponentInfo_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.wso2.choreo.connect.discovery.api.ChoreoComponentInfoProto.internal_static_wso2_discovery_api_ChoreoComponentInfo_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.wso2.choreo.connect.discovery.api.ChoreoComponentInfo.class, org.wso2.choreo.connect.discovery.api.ChoreoComponentInfo.Builder.class); + } + + public static final int ORGANIZATIONID_FIELD_NUMBER = 1; + private volatile java.lang.Object organizationID_; + /** + * string OrganizationID = 1; + * @return The organizationID. + */ + @java.lang.Override + public java.lang.String getOrganizationID() { + java.lang.Object ref = organizationID_; + 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(); + organizationID_ = s; + return s; + } + } + /** + * string OrganizationID = 1; + * @return The bytes for organizationID. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getOrganizationIDBytes() { + java.lang.Object ref = organizationID_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + organizationID_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PROJECTID_FIELD_NUMBER = 2; + private volatile java.lang.Object projectID_; + /** + * string ProjectID = 2; + * @return The projectID. + */ + @java.lang.Override + public java.lang.String getProjectID() { + java.lang.Object ref = projectID_; + 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(); + projectID_ = s; + return s; + } + } + /** + * string ProjectID = 2; + * @return The bytes for projectID. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getProjectIDBytes() { + java.lang.Object ref = projectID_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + projectID_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int COMPONENTID_FIELD_NUMBER = 3; + private volatile java.lang.Object componentID_; + /** + * string ComponentID = 3; + * @return The componentID. + */ + @java.lang.Override + public java.lang.String getComponentID() { + java.lang.Object ref = componentID_; + 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(); + componentID_ = s; + return s; + } + } + /** + * string ComponentID = 3; + * @return The bytes for componentID. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getComponentIDBytes() { + java.lang.Object ref = componentID_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + componentID_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int VERSIONID_FIELD_NUMBER = 4; + private volatile java.lang.Object versionID_; + /** + * string VersionID = 4; + * @return The versionID. + */ + @java.lang.Override + public java.lang.String getVersionID() { + java.lang.Object ref = versionID_; + 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(); + versionID_ = s; + return s; + } + } + /** + * string VersionID = 4; + * @return The bytes for versionID. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getVersionIDBytes() { + java.lang.Object ref = versionID_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + versionID_ = 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 (!getOrganizationIDBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, organizationID_); + } + if (!getProjectIDBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, projectID_); + } + if (!getComponentIDBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, componentID_); + } + if (!getVersionIDBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 4, versionID_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getOrganizationIDBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, organizationID_); + } + if (!getProjectIDBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, projectID_); + } + if (!getComponentIDBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, componentID_); + } + if (!getVersionIDBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, versionID_); + } + 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.choreo.connect.discovery.api.ChoreoComponentInfo)) { + return super.equals(obj); + } + org.wso2.choreo.connect.discovery.api.ChoreoComponentInfo other = (org.wso2.choreo.connect.discovery.api.ChoreoComponentInfo) obj; + + if (!getOrganizationID() + .equals(other.getOrganizationID())) return false; + if (!getProjectID() + .equals(other.getProjectID())) return false; + if (!getComponentID() + .equals(other.getComponentID())) return false; + if (!getVersionID() + .equals(other.getVersionID())) 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) + ORGANIZATIONID_FIELD_NUMBER; + hash = (53 * hash) + getOrganizationID().hashCode(); + hash = (37 * hash) + PROJECTID_FIELD_NUMBER; + hash = (53 * hash) + getProjectID().hashCode(); + hash = (37 * hash) + COMPONENTID_FIELD_NUMBER; + hash = (53 * hash) + getComponentID().hashCode(); + hash = (37 * hash) + VERSIONID_FIELD_NUMBER; + hash = (53 * hash) + getVersionID().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.wso2.choreo.connect.discovery.api.ChoreoComponentInfo parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.wso2.choreo.connect.discovery.api.ChoreoComponentInfo parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.wso2.choreo.connect.discovery.api.ChoreoComponentInfo parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.wso2.choreo.connect.discovery.api.ChoreoComponentInfo 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.choreo.connect.discovery.api.ChoreoComponentInfo parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.wso2.choreo.connect.discovery.api.ChoreoComponentInfo parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.wso2.choreo.connect.discovery.api.ChoreoComponentInfo parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.wso2.choreo.connect.discovery.api.ChoreoComponentInfo 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.choreo.connect.discovery.api.ChoreoComponentInfo parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static org.wso2.choreo.connect.discovery.api.ChoreoComponentInfo 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.choreo.connect.discovery.api.ChoreoComponentInfo parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.wso2.choreo.connect.discovery.api.ChoreoComponentInfo 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.choreo.connect.discovery.api.ChoreoComponentInfo 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 wso2.discovery.api.ChoreoComponentInfo} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:wso2.discovery.api.ChoreoComponentInfo) + org.wso2.choreo.connect.discovery.api.ChoreoComponentInfoOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.wso2.choreo.connect.discovery.api.ChoreoComponentInfoProto.internal_static_wso2_discovery_api_ChoreoComponentInfo_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.wso2.choreo.connect.discovery.api.ChoreoComponentInfoProto.internal_static_wso2_discovery_api_ChoreoComponentInfo_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.wso2.choreo.connect.discovery.api.ChoreoComponentInfo.class, org.wso2.choreo.connect.discovery.api.ChoreoComponentInfo.Builder.class); + } + + // Construct using org.wso2.choreo.connect.discovery.api.ChoreoComponentInfo.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(); + organizationID_ = ""; + + projectID_ = ""; + + componentID_ = ""; + + versionID_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.wso2.choreo.connect.discovery.api.ChoreoComponentInfoProto.internal_static_wso2_discovery_api_ChoreoComponentInfo_descriptor; + } + + @java.lang.Override + public org.wso2.choreo.connect.discovery.api.ChoreoComponentInfo getDefaultInstanceForType() { + return org.wso2.choreo.connect.discovery.api.ChoreoComponentInfo.getDefaultInstance(); + } + + @java.lang.Override + public org.wso2.choreo.connect.discovery.api.ChoreoComponentInfo build() { + org.wso2.choreo.connect.discovery.api.ChoreoComponentInfo result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.wso2.choreo.connect.discovery.api.ChoreoComponentInfo buildPartial() { + org.wso2.choreo.connect.discovery.api.ChoreoComponentInfo result = new org.wso2.choreo.connect.discovery.api.ChoreoComponentInfo(this); + result.organizationID_ = organizationID_; + result.projectID_ = projectID_; + result.componentID_ = componentID_; + result.versionID_ = versionID_; + 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.choreo.connect.discovery.api.ChoreoComponentInfo) { + return mergeFrom((org.wso2.choreo.connect.discovery.api.ChoreoComponentInfo)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.wso2.choreo.connect.discovery.api.ChoreoComponentInfo other) { + if (other == org.wso2.choreo.connect.discovery.api.ChoreoComponentInfo.getDefaultInstance()) return this; + if (!other.getOrganizationID().isEmpty()) { + organizationID_ = other.organizationID_; + onChanged(); + } + if (!other.getProjectID().isEmpty()) { + projectID_ = other.projectID_; + onChanged(); + } + if (!other.getComponentID().isEmpty()) { + componentID_ = other.componentID_; + onChanged(); + } + if (!other.getVersionID().isEmpty()) { + versionID_ = other.versionID_; + 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.choreo.connect.discovery.api.ChoreoComponentInfo parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.wso2.choreo.connect.discovery.api.ChoreoComponentInfo) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object organizationID_ = ""; + /** + * string OrganizationID = 1; + * @return The organizationID. + */ + public java.lang.String getOrganizationID() { + java.lang.Object ref = organizationID_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + organizationID_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string OrganizationID = 1; + * @return The bytes for organizationID. + */ + public com.google.protobuf.ByteString + getOrganizationIDBytes() { + java.lang.Object ref = organizationID_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + organizationID_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string OrganizationID = 1; + * @param value The organizationID to set. + * @return This builder for chaining. + */ + public Builder setOrganizationID( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + organizationID_ = value; + onChanged(); + return this; + } + /** + * string OrganizationID = 1; + * @return This builder for chaining. + */ + public Builder clearOrganizationID() { + + organizationID_ = getDefaultInstance().getOrganizationID(); + onChanged(); + return this; + } + /** + * string OrganizationID = 1; + * @param value The bytes for organizationID to set. + * @return This builder for chaining. + */ + public Builder setOrganizationIDBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + organizationID_ = value; + onChanged(); + return this; + } + + private java.lang.Object projectID_ = ""; + /** + * string ProjectID = 2; + * @return The projectID. + */ + public java.lang.String getProjectID() { + java.lang.Object ref = projectID_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + projectID_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string ProjectID = 2; + * @return The bytes for projectID. + */ + public com.google.protobuf.ByteString + getProjectIDBytes() { + java.lang.Object ref = projectID_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + projectID_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string ProjectID = 2; + * @param value The projectID to set. + * @return This builder for chaining. + */ + public Builder setProjectID( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + projectID_ = value; + onChanged(); + return this; + } + /** + * string ProjectID = 2; + * @return This builder for chaining. + */ + public Builder clearProjectID() { + + projectID_ = getDefaultInstance().getProjectID(); + onChanged(); + return this; + } + /** + * string ProjectID = 2; + * @param value The bytes for projectID to set. + * @return This builder for chaining. + */ + public Builder setProjectIDBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + projectID_ = value; + onChanged(); + return this; + } + + private java.lang.Object componentID_ = ""; + /** + * string ComponentID = 3; + * @return The componentID. + */ + public java.lang.String getComponentID() { + java.lang.Object ref = componentID_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + componentID_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string ComponentID = 3; + * @return The bytes for componentID. + */ + public com.google.protobuf.ByteString + getComponentIDBytes() { + java.lang.Object ref = componentID_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + componentID_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string ComponentID = 3; + * @param value The componentID to set. + * @return This builder for chaining. + */ + public Builder setComponentID( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + componentID_ = value; + onChanged(); + return this; + } + /** + * string ComponentID = 3; + * @return This builder for chaining. + */ + public Builder clearComponentID() { + + componentID_ = getDefaultInstance().getComponentID(); + onChanged(); + return this; + } + /** + * string ComponentID = 3; + * @param value The bytes for componentID to set. + * @return This builder for chaining. + */ + public Builder setComponentIDBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + componentID_ = value; + onChanged(); + return this; + } + + private java.lang.Object versionID_ = ""; + /** + * string VersionID = 4; + * @return The versionID. + */ + public java.lang.String getVersionID() { + java.lang.Object ref = versionID_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + versionID_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string VersionID = 4; + * @return The bytes for versionID. + */ + public com.google.protobuf.ByteString + getVersionIDBytes() { + java.lang.Object ref = versionID_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + versionID_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string VersionID = 4; + * @param value The versionID to set. + * @return This builder for chaining. + */ + public Builder setVersionID( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + versionID_ = value; + onChanged(); + return this; + } + /** + * string VersionID = 4; + * @return This builder for chaining. + */ + public Builder clearVersionID() { + + versionID_ = getDefaultInstance().getVersionID(); + onChanged(); + return this; + } + /** + * string VersionID = 4; + * @param value The bytes for versionID to set. + * @return This builder for chaining. + */ + public Builder setVersionIDBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + versionID_ = 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.ChoreoComponentInfo) + } + + // @@protoc_insertion_point(class_scope:wso2.discovery.api.ChoreoComponentInfo) + private static final org.wso2.choreo.connect.discovery.api.ChoreoComponentInfo DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.wso2.choreo.connect.discovery.api.ChoreoComponentInfo(); + } + + public static org.wso2.choreo.connect.discovery.api.ChoreoComponentInfo getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ChoreoComponentInfo parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ChoreoComponentInfo(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.choreo.connect.discovery.api.ChoreoComponentInfo getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/enforcer-parent/enforcer/src/main/gen/org/wso2/choreo/connect/discovery/api/ChoreoComponentInfoOrBuilder.java b/enforcer-parent/enforcer/src/main/gen/org/wso2/choreo/connect/discovery/api/ChoreoComponentInfoOrBuilder.java new file mode 100644 index 0000000000..4f3f2a4a9f --- /dev/null +++ b/enforcer-parent/enforcer/src/main/gen/org/wso2/choreo/connect/discovery/api/ChoreoComponentInfoOrBuilder.java @@ -0,0 +1,57 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: wso2/discovery/api/choreo_component_info.proto + +package org.wso2.choreo.connect.discovery.api; + +public interface ChoreoComponentInfoOrBuilder extends + // @@protoc_insertion_point(interface_extends:wso2.discovery.api.ChoreoComponentInfo) + com.google.protobuf.MessageOrBuilder { + + /** + * string OrganizationID = 1; + * @return The organizationID. + */ + java.lang.String getOrganizationID(); + /** + * string OrganizationID = 1; + * @return The bytes for organizationID. + */ + com.google.protobuf.ByteString + getOrganizationIDBytes(); + + /** + * string ProjectID = 2; + * @return The projectID. + */ + java.lang.String getProjectID(); + /** + * string ProjectID = 2; + * @return The bytes for projectID. + */ + com.google.protobuf.ByteString + getProjectIDBytes(); + + /** + * string ComponentID = 3; + * @return The componentID. + */ + java.lang.String getComponentID(); + /** + * string ComponentID = 3; + * @return The bytes for componentID. + */ + com.google.protobuf.ByteString + getComponentIDBytes(); + + /** + * string VersionID = 4; + * @return The versionID. + */ + java.lang.String getVersionID(); + /** + * string VersionID = 4; + * @return The bytes for versionID. + */ + com.google.protobuf.ByteString + getVersionIDBytes(); +} diff --git a/enforcer-parent/enforcer/src/main/gen/org/wso2/choreo/connect/discovery/api/ChoreoComponentInfoProto.java b/enforcer-parent/enforcer/src/main/gen/org/wso2/choreo/connect/discovery/api/ChoreoComponentInfoProto.java new file mode 100644 index 0000000000..f111f22f7d --- /dev/null +++ b/enforcer-parent/enforcer/src/main/gen/org/wso2/choreo/connect/discovery/api/ChoreoComponentInfoProto.java @@ -0,0 +1,53 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: wso2/discovery/api/choreo_component_info.proto + +package org.wso2.choreo.connect.discovery.api; + +public final class ChoreoComponentInfoProto { + private ChoreoComponentInfoProto() {} + 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_ChoreoComponentInfo_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_wso2_discovery_api_ChoreoComponentInfo_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/choreo_component_in" + + "fo.proto\022\022wso2.discovery.api\"h\n\023ChoreoCo" + + "mponentInfo\022\026\n\016OrganizationID\030\001 \001(\t\022\021\n\tP" + + "rojectID\030\002 \001(\t\022\023\n\013ComponentID\030\003 \001(\t\022\021\n\tV" + + "ersionID\030\004 \001(\tB\202\001\n%org.wso2.choreo.conne" + + "ct.discovery.apiB\030ChoreoComponentInfoPro" + + "toP\001Z=github.com/envoyproxy/go-control-p" + + "lane/wso2/discovery/api;apib\006proto3" + }; + descriptor = com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + }); + internal_static_wso2_discovery_api_ChoreoComponentInfo_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_wso2_discovery_api_ChoreoComponentInfo_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_wso2_discovery_api_ChoreoComponentInfo_descriptor, + new java.lang.String[] { "OrganizationID", "ProjectID", "ComponentID", "VersionID", }); + } + + // @@protoc_insertion_point(outer_class_scope) +} From 381a5dd9543176d2da3e4769f1479e429d72e4e7 Mon Sep 17 00:00:00 2001 From: ruks Date: Mon, 7 Oct 2024 10:27:15 +0530 Subject: [PATCH 4/6] Adding header --- .../discovery/api/choreo_component_info.pb.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/adapter/pkg/discovery/api/wso2/discovery/api/choreo_component_info.pb.go b/adapter/pkg/discovery/api/wso2/discovery/api/choreo_component_info.pb.go index 721486adf0..3dc784dcb0 100644 --- a/adapter/pkg/discovery/api/wso2/discovery/api/choreo_component_info.pb.go +++ b/adapter/pkg/discovery/api/wso2/discovery/api/choreo_component_info.pb.go @@ -1,3 +1,19 @@ +// Copyright (c) 2024, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. +// +// WSO2 Inc. 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. + // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.25.0-devel From de0ccbeb67148902d6d15693757f30a623ab381b Mon Sep 17 00:00:00 2001 From: ruks Date: Wed, 9 Oct 2024 10:49:58 +0530 Subject: [PATCH 5/6] Fixed review suggestions --- .../internal/oasparser/config_generator.go | 11 +-- .../oasparser/envoyconf/access_loggers.go | 71 +++++++++---------- .../commons/model/ChoreoComponentInfo.java | 18 +++++ 3 files changed, 56 insertions(+), 44 deletions(-) diff --git a/adapter/internal/oasparser/config_generator.go b/adapter/internal/oasparser/config_generator.go index f4289e5065..70488a56c2 100644 --- a/adapter/internal/oasparser/config_generator.go +++ b/adapter/internal/oasparser/config_generator.go @@ -196,11 +196,12 @@ func GetEnforcerAPI(mgwSwagger model.MgwSwagger, lifeCycleState string, vhost st } } - choreoComponentInfo := &api.ChoreoComponentInfo{ - ComponentID: mgwSwagger.ChoreoComponentInfo.ComponentID, - VersionID: mgwSwagger.ChoreoComponentInfo.VersionID, - OrganizationID: mgwSwagger.ChoreoComponentInfo.OrganizationID, - ProjectID: mgwSwagger.ChoreoComponentInfo.ProjectID, + choreoComponentInfo := &api.ChoreoComponentInfo{} + if mgwSwagger.ChoreoComponentInfo != nil { + choreoComponentInfo.ComponentID = mgwSwagger.ChoreoComponentInfo.ComponentID + choreoComponentInfo.VersionID = mgwSwagger.ChoreoComponentInfo.VersionID + choreoComponentInfo.OrganizationID = mgwSwagger.ChoreoComponentInfo.OrganizationID + choreoComponentInfo.ProjectID = mgwSwagger.ChoreoComponentInfo.ProjectID } return &api.Api{ diff --git a/adapter/internal/oasparser/envoyconf/access_loggers.go b/adapter/internal/oasparser/envoyconf/access_loggers.go index 0f994a7d53..745379f2ea 100644 --- a/adapter/internal/oasparser/envoyconf/access_loggers.go +++ b/adapter/internal/oasparser/envoyconf/access_loggers.go @@ -36,18 +36,9 @@ import ( "google.golang.org/protobuf/types/known/wrapperspb" ) -// getAccessLogConfigs provides file access log configurations for envoy -func getInsightsAccessLogConfigs() *config_access_logv3.AccessLog { - var logFormat *file_accesslogv3.FileAccessLog_LogFormat - logpath := defaultAccessLogPath //default access log path - - logConf := config.ReadLogConfigs() - - if !logConf.InsightsLogs.Enable { - return nil - } - - formatters := []*corev3.TypedExtensionConfig{ +// getAccessLogConfigs provides default formatters +func getDefaultFormatters() []*corev3.TypedExtensionConfig { + return []*corev3.TypedExtensionConfig{ { Name: "envoy.formatter.req_without_query", TypedConfig: &anypb.Any{ @@ -55,20 +46,42 @@ func getInsightsAccessLogConfigs() *config_access_logv3.AccessLog { }, }, } - // Set the default log format - logFormat = &file_accesslogv3.FileAccessLog_LogFormat{ +} + +// getDefaultTextLogFormat provides default text log format +func getDefaultTextLogFormat() *file_accesslogv3.FileAccessLog_LogFormat { + logConf := config.ReadLogConfigs() + + formatters := getDefaultFormatters() + + return &file_accesslogv3.FileAccessLog_LogFormat{ LogFormat: &corev3.SubstitutionFormatString{ Format: &corev3.SubstitutionFormatString_TextFormatSource{ TextFormatSource: &corev3.DataSource{ Specifier: &corev3.DataSource_InlineString{ - InlineString: logConf.InsightsLogs.LoggingFormat, + InlineString: logConf.AccessLogs.ReservedLogFormat + + strings.TrimLeft(logConf.AccessLogs.SecondaryLogFormat, "'") + "\n", }, }, }, - OmitEmptyValues: logConf.InsightsLogs.OmitEmptyValues, - Formatters: formatters, + Formatters: formatters, }, } +} + +// getAccessLogConfigs provides file access log configurations for envoy +func getInsightsAccessLogConfigs() *config_access_logv3.AccessLog { + var logFormat *file_accesslogv3.FileAccessLog_LogFormat + logpath := defaultAccessLogPath //default access log path + + logConf := config.ReadLogConfigs() + + if !logConf.InsightsLogs.Enable { + return nil + } + + // Set the default log format + logFormat = getDefaultTextLogFormat() logpath = logConf.InsightsLogs.LogFile accessLogConf := &file_accesslogv3.FileAccessLog{ @@ -105,28 +118,8 @@ func getFileAccessLogConfigs() *config_access_logv3.AccessLog { return nil } - formatters := []*corev3.TypedExtensionConfig{ - { - Name: "envoy.formatter.req_without_query", - TypedConfig: &anypb.Any{ - TypeUrl: "type.googleapis.com/envoy.extensions.formatter.req_without_query.v3.ReqWithoutQuery", - }, - }, - } // Set the default log format - logFormat = &file_accesslogv3.FileAccessLog_LogFormat{ - LogFormat: &corev3.SubstitutionFormatString{ - Format: &corev3.SubstitutionFormatString_TextFormatSource{ - TextFormatSource: &corev3.DataSource{ - Specifier: &corev3.DataSource_InlineString{ - InlineString: logConf.AccessLogs.ReservedLogFormat + - strings.TrimLeft(logConf.AccessLogs.SecondaryLogFormat, "'") + "\n", - }, - }, - }, - Formatters: formatters, - }, - } + logFormat = getDefaultTextLogFormat() // Configure the log format based on the log type switch logConf.AccessLogs.LogType { @@ -152,7 +145,7 @@ func getFileAccessLogConfigs() *config_access_logv3.AccessLog { Fields: logFields, }, }, - Formatters: formatters, + Formatters: getDefaultFormatters(), }, } logger.LoggerOasparser.Debug("Access log type is set to json.") diff --git a/enforcer-parent/commons/src/main/java/org/wso2/choreo/connect/enforcer/commons/model/ChoreoComponentInfo.java b/enforcer-parent/commons/src/main/java/org/wso2/choreo/connect/enforcer/commons/model/ChoreoComponentInfo.java index 9fae9ea82c..ab56d6181d 100644 --- a/enforcer-parent/commons/src/main/java/org/wso2/choreo/connect/enforcer/commons/model/ChoreoComponentInfo.java +++ b/enforcer-parent/commons/src/main/java/org/wso2/choreo/connect/enforcer/commons/model/ChoreoComponentInfo.java @@ -1,3 +1,21 @@ +/* + * Copyright (c) 2024, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. 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.choreo.connect.enforcer.commons.model; /** From 366be3ee12668baebce3365c3d539ffffb5791b9 Mon Sep 17 00:00:00 2001 From: ruks Date: Wed, 9 Oct 2024 11:21:12 +0530 Subject: [PATCH 6/6] Fixed logging format issue --- .../internal/oasparser/envoyconf/access_loggers.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/adapter/internal/oasparser/envoyconf/access_loggers.go b/adapter/internal/oasparser/envoyconf/access_loggers.go index 745379f2ea..8a1af5cd73 100644 --- a/adapter/internal/oasparser/envoyconf/access_loggers.go +++ b/adapter/internal/oasparser/envoyconf/access_loggers.go @@ -49,9 +49,7 @@ func getDefaultFormatters() []*corev3.TypedExtensionConfig { } // getDefaultTextLogFormat provides default text log format -func getDefaultTextLogFormat() *file_accesslogv3.FileAccessLog_LogFormat { - logConf := config.ReadLogConfigs() - +func getDefaultTextLogFormat(loggingFormat string) *file_accesslogv3.FileAccessLog_LogFormat { formatters := getDefaultFormatters() return &file_accesslogv3.FileAccessLog_LogFormat{ @@ -59,8 +57,7 @@ func getDefaultTextLogFormat() *file_accesslogv3.FileAccessLog_LogFormat { Format: &corev3.SubstitutionFormatString_TextFormatSource{ TextFormatSource: &corev3.DataSource{ Specifier: &corev3.DataSource_InlineString{ - InlineString: logConf.AccessLogs.ReservedLogFormat + - strings.TrimLeft(logConf.AccessLogs.SecondaryLogFormat, "'") + "\n", + InlineString: loggingFormat, }, }, }, @@ -81,7 +78,8 @@ func getInsightsAccessLogConfigs() *config_access_logv3.AccessLog { } // Set the default log format - logFormat = getDefaultTextLogFormat() + loggingFormat := logConf.InsightsLogs.LoggingFormat + "\n" + logFormat = getDefaultTextLogFormat(loggingFormat) logpath = logConf.InsightsLogs.LogFile accessLogConf := &file_accesslogv3.FileAccessLog{ @@ -119,7 +117,9 @@ func getFileAccessLogConfigs() *config_access_logv3.AccessLog { } // Set the default log format - logFormat = getDefaultTextLogFormat() + loggingFormat := logConf.AccessLogs.ReservedLogFormat + + strings.TrimLeft(logConf.AccessLogs.SecondaryLogFormat, "'") + "\n" + logFormat = getDefaultTextLogFormat(loggingFormat) // Configure the log format based on the log type switch logConf.AccessLogs.LogType {