github.com/argoproj/argo-events@v1.9.1/eventsources/sources/gerrit/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 gerrit 18 19 import ( 20 "github.com/andygrunwald/go-gerrit" 21 22 "github.com/argoproj/argo-events/eventsources/common/webhook" 23 "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 GerritEventSource v1alpha1.GerritEventSource 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.GerritEvent 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 // gerritClient is the client to connect to Gerrit 56 gerritClient *gerrit.Client 57 // gerritClient is the client to connect to Gerrit 58 gerritHookService *gerritWebhookService 59 // project -> hook 60 projectHooks map[string]string 61 // gerritEventSource is the event source that contains configuration necessary to consume events from Gerrit 62 gerritEventSource *v1alpha1.GerritEventSource 63 } 64 65 // ProjectHookConfigs is the config for gerrit project 66 // Ref: https://gerrit.googlesource.com/plugins/webhooks/+doc/master/src/main/resources/Documentation/config.md 67 type ProjectHookConfigs struct { 68 // URL: Address of the remote server to post events to 69 URL string `json:"url,omitempty"` 70 // Events: 71 // Type of the event which will be posted to the remote url. Multiple event types can be specified, listing event types which should be posted. 72 // When no event type is configured, all events will be posted. 73 Events []string `json:"events,omitempty"` 74 // ConnectionTimeout: 75 // Maximum interval of time in milliseconds the plugin waits for a connection to the target instance. 76 // When not specified, the default value is derrived from global configuration. 77 ConnectionTimeout string `json:"connectionTimeout,omitempty"` 78 // SocketTimeout: 79 // Maximum interval of time in milliseconds the plugin waits for a response from the target instance once the connection has been established. 80 // When not specified, the default value is derrived from global configuration. 81 SocketTimeout string `json:"socketTimeout,omitempty"` 82 // MaxTries: 83 // Maximum number of times the plugin should attempt when posting an event to the target url. Setting this value to 0 will disable retries. 84 // When not specified, the default value is derrived from global configuration. 85 MaxTries string `json:"maxTries,omitempty"` 86 // RetryInterval: 87 // The interval of time in milliseconds between the subsequent auto-retries. 88 // When not specified, the default value is derrived from global configuration. 89 RetryInterval string `json:"retryInterval,omitempty"` 90 // SslVerify: 91 // When 'true' SSL certificate verification of remote url is performed when payload is delivered, the default value is derived from global configuration. 92 SslVerify bool `json:"sslVerify,omitempty"` 93 }