github.com/argoproj/argo-events@v1.9.1/pkg/apis/eventsource/v1alpha1/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 v1alpha1 18 19 import ( 20 corev1 "k8s.io/api/core/v1" 21 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 22 23 apicommon "github.com/argoproj/argo-events/pkg/apis/common" 24 ) 25 26 // EventSource is the definition of a eventsource resource 27 // +genclient 28 // +kubebuilder:resource:shortName=es 29 // +kubebuilder:subresource:status 30 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 31 // +k8s:openapi-gen=true 32 type EventSource struct { 33 metav1.TypeMeta `json:",inline"` 34 metav1.ObjectMeta `json:"metadata" protobuf:"bytes,1,opt,name=metadata"` 35 Spec EventSourceSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"` 36 // +optional 37 Status EventSourceStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` 38 } 39 40 // EventSourceList is the list of eventsource resources 41 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 42 type EventSourceList struct { 43 metav1.TypeMeta `json:",inline"` 44 metav1.ListMeta `json:"metadata" protobuf:"bytes,1,opt,name=metadata"` 45 46 Items []EventSource `json:"items" protobuf:"bytes,2,rep,name=items"` 47 } 48 49 type EventSourceFilter struct { 50 Expression string `json:"expression,omitempty" protobuf:"bytes,1,opt,name=expression"` 51 } 52 53 // EventSourceSpec refers to specification of event-source resource 54 type EventSourceSpec struct { 55 // EventBusName references to a EventBus name. By default the value is "default" 56 EventBusName string `json:"eventBusName,omitempty" protobuf:"bytes,1,opt,name=eventBusName"` 57 // Template is the pod specification for the event source 58 // +optional 59 Template *Template `json:"template,omitempty" protobuf:"bytes,2,opt,name=template"` 60 // Service is the specifications of the service to expose the event source 61 // +optional 62 Service *Service `json:"service,omitempty" protobuf:"bytes,3,opt,name=service"` 63 // Minio event sources 64 Minio map[string]apicommon.S3Artifact `json:"minio,omitempty" protobuf:"bytes,4,rep,name=minio"` 65 // Calendar event sources 66 Calendar map[string]CalendarEventSource `json:"calendar,omitempty" protobuf:"bytes,5,rep,name=calendar"` 67 // File event sources 68 File map[string]FileEventSource `json:"file,omitempty" protobuf:"bytes,6,rep,name=file"` 69 // Resource event sources 70 Resource map[string]ResourceEventSource `json:"resource,omitempty" protobuf:"bytes,7,rep,name=resource"` 71 // Webhook event sources 72 Webhook map[string]WebhookEventSource `json:"webhook,omitempty" protobuf:"bytes,8,rep,name=webhook"` 73 // AMQP event sources 74 AMQP map[string]AMQPEventSource `json:"amqp,omitempty" protobuf:"bytes,9,rep,name=amqp"` 75 // Kafka event sources 76 Kafka map[string]KafkaEventSource `json:"kafka,omitempty" protobuf:"bytes,10,rep,name=kafka"` 77 // MQTT event sources 78 MQTT map[string]MQTTEventSource `json:"mqtt,omitempty" protobuf:"bytes,11,rep,name=mqtt"` 79 // NATS event sources 80 NATS map[string]NATSEventsSource `json:"nats,omitempty" protobuf:"bytes,12,rep,name=nats"` 81 // SNS event sources 82 SNS map[string]SNSEventSource `json:"sns,omitempty" protobuf:"bytes,13,rep,name=sns"` 83 // SQS event sources 84 SQS map[string]SQSEventSource `json:"sqs,omitempty" protobuf:"bytes,14,rep,name=sqs"` 85 // PubSub event sources 86 PubSub map[string]PubSubEventSource `json:"pubSub,omitempty" protobuf:"bytes,15,rep,name=pubSub"` 87 // Github event sources 88 Github map[string]GithubEventSource `json:"github,omitempty" protobuf:"bytes,16,rep,name=github"` 89 // Gitlab event sources 90 Gitlab map[string]GitlabEventSource `json:"gitlab,omitempty" protobuf:"bytes,17,rep,name=gitlab"` 91 // HDFS event sources 92 HDFS map[string]HDFSEventSource `json:"hdfs,omitempty" protobuf:"bytes,18,rep,name=hdfs"` 93 // Slack event sources 94 Slack map[string]SlackEventSource `json:"slack,omitempty" protobuf:"bytes,19,rep,name=slack"` 95 // StorageGrid event sources 96 StorageGrid map[string]StorageGridEventSource `json:"storageGrid,omitempty" protobuf:"bytes,20,rep,name=storageGrid"` 97 // AzureEventsHub event sources 98 AzureEventsHub map[string]AzureEventsHubEventSource `json:"azureEventsHub,omitempty" protobuf:"bytes,21,rep,name=azureEventsHub"` 99 // Stripe event sources 100 Stripe map[string]StripeEventSource `json:"stripe,omitempty" protobuf:"bytes,22,rep,name=stripe"` 101 // Emitter event source 102 Emitter map[string]EmitterEventSource `json:"emitter,omitempty" protobuf:"bytes,23,rep,name=emitter"` 103 // Redis event source 104 Redis map[string]RedisEventSource `json:"redis,omitempty" protobuf:"bytes,24,rep,name=redis"` 105 // NSQ event source 106 NSQ map[string]NSQEventSource `json:"nsq,omitempty" protobuf:"bytes,25,rep,name=nsq"` 107 // Pulsar event source 108 Pulsar map[string]PulsarEventSource `json:"pulsar,omitempty" protobuf:"bytes,26,opt,name=pulsar"` 109 // Generic event source 110 Generic map[string]GenericEventSource `json:"generic,omitempty" protobuf:"bytes,27,rep,name=generic"` 111 // Replicas is the event source deployment replicas 112 Replicas *int32 `json:"replicas,omitempty" protobuf:"varint,28,opt,name=replicas"` 113 // Bitbucket Server event sources 114 BitbucketServer map[string]BitbucketServerEventSource `json:"bitbucketserver,omitempty" protobuf:"bytes,29,rep,name=bitbucketserver"` 115 // Bitbucket event sources 116 Bitbucket map[string]BitbucketEventSource `json:"bitbucket,omitempty" protobuf:"bytes,30,rep,name=bitbucket"` 117 // Redis stream source 118 RedisStream map[string]RedisStreamEventSource `json:"redisStream,omitempty" protobuf:"bytes,31,rep,name=redisStream"` 119 // Azure Service Bus event source 120 AzureServiceBus map[string]AzureServiceBusEventSource `json:"azureServiceBus,omitempty" protobuf:"bytes,32,rep,name=azureServiceBus"` 121 // AzureQueueStorage event source 122 AzureQueueStorage map[string]AzureQueueStorageEventSource `json:"azureQueueStorage,omitempty" protobuf:"bytes,33,rep,name=azureQueueStorage"` 123 // SFTP event sources 124 SFTP map[string]SFTPEventSource `json:"sftp,omitempty" protobuf:"bytes,34,rep,name=sftp"` 125 // Gerrit event source 126 Gerrit map[string]GerritEventSource `json:"gerrit,omitempty" protobuf:"bytes,35,rep,name=gerrit"` 127 } 128 129 func (e EventSourceSpec) GetReplicas() int32 { 130 if e.Replicas == nil { 131 return 1 132 } 133 var replicas int32 134 if e.Replicas != nil { 135 replicas = *e.Replicas 136 } 137 if replicas < 1 { 138 replicas = 1 139 } 140 return replicas 141 } 142 143 // Template holds the information of an EventSource deployment template 144 type Template struct { 145 // Metadata sets the pods's metadata, i.e. annotations and labels 146 Metadata *apicommon.Metadata `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 147 // ServiceAccountName is the name of the ServiceAccount to use to run event source pod. 148 // More info: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/ 149 // +optional 150 ServiceAccountName string `json:"serviceAccountName,omitempty" protobuf:"bytes,2,opt,name=serviceAccountName"` 151 // Container is the main container image to run in the event source pod 152 // +optional 153 Container *corev1.Container `json:"container,omitempty" protobuf:"bytes,3,opt,name=container"` 154 // Volumes is a list of volumes that can be mounted by containers in an eventsource. 155 // +patchStrategy=merge 156 // +patchMergeKey=name 157 // +optional 158 Volumes []corev1.Volume `json:"volumes,omitempty" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,4,rep,name=volumes"` 159 // SecurityContext holds pod-level security attributes and common container settings. 160 // Optional: Defaults to empty. See type description for default values of each field. 161 // +optional 162 SecurityContext *corev1.PodSecurityContext `json:"securityContext,omitempty" protobuf:"bytes,5,opt,name=securityContext"` 163 // If specified, the pod's scheduling constraints 164 // +optional 165 Affinity *corev1.Affinity `json:"affinity,omitempty" protobuf:"bytes,6,opt,name=affinity"` 166 // If specified, the pod's tolerations. 167 // +optional 168 Tolerations []corev1.Toleration `json:"tolerations,omitempty" protobuf:"bytes,7,rep,name=tolerations"` 169 // NodeSelector is a selector which must be true for the pod to fit on a node. 170 // Selector which must match a node's labels for the pod to be scheduled on that node. 171 // More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/ 172 // +optional 173 NodeSelector map[string]string `json:"nodeSelector,omitempty" protobuf:"bytes,8,rep,name=nodeSelector"` 174 // ImagePullSecrets is an optional list of references to secrets in the same namespace to use for pulling any of the images used by this PodSpec. 175 // If specified, these secrets will be passed to individual puller implementations for them to use. For example, 176 // in the case of docker, only DockerConfig type secrets are honored. 177 // More info: https://kubernetes.io/docs/concepts/containers/images#specifying-imagepullsecrets-on-a-pod 178 // +optional 179 // +patchMergeKey=name 180 // +patchStrategy=merge 181 ImagePullSecrets []corev1.LocalObjectReference `json:"imagePullSecrets,omitempty" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,9,rep,name=imagePullSecrets"` 182 // If specified, indicates the EventSource pod's priority. "system-node-critical" 183 // and "system-cluster-critical" are two special keywords which indicate the 184 // highest priorities with the former being the highest priority. Any other 185 // name must be defined by creating a PriorityClass object with that name. 186 // If not specified, the pod priority will be default or zero if there is no 187 // default. 188 // More info: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/ 189 // +optional 190 PriorityClassName string `json:"priorityClassName,omitempty" protobuf:"bytes,10,opt,name=priorityClassName"` 191 // The priority value. Various system components use this field to find the 192 // priority of the EventSource pod. When Priority Admission Controller is enabled, 193 // it prevents users from setting this field. The admission controller populates 194 // this field from PriorityClassName. 195 // The higher the value, the higher the priority. 196 // More info: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/ 197 // +optional 198 Priority *int32 `json:"priority,omitempty" protobuf:"bytes,11,opt,name=priority"` 199 } 200 201 // Service holds the service information eventsource exposes 202 type Service struct { 203 // The list of ports that are exposed by this ClusterIP service. 204 // +patchMergeKey=port 205 // +patchStrategy=merge 206 // +listType=map 207 // +listMapKey=port 208 // +listMapKey=protocol 209 Ports []corev1.ServicePort `json:"ports,omitempty" patchStrategy:"merge" patchMergeKey:"port" protobuf:"bytes,1,rep,name=ports"` 210 // clusterIP is the IP address of the service and is usually assigned 211 // randomly by the master. If an address is specified manually and is not in 212 // use by others, it will be allocated to the service; otherwise, creation 213 // of the service will fail. This field can not be changed through updates. 214 // Valid values are "None", empty string (""), or a valid IP address. "None" 215 // can be specified for headless services when proxying is not required. 216 // More info: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies 217 // +optional 218 ClusterIP string `json:"clusterIP,omitempty" protobuf:"bytes,2,opt,name=clusterIP"` 219 } 220 221 // CalendarEventSource describes an HTTP based EventSource 222 type WebhookEventSource struct { 223 WebhookContext `json:",inline" protobuf:"bytes,1,opt,name=webhookContext"` 224 // Filter 225 // +optional 226 Filter *EventSourceFilter `json:"filter,omitempty" protobuf:"bytes,2,opt,name=filter"` 227 } 228 229 // CalendarEventSource describes a time based dependency. One of the fields (schedule, interval, or recurrence) must be passed. 230 // Schedule takes precedence over interval; interval takes precedence over recurrence 231 type CalendarEventSource struct { 232 // Schedule is a cron-like expression. For reference, see: https://en.wikipedia.org/wiki/Cron 233 // +optional 234 Schedule string `json:"schedule" protobuf:"bytes,1,opt,name=schedule"` 235 // Interval is a string that describes an interval duration, e.g. 1s, 30m, 2h... 236 // +optional 237 Interval string `json:"interval" protobuf:"bytes,2,opt,name=interval"` 238 // ExclusionDates defines the list of DATE-TIME exceptions for recurring events. 239 ExclusionDates []string `json:"exclusionDates,omitempty" protobuf:"bytes,3,rep,name=exclusionDates"` 240 // Timezone in which to run the schedule 241 // +optional 242 Timezone string `json:"timezone,omitempty" protobuf:"bytes,4,opt,name=timezone"` 243 // Metadata holds the user defined metadata which will passed along the event payload. 244 // +optional 245 Metadata map[string]string `json:"metadata,omitempty" protobuf:"bytes,5,rep,name=metadata"` 246 // Persistence hold the configuration for event persistence 247 Persistence *EventPersistence `json:"persistence,omitempty" protobuf:"bytes,6,opt,name=persistence"` 248 // Filter 249 // +optional 250 Filter *EventSourceFilter `json:"filter,omitempty" protobuf:"bytes,8,opt,name=filter"` 251 } 252 253 type EventPersistence struct { 254 // Catchup enables to triggered the missed schedule when eventsource restarts 255 Catchup *CatchupConfiguration `json:"catchup,omitempty" protobuf:"bytes,1,opt,name=catchup"` 256 // ConfigMap holds configmap details for persistence 257 ConfigMap *ConfigMapPersistence `json:"configMap,omitempty" protobuf:"bytes,2,opt,name=configMap"` 258 } 259 260 func (ep *EventPersistence) IsCatchUpEnabled() bool { 261 return ep.Catchup != nil && ep.Catchup.Enabled 262 } 263 264 type CatchupConfiguration struct { 265 // Enabled enables to triggered the missed schedule when eventsource restarts 266 Enabled bool `json:"enabled,omitempty" protobuf:"varint,1,opt,name=enabled"` 267 // MaxDuration holds max catchup duration 268 MaxDuration string `json:"maxDuration,omitempty" protobuf:"bytes,2,opt,name=maxDuration"` 269 } 270 271 type ConfigMapPersistence struct { 272 // Name of the configmap 273 Name string `json:"name,omitempty" protobuf:"bytes,1,opt,name=name"` 274 // CreateIfNotExist will create configmap if it doesn't exists 275 CreateIfNotExist bool `json:"createIfNotExist,omitempty" protobuf:"varint,2,opt,name=createIfNotExist"` 276 } 277 278 // FileEventSource describes an event-source for file related events. 279 type FileEventSource struct { 280 // Type of file operations to watch 281 // Refer https://github.com/fsnotify/fsnotify/blob/master/fsnotify.go for more information 282 EventType string `json:"eventType" protobuf:"bytes,1,opt,name=eventType"` 283 // WatchPathConfig contains configuration about the file path to watch 284 WatchPathConfig WatchPathConfig `json:"watchPathConfig" protobuf:"bytes,2,opt,name=watchPathConfig"` 285 // Use polling instead of inotify 286 Polling bool `json:"polling,omitempty" protobuf:"varint,3,opt,name=polling"` 287 // Metadata holds the user defined metadata which will passed along the event payload. 288 // +optional 289 Metadata map[string]string `json:"metadata,omitempty" protobuf:"bytes,4,rep,name=metadata"` 290 // Filter 291 // +optional 292 Filter *EventSourceFilter `json:"filter,omitempty" protobuf:"bytes,5,opt,name=filter"` 293 } 294 295 // SFTPEventSource describes an event-source for sftp related events. 296 type SFTPEventSource struct { 297 // Type of file operations to watch 298 // Refer https://github.com/fsnotify/fsnotify/blob/master/fsnotify.go for more information 299 EventType string `json:"eventType" protobuf:"bytes,1,opt,name=eventType"` 300 // WatchPathConfig contains configuration about the file path to watch 301 WatchPathConfig WatchPathConfig `json:"watchPathConfig" protobuf:"bytes,2,opt,name=watchPathConfig"` 302 // Username required for authentication if any. 303 Username *corev1.SecretKeySelector `json:"username,omitempty" protobuf:"bytes,3,opt,name=username"` 304 // Password required for authentication if any. 305 Password *corev1.SecretKeySelector `json:"password,omitempty" protobuf:"bytes,4,opt,name=password"` 306 // SSHKeySecret refers to the secret that contains SSH key 307 SSHKeySecret *corev1.SecretKeySelector `json:"sshKeySecret,omitempty" protobuf:"bytes,5,opt,name=sshKeySecret"` 308 // Address sftp address. 309 Address *corev1.SecretKeySelector `json:"address,omitempty" protobuf:"bytes,6,opt,name=address"` 310 // Metadata holds the user defined metadata which will passed along the event payload. 311 // +optional 312 Metadata map[string]string `json:"metadata,omitempty" protobuf:"bytes,7,rep,name=metadata"` 313 // Filter 314 // +optional 315 Filter *EventSourceFilter `json:"filter,omitempty" protobuf:"bytes,8,opt,name=filter"` 316 // PollIntervalDuration the interval at which to poll the SFTP server 317 // defaults to 10 seconds 318 // +optional 319 PollIntervalDuration string `json:"pollIntervalDuration" protobuf:"varint,9,opt,name=pollIntervalDuration"` 320 } 321 322 // ResourceEventType is the type of event for the K8s resource mutation 323 type ResourceEventType string 324 325 // possible values of ResourceEventType 326 const ( 327 ADD ResourceEventType = "ADD" 328 UPDATE ResourceEventType = "UPDATE" 329 DELETE ResourceEventType = "DELETE" 330 ) 331 332 // ResourceEventSource refers to a event-source for K8s resource related events. 333 type ResourceEventSource struct { 334 // Namespace where resource is deployed 335 Namespace string `json:"namespace" protobuf:"bytes,1,opt,name=namespace"` 336 // Filter is applied on the metadata of the resource 337 // If you apply filter, then the internal event informer will only monitor objects that pass the filter. 338 // +optional 339 Filter *ResourceFilter `json:"filter,omitempty" protobuf:"bytes,2,opt,name=filter"` 340 // Group of the resource 341 metav1.GroupVersionResource `json:",inline" protobuf:"bytes,3,opt,name=groupVersionResource"` 342 // EventTypes is the list of event type to watch. 343 // Possible values are - ADD, UPDATE and DELETE. 344 EventTypes []ResourceEventType `json:"eventTypes" protobuf:"bytes,4,rep,name=eventTypes,casttype=ResourceEventType"` 345 // Metadata holds the user defined metadata which will passed along the event payload. 346 // +optional 347 Metadata map[string]string `json:"metadata,omitempty" protobuf:"bytes,5,rep,name=metadata"` 348 } 349 350 // ResourceFilter contains K8s ObjectMeta information to further filter resource event objects 351 type ResourceFilter struct { 352 // Prefix filter is applied on the resource name. 353 // +optional 354 Prefix string `json:"prefix,omitempty" protobuf:"bytes,1,opt,name=prefix"` 355 // Labels provide listing options to K8s API to watch resource/s. 356 // Refer https://kubernetes.io/docs/concepts/overview/working-with-objects/label-selectors/ for more info. 357 // Unlike K8s field selector, multiple values are passed as comma separated values instead of list of values. 358 // Eg: value: value1,value2. 359 // Same as K8s label selector, operator "=", "==", "!=", "exists", "!", "notin", "in", "gt" and "lt" 360 // are supported 361 // +optional 362 Labels []Selector `json:"labels,omitempty" protobuf:"bytes,2,rep,name=labels"` 363 // Fields provide field filters similar to K8s field selector 364 // (see https://kubernetes.io/docs/concepts/overview/working-with-objects/field-selectors/). 365 // Unlike K8s field selector, it supports arbitrary fileds like "spec.serviceAccountName", 366 // and the value could be a string or a regex. 367 // Same as K8s field selector, operator "=", "==" and "!=" are supported. 368 // +optional 369 Fields []Selector `json:"fields,omitempty" protobuf:"bytes,3,rep,name=fields"` 370 // If resource is created before the specified time then the event is treated as valid. 371 // +optional 372 CreatedBy metav1.Time `json:"createdBy,omitempty" protobuf:"bytes,4,opt,name=createdBy"` 373 // If the resource is created after the start time then the event is treated as valid. 374 // +optional 375 AfterStart bool `json:"afterStart,omitempty" protobuf:"varint,5,opt,name=afterStart"` 376 } 377 378 // Selector represents conditional operation to select K8s objects. 379 type Selector struct { 380 // Key name 381 Key string `json:"key" protobuf:"bytes,1,opt,name=key"` 382 // Supported operations like ==, != etc. 383 // Defaults to ==. 384 // Refer https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors for more info. 385 // +optional 386 Operation string `json:"operation,omitempty" protobuf:"bytes,2,opt,name=operation"` 387 // Value 388 Value string `json:"value" protobuf:"bytes,3,opt,name=value"` 389 } 390 391 // AMQPEventSource refers to an event-source for AMQP stream events 392 type AMQPEventSource struct { 393 394 // URL for rabbitmq service 395 URL string `json:"url,omitempty" protobuf:"bytes,1,opt,name=url"` 396 // ExchangeName is the exchange name 397 // For more information, visit https://www.rabbitmq.com/tutorials/amqp-concepts.html 398 ExchangeName string `json:"exchangeName" protobuf:"bytes,2,opt,name=exchangeName"` 399 // ExchangeType is rabbitmq exchange type 400 ExchangeType string `json:"exchangeType" protobuf:"bytes,3,opt,name=exchangeType"` 401 // Routing key for bindings 402 RoutingKey string `json:"routingKey" protobuf:"bytes,4,opt,name=routingKey"` 403 // Backoff holds parameters applied to connection. 404 // +optional 405 ConnectionBackoff *apicommon.Backoff `json:"connectionBackoff,omitempty" protobuf:"bytes,5,opt,name=connectionBackoff"` 406 // JSONBody specifies that all event body payload coming from this 407 // source will be JSON 408 // +optional 409 JSONBody bool `json:"jsonBody,omitempty" protobuf:"varint,6,opt,name=jsonBody"` 410 // TLS configuration for the amqp client. 411 // +optional 412 TLS *apicommon.TLSConfig `json:"tls,omitempty" protobuf:"bytes,7,opt,name=tls"` 413 // Metadata holds the user defined metadata which will passed along the event payload. 414 // +optional 415 Metadata map[string]string `json:"metadata,omitempty" protobuf:"bytes,8,rep,name=metadata"` 416 // ExchangeDeclare holds the configuration for the exchange on the server 417 // For more information, visit https://pkg.go.dev/github.com/rabbitmq/amqp091-go#Channel.ExchangeDeclare 418 // +optional 419 ExchangeDeclare *AMQPExchangeDeclareConfig `json:"exchangeDeclare,omitempty" protobuf:"bytes,9,opt,name=exchangeDeclare"` 420 // QueueDeclare holds the configuration of a queue to hold messages and deliver to consumers. 421 // Declaring creates a queue if it doesn't already exist, or ensures that an existing queue matches 422 // the same parameters 423 // For more information, visit https://pkg.go.dev/github.com/rabbitmq/amqp091-go#Channel.QueueDeclare 424 // +optional 425 QueueDeclare *AMQPQueueDeclareConfig `json:"queueDeclare,omitempty" protobuf:"bytes,10,opt,name=queueDeclare"` 426 // QueueBind holds the configuration that binds an exchange to a queue so that publishings to the 427 // exchange will be routed to the queue when the publishing routing key matches the binding routing key 428 // For more information, visit https://pkg.go.dev/github.com/rabbitmq/amqp091-go#Channel.QueueBind 429 // +optional 430 QueueBind *AMQPQueueBindConfig `json:"queueBind,omitempty" protobuf:"bytes,11,opt,name=queueBind"` 431 // Consume holds the configuration to immediately starts delivering queued messages 432 // For more information, visit https://pkg.go.dev/github.com/rabbitmq/amqp091-go#Channel.Consume 433 // +optional 434 Consume *AMQPConsumeConfig `json:"consume,omitempty" protobuf:"bytes,12,opt,name=consume"` 435 // Auth hosts secret selectors for username and password 436 // +optional 437 Auth *apicommon.BasicAuth `json:"auth,omitempty" protobuf:"bytes,13,opt,name=auth"` 438 // URLSecret is secret reference for rabbitmq service URL 439 URLSecret *corev1.SecretKeySelector `json:"urlSecret,omitempty" protobuf:"bytes,14,opt,name=urlSecret"` 440 // Filter 441 // +optional 442 Filter *EventSourceFilter `json:"filter,omitempty" protobuf:"bytes,15,opt,name=filter"` 443 } 444 445 // AMQPExchangeDeclareConfig holds the configuration for the exchange on the server 446 // +k8s:openapi-gen=true 447 type AMQPExchangeDeclareConfig struct { 448 // Durable keeps the exchange also after the server restarts 449 // +optional 450 Durable bool `json:"durable,omitempty" protobuf:"varint,1,opt,name=durable"` 451 // AutoDelete removes the exchange when no bindings are active 452 // +optional 453 AutoDelete bool `json:"autoDelete,omitempty" protobuf:"varint,2,opt,name=autoDelete"` 454 // Internal when true does not accept publishings 455 // +optional 456 Internal bool `json:"internal,omitempty" protobuf:"varint,3,opt,name=internal"` 457 // NowWait when true does not wait for a confirmation from the server 458 // +optional 459 NoWait bool `json:"noWait,omitempty" protobuf:"varint,4,opt,name=noWait"` 460 } 461 462 // AMQPQueueDeclareConfig holds the configuration of a queue to hold messages and deliver to consumers. 463 // Declaring creates a queue if it doesn't already exist, or ensures that an existing queue matches 464 // the same parameters 465 // +k8s:openapi-gen=true 466 type AMQPQueueDeclareConfig struct { 467 // Name of the queue. If empty the server auto-generates a unique name for this queue 468 // +optional 469 Name string `json:"name,omitempty" protobuf:"bytes,1,opt,name=name"` 470 // Durable keeps the queue also after the server restarts 471 // +optional 472 Durable bool `json:"durable,omitempty" protobuf:"varint,2,opt,name=durable"` 473 // AutoDelete removes the queue when no consumers are active 474 // +optional 475 AutoDelete bool `json:"autoDelete,omitempty" protobuf:"varint,3,opt,name=autoDelete"` 476 // Exclusive sets the queues to be accessible only by the connection that declares them and will be 477 // deleted wgen the connection closes 478 // +optional 479 Exclusive bool `json:"exclusive,omitempty" protobuf:"varint,4,opt,name=exclusive"` 480 // NowWait when true, the queue assumes to be declared on the server 481 // +optional 482 NoWait bool `json:"noWait,omitempty" protobuf:"varint,5,opt,name=noWait"` 483 // Arguments of a queue (also known as "x-arguments") used for optional features and plugins 484 // +optional 485 Arguments string `json:"arguments,omitempty" protobuf:"bytes,6,opt,name=arguments"` 486 } 487 488 // AMQPQueueBindConfig holds the configuration that binds an exchange to a queue so that publishings to the 489 // exchange will be routed to the queue when the publishing routing key matches the binding routing key 490 // +k8s:openapi-gen=true 491 type AMQPQueueBindConfig struct { 492 // NowWait false and the queue could not be bound, the channel will be closed with an error 493 // +optional 494 NoWait bool `json:"noWait,omitempty" protobuf:"varint,1,opt,name=noWait"` 495 } 496 497 // AMQPConsumeConfig holds the configuration to immediately starts delivering queued messages 498 // +k8s:openapi-gen=true 499 type AMQPConsumeConfig struct { 500 // ConsumerTag is the identity of the consumer included in every delivery 501 // +optional 502 ConsumerTag string `json:"consumerTag,omitempty" protobuf:"bytes,1,opt,name=consumerTag"` 503 // AutoAck when true, the server will acknowledge deliveries to this consumer prior to writing 504 // the delivery to the network 505 // +optional 506 AutoAck bool `json:"autoAck,omitempty" protobuf:"varint,2,opt,name=autoAck"` 507 // Exclusive when true, the server will ensure that this is the sole consumer from this queue 508 // +optional 509 Exclusive bool `json:"exclusive,omitempty" protobuf:"varint,3,opt,name=exclusive"` 510 // NoLocal flag is not supported by RabbitMQ 511 // +optional 512 NoLocal bool `json:"noLocal,omitempty" protobuf:"varint,4,opt,name=noLocal"` 513 // NowWait when true, do not wait for the server to confirm the request and immediately begin deliveries 514 // +optional 515 NoWait bool `json:"noWait,omitempty" protobuf:"varint,5,opt,name=noWait"` 516 } 517 518 // KafkaEventSource refers to event-source for Kafka related events 519 type KafkaEventSource struct { 520 // URL to kafka cluster, multiple URLs separated by comma 521 URL string `json:"url" protobuf:"bytes,1,opt,name=url"` 522 // Partition name 523 // +optional 524 Partition string `json:"partition" protobuf:"bytes,2,opt,name=partition"` 525 // Topic name 526 Topic string `json:"topic" protobuf:"bytes,3,opt,name=topic"` 527 // Backoff holds parameters applied to connection. 528 ConnectionBackoff *apicommon.Backoff `json:"connectionBackoff,omitempty" protobuf:"bytes,4,opt,name=connectionBackoff"` 529 // TLS configuration for the kafka client. 530 // +optional 531 TLS *apicommon.TLSConfig `json:"tls,omitempty" protobuf:"bytes,5,opt,name=tls"` 532 // JSONBody specifies that all event body payload coming from this 533 // source will be JSON 534 // +optional 535 JSONBody bool `json:"jsonBody,omitempty" protobuf:"varint,6,opt,name=jsonBody"` 536 // Metadata holds the user defined metadata which will passed along the event payload. 537 // +optional 538 Metadata map[string]string `json:"metadata,omitempty" protobuf:"bytes,7,rep,name=metadata"` 539 540 // Consumer group for kafka client 541 // +optional 542 ConsumerGroup *KafkaConsumerGroup `json:"consumerGroup,omitempty" protobuf:"bytes,8,opt,name=consumerGroup"` 543 544 // Sets a limit on how many events get read from kafka per second. 545 // +optional 546 LimitEventsPerSecond int64 `json:"limitEventsPerSecond,omitempty" protobuf:"varint,9,opt,name=limitEventsPerSecond"` 547 548 // Specify what kafka version is being connected to enables certain features in sarama, defaults to 1.0.0 549 // +optional 550 Version string `json:"version" protobuf:"bytes,10,opt,name=version"` 551 // SASL configuration for the kafka client 552 // +optional 553 SASL *apicommon.SASLConfig `json:"sasl,omitempty" protobuf:"bytes,11,opt,name=sasl"` 554 // Filter 555 // +optional 556 Filter *EventSourceFilter `json:"filter,omitempty" protobuf:"bytes,12,opt,name=filter"` 557 // Yaml format Sarama config for Kafka connection. 558 // It follows the struct of sarama.Config. See https://github.com/IBM/sarama/blob/main/config.go 559 // e.g. 560 // 561 // consumer: 562 // fetch: 563 // min: 1 564 // net: 565 // MaxOpenRequests: 5 566 // 567 // +optional 568 Config string `json:"config,omitempty" protobuf:"bytes,13,opt,name=config"` 569 } 570 571 type KafkaConsumerGroup struct { 572 // The name for the consumer group to use 573 GroupName string `json:"groupName" protobuf:"bytes,1,opt,name=groupName"` 574 // When starting up a new group do we want to start from the oldest event (true) or the newest event (false), defaults to false 575 // +optional 576 Oldest bool `json:"oldest,omitempty" protobuf:"varint,2,opt,name=oldest"` 577 // Rebalance strategy can be one of: sticky, roundrobin, range. Range is the default. 578 // +optional 579 RebalanceStrategy string `json:"rebalanceStrategy" protobuf:"bytes,3,opt,name=rebalanceStrategy"` 580 } 581 582 // MQTTEventSource refers to event-source for MQTT related events 583 type MQTTEventSource struct { 584 // URL to connect to broker 585 URL string `json:"url" protobuf:"bytes,1,opt,name=url"` 586 // Topic name 587 Topic string `json:"topic" protobuf:"bytes,2,opt,name=topic"` 588 // ClientID is the id of the client 589 ClientID string `json:"clientId" protobuf:"bytes,3,opt,name=clientId"` 590 // ConnectionBackoff holds backoff applied to connection. 591 ConnectionBackoff *apicommon.Backoff `json:"connectionBackoff,omitempty" protobuf:"bytes,4,opt,name=connectionBackoff"` 592 // JSONBody specifies that all event body payload coming from this 593 // source will be JSON 594 // +optional 595 JSONBody bool `json:"jsonBody,omitempty" protobuf:"varint,5,opt,name=jsonBody"` 596 // TLS configuration for the mqtt client. 597 // +optional 598 TLS *apicommon.TLSConfig `json:"tls,omitempty" protobuf:"bytes,6,opt,name=tls"` 599 // Metadata holds the user defined metadata which will passed along the event payload. 600 // +optional 601 Metadata map[string]string `json:"metadata,omitempty" protobuf:"bytes,7,rep,name=metadata"` 602 // Filter 603 // +optional 604 Filter *EventSourceFilter `json:"filter,omitempty" protobuf:"bytes,8,opt,name=filter"` 605 // Auth hosts secret selectors for username and password 606 // +optional 607 Auth *apicommon.BasicAuth `json:"auth,omitempty" protobuf:"bytes,9,opt,name=auth"` 608 } 609 610 // NATSEventsSource refers to event-source for NATS related events 611 type NATSEventsSource struct { 612 // URL to connect to NATS cluster 613 URL string `json:"url" protobuf:"bytes,1,opt,name=url"` 614 // Subject holds the name of the subject onto which messages are published 615 Subject string `json:"subject" protobuf:"bytes,2,opt,name=subject"` 616 // ConnectionBackoff holds backoff applied to connection. 617 ConnectionBackoff *apicommon.Backoff `json:"connectionBackoff,omitempty" protobuf:"bytes,3,opt,name=connectionBackoff"` 618 // JSONBody specifies that all event body payload coming from this 619 // source will be JSON 620 // +optional 621 JSONBody bool `json:"jsonBody,omitempty" protobuf:"varint,4,opt,name=jsonBody"` 622 // TLS configuration for the nats client. 623 // +optional 624 TLS *apicommon.TLSConfig `json:"tls,omitempty" protobuf:"bytes,5,opt,name=tls"` 625 // Metadata holds the user defined metadata which will passed along the event payload. 626 // +optional 627 Metadata map[string]string `json:"metadata,omitempty" protobuf:"bytes,6,rep,name=metadata"` 628 // Auth information 629 // +optional 630 Auth *NATSAuth `json:"auth,omitempty" protobuf:"bytes,7,opt,name=auth"` 631 // Filter 632 // +optional 633 Filter *EventSourceFilter `json:"filter,omitempty" protobuf:"bytes,8,opt,name=filter"` 634 } 635 636 // NATSAuth refers to the auth info for NATS EventSource 637 type NATSAuth struct { 638 // Baisc auth with username and password 639 // +optional 640 Basic *apicommon.BasicAuth `json:"basic,omitempty" protobuf:"bytes,1,opt,name=basic"` 641 // Token used to connect 642 // +optional 643 Token *corev1.SecretKeySelector `json:"token,omitempty" protobuf:"bytes,2,opt,name=token"` 644 // NKey used to connect 645 // +optional 646 NKey *corev1.SecretKeySelector `json:"nkey,omitempty" protobuf:"bytes,3,opt,name=nkey"` 647 // credential used to connect 648 // +optional 649 Credential *corev1.SecretKeySelector `json:"credential,omitempty" protobuf:"bytes,4,opt,name=credential"` 650 } 651 652 // SNSEventSource refers to event-source for AWS SNS related events 653 type SNSEventSource struct { 654 // Webhook configuration for http server 655 Webhook *WebhookContext `json:"webhook,omitempty" protobuf:"bytes,1,opt,name=webhook"` 656 // TopicArn 657 TopicArn string `json:"topicArn" protobuf:"bytes,2,opt,name=topicArn"` 658 // AccessKey refers K8s secret containing aws access key 659 AccessKey *corev1.SecretKeySelector `json:"accessKey,omitempty" protobuf:"bytes,3,opt,name=accessKey"` 660 // SecretKey refers K8s secret containing aws secret key 661 SecretKey *corev1.SecretKeySelector `json:"secretKey,omitempty" protobuf:"bytes,4,opt,name=secretKey"` 662 // Region is AWS region 663 Region string `json:"region" protobuf:"bytes,5,opt,name=region"` 664 // RoleARN is the Amazon Resource Name (ARN) of the role to assume. 665 // +optional 666 RoleARN string `json:"roleARN,omitempty" protobuf:"bytes,6,opt,name=roleARN"` 667 // Metadata holds the user defined metadata which will passed along the event payload. 668 // +optional 669 Metadata map[string]string `json:"metadata,omitempty" protobuf:"bytes,7,rep,name=metadata"` 670 // ValidateSignature is boolean that can be set to true for SNS signature verification 671 // +optional 672 ValidateSignature bool `json:"validateSignature,omitempty" protobuf:"varint,8,opt,name=validateSignature"` 673 // Filter 674 // +optional 675 Filter *EventSourceFilter `json:"filter,omitempty" protobuf:"bytes,9,opt,name=filter"` 676 // Endpoint configures connection to a specific SNS endpoint instead of Amazons servers 677 // +optional 678 Endpoint string `json:"endpoint" protobuf:"bytes,10,opt,name=endpoint"` 679 } 680 681 // SQSEventSource refers to event-source for AWS SQS related events 682 type SQSEventSource struct { 683 // AccessKey refers K8s secret containing aws access key 684 AccessKey *corev1.SecretKeySelector `json:"accessKey,omitempty" protobuf:"bytes,1,opt,name=accessKey"` 685 // SecretKey refers K8s secret containing aws secret key 686 SecretKey *corev1.SecretKeySelector `json:"secretKey,omitempty" protobuf:"bytes,2,opt,name=secretKey"` 687 // Region is AWS region 688 Region string `json:"region" protobuf:"bytes,3,opt,name=region"` 689 // Queue is AWS SQS queue to listen to for messages 690 Queue string `json:"queue" protobuf:"bytes,4,opt,name=queue"` 691 // WaitTimeSeconds is The duration (in seconds) for which the call waits for a message to arrive 692 // in the queue before returning. 693 WaitTimeSeconds int64 `json:"waitTimeSeconds" protobuf:"varint,5,opt,name=waitTimeSeconds"` 694 // RoleARN is the Amazon Resource Name (ARN) of the role to assume. 695 // +optional 696 RoleARN string `json:"roleARN,omitempty" protobuf:"bytes,6,opt,name=roleARN"` 697 // JSONBody specifies that all event body payload coming from this 698 // source will be JSON 699 // +optional 700 JSONBody bool `json:"jsonBody,omitempty" protobuf:"varint,7,opt,name=jsonBody"` 701 // QueueAccountID is the ID of the account that created the queue to monitor 702 // +optional 703 QueueAccountID string `json:"queueAccountId,omitempty" protobuf:"bytes,8,opt,name=queueAccountId"` 704 // Metadata holds the user defined metadata which will passed along the event payload. 705 // +optional 706 Metadata map[string]string `json:"metadata,omitempty" protobuf:"bytes,9,rep,name=metadata"` 707 // DLQ specifies if a dead-letter queue is configured for messages that can't be processed successfully. 708 // If set to true, messages with invalid payload won't be acknowledged to allow to forward them farther to the dead-letter queue. 709 // The default value is false. 710 // +optional 711 DLQ bool `json:"dlq,omitempty" protobuf:"varint,10,opt,name=dlq"` 712 // Filter 713 // +optional 714 Filter *EventSourceFilter `json:"filter,omitempty" protobuf:"bytes,11,opt,name=filter"` 715 // Endpoint configures connection to a specific SQS endpoint instead of Amazons servers 716 // +optional 717 Endpoint string `json:"endpoint" protobuf:"bytes,12,opt,name=endpoint"` 718 // SessionToken refers to K8s secret containing AWS temporary credentials(STS) session token 719 // +optional 720 SessionToken *corev1.SecretKeySelector `json:"sessionToken,omitempty" protobuf:"bytes,13,opt,name=sessionToken"` 721 } 722 723 // PubSubEventSource refers to event-source for GCP PubSub related events. 724 type PubSubEventSource struct { 725 // ProjectID is GCP project ID for the subscription. 726 // Required if you run Argo Events outside of GKE/GCE. 727 // (otherwise, the default value is its project) 728 // +optional 729 ProjectID string `json:"projectID" protobuf:"bytes,1,opt,name=projectID"` 730 // TopicProjectID is GCP project ID for the topic. 731 // By default, it is same as ProjectID. 732 // +optional 733 TopicProjectID string `json:"topicProjectID" protobuf:"bytes,2,opt,name=topicProjectID"` 734 // Topic to which the subscription should belongs. 735 // Required if you want the eventsource to create a new subscription. 736 // If you specify this field along with an existing subscription, 737 // it will be verified whether it actually belongs to the specified topic. 738 // +optional 739 Topic string `json:"topic" protobuf:"bytes,3,opt,name=topic"` 740 // SubscriptionID is ID of subscription. 741 // Required if you use existing subscription. 742 // The default value will be auto generated hash based on this eventsource setting, so the subscription 743 // might be recreated every time you update the setting, which has a possibility of event loss. 744 // +optional 745 SubscriptionID string `json:"subscriptionID" protobuf:"bytes,4,opt,name=subscriptionID"` 746 // CredentialSecret references to the secret that contains JSON credentials to access GCP. 747 // If it is missing, it implicitly uses Workload Identity to access. 748 // https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity 749 // +optional 750 CredentialSecret *corev1.SecretKeySelector `json:"credentialSecret,omitempty" protobuf:"bytes,5,opt,name=credentialSecret"` 751 // DeleteSubscriptionOnFinish determines whether to delete the GCP PubSub subscription once the event source is stopped. 752 // +optional 753 DeleteSubscriptionOnFinish bool `json:"deleteSubscriptionOnFinish,omitempty" protobuf:"varint,6,opt,name=deleteSubscriptionOnFinish"` 754 // JSONBody specifies that all event body payload coming from this 755 // source will be JSON 756 // +optional 757 JSONBody bool `json:"jsonBody,omitempty" protobuf:"varint,7,opt,name=jsonBody"` 758 // Metadata holds the user defined metadata which will passed along the event payload. 759 // +optional 760 Metadata map[string]string `json:"metadata,omitempty" protobuf:"bytes,8,rep,name=metadata"` 761 // Filter 762 // +optional 763 Filter *EventSourceFilter `json:"filter,omitempty" protobuf:"bytes,9,opt,name=filter"` 764 } 765 766 // GerritEventSource refers to event-source related to gerrit events 767 type GerritEventSource struct { 768 // Webhook holds configuration to run a http server 769 Webhook *WebhookContext `json:"webhook,omitempty" protobuf:"bytes,1,opt,name=webhook"` 770 // HookName is the name of the webhook 771 HookName string `json:"hookName" protobuf:"bytes,2,opt,name=hookName"` 772 // Events are gerrit event to listen to. 773 // Refer https://gerrit-review.googlesource.com/Documentation/cmd-stream-events.html#events 774 Events []string `json:"events" protobuf:"bytes,3,opt,name=events"` 775 // Auth hosts secret selectors for username and password 776 // +optional 777 Auth *apicommon.BasicAuth `json:"auth,omitempty" protobuf:"bytes,4,opt,name=auth"` 778 // GerritBaseURL is the base URL for API requests to a custom endpoint 779 GerritBaseURL string `json:"gerritBaseURL" protobuf:"bytes,5,opt,name=gerritBaseURL"` 780 // DeleteHookOnFinish determines whether to delete the Gerrit hook for the project once the event source is stopped. 781 // +optional 782 DeleteHookOnFinish bool `json:"deleteHookOnFinish,omitempty" protobuf:"varint,6,opt,name=deleteHookOnFinish"` 783 // Metadata holds the user defined metadata which will passed along the event payload. 784 // +optional 785 Metadata map[string]string `json:"metadata,omitempty" protobuf:"bytes,7,rep,name=metadata"` 786 // List of project namespace paths like "whynowy/test". 787 Projects []string `json:"projects,omitempty" protobuf:"bytes,8,rep,name=projects"` 788 // SslVerify to enable ssl verification 789 // +optional 790 SslVerify bool `json:"sslVerify,omitempty" protobuf:"varint,9,opt,name=sslVerify"` 791 // Filter 792 // +optional 793 Filter *EventSourceFilter `json:"filter,omitempty" protobuf:"bytes,10,opt,name=filter"` 794 } 795 796 func (g GerritEventSource) NeedToCreateHooks() bool { 797 return g.Auth != nil && g.Webhook != nil && g.Webhook.URL != "" 798 } 799 800 type OwnedRepositories struct { 801 // Organization or user name 802 Owner string `json:"owner,omitempty" protobuf:"bytes,1,opt,name=owner"` 803 // Repository names 804 Names []string `json:"names,omitempty" protobuf:"bytes,2,rep,name=names"` 805 } 806 807 type GithubAppCreds struct { 808 // PrivateKey refers to a K8s secret containing the GitHub app private key 809 PrivateKey *corev1.SecretKeySelector `json:"privateKey" protobuf:"bytes,1,opt,name=privateKey"` 810 // AppID refers to the GitHub App ID for the application you created 811 AppID int64 `json:"appID" protobuf:"bytes,2,opt,name=appID"` 812 // InstallationID refers to the Installation ID of the GitHub app you created and installed 813 InstallationID int64 `json:"installationID" protobuf:"bytes,3,opt,name=installationID"` 814 } 815 816 // GithubEventSource refers to event-source for github related events 817 type GithubEventSource struct { 818 // Id is the webhook's id 819 // Deprecated: This is not used at all, will be removed in v1.6 820 // +optional 821 ID int64 `json:"id" protobuf:"varint,1,opt,name=id"` 822 // Webhook refers to the configuration required to run a http server 823 Webhook *WebhookContext `json:"webhook,omitempty" protobuf:"bytes,2,opt,name=webhook"` 824 // DeprecatedOwner refers to GitHub owner name i.e. argoproj 825 // Deprecated: use Repositories instead. Will be unsupported in v 1.6 826 // +optional 827 DeprecatedOwner string `json:"owner" protobuf:"bytes,3,opt,name=owner"` 828 // DeprecatedRepository refers to GitHub repo name i.e. argo-events 829 // Deprecated: use Repositories instead. Will be unsupported in v 1.6 830 // +optional 831 DeprecatedRepository string `json:"repository" protobuf:"bytes,4,opt,name=repository"` 832 // Events refer to Github events to which the event source will subscribe 833 Events []string `json:"events" protobuf:"bytes,5,rep,name=events"` 834 // APIToken refers to a K8s secret containing github api token 835 // +optional 836 APIToken *corev1.SecretKeySelector `json:"apiToken,omitempty" protobuf:"bytes,6,opt,name=apiToken"` 837 // WebhookSecret refers to K8s secret containing GitHub webhook secret 838 // https://developer.github.com/webhooks/securing/ 839 // +optional 840 WebhookSecret *corev1.SecretKeySelector `json:"webhookSecret,omitempty" protobuf:"bytes,7,opt,name=webhookSecret"` 841 // Insecure tls verification 842 Insecure bool `json:"insecure,omitempty" protobuf:"varint,8,opt,name=insecure"` 843 // Active refers to status of the webhook for event deliveries. 844 // https://developer.github.com/webhooks/creating/#active 845 // +optional 846 Active bool `json:"active,omitempty" protobuf:"varint,9,opt,name=active"` 847 // ContentType of the event delivery 848 ContentType string `json:"contentType,omitempty" protobuf:"bytes,10,opt,name=contentType"` 849 // GitHub base URL (for GitHub Enterprise) 850 // +optional 851 GithubBaseURL string `json:"githubBaseURL,omitempty" protobuf:"bytes,11,opt,name=githubBaseURL"` 852 // GitHub upload URL (for GitHub Enterprise) 853 // +optional 854 GithubUploadURL string `json:"githubUploadURL,omitempty" protobuf:"bytes,12,opt,name=githubUploadURL"` 855 // DeleteHookOnFinish determines whether to delete the GitHub hook for the repository once the event source is stopped. 856 // +optional 857 DeleteHookOnFinish bool `json:"deleteHookOnFinish,omitempty" protobuf:"varint,13,opt,name=deleteHookOnFinish"` 858 // Metadata holds the user defined metadata which will passed along the event payload. 859 // +optional 860 Metadata map[string]string `json:"metadata,omitempty" protobuf:"bytes,14,rep,name=metadata"` 861 // Repositories holds the information of repositories, which uses repo owner as the key, 862 // and list of repo names as the value. Not required if Organizations is set. 863 Repositories []OwnedRepositories `json:"repositories,omitempty" protobuf:"bytes,15,rep,name=repositories"` 864 // Organizations holds the names of organizations (used for organization level webhooks). Not required if Repositories is set. 865 Organizations []string `json:"organizations,omitempty" protobuf:"bytes,16,rep,name=organizations"` 866 // GitHubApp holds the GitHub app credentials 867 // +optional 868 GithubApp *GithubAppCreds `json:"githubApp,omitempty" protobuf:"bytes,17,opt,name=githubApp"` 869 // Filter 870 // +optional 871 Filter *EventSourceFilter `json:"filter,omitempty" protobuf:"bytes,18,opt,name=filter"` 872 } 873 874 func (g GithubEventSource) GetOwnedRepositories() []OwnedRepositories { 875 if len(g.Repositories) > 0 { 876 return g.Repositories 877 } else if g.DeprecatedOwner != "" && g.DeprecatedRepository != "" { 878 return []OwnedRepositories{ 879 { 880 Owner: g.DeprecatedOwner, 881 Names: []string{ 882 g.DeprecatedRepository, 883 }, 884 }, 885 } 886 } 887 return nil 888 } 889 890 func (g GithubEventSource) HasGithubAPIToken() bool { 891 return g.APIToken != nil 892 } 893 894 func (g GithubEventSource) HasGithubAppCreds() bool { 895 return g.GithubApp != nil && g.GithubApp.PrivateKey != nil 896 } 897 898 func (g GithubEventSource) HasConfiguredWebhook() bool { 899 return g.Webhook != nil && g.Webhook.URL != "" 900 } 901 902 func (g GithubEventSource) NeedToCreateHooks() bool { 903 return (g.HasGithubAPIToken() || g.HasGithubAppCreds()) && g.HasConfiguredWebhook() 904 } 905 906 // GitlabEventSource refers to event-source related to Gitlab events 907 type GitlabEventSource struct { 908 // Webhook holds configuration to run a http server 909 Webhook *WebhookContext `json:"webhook,omitempty" protobuf:"bytes,1,opt,name=webhook"` 910 // DeprecatedProjectID is the id of project for which integration needs to setup 911 // Deprecated: use Projects instead. Will be unsupported in v 1.7 912 // +optional 913 DeprecatedProjectID string `json:"projectID,omitempty" protobuf:"bytes,2,opt,name=projectID"` 914 // Events are gitlab event to listen to. 915 // Refer https://github.com/xanzy/go-gitlab/blob/bf34eca5d13a9f4c3f501d8a97b8ac226d55e4d9/projects.go#L794. 916 Events []string `json:"events" protobuf:"bytes,3,opt,name=events"` 917 // AccessToken references to k8 secret which holds the gitlab api access information 918 AccessToken *corev1.SecretKeySelector `json:"accessToken,omitempty" protobuf:"bytes,4,opt,name=accessToken"` 919 // EnableSSLVerification to enable ssl verification 920 // +optional 921 EnableSSLVerification bool `json:"enableSSLVerification,omitempty" protobuf:"varint,5,opt,name=enableSSLVerification"` 922 // GitlabBaseURL is the base URL for API requests to a custom endpoint 923 GitlabBaseURL string `json:"gitlabBaseURL" protobuf:"bytes,6,opt,name=gitlabBaseURL"` 924 // DeleteHookOnFinish determines whether to delete the GitLab hook for the project once the event source is stopped. 925 // +optional 926 DeleteHookOnFinish bool `json:"deleteHookOnFinish,omitempty" protobuf:"varint,8,opt,name=deleteHookOnFinish"` 927 // Metadata holds the user defined metadata which will passed along the event payload. 928 // +optional 929 Metadata map[string]string `json:"metadata,omitempty" protobuf:"bytes,9,rep,name=metadata"` 930 // List of project IDs or project namespace paths like "whynowy/test". Projects and groups cannot be empty at the same time. 931 // +optional 932 Projects []string `json:"projects,omitempty" protobuf:"bytes,10,rep,name=projects"` 933 // SecretToken references to k8 secret which holds the Secret Token used by webhook config 934 SecretToken *corev1.SecretKeySelector `json:"secretToken,omitempty" protobuf:"bytes,11,opt,name=secretToken"` 935 // Filter 936 // +optional 937 Filter *EventSourceFilter `json:"filter,omitempty" protobuf:"bytes,12,opt,name=filter"` 938 // List of group IDs or group name like "test". 939 // Group level hook available in Premium and Ultimate Gitlab. 940 // +optional 941 Groups []string `json:"groups,omitempty" protobuf:"bytes,13,rep,name=groups"` 942 } 943 944 func (g GitlabEventSource) GetProjects() []string { 945 if len(g.Projects) > 0 { 946 return g.Projects 947 } 948 if g.DeprecatedProjectID != "" { 949 return []string{g.DeprecatedProjectID} 950 } 951 return []string{} 952 } 953 954 func (g GitlabEventSource) GetGroups() []string { 955 if len(g.Groups) > 0 { 956 return g.Groups 957 } 958 return []string{} 959 } 960 961 func (g GitlabEventSource) NeedToCreateHooks() bool { 962 return g.AccessToken != nil && g.Webhook != nil && g.Webhook.URL != "" 963 } 964 965 // BitbucketEventSource describes the event source for Bitbucket 966 type BitbucketEventSource struct { 967 // DeleteHookOnFinish determines whether to delete the defined Bitbucket hook once the event source is stopped. 968 // +optional 969 DeleteHookOnFinish bool `json:"deleteHookOnFinish,omitempty" protobuf:"varint,1,opt,name=deleteHookOnFinish"` 970 // Metadata holds the user defined metadata which will be passed along the event payload. 971 // +optional 972 Metadata map[string]string `json:"metadata,omitempty" protobuf:"bytes,2,rep,name=metadata"` 973 // Webhook refers to the configuration required to run an http server 974 Webhook *WebhookContext `json:"webhook" protobuf:"bytes,3,name=webhook"` 975 // Auth information required to connect to Bitbucket. 976 Auth *BitbucketAuth `json:"auth" protobuf:"bytes,4,name=auth"` 977 // Events this webhook is subscribed to. 978 Events []string `json:"events" protobuf:"bytes,5,name=events"` 979 // DeprecatedOwner is the owner of the repository. 980 // Deprecated: use Repositories instead. Will be unsupported in v1.9 981 // +optional 982 DeprecatedOwner string `json:"owner,omitempty" protobuf:"bytes,6,name=owner"` 983 // DeprecatedProjectKey is the key of the project to which the repository relates 984 // Deprecated: use Repositories instead. Will be unsupported in v1.9 985 // +optional 986 DeprecatedProjectKey string `json:"projectKey,omitempty" protobuf:"bytes,7,opt,name=projectKey"` 987 // DeprecatedRepositorySlug is a URL-friendly version of a repository name, automatically generated by Bitbucket for use in the URL 988 // Deprecated: use Repositories instead. Will be unsupported in v1.9 989 // +optional 990 DeprecatedRepositorySlug string `json:"repositorySlug,omitempty" protobuf:"bytes,8,name=repositorySlug"` 991 // Repositories holds a list of repositories for which integration needs to set up 992 // +optional 993 Repositories []BitbucketRepository `json:"repositories,omitempty" protobuf:"bytes,9,rep,name=repositories"` 994 // Filter 995 // +optional 996 Filter *EventSourceFilter `json:"filter,omitempty" protobuf:"bytes,10,opt,name=filter"` 997 } 998 999 func (b BitbucketEventSource) HasBitbucketBasicAuth() bool { 1000 return b.Auth.Basic != nil && b.Auth.Basic.Username != nil && b.Auth.Basic.Password != nil 1001 } 1002 1003 func (b BitbucketEventSource) HasBitbucketOAuthToken() bool { 1004 return b.Auth.OAuthToken != nil 1005 } 1006 1007 func (b BitbucketEventSource) HasConfiguredWebhook() bool { 1008 return b.Webhook != nil && b.Webhook.URL != "" 1009 } 1010 1011 func (b BitbucketEventSource) ShouldCreateWebhooks() bool { 1012 return (b.HasBitbucketBasicAuth() || b.HasBitbucketOAuthToken()) && b.HasConfiguredWebhook() 1013 } 1014 1015 func (b BitbucketEventSource) GetBitbucketRepositories() []BitbucketRepository { 1016 if len(b.Repositories) > 0 { 1017 return b.Repositories 1018 } 1019 1020 if b.DeprecatedOwner != "" && b.DeprecatedRepositorySlug != "" { 1021 return []BitbucketRepository{ 1022 { 1023 Owner: b.DeprecatedOwner, 1024 RepositorySlug: b.DeprecatedRepositorySlug, 1025 }, 1026 } 1027 } 1028 1029 return nil 1030 } 1031 1032 type BitbucketRepository struct { 1033 // Owner is the owner of the repository 1034 Owner string `json:"owner" protobuf:"bytes,1,name=owner"` 1035 // RepositorySlug is a URL-friendly version of a repository name, automatically generated by Bitbucket for use in the URL 1036 RepositorySlug string `json:"repositorySlug" protobuf:"bytes,2,rep,name=repositorySlug"` 1037 } 1038 1039 // GetRepositoryID helper returns a string key identifier for the repo 1040 func (r BitbucketRepository) GetRepositoryID() string { 1041 return r.Owner + "," + r.RepositorySlug 1042 } 1043 1044 // BitbucketAuth holds the different auth strategies for connecting to Bitbucket 1045 type BitbucketAuth struct { 1046 // Basic is BasicAuth auth strategy. 1047 // +optional 1048 Basic *BitbucketBasicAuth `json:"basic,omitempty" protobuf:"bytes,1,opt,name=basic"` 1049 // OAuthToken refers to the K8s secret that holds the OAuth Bearer token. 1050 // +optional 1051 OAuthToken *corev1.SecretKeySelector `json:"oauthToken,omitempty" protobuf:"bytes,2,opt,name=oauthToken"` 1052 } 1053 1054 // BasicAuth holds the information required to authenticate user via basic auth mechanism 1055 type BitbucketBasicAuth struct { 1056 // Username refers to the K8s secret that holds the username. 1057 Username *corev1.SecretKeySelector `json:"username" protobuf:"bytes,1,name=username"` 1058 // Password refers to the K8s secret that holds the password. 1059 Password *corev1.SecretKeySelector `json:"password" protobuf:"bytes,2,name=password"` 1060 } 1061 1062 // BitbucketServerEventSource refers to event-source related to Bitbucket Server events 1063 type BitbucketServerEventSource struct { 1064 // Webhook holds configuration to run a http server 1065 Webhook *WebhookContext `json:"webhook,omitempty" protobuf:"bytes,1,opt,name=webhook"` 1066 // DeprecatedProjectKey is the key of project for which integration needs to set up 1067 // Deprecated: use Repositories instead. Will be unsupported in v1.8 1068 // +optional 1069 DeprecatedProjectKey string `json:"projectKey,omitempty" protobuf:"bytes,2,opt,name=projectKey"` 1070 // DeprecatedRepositorySlug is the slug of the repository for which integration needs to set up 1071 // Deprecated: use Repositories instead. Will be unsupported in v1.8 1072 // +optional 1073 DeprecatedRepositorySlug string `json:"repositorySlug,omitempty" protobuf:"bytes,3,opt,name=repositorySlug"` 1074 // Repositories holds a list of repositories for which integration needs to set up 1075 // +optional 1076 Repositories []BitbucketServerRepository `json:"repositories,omitempty" protobuf:"bytes,4,rep,name=repositories"` 1077 // Events are bitbucket event to listen to. 1078 // Refer https://confluence.atlassian.com/bitbucketserver/event-payload-938025882.html 1079 Events []string `json:"events" protobuf:"bytes,5,opt,name=events"` 1080 // AccessToken is reference to K8s secret which holds the bitbucket api access information 1081 AccessToken *corev1.SecretKeySelector `json:"accessToken,omitempty" protobuf:"bytes,6,opt,name=accessToken"` 1082 // WebhookSecret is reference to K8s secret which holds the bitbucket webhook secret (for HMAC validation) 1083 WebhookSecret *corev1.SecretKeySelector `json:"webhookSecret,omitempty" protobuf:"bytes,7,opt,name=webhookSecret"` 1084 // BitbucketServerBaseURL is the base URL for API requests to a custom endpoint 1085 BitbucketServerBaseURL string `json:"bitbucketserverBaseURL" protobuf:"bytes,8,opt,name=bitbucketserverBaseURL"` 1086 // DeleteHookOnFinish determines whether to delete the Bitbucket Server hook for the project once the event source is stopped. 1087 // +optional 1088 DeleteHookOnFinish bool `json:"deleteHookOnFinish,omitempty" protobuf:"varint,9,opt,name=deleteHookOnFinish"` 1089 // Metadata holds the user defined metadata which will passed along the event payload. 1090 // +optional 1091 Metadata map[string]string `json:"metadata,omitempty" protobuf:"bytes,10,rep,name=metadata"` 1092 // Filter 1093 // +optional 1094 Filter *EventSourceFilter `json:"filter,omitempty" protobuf:"bytes,11,opt,name=filter"` 1095 // TLS configuration for the bitbucketserver client. 1096 // +optional 1097 TLS *apicommon.TLSConfig `json:"tls,omitempty" protobuf:"bytes,12,opt,name=tls"` 1098 } 1099 1100 type BitbucketServerRepository struct { 1101 // ProjectKey is the key of project for which integration needs to set up 1102 ProjectKey string `json:"projectKey" protobuf:"bytes,1,opt,name=projectKey"` 1103 // RepositorySlug is the slug of the repository for which integration needs to set up 1104 RepositorySlug string `json:"repositorySlug" protobuf:"bytes,2,rep,name=repositorySlug"` 1105 } 1106 1107 func (b BitbucketServerEventSource) ShouldCreateWebhooks() bool { 1108 return b.AccessToken != nil && b.Webhook != nil && b.Webhook.URL != "" 1109 } 1110 1111 func (b BitbucketServerEventSource) GetBitbucketServerRepositories() []BitbucketServerRepository { 1112 if len(b.Repositories) > 0 { 1113 return b.Repositories 1114 } 1115 1116 if b.DeprecatedProjectKey != "" && b.DeprecatedRepositorySlug != "" { 1117 return []BitbucketServerRepository{ 1118 { 1119 ProjectKey: b.DeprecatedProjectKey, 1120 RepositorySlug: b.DeprecatedRepositorySlug, 1121 }, 1122 } 1123 } 1124 1125 return nil 1126 } 1127 1128 // HDFSEventSource refers to event-source for HDFS related events 1129 type HDFSEventSource struct { 1130 WatchPathConfig `json:",inline" protobuf:"bytes,1,opt,name=watchPathConfig"` 1131 // Type of file operations to watch 1132 Type string `json:"type" protobuf:"bytes,2,opt,name=type"` 1133 // CheckInterval is a string that describes an interval duration to check the directory state, e.g. 1s, 30m, 2h... (defaults to 1m) 1134 CheckInterval string `json:"checkInterval,omitempty" protobuf:"bytes,3,opt,name=checkInterval"` 1135 // Addresses is accessible addresses of HDFS name nodes 1136 1137 Addresses []string `json:"addresses" protobuf:"bytes,4,rep,name=addresses"` 1138 // HDFSUser is the user to access HDFS file system. 1139 // It is ignored if either ccache or keytab is used. 1140 HDFSUser string `json:"hdfsUser,omitempty" protobuf:"bytes,5,opt,name=hdfsUser"` 1141 // KrbCCacheSecret is the secret selector for Kerberos ccache 1142 // Either ccache or keytab can be set to use Kerberos. 1143 KrbCCacheSecret *corev1.SecretKeySelector `json:"krbCCacheSecret,omitempty" protobuf:"bytes,6,opt,name=krbCCacheSecret"` 1144 // KrbKeytabSecret is the secret selector for Kerberos keytab 1145 // Either ccache or keytab can be set to use Kerberos. 1146 KrbKeytabSecret *corev1.SecretKeySelector `json:"krbKeytabSecret,omitempty" protobuf:"bytes,7,opt,name=krbKeytabSecret"` 1147 // KrbUsername is the Kerberos username used with Kerberos keytab 1148 // It must be set if keytab is used. 1149 KrbUsername string `json:"krbUsername,omitempty" protobuf:"bytes,8,opt,name=krbUsername"` 1150 // KrbRealm is the Kerberos realm used with Kerberos keytab 1151 // It must be set if keytab is used. 1152 KrbRealm string `json:"krbRealm,omitempty" protobuf:"bytes,9,opt,name=krbRealm"` 1153 // KrbConfig is the configmap selector for Kerberos config as string 1154 // It must be set if either ccache or keytab is used. 1155 KrbConfigConfigMap *corev1.ConfigMapKeySelector `json:"krbConfigConfigMap,omitempty" protobuf:"bytes,10,opt,name=krbConfigConfigMap"` 1156 // KrbServicePrincipalName is the principal name of Kerberos service 1157 // It must be set if either ccache or keytab is used. 1158 KrbServicePrincipalName string `json:"krbServicePrincipalName,omitempty" protobuf:"bytes,11,opt,name=krbServicePrincipalName"` 1159 // Metadata holds the user defined metadata which will passed along the event payload. 1160 // +optional 1161 Metadata map[string]string `json:"metadata,omitempty" protobuf:"bytes,12,rep,name=metadata"` 1162 // Filter 1163 // +optional 1164 Filter *EventSourceFilter `json:"filter,omitempty" protobuf:"bytes,13,opt,name=filter"` 1165 } 1166 1167 // SlackEventSource refers to event-source for Slack related events 1168 type SlackEventSource struct { 1169 // Slack App signing secret 1170 SigningSecret *corev1.SecretKeySelector `json:"signingSecret,omitempty" protobuf:"bytes,1,opt,name=signingSecret"` 1171 // Token for URL verification handshake 1172 Token *corev1.SecretKeySelector `json:"token,omitempty" protobuf:"bytes,2,opt,name=token"` 1173 // Webhook holds configuration for a REST endpoint 1174 Webhook *WebhookContext `json:"webhook,omitempty" protobuf:"bytes,3,opt,name=webhook"` 1175 // Metadata holds the user defined metadata which will passed along the event payload. 1176 // +optional 1177 Metadata map[string]string `json:"metadata,omitempty" protobuf:"bytes,4,rep,name=metadata"` 1178 // Filter 1179 // +optional 1180 Filter *EventSourceFilter `json:"filter,omitempty" protobuf:"bytes,5,opt,name=filter"` 1181 } 1182 1183 // StorageGridEventSource refers to event-source for StorageGrid related events 1184 type StorageGridEventSource struct { 1185 // Webhook holds configuration for a REST endpoint 1186 Webhook *WebhookContext `json:"webhook,omitempty" protobuf:"bytes,1,opt,name=webhook"` 1187 // Events are s3 bucket notification events. 1188 // For more information on s3 notifications, follow https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html#notification-how-to-event-types-and-destinations 1189 // Note that storage grid notifications do not contain `s3:` 1190 1191 Events []string `json:"events,omitempty" protobuf:"bytes,2,rep,name=events"` 1192 // Filter on object key which caused the notification. 1193 Filter *StorageGridFilter `json:"filter,omitempty" protobuf:"bytes,3,opt,name=filter"` 1194 // TopicArn 1195 TopicArn string `json:"topicArn" protobuf:"bytes,4,name=topicArn"` 1196 // Name of the bucket to register notifications for. 1197 Bucket string `json:"bucket" protobuf:"bytes,5,name=bucket"` 1198 // S3 region. 1199 // Defaults to us-east-1 1200 // +optional 1201 Region string `json:"region,omitempty" protobuf:"bytes,6,opt,name=region"` 1202 // Auth token for storagegrid api 1203 AuthToken *corev1.SecretKeySelector `json:"authToken" protobuf:"bytes,7,name=authToken"` 1204 // APIURL is the url of the storagegrid api. 1205 APIURL string `json:"apiURL" protobuf:"bytes,8,name=apiURL"` 1206 // Metadata holds the user defined metadata which will passed along the event payload. 1207 // +optional 1208 Metadata map[string]string `json:"metadata,omitempty" protobuf:"bytes,9,rep,name=metadata"` 1209 } 1210 1211 // StorageGridFilter represents filters to apply to bucket notifications for specifying constraints on objects 1212 // +k8s:openapi-gen=true 1213 type StorageGridFilter struct { 1214 Prefix string `json:"prefix" protobuf:"bytes,1,opt,name=prefix"` 1215 Suffix string `json:"suffix" protobuf:"bytes,2,opt,name=suffix"` 1216 } 1217 1218 // AzureEventsHubEventSource describes the event source for azure events hub 1219 // More info at https://docs.microsoft.com/en-us/azure/event-hubs/ 1220 type AzureEventsHubEventSource struct { 1221 // FQDN of the EventHubs namespace you created 1222 // More info at https://docs.microsoft.com/en-us/azure/event-hubs/event-hubs-get-connection-string 1223 FQDN string `json:"fqdn" protobuf:"bytes,1,opt,name=fqdn"` 1224 // SharedAccessKeyName is the name you chose for your application's SAS keys 1225 SharedAccessKeyName *corev1.SecretKeySelector `json:"sharedAccessKeyName,omitempty" protobuf:"bytes,2,opt,name=sharedAccessKeyName"` 1226 // SharedAccessKey is the generated value of the key 1227 SharedAccessKey *corev1.SecretKeySelector `json:"sharedAccessKey,omitempty" protobuf:"bytes,3,opt,name=sharedAccessKey"` 1228 // Event Hub path/name 1229 HubName string `json:"hubName" protobuf:"bytes,4,opt,name=hubName"` 1230 // Metadata holds the user defined metadata which will passed along the event payload. 1231 // +optional 1232 Metadata map[string]string `json:"metadata,omitempty" protobuf:"bytes,5,rep,name=metadata"` 1233 // Filter 1234 // +optional 1235 Filter *EventSourceFilter `json:"filter,omitempty" protobuf:"bytes,6,opt,name=filter"` 1236 } 1237 1238 // AzureServiceBusEventSource describes the event source for azure service bus 1239 // More info at https://docs.microsoft.com/en-us/azure/service-bus-messaging/ 1240 type AzureServiceBusEventSource struct { 1241 // ConnectionString is the connection string for the Azure Service Bus. If this fields is not provided 1242 // it will try to access via Azure AD with DefaultAzureCredential and FullyQualifiedNamespace. 1243 // +optional 1244 ConnectionString *corev1.SecretKeySelector `json:"connectionString,omitempty" protobuf:"bytes,1,opt,name=connectionString"` 1245 // QueueName is the name of the Azure Service Bus Queue 1246 QueueName string `json:"queueName" protobuf:"bytes,2,opt,name=queueName"` 1247 // TopicName is the name of the Azure Service Bus Topic 1248 TopicName string `json:"topicName" protobuf:"bytes,3,opt,name=topicName"` 1249 // SubscriptionName is the name of the Azure Service Bus Topic Subscription 1250 SubscriptionName string `json:"subscriptionName" protobuf:"bytes,4,opt,name=subscriptionName"` 1251 // TLS configuration for the service bus client 1252 // +optional 1253 TLS *apicommon.TLSConfig `json:"tls,omitempty" protobuf:"bytes,5,opt,name=tls"` 1254 // JSONBody specifies that all event body payload coming from this 1255 // source will be JSON 1256 // +optional 1257 JSONBody bool `json:"jsonBody,omitempty" protobuf:"varint,6,opt,name=jsonBody"` 1258 // Metadata holds the user defined metadata which will passed along the event payload. 1259 // +optional 1260 Metadata map[string]string `json:"metadata,omitempty" protobuf:"bytes,7,rep,name=metadata"` 1261 // Filter 1262 // +optional 1263 Filter *EventSourceFilter `json:"filter,omitempty" protobuf:"bytes,8,opt,name=filter"` 1264 // FullyQualifiedNamespace is the Service Bus namespace name (ex: myservicebus.servicebus.windows.net). This field is necessary to 1265 // access via Azure AD (managed identity) and it is ignored if ConnectionString is set. 1266 // +optional 1267 FullyQualifiedNamespace string `json:"fullyQualifiedNamespace,omitempty" protobuf:"bytes,9,opt,name=fullyQualifiedNamespace"` 1268 } 1269 1270 // AzureQueueStorageEventSource describes the event source for azure queue storage 1271 // more info at https://learn.microsoft.com/en-us/azure/storage/queues/ 1272 type AzureQueueStorageEventSource struct { 1273 // StorageAccountName is the name of the storage account where the queue is. This field is necessary to 1274 // access via Azure AD (managed identity) and it is ignored if ConnectionString is set. 1275 // +optional 1276 StorageAccountName string `json:"storageAccountName,omitempty" protobuf:"bytes,1,opt,name=storageAccountName"` 1277 // ConnectionString is the connection string to access Azure Queue Storage. If this fields is not provided 1278 // it will try to access via Azure AD with StorageAccountName. 1279 // +optional 1280 ConnectionString *corev1.SecretKeySelector `json:"connectionString,omitempty" protobuf:"bytes,2,opt,name=connectionString"` 1281 // QueueName is the name of the queue 1282 QueueName string `json:"queueName" protobuf:"bytes,3,opt,name=queueName"` 1283 // JSONBody specifies that all event body payload coming from this 1284 // source will be JSON 1285 // +optional 1286 JSONBody bool `json:"jsonBody,omitempty" protobuf:"varint,4,opt,name=jsonBody"` 1287 // DLQ specifies if a dead-letter queue is configured for messages that can't be processed successfully. 1288 // If set to true, messages with invalid payload won't be acknowledged to allow to forward them farther to the dead-letter queue. 1289 // The default value is false. 1290 // +optional 1291 DLQ bool `json:"dlq,omitempty" protobuf:"varint,5,opt,name=dlq"` 1292 // Metadata holds the user defined metadata which will passed along the event payload. 1293 // +optional 1294 Metadata map[string]string `json:"metadata,omitempty" protobuf:"bytes,6,rep,name=metadata"` 1295 // Filter 1296 // +optional 1297 Filter *EventSourceFilter `json:"filter,omitempty" protobuf:"bytes,7,opt,name=filter"` 1298 // DecodeMessage specifies if all the messages should be base64 decoded. 1299 // If set to true the decoding is done before the evaluation of JSONBody 1300 // +optional 1301 DecodeMessage bool `json:"decodeMessage,omitempty" protobuf:"bytes,8,opt,name=decodeMessage"` 1302 // WaitTimeInSeconds is the duration (in seconds) for which the event source waits between empty results from the queue. 1303 // The default value is 3 seconds. 1304 // +optional 1305 WaitTimeInSeconds *int32 `json:"waitTimeInSeconds,omitempty" protobuf:"varint,9,opt,name=waitTimeInSeconds"` 1306 } 1307 1308 // StripeEventSource describes the event source for stripe webhook notifications 1309 // More info at https://stripe.com/docs/webhooks 1310 type StripeEventSource struct { 1311 // Webhook holds configuration for a REST endpoint 1312 Webhook *WebhookContext `json:"webhook,omitempty" protobuf:"bytes,1,opt,name=webhook"` 1313 // CreateWebhook if specified creates a new webhook programmatically. 1314 // +optional 1315 CreateWebhook bool `json:"createWebhook,omitempty" protobuf:"varint,2,opt,name=createWebhook"` 1316 // APIKey refers to K8s secret that holds Stripe API key. Used only if CreateWebhook is enabled. 1317 // +optional 1318 APIKey *corev1.SecretKeySelector `json:"apiKey,omitempty" protobuf:"bytes,3,opt,name=apiKey"` 1319 // EventFilter describes the type of events to listen to. If not specified, all types of events will be processed. 1320 // More info at https://stripe.com/docs/api/events/list 1321 // +optional 1322 EventFilter []string `json:"eventFilter,omitempty" protobuf:"bytes,4,rep,name=eventFilter"` 1323 // Metadata holds the user defined metadata which will passed along the event payload. 1324 // +optional 1325 Metadata map[string]string `json:"metadata,omitempty" protobuf:"bytes,5,rep,name=metadata"` 1326 } 1327 1328 // EmitterEventSource describes the event source for emitter 1329 // More info at https://emitter.io/develop/getting-started/ 1330 type EmitterEventSource struct { 1331 // Broker URI to connect to. 1332 Broker string `json:"broker" protobuf:"bytes,1,opt,name=broker"` 1333 // ChannelKey refers to the channel key 1334 ChannelKey string `json:"channelKey" protobuf:"bytes,2,opt,name=channelKey"` 1335 // ChannelName refers to the channel name 1336 ChannelName string `json:"channelName" protobuf:"bytes,3,opt,name=channelName"` 1337 // Username to use to connect to broker 1338 // +optional 1339 Username *corev1.SecretKeySelector `json:"username,omitempty" protobuf:"bytes,4,opt,name=username"` 1340 // Password to use to connect to broker 1341 // +optional 1342 Password *corev1.SecretKeySelector `json:"password,omitempty" protobuf:"bytes,5,opt,name=password"` 1343 // Backoff holds parameters applied to connection. 1344 // +optional 1345 ConnectionBackoff *apicommon.Backoff `json:"connectionBackoff,omitempty" protobuf:"bytes,6,opt,name=connectionBackoff"` 1346 // JSONBody specifies that all event body payload coming from this 1347 // source will be JSON 1348 // +optional 1349 JSONBody bool `json:"jsonBody,omitempty" protobuf:"varint,7,opt,name=jsonBody"` 1350 // TLS configuration for the emitter client. 1351 // +optional 1352 TLS *apicommon.TLSConfig `json:"tls,omitempty" protobuf:"bytes,8,opt,name=tls"` 1353 // Metadata holds the user defined metadata which will passed along the event payload. 1354 // +optional 1355 Metadata map[string]string `json:"metadata,omitempty" protobuf:"bytes,9,rep,name=metadata"` 1356 // Filter 1357 // +optional 1358 Filter *EventSourceFilter `json:"filter,omitempty" protobuf:"bytes,10,opt,name=filter"` 1359 } 1360 1361 // RedisEventSource describes an event source for the Redis PubSub. 1362 // More info at https://godoc.org/github.com/go-redis/redis#example-PubSub 1363 type RedisEventSource struct { 1364 // HostAddress refers to the address of the Redis host/server 1365 HostAddress string `json:"hostAddress" protobuf:"bytes,1,opt,name=hostAddress"` 1366 // Password required for authentication if any. 1367 // +optional 1368 Password *corev1.SecretKeySelector `json:"password,omitempty" protobuf:"bytes,2,opt,name=password"` 1369 // Namespace to use to retrieve the password from. It should only be specified if password is declared 1370 // +optional 1371 Namespace string `json:"namespace,omitempty" protobuf:"bytes,3,opt,name=namespace"` 1372 // DB to use. If not specified, default DB 0 will be used. 1373 // +optional 1374 DB int32 `json:"db,omitempty" protobuf:"varint,4,opt,name=db"` 1375 // Channels to subscribe to listen events. 1376 1377 Channels []string `json:"channels" protobuf:"bytes,5,rep,name=channels"` 1378 // TLS configuration for the redis client. 1379 // +optional 1380 TLS *apicommon.TLSConfig `json:"tls,omitempty" protobuf:"bytes,6,opt,name=tls"` 1381 // Metadata holds the user defined metadata which will passed along the event payload. 1382 // +optional 1383 Metadata map[string]string `json:"metadata,omitempty" protobuf:"bytes,7,rep,name=metadata"` 1384 // Filter 1385 // +optional 1386 Filter *EventSourceFilter `json:"filter,omitempty" protobuf:"bytes,8,opt,name=filter"` 1387 // JSONBody specifies that all event body payload coming from this 1388 // source will be JSON 1389 // +optional 1390 JSONBody bool `json:"jsonBody,omitempty" protobuf:"varint,9,opt,name=jsonBody"` 1391 // Username required for ACL style authentication if any. 1392 // +optional 1393 Username string `json:"username,omitempty" protobuf:"bytes,10,opt,name=username"` 1394 } 1395 1396 // RedisStreamEventSource describes an event source for 1397 // Redis streams (https://redis.io/topics/streams-intro) 1398 type RedisStreamEventSource struct { 1399 // HostAddress refers to the address of the Redis host/server (master instance) 1400 HostAddress string `json:"hostAddress" protobuf:"bytes,1,opt,name=hostAddress"` 1401 // Password required for authentication if any. 1402 // +optional 1403 Password *corev1.SecretKeySelector `json:"password,omitempty" protobuf:"bytes,2,opt,name=password"` 1404 // DB to use. If not specified, default DB 0 will be used. 1405 // +optional 1406 DB int32 `json:"db,omitempty" protobuf:"varint,3,opt,name=db"` 1407 // Streams to look for entries. XREADGROUP is used on all streams using a single consumer group. 1408 Streams []string `json:"streams" protobuf:"bytes,4,rep,name=streams"` 1409 // MaxMsgCountPerRead holds the maximum number of messages per stream that will be read in each XREADGROUP of all streams 1410 // Example: if there are 2 streams and MaxMsgCountPerRead=10, then each XREADGROUP may read upto a total of 20 messages. 1411 // Same as COUNT option in XREADGROUP(https://redis.io/topics/streams-intro). Defaults to 10 1412 // +optional 1413 MaxMsgCountPerRead int32 `json:"maxMsgCountPerRead,omitempty" protobuf:"varint,5,opt,name=maxMsgCountPerRead"` 1414 // ConsumerGroup refers to the Redis stream consumer group that will be 1415 // created on all redis streams. Messages are read through this group. Defaults to 'argo-events-cg' 1416 // +optional 1417 ConsumerGroup string `json:"consumerGroup,omitempty" protobuf:"bytes,6,opt,name=consumerGroup"` 1418 // TLS configuration for the redis client. 1419 // +optional 1420 TLS *apicommon.TLSConfig `json:"tls,omitempty" protobuf:"bytes,7,opt,name=tls"` 1421 // Metadata holds the user defined metadata which will passed along the event payload. 1422 // +optional 1423 Metadata map[string]string `json:"metadata,omitempty" protobuf:"bytes,8,rep,name=metadata"` 1424 // Filter 1425 // +optional 1426 Filter *EventSourceFilter `json:"filter,omitempty" protobuf:"bytes,9,opt,name=filter"` 1427 // Username required for ACL style authentication if any. 1428 // +optional 1429 Username string `json:"username,omitempty" protobuf:"bytes,10,opt,name=username"` 1430 } 1431 1432 // NSQEventSource describes the event source for NSQ PubSub 1433 // More info at https://godoc.org/github.com/nsqio/go-nsq 1434 type NSQEventSource struct { 1435 // HostAddress is the address of the host for NSQ lookup 1436 HostAddress string `json:"hostAddress" protobuf:"bytes,1,opt,name=hostAddress"` 1437 // Topic to subscribe to. 1438 Topic string `json:"topic" protobuf:"bytes,2,opt,name=topic"` 1439 // Channel used for subscription 1440 Channel string `json:"channel" protobuf:"bytes,3,opt,name=channel"` 1441 // Backoff holds parameters applied to connection. 1442 // +optional 1443 ConnectionBackoff *apicommon.Backoff `json:"connectionBackoff,omitempty" protobuf:"bytes,4,opt,name=connectionBackoff"` 1444 // JSONBody specifies that all event body payload coming from this 1445 // source will be JSON 1446 // +optional 1447 JSONBody bool `json:"jsonBody,omitempty" protobuf:"varint,5,opt,name=jsonBody"` 1448 // TLS configuration for the nsq client. 1449 // +optional 1450 TLS *apicommon.TLSConfig `json:"tls,omitempty" protobuf:"bytes,6,opt,name=tls"` 1451 // Metadata holds the user defined metadata which will passed along the event payload. 1452 // +optional 1453 Metadata map[string]string `json:"metadata,omitempty" protobuf:"bytes,7,rep,name=metadata"` 1454 // Filter 1455 // +optional 1456 Filter *EventSourceFilter `json:"filter,omitempty" protobuf:"bytes,8,opt,name=filter"` 1457 } 1458 1459 // PulsarEventSource describes the event source for Apache Pulsar 1460 type PulsarEventSource struct { 1461 // Name of the topics to subscribe to. 1462 // +required 1463 Topics []string `json:"topics" protobuf:"bytes,1,rep,name=topics"` 1464 // Type of the subscription. 1465 // Only "exclusive" and "shared" is supported. 1466 // Defaults to exclusive. 1467 // +optional 1468 Type string `json:"type,omitempty" protobuf:"bytes,2,opt,name=type"` 1469 // Configure the service URL for the Pulsar service. 1470 // +required 1471 URL string `json:"url" protobuf:"bytes,3,name=url"` 1472 // Trusted TLS certificate secret. 1473 // +optional 1474 TLSTrustCertsSecret *corev1.SecretKeySelector `json:"tlsTrustCertsSecret,omitempty" protobuf:"bytes,4,opt,name=tlsTrustCertsSecret"` 1475 // Whether the Pulsar client accept untrusted TLS certificate from broker. 1476 // +optional 1477 TLSAllowInsecureConnection bool `json:"tlsAllowInsecureConnection,omitempty" protobuf:"bytes,5,opt,name=tlsAllowInsecureConnection"` 1478 // Whether the Pulsar client verify the validity of the host name from broker. 1479 // +optional 1480 TLSValidateHostname bool `json:"tlsValidateHostname,omitempty" protobuf:"bytes,6,opt,name=tlsValidateHostname"` 1481 // TLS configuration for the pulsar client. 1482 // +optional 1483 TLS *apicommon.TLSConfig `json:"tls,omitempty" protobuf:"bytes,7,opt,name=tls"` 1484 // Backoff holds parameters applied to connection. 1485 // +optional 1486 ConnectionBackoff *apicommon.Backoff `json:"connectionBackoff,omitempty" protobuf:"bytes,8,opt,name=connectionBackoff"` 1487 // JSONBody specifies that all event body payload coming from this 1488 // source will be JSON 1489 // +optional 1490 JSONBody bool `json:"jsonBody,omitempty" protobuf:"bytes,9,opt,name=jsonBody"` 1491 // Metadata holds the user defined metadata which will passed along the event payload. 1492 // +optional 1493 Metadata map[string]string `json:"metadata,omitempty" protobuf:"bytes,10,rep,name=metadata"` 1494 // Authentication token for the pulsar client. 1495 // Either token or athenz can be set to use auth. 1496 // +optional 1497 AuthTokenSecret *corev1.SecretKeySelector `json:"authTokenSecret,omitempty" protobuf:"bytes,11,opt,name=authTokenSecret"` 1498 // Filter 1499 // +optional 1500 Filter *EventSourceFilter `json:"filter,omitempty" protobuf:"bytes,12,opt,name=filter"` 1501 // Authentication athenz parameters for the pulsar client. 1502 // Refer https://github.com/apache/pulsar-client-go/blob/master/pulsar/auth/athenz.go 1503 // Either token or athenz can be set to use auth. 1504 // +optional 1505 AuthAthenzParams map[string]string `json:"authAthenzParams,omitempty" protobuf:"bytes,13,rep,name=authAthenzParams"` 1506 // Authentication athenz privateKey secret for the pulsar client. 1507 // AuthAthenzSecret must be set if AuthAthenzParams is used. 1508 // +optional 1509 AuthAthenzSecret *corev1.SecretKeySelector `json:"authAthenzSecret,omitempty" protobuf:"bytes,14,opt,name=authAthenzSecret"` 1510 } 1511 1512 // GenericEventSource refers to a generic event source. It can be used to implement a custom event source. 1513 type GenericEventSource struct { 1514 // URL of the gRPC server that implements the event source. 1515 URL string `json:"url" protobuf:"bytes,1,name=url"` 1516 // Config is the event source configuration 1517 Config string `json:"config" protobuf:"bytes,2,name=config"` 1518 // Insecure determines the type of connection. 1519 Insecure bool `json:"insecure,omitempty" protobuf:"varint,3,opt,name=insecure"` 1520 // JSONBody specifies that all event body payload coming from this 1521 // source will be JSON 1522 // +optional 1523 JSONBody bool `json:"jsonBody,omitempty" protobuf:"varint,4,opt,name=jsonBody"` 1524 // Metadata holds the user defined metadata which will passed along the event payload. 1525 // +optional 1526 Metadata map[string]string `json:"metadata,omitempty" protobuf:"bytes,5,rep,name=metadata"` 1527 // AuthSecret holds a secret selector that contains a bearer token for authentication 1528 // +optional 1529 AuthSecret *corev1.SecretKeySelector `json:"authSecret,omitempty" protobuf:"bytes,6,opt,name=authSecret"` 1530 // Filter 1531 // +optional 1532 Filter *EventSourceFilter `json:"filter,omitempty" protobuf:"bytes,7,opt,name=filter"` 1533 } 1534 1535 const ( 1536 // EventSourceConditionSourcesProvided has the status True when the EventSource 1537 // has its event source provided. 1538 EventSourceConditionSourcesProvided apicommon.ConditionType = "SourcesProvided" 1539 // EventSourceConditionDeployed has the status True when the EventSource 1540 // has its Deployment created. 1541 EventSourceConditionDeployed apicommon.ConditionType = "Deployed" 1542 ) 1543 1544 // EventSourceStatus holds the status of the event-source resource 1545 type EventSourceStatus struct { 1546 apicommon.Status `json:",inline" protobuf:"bytes,1,opt,name=status"` 1547 } 1548 1549 // InitConditions sets conditions to Unknown state. 1550 func (es *EventSourceStatus) InitConditions() { 1551 es.InitializeConditions(EventSourceConditionSourcesProvided, EventSourceConditionDeployed) 1552 } 1553 1554 // MarkSourcesProvided set the eventsource has valid sources spec provided. 1555 func (es *EventSourceStatus) MarkSourcesProvided() { 1556 es.MarkTrue(EventSourceConditionSourcesProvided) 1557 } 1558 1559 // MarkSourcesNotProvided the eventsource has invalid sources spec provided. 1560 func (es *EventSourceStatus) MarkSourcesNotProvided(reason, message string) { 1561 es.MarkFalse(EventSourceConditionSourcesProvided, reason, message) 1562 } 1563 1564 // MarkDeployed set the eventsource has been deployed. 1565 func (es *EventSourceStatus) MarkDeployed() { 1566 es.MarkTrue(EventSourceConditionDeployed) 1567 } 1568 1569 // MarkDeployFailed set the eventsource deploy failed 1570 func (es *EventSourceStatus) MarkDeployFailed(reason, message string) { 1571 es.MarkFalse(EventSourceConditionDeployed, reason, message) 1572 }