github.com/argoproj/argo-events@v1.9.1/eventsources/sources/storagegrid/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 storagegrid
    18  
    19  import (
    20  	"time"
    21  
    22  	"github.com/argoproj/argo-events/eventsources/common/webhook"
    23  	metrics "github.com/argoproj/argo-events/metrics"
    24  	"github.com/argoproj/argo-events/pkg/apis/eventsource/v1alpha1"
    25  )
    26  
    27  // EventListener implements Eventing for storage grid events
    28  type EventListener struct {
    29  	EventSourceName        string
    30  	EventName              string
    31  	StorageGridEventSource v1alpha1.StorageGridEventSource
    32  	Metrics                *metrics.Metrics
    33  }
    34  
    35  // Router manages route
    36  type Router struct {
    37  	// route contains configuration of a REST endpoint
    38  	route *webhook.Route
    39  	// storageGridEventSource refers to event source which contains configuration to consume events from storage grid
    40  	storageGridEventSource *v1alpha1.StorageGridEventSource
    41  }
    42  
    43  type storageGridNotificationRequest struct {
    44  	Notification string `json:"notification"`
    45  }
    46  
    47  type registerNotificationResponse struct {
    48  	ResponseTime time.Time `json:"responseTime"`
    49  	Status       string    `json:"status"`
    50  	APIVersion   string    `json:"apiVersion"`
    51  	Deprecated   bool      `json:"deprecated"`
    52  	Code         int       `json:"code"`
    53  	Message      struct {
    54  		Text             string `json:"text"`
    55  		Key              string `json:"key"`
    56  		Context          string `json:"context"`
    57  		DeveloperMessage string `json:"developerMessage"`
    58  	} `json:"message"`
    59  	Errors []struct {
    60  		Text             string `json:"text"`
    61  		Key              string `json:"key"`
    62  		Context          string `json:"context"`
    63  		DeveloperMessage string `json:"developerMessage"`
    64  	} `json:"errors"`
    65  }
    66  
    67  type getEndpointResponse struct {
    68  	ResponseTime time.Time `json:"responseTime"`
    69  	Status       string    `json:"status"`
    70  	APIVersion   string    `json:"apiVersion"`
    71  	Deprecated   bool      `json:"deprecated"`
    72  	Data         []struct {
    73  		DisplayName string `json:"displayName"`
    74  		EndpointURI string `json:"endpointURI"`
    75  		EndpointURN string `json:"endpointURN"`
    76  		AuthType    string `json:"authType"`
    77  		CaCert      string `json:"caCert"`
    78  		InsecureTLS bool   `json:"insecureTLS"`
    79  		Credentials struct {
    80  			AccessKeyID     string `json:"accessKeyId"`
    81  			SecretAccessKey string `json:"secretAccessKey"`
    82  		} `json:"credentials"`
    83  		BasicHTTPCredentials struct {
    84  			Username string `json:"username"`
    85  			Password string `json:"password"`
    86  		} `json:"basicHttpCredentials"`
    87  		Error struct {
    88  			Text string    `json:"text"`
    89  			Time time.Time `json:"time"`
    90  			Key  string    `json:"key"`
    91  		} `json:"error"`
    92  		ID string `json:"id"`
    93  	} `json:"data"`
    94  }
    95  
    96  type createEndpointRequest struct {
    97  	DisplayName string `json:"displayName"`
    98  	EndpointURI string `json:"endpointURI"`
    99  	EndpointURN string `json:"endpointURN"`
   100  	AuthType    string `json:"authType"`
   101  	InsecureTLS bool   `json:"insecureTLS"`
   102  }
   103  
   104  type genericResponse struct {
   105  	ResponseTime time.Time `json:"responseTime"`
   106  	Status       string    `json:"status"`
   107  	APIVersion   string    `json:"apiVersion"`
   108  	Deprecated   bool      `json:"deprecated"`
   109  	Code         int       `json:"code"`
   110  	Message      struct {
   111  		Text             string `json:"text"`
   112  		Key              string `json:"key"`
   113  		Context          string `json:"context"`
   114  		DeveloperMessage string `json:"developerMessage"`
   115  	} `json:"message"`
   116  	Errors []struct {
   117  		Text             string `json:"text"`
   118  		Key              string `json:"key"`
   119  		Context          string `json:"context"`
   120  		DeveloperMessage string `json:"developerMessage"`
   121  	} `json:"errors"`
   122  }