github.com/argoproj/argo-events@v1.9.1/eventsources/sources/bitbucketserver/types.go (about)

     1  /*
     2  
     3  Licensed under the Apache License, Version 2.0 (the "License");
     4  you may not use this file except in compliance with the License.
     5  You may obtain a copy of the License at
     6  
     7  	http://www.apache.org/licenses/LICENSE-2.0
     8  
     9  Unless required by applicable law or agreed to in writing, software
    10  distributed under the License is distributed on an "AS IS" BASIS,
    11  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  See the License for the specific language governing permissions and
    13  limitations under the License.
    14  */
    15  
    16  package bitbucketserver
    17  
    18  import (
    19  	"github.com/argoproj/argo-events/eventsources/common/webhook"
    20  	metrics "github.com/argoproj/argo-events/metrics"
    21  	apicommon "github.com/argoproj/argo-events/pkg/apis/common"
    22  	"github.com/argoproj/argo-events/pkg/apis/eventsource/v1alpha1"
    23  )
    24  
    25  // EventListener implements ConfigExecutor
    26  type EventListener struct {
    27  	EventSourceName            string
    28  	EventName                  string
    29  	BitbucketServerEventSource v1alpha1.BitbucketServerEventSource
    30  	Metrics                    *metrics.Metrics
    31  }
    32  
    33  // GetEventSourceName returns name of event source
    34  func (el *EventListener) GetEventSourceName() string {
    35  	return el.EventSourceName
    36  }
    37  
    38  // GetEventName returns name of event
    39  func (el *EventListener) GetEventName() string {
    40  	return el.EventName
    41  }
    42  
    43  // GetEventSourceType return type of event server
    44  func (el *EventListener) GetEventSourceType() apicommon.EventSourceType {
    45  	return apicommon.BitbucketServerEvent
    46  }
    47  
    48  // Router contains the configuration information for a route
    49  type Router struct {
    50  	// route contains information about a API endpoint
    51  	route *webhook.Route
    52  	// hookIDs is a map of webhook IDs
    53  	// (projectKey + "," + repoSlug) -> hook ID
    54  	// Bitbucket Server API docs:
    55  	// https://developer.atlassian.com/server/bitbucket/reference/rest-api/
    56  	hookIDs map[string]int
    57  	// hookSecret is a Bitbucket Server webhook secret
    58  	hookSecret string
    59  	// bitbucketserverEventSource is the event source that contains configuration necessary to consume events from Bitbucket Server
    60  	bitbucketserverEventSource *v1alpha1.BitbucketServerEventSource
    61  }