github.com/argoproj/argo-events@v1.9.1/eventsources/sources/gitlab/types.go (about) 1 /* 2 Copyright 2018 BlackRock, Inc. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package gitlab 18 19 import ( 20 "github.com/xanzy/go-gitlab" 21 22 "github.com/argoproj/argo-events/eventsources/common/webhook" 23 metrics "github.com/argoproj/argo-events/metrics" 24 apicommon "github.com/argoproj/argo-events/pkg/apis/common" 25 "github.com/argoproj/argo-events/pkg/apis/eventsource/v1alpha1" 26 ) 27 28 // EventListener implements ConfigExecutor 29 type EventListener struct { 30 EventSourceName string 31 EventName string 32 GitlabEventSource v1alpha1.GitlabEventSource 33 Metrics *metrics.Metrics 34 } 35 36 // GetEventSourceName returns name of event source 37 func (el *EventListener) GetEventSourceName() string { 38 return el.EventSourceName 39 } 40 41 // GetEventName returns name of event 42 func (el *EventListener) GetEventName() string { 43 return el.EventName 44 } 45 46 // GetEventSourceType return type of event server 47 func (el *EventListener) GetEventSourceType() apicommon.EventSourceType { 48 return apicommon.GitlabEvent 49 } 50 51 // Router contains the configuration information for a route 52 type Router struct { 53 // route contains information about a API endpoint 54 route *webhook.Route 55 // gitlabClient is the client to connect to GitLab 56 gitlabClient *gitlab.Client 57 // projectID -> hook ID 58 projectHookIDs map[string]int 59 // groupID -> hook ID 60 groupHookIDs map[string]int 61 // gitlabEventSource is the event source that contains configuration necessary to consume events from GitLab 62 gitlabEventSource *v1alpha1.GitlabEventSource 63 // gitlab webhook secret token 64 secretToken string 65 }