New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DX-1084] Add documentation to protobuf source code files for review #6251
base: master
Are you sure you want to change the base?
Conversation
API Changes --- prev.txt 2024-05-24 10:06:43.360132823 +0000
+++ current.txt 2024-05-24 10:06:40.220101863 +0000
@@ -733,32 +733,9 @@
"proxy": {
"type": ["object", "null"],
"properties": {
- "features": {
- "type": ["object", "null"],
- "properties": {
- "use_immutable_headers": {
- "type": "boolean"
- }
- }
- },
"auth_headers": {
"type": ["object", "null"]
- },
- "request_headers_rewrite": {
- "type": ["object", "null"],
- "additionalProperties": {
- "type": "object",
- "properties": {
- "value": {
- "type": "string"
- },
- "remove": {
- "type": "boolean"
- }
- },
- "required": ["value", "remove"]
- }
- }
+ }
}
},
"subgraph": {
@@ -1270,10 +1247,9 @@
type GraphQLConfigVersion string
const (
- GraphQLConfigVersionNone GraphQLConfigVersion = ""
- GraphQLConfigVersion1 GraphQLConfigVersion = "1"
- GraphQLConfigVersion2 GraphQLConfigVersion = "2"
- GraphQLConfigVersion3Preview GraphQLConfigVersion = "3-preview"
+ GraphQLConfigVersionNone GraphQLConfigVersion = ""
+ GraphQLConfigVersion1 GraphQLConfigVersion = "1"
+ GraphQLConfigVersion2 GraphQLConfigVersion = "2"
)
type GraphQLEngineConfig struct {
FieldConfigs []GraphQLFieldConfig `bson:"field_configs" json:"field_configs"`
@@ -1300,15 +1276,15 @@
}
type GraphQLEngineDataSourceConfigKafka struct {
- BrokerAddresses []string `bson:"broker_addresses" json:"broker_addresses"`
- Topics []string `bson:"topics" json:"topics"`
- GroupID string `bson:"group_id" json:"group_id"`
- ClientID string `bson:"client_id" json:"client_id"`
- KafkaVersion string `bson:"kafka_version" json:"kafka_version"`
- StartConsumingLatest bool `json:"start_consuming_latest"`
- BalanceStrategy string `json:"balance_strategy"`
- IsolationLevel string `json:"isolation_level"`
- SASL GraphQLEngineKafkaSASL `json:"sasl"`
+ BrokerAddresses []string `bson:"broker_addresses" json:"broker_addresses"`
+ Topics []string `bson:"topics" json:"topics"`
+ GroupID string `bson:"group_id" json:"group_id"`
+ ClientID string `bson:"client_id" json:"client_id"`
+ KafkaVersion string `bson:"kafka_version" json:"kafka_version"`
+ StartConsumingLatest bool `json:"start_consuming_latest"`
+ BalanceStrategy string `json:"balance_strategy"`
+ IsolationLevel string `json:"isolation_level"`
+ SASL kafka_datasource.SASL `json:"sasl"`
}
type GraphQLEngineDataSourceConfigREST struct {
@@ -1321,12 +1297,6 @@
type GraphQLEngineDataSourceKind string
-type GraphQLEngineKafkaSASL struct {
- Enable bool `json:"enable"`
- User string `json:"user"`
- Password string `json:"password"`
-}
-
type GraphQLExecutionMode string
GraphQLExecutionMode is the mode in which the GraphQL Middleware should
operate.
@@ -1366,16 +1336,10 @@
which will be hosted alongside the api.
type GraphQLProxyConfig struct {
- Features GraphQLProxyFeaturesConfig `bson:"features" json:"features"`
- AuthHeaders map[string]string `bson:"auth_headers" json:"auth_headers"`
- SubscriptionType SubscriptionType `bson:"subscription_type" json:"subscription_type,omitempty"`
- RequestHeaders map[string]string `bson:"request_headers" json:"request_headers"`
- UseResponseExtensions GraphQLResponseExtensions `bson:"use_response_extensions" json:"use_response_extensions"`
- RequestHeadersRewrite map[string]RequestHeadersRewriteConfig `json:"request_headers_rewrite" bson:"request_headers_rewrite"`
-}
-
-type GraphQLProxyFeaturesConfig struct {
- UseImmutableHeaders bool `bson:"use_immutable_headers" json:"use_immutable_headers"`
+ AuthHeaders map[string]string `bson:"auth_headers" json:"auth_headers"`
+ SubscriptionType SubscriptionType `bson:"subscription_type" json:"subscription_type,omitempty"`
+ RequestHeaders map[string]string `bson:"request_headers" json:"request_headers"`
+ UseResponseExtensions GraphQLResponseExtensions `bson:"use_response_extensions" json:"use_response_extensions"`
}
type GraphQLResponseExtensions struct {
@@ -1665,11 +1629,6 @@
Value string `bson:"value" json:"value"`
}
-type RequestHeadersRewriteConfig struct {
- Value string `json:"value" bson:"value"`
- Remove bool `json:"remove" bson:"remove"`
-}
-
type RequestInputType string
type RequestSigningMeta struct {
@@ -1826,11 +1785,9 @@
Method string `bson:"method" json:"method"`
}
-type TykEvent = event.Event
- TykEvent is an alias maintained for backwards compatibility.
+type TykEvent string // A type so we can ENUM event types easily, e.g. EventQuotaExceeded
-type TykEventHandlerName = event.HandlerName
- TykEventHandlerName is an alias maintained for backwards compatibility.
+type TykEventHandlerName string // A type for handler codes in API definitions
type UDGGlobalHeader struct {
Key string `bson:"key" json:"key"`
@@ -1969,29 +1926,6 @@
ProxyOnError bool `bson:"proxy_on_error" json:"proxy_on_error"`
}
-type WebHookHandlerConf struct {
- // Disabled enables/disables this webhook.
- Disabled bool `bson:"disabled" json:"disabled"`
- // ID optional ID of the webhook, to be used in pro mode.
- ID string `bson:"id" json:"id"`
- // Name is the name of webhook.
- Name string `bson:"name" json:"name"`
- // The method to use for the webhook.
- Method string `bson:"method" json:"method"`
- // The target path on which to send the request.
- TargetPath string `bson:"target_path" json:"target_path"`
- // The template to load in order to format the request.
- TemplatePath string `bson:"template_path" json:"template_path"`
- // Headers to set when firing the webhook.
- HeaderList map[string]string `bson:"header_map" json:"header_map"`
- // The cool-down for the event so it does not trigger again (in seconds).
- EventTimeout int64 `bson:"event_timeout" json:"event_timeout"`
-}
- WebHookHandlerConf holds configuration related to webhook event handler.
-
-func (w *WebHookHandlerConf) Scan(in any) error
- Scan scans WebHookHandlerConf from `any` in.
-
# Package: ./apidef/adapter
package adapter // import "github.com/TykTechnologies/tyk/apidef/adapter"
@@ -2029,8 +1963,6 @@
func (g *GraphQLConfigAdapter) EngineConfigV2() (*graphql.EngineV2Configuration, error)
-func (g *GraphQLConfigAdapter) EngineConfigV3() (*gqlv2.EngineV2Configuration, error)
-
type GraphQLConfigAdapterOption func(adapter *GraphQLConfigAdapter)
func WithHttpClient(httpClient *http.Client) GraphQLConfigAdapterOption
@@ -2039,18 +1971,12 @@
func WithStreamingClient(streamingClient *http.Client) GraphQLConfigAdapterOption
-func WithV2Schema(schema *gqlv2.Schema) GraphQLConfigAdapterOption
-
type GraphQLEngineAdapter interface {
EngineConfig() (*graphql.EngineV2Configuration, error)
}
type GraphQLEngineAdapterType int
-type GraphQLEngineAdapterV3 interface {
- EngineConfigV3() (*gqlv2.EngineV2Configuration, error)
-}
-
type ImportAdapter interface {
Import() (*apidef.APIDefinition, error)
}
@@ -2070,11 +1996,6 @@
ErrGraphQLConfigIsMissingOperation = errors.New("graphql data source config is missing an operation")
)
-FUNCTIONS
-
-func ConvertApiDefinitionHeadersToHttpHeaders(apiDefHeaders map[string]string) http.Header
-func RemoveDuplicateApiDefinitionHeaders(headers ...map[string]string) map[string]string
-
TYPES
type ProxyOnly struct {
@@ -2109,49 +2030,6 @@
func (u *UniversalDataGraph) EngineConfig() (*graphql.EngineV2Configuration, error)
-# Package: ./apidef/adapter/gqlengineadapter/enginev3
-
-package enginev3 // import "github.com/TykTechnologies/tyk/apidef/adapter/gqlengineadapter/enginev3"
-
-
-FUNCTIONS
-
-func ConvertApiDefinitionHeadersToHttpHeaders(apiDefHeaders map[string]string) http.Header
-
-TYPES
-
-type ProxyOnly struct {
- ApiDefinition *apidef.APIDefinition
- HttpClient *http.Client
- StreamingClient *http.Client
- Schema *graphql.Schema
-
- // Has unexported fields.
-}
-
-func (p *ProxyOnly) EngineConfigV3() (*graphql.EngineV2Configuration, error)
-
-type Supergraph struct {
- ApiDefinition *apidef.APIDefinition
- HttpClient *http.Client
- StreamingClient *http.Client
-
- // Has unexported fields.
-}
-
-func (s *Supergraph) EngineConfigV3() (*graphql.EngineV2Configuration, error)
-
-type UniversalDataGraph struct {
- ApiDefinition *apidef.APIDefinition
- HttpClient *http.Client
- StreamingClient *http.Client
- Schema *graphql.Schema
-
- // Has unexported fields.
-}
-
-func (u *UniversalDataGraph) EngineConfigV3() (*graphql.EngineV2Configuration, error)
-
# Package: ./apidef/importer
package importer // import "github.com/TykTechnologies/tyk/apidef/importer"
@@ -2433,9 +2311,6 @@
)
Enumerated constants for inputs and conditions.
-const WebhookKind = event.WebhookKind
- WebhookKind is an alias maintained to be used in imports.
-
VARIABLES
@@ -2868,19 +2743,6 @@
}
ClientToPolicy contains a 1-1 mapping between Client ID and Policy ID.
-type ContextVariables struct {
- // Enabled enables context variables to be passed to Tyk middlewares.
- // Tyk classic API definition: `enable_context_vars`.
- Enabled bool `json:"enabled" bson:"enabled"`
-}
- ContextVariables holds the configuration related to Tyk context variables.
-
-func (c *ContextVariables) ExtractTo(api *apidef.APIDefinition)
- ExtractTo extracts *ContextVariables into *apidef.APIDefinition.
-
-func (c *ContextVariables) Fill(api apidef.APIDefinition)
- Fill fills *ContextVariables from apidef.APIDefinition.
-
type CustomPlugin struct {
// Enabled activates the custom pre plugin.
Enabled bool `bson:"enabled" json:"enabled"` // required.
@@ -3025,42 +2887,6 @@
func (et *EnforceTimeout) Fill(meta apidef.HardTimeoutMeta)
Fill fills *EnforceTimeout from apidef.HardTimeoutMeta.
-type EventHandler struct {
- // Enabled enables the event handler.
- Enabled bool `json:"enabled" bson:"enabled"`
- // Trigger specifies the TykEvent that should trigger the event handler.
- Trigger event.Event `json:"trigger" bson:"trigger"`
- // Kind specifies the action to be taken on the event trigger.
- Kind Kind `json:"type" bson:"type"` // json tag is changed as per contract
- // ID is the ID of event handler in storage.
- ID string `json:"id,omitempty" bson:"id,omitempty"`
- // Name is the name of event handler
- Name string `json:"name,omitempty" bson:"name,omitempty"`
-
- Webhook WebhookEvent `bson:"-" json:"-"`
-}
- EventHandler holds information about individual event to be configured on
- the API.
-
-func (e *EventHandler) GetWebhookConf() apidef.WebHookHandlerConf
- GetWebhookConf converts EventHandler.WebhookEvent apidef.WebHookHandlerConf.
-
-func (e EventHandler) MarshalJSON() ([]byte, error)
- MarshalJSON marshals EventHandler as per Tyk OAS API definition contract.
-
-func (e *EventHandler) UnmarshalJSON(in []byte) error
- UnmarshalJSON unmarshal EventHandler as per Tyk OAS API definition contract.
-
-type EventHandlers []EventHandler
- EventHandlers holds the list of events to be processed for the API.
-
-func (e *EventHandlers) ExtractTo(api *apidef.APIDefinition)
- ExtractTo EventHandlers events to apidef.APIDefinition.
-
-func (e *EventHandlers) Fill(api apidef.APIDefinition)
- Fill fills EventHandlers from classic API definition. Currently only webhook
- events are supported.
-
type ExternalOAuth struct {
Enabled bool `bson:"enabled" json:"enabled"` // required
AuthSources `bson:",inline" json:",inline"`
@@ -3167,12 +2993,6 @@
// TransformResponseHeaders contains the configurations related to API level response header transformation.
// Tyk classic API definition: `global_response_headers`/`global_response_headers_remove`.
TransformResponseHeaders *TransformHeaders `bson:"transformResponseHeaders,omitempty" json:"transformResponseHeaders,omitempty"`
-
- // ContextVariables contains the configuration related to Tyk context variables.
- ContextVariables *ContextVariables `bson:"contextVariables,omitempty" json:"contextVariables,omitempty"`
-
- // TrafficLogs contains the configurations related to API level log analytics.
- TrafficLogs *TrafficLogs `bson:"trafficLogs,omitempty" json:"trafficLogs,omitempty"`
}
Global contains configuration that affects the whole API (all endpoints).
@@ -3232,15 +3052,6 @@
}
Header holds a header name and value pair.
-type Headers []Header
- Headers is an array of Header.
-
-func NewHeaders(in map[string]string) Headers
- NewHeaders creates Headers from in map.
-
-func (hs Headers) Map() map[string]string
- Map transforms Headers into a map.
-
type IDExtractor struct {
// Enabled activates ID extractor with coprocess authentication.
Enabled bool `bson:"enabled" json:"enabled"` // required
@@ -3408,9 +3219,6 @@
func (j *JWTValidation) Fill(jwt apidef.JWTValidation)
-type Kind = event.Kind
- Kind is an alias maintained to be used in imports.
-
type ListenPath struct {
// Value is the value of the listen path e.g. `/api/` or `/` or `/httpbin/`.
// Tyk classic API definition: `proxy.listen_path`
@@ -3459,7 +3267,7 @@
// Body is the HTTP response body that will be returned.
Body string `bson:"body,omitempty" json:"body,omitempty"`
// Headers are the HTTP response headers that will be returned.
- Headers Headers `bson:"headers,omitempty" json:"headers,omitempty"`
+ Headers []Header `bson:"headers,omitempty" json:"headers,omitempty"`
// FromOASExamples is the configuration to extract a mock response from OAS documentation.
FromOASExamples *FromOASExamples `bson:"fromOASExamples,omitempty" json:"fromOASExamples,omitempty"`
}
@@ -3886,7 +3694,7 @@
// be considered as 0s/empty.
//
// Tyk classic API definition: `global_rate_limit.per`.
- Per time.ReadableDuration `json:"per" bson:"per"`
+ Per string `json:"per" bson:"per"`
}
RateLimit holds the configurations related to rate limit. The API-level rate
limit applies a base-line limit on the frequency of requests to the upstream
@@ -3900,9 +3708,6 @@
func (r *RateLimit) Fill(api apidef.APIDefinition)
Fill fills *RateLimit from apidef.APIDefinition.
-type ReadableDuration = time.ReadableDuration
- ReadableDuration is an alias maintained to be used in imports.
-
type RequestSizeLimit struct {
// Enabled activates the Request Size Limit functionality.
Enabled bool `bson:"enabled" json:"enabled"`
@@ -4001,11 +3806,6 @@
//
// Tyk classic API definition: `detailed_tracing`
DetailedTracing *DetailedTracing `bson:"detailedTracing,omitempty" json:"detailedTracing,omitempty"`
-
- // Events contains the configuration related to Tyk Events.
- //
- // Tyk classic API definition: `event_handlers`
- EventHandlers EventHandlers `bson:"eventHandlers,omitempty" json:"eventHandlers,omitempty"`
}
Server contains the configuration that sets Tyk up to receive requests from
the client applications.
@@ -4232,19 +4032,6 @@
func (i *TrackEndpoint) Fill(meta apidef.TrackEndpointMeta)
Fill fills *TrackEndpoint receiver with data from apidef.TrackEndpointMeta.
-type TrafficLogs struct {
- // Enabled enables traffic log analytics for the API.
- // Tyk classic API definition: `do_not_track`.
- Enabled bool `bson:"enabled" json:"enabled"`
-}
- TrafficLogs holds configuration about API log analytics.
-
-func (t *TrafficLogs) ExtractTo(api *apidef.APIDefinition)
- ExtractTo extracts *TrafficLogs into *apidef.APIDefinition.
-
-func (t *TrafficLogs) Fill(api apidef.APIDefinition)
- Fill fills *TrafficLogs from apidef.APIDefinition.
-
type TransformBody struct {
// Enabled activates transform request/request body middleware.
Enabled bool `bson:"enabled" json:"enabled"`
@@ -4270,7 +4057,7 @@
// Remove specifies header names to be removed from the request/response.
Remove []string `bson:"remove,omitempty" json:"remove,omitempty"`
// Add specifies headers to be added to the request/response.
- Add Headers `bson:"add,omitempty" json:"add,omitempty"`
+ Add []Header `bson:"add,omitempty" json:"add,omitempty"`
}
TransformHeaders holds configuration about request/response header
transformations.
@@ -4537,35 +4324,6 @@
It is implemented to facilitate a smooth migration from deprecated fields
that were previously used to represent the same data.
-type WebhookEvent struct {
- // URL is the target URL for the webhook.
- URL string `json:"url" bson:"url"`
- // Method is the HTTP method for the webhook.
- Method string `json:"method" bson:"method"`
- // CoolDownPeriod defines cool-down for the event, so it does not trigger again.
- // It uses shorthand notation.
- // The value of CoolDownPeriod is a string that specifies the interval in a compact form,
- // where hours, minutes and seconds are denoted by 'h', 'm' and 's' respectively.
- // Multiple units can be combined to represent the duration.
- //
- // Examples of valid shorthand notations:
- // - "1h" : one hour
- // - "20m" : twenty minutes
- // - "30s" : thirty seconds
- // - "1m29s": one minute and twenty-nine seconds
- // - "1h30m" : one hour and thirty minutes
- //
- // An empty value is interpreted as "0s", implying no cool-down.
- // It's important to format the string correctly, as invalid formats will
- // be considered as 0s/empty.
- CoolDownPeriod time.ReadableDuration `json:"cooldownPeriod" bson:"cooldownPeriod"`
- // BodyTemplate is the template to be used for request payload.
- BodyTemplate string `json:"bodyTemplate,omitempty" bson:"bodyTemplate,omitempty"`
- // Headers are the list of request headers to be used.
- Headers Headers `json:"headers,omitempty" bson:"headers,omitempty"`
-}
- WebhookEvent stores the core information about a webhook event.
-
type XTykAPIGateway struct {
// Info contains the main metadata for the API definition.
Info Info `bson:"info" json:"info"` // required
@@ -5241,7 +4999,7 @@
// Maximum TLS version for connection between Tyk and your upstream service.
ProxySSLMaxVersion uint16 `json:"proxy_ssl_max_version"`
- // Allow list of ciphers for connection between Tyk and your upstream service.
+ // Whitelist ciphers for connection between Tyk and your upstream service.
ProxySSLCipherSuites []string `json:"proxy_ssl_ciphers"`
// This can specify a default timeout in seconds for upstream API requests.
@@ -5520,7 +5278,6 @@
func (c *Config) LoadIgnoredIPs()
func (c *Config) SetEventTriggers(eventTriggers map[apidef.TykEvent][]TykEventHandler)
- SetEventTriggers sets events for backwards compatibility
func (c *Config) StoreAnalytics(ip string) bool
@@ -5841,10 +5598,7 @@
GetOAuthTokensPurgeInterval returns purge interval for lapsed OAuth tokens.
type RateLimit struct {
- // EnableFixedWindow enables fixed window rate limiting.
- EnableFixedWindowRateLimiter bool `json:"enable_fixed_window_rate_limiter"`
-
- // Redis based rate limiter with sliding log. Provides 100% rate limiting accuracy, but require two additional Redis roundtrip for each request.
+ // Redis based rate limiter with fixed window. Provides 100% rate limiting accuracy, but require two additional Redis roundtrip for each request.
EnableRedisRollingLimiter bool `json:"enable_redis_rolling_limiter"`
// To enable, set to `true`. The sentinel-based rate limiter delivers a smoother performance curve as rate-limit calculations happen off-thread, but a stricter time-out based cool-down for clients. For example, when a throttling action is triggered, they are required to cool-down for the period of the rate limit.
@@ -5968,7 +5722,7 @@
// For an Self-Managed installation this can be left at `false` (the default setting). For Legacy Cloud Gateways it must be set to ‘true’.
BindToSlugsInsteadOfListenPaths bool `json:"bind_to_slugs"`
- // Set this option to `true` if you don’t want to monitor changes in the keys from a primary Gateway.
+ // Set this option to `true` if you don’t want to monitor changes in the keys from a master Gateway.
DisableKeySpaceSync bool `json:"disable_keyspace_sync"`
// This is the `zone` that this instance inhabits, e.g. the cluster/data-centre the Gateway lives in.
@@ -6203,12 +5957,23 @@
TYPES
type AccessDefinition struct {
- ApiName string `protobuf:"bytes,1,opt,name=api_name,json=apiName,proto3" json:"api_name,omitempty"`
- ApiId string `protobuf:"bytes,2,opt,name=api_id,json=apiId,proto3" json:"api_id,omitempty"`
- Versions []string `protobuf:"bytes,3,rep,name=versions,proto3" json:"versions,omitempty"`
+
+ // The name of the API that the session request relates to
+ ApiName string `protobuf:"bytes,1,opt,name=api_name,json=apiName,proto3" json:"api_name,omitempty"`
+ // The ID of the API that the session request relates to
+ ApiId string `protobuf:"bytes,2,opt,name=api_id,json=apiId,proto3" json:"api_id,omitempty"`
+ // List of allowed API versions, e.g. `"versions": [ "Default" ]`
+ Versions []string `protobuf:"bytes,3,rep,name=versions,proto3" json:"versions,omitempty"`
+ // List of AccessSpec instances. Each instance defines a URL (endpoint)
+ // with an associated allowed list of methods. If all URLs (endpoints) are allowed then the
+ // attribute is not set.
AllowedUrls []*AccessSpec `protobuf:"bytes,4,rep,name=allowed_urls,json=allowedUrls,proto3" json:"allowed_urls,omitempty"`
// Has unexported fields.
}
+ Defined as an attribute within a SessionState instance. Contains the allowed
+ versions and URLs (endpoints) for the API that the session request relates
+ to. Each URL (endpoint) specifies an associated list of allowed methods.
+ See also AccessSpec
func (*AccessDefinition) Descriptor() ([]byte, []int)
Deprecated: Use AccessDefinition.ProtoReflect.Descriptor instead.
@@ -6230,10 +5995,15 @@
func (x *AccessDefinition) String() string
type AccessSpec struct {
- Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"`
+
+ // A URL (endpoint) belonging to the API associated with the request session
+ Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"`
+ // List of allowed methods for the URL (endpoint), e.g. 'methods': [ 'GET'. 'POST', 'PUT', 'PATCH' ]
+ // The list of methods are case sensitive
Methods []string `protobuf:"bytes,2,rep,name=methods,proto3" json:"methods,omitempty"`
// Has unexported fields.
}
+ Defines an API's URL (endpoint) and associated list of allowed methods
func (*AccessSpec) Descriptor() ([]byte, []int)
Deprecated: Use AccessSpec.ProtoReflect.Descriptor instead.
@@ -6251,10 +6021,14 @@
func (x *AccessSpec) String() string
type BasicAuthData struct {
+
+ // A hashed password
Password string `protobuf:"bytes,1,opt,name=password,proto3" json:"password,omitempty"`
- Hash string `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"`
+ // Name of the hashing algorithm used to hash the password, e.g. bcrypt, Argon2
+ Hash string `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"`
// Has unexported fields.
}
+ Contains a hashed password and the name of the hashing algorithm used
func (*BasicAuthData) Descriptor() ([]byte, []int)
Deprecated: Use BasicAuthData.ProtoReflect.Descriptor instead.
@@ -6294,7 +6068,9 @@
PythonDispatcher for reference.
type DispatcherClient interface {
+ // Accepts and returns an Object
Dispatch(ctx context.Context, in *Object, opts ...grpc.CallOption) (*Object, error)
+ // Dispatches an event to the target language
DispatchEvent(ctx context.Context, in *Event, opts ...grpc.CallOption) (*EventReply, error)
}
DispatcherClient is the client API for Dispatcher service.
@@ -6305,7 +6081,9 @@
func NewDispatcherClient(cc grpc.ClientConnInterface) DispatcherClient
type DispatcherServer interface {
+ // Accepts and returns an Object
Dispatch(context.Context, *Object) (*Object, error)
+ // Dispatches an event to the target language
DispatchEvent(context.Context, *Event) (*EventReply, error)
}
DispatcherServer is the server API for Dispatcher service. All
@@ -6313,9 +6091,12 @@
compatibility
type Event struct {
+
+ // The JSON payload
Payload string `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"`
// Has unexported fields.
}
+ An event is represented as a JSON payload
func (*Event) Descriptor() ([]byte, []int)
Deprecated: Use Event.ProtoReflect.Descriptor instead.
@@ -6333,6 +6114,7 @@
type EventReply struct {
// Has unexported fields.
}
+ Response for event
func (*EventReply) Descriptor() ([]byte, []int)
Deprecated: Use EventReply.ProtoReflect.Descriptor instead.
@@ -6346,10 +6128,14 @@
func (x *EventReply) String() string
type Header struct {
- Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
+
+ // The header name
+ Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
+ // * List of values representing the header content
Values []string `protobuf:"bytes,2,rep,name=values,proto3" json:"values,omitempty"`
// Has unexported fields.
}
+ A reponse header that contains multiple associated values
func (*Header) Descriptor() ([]byte, []int)
Deprecated: Use Header.ProtoReflect.Descriptor instead.
@@ -6367,14 +6153,35 @@
func (x *Header) String() string
type HookType int32
+ Plugin hooks
+
+ Used to identify the type of plugin
const (
- HookType_Unknown HookType = 0
- HookType_Pre HookType = 1
- HookType_Post HookType = 2
- HookType_PostKeyAuth HookType = 3
+ // Use for error checking and handling of an unrecognised hook type.
+ HookType_Unknown HookType = 0
+ // Executed before request sent to upstream target and before any
+ // authentication information is extracted from the header or
+ // parameter list of the request. Applies to both keyless and protected
+ // APIs.
+ HookType_Pre HookType = 1
+ // Executed after authentication, validation, throttling and quota-limiting
+ // middleware has been executed, just before the request is proxied upstream. Use this
+ // to post-process a request before sending it to upstream API. This is only called
+ // when using protected APIs.
+ HookType_Post HookType = 2
+ // Executed after authentication, validation, throttling, and quota-limiting
+ // middleware has been executed, just before the request is proxied upstream. Use this
+ // to post-process a request before sending it to upstream API. This is only called
+ // when using protected APIs.
+ HookType_PostKeyAuth HookType = 3
+ // Executed for performing customised authentication.
HookType_CustomKeyCheck HookType = 4
- HookType_Response HookType = 5
+ // Executed after the upstream API replies. The arguments passed to this hook include
+ // both the request and response data. Use this to modify the HTTP response before it’s
+ // sent to the client. This hook also receives the request object, the session object,
+ // the metadata and API definition associated with the request.
+ HookType_Response HookType = 5
)
func (HookType) Descriptor() protoreflect.EnumDescriptor
@@ -6390,9 +6197,13 @@
func (HookType) Type() protoreflect.EnumType
type JWTData struct {
+
+ // The shared secret
Secret string `protobuf:"bytes,1,opt,name=secret,proto3" json:"secret,omitempty"`
// Has unexported fields.
}
+ Added to sessions where a Tyk key (embedding a shared secret) is used as the
+ public key for signing the JWT. This message contains the shared secret
func (*JWTData) Descriptor() ([]byte, []int)
Deprecated: Use JWTData.ProtoReflect.Descriptor instead.
@@ -6408,22 +6219,39 @@
func (x *JWTData) String() string
type MiniRequestObject struct {
- Headers map[string]string `protobuf:"bytes,1,rep,name=headers,proto3" json:"headers,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
- SetHeaders map[string]string `protobuf:"bytes,2,rep,name=set_headers,json=setHeaders,proto3" json:"set_headers,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
- DeleteHeaders []string `protobuf:"bytes,3,rep,name=delete_headers,json=deleteHeaders,proto3" json:"delete_headers,omitempty"`
- Body string `protobuf:"bytes,4,opt,name=body,proto3" json:"body,omitempty"`
- Url string `protobuf:"bytes,5,opt,name=url,proto3" json:"url,omitempty"`
- Params map[string]string `protobuf:"bytes,6,rep,name=params,proto3" json:"params,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
- AddParams map[string]string `protobuf:"bytes,7,rep,name=add_params,json=addParams,proto3" json:"add_params,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
- ExtendedParams map[string]string `protobuf:"bytes,8,rep,name=extended_params,json=extendedParams,proto3" json:"extended_params,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
- DeleteParams []string `protobuf:"bytes,9,rep,name=delete_params,json=deleteParams,proto3" json:"delete_params,omitempty"`
- ReturnOverrides *ReturnOverrides `protobuf:"bytes,10,opt,name=return_overrides,json=returnOverrides,proto3" json:"return_overrides,omitempty"`
- Method string `protobuf:"bytes,11,opt,name=method,proto3" json:"method,omitempty"`
- RequestUri string `protobuf:"bytes,12,opt,name=request_uri,json=requestUri,proto3" json:"request_uri,omitempty"`
- Scheme string `protobuf:"bytes,13,opt,name=scheme,proto3" json:"scheme,omitempty"`
- RawBody []byte `protobuf:"bytes,14,opt,name=raw_body,json=rawBody,proto3" json:"raw_body,omitempty"`
+
+ // A read-only field for reading headers injected by previous middleware
+ Headers map[string]string `protobuf:"bytes,1,rep,name=headers,proto3" json:"headers,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
+ // Map of header key values to append to the request
+ SetHeaders map[string]string `protobuf:"bytes,2,rep,name=set_headers,json=setHeaders,proto3" json:"set_headers,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
+ // List of header names to be removed from the request
+ DeleteHeaders []string `protobuf:"bytes,3,rep,name=delete_headers,json=deleteHeaders,proto3" json:"delete_headers,omitempty"`
+ // Request body
+ Body string `protobuf:"bytes,4,opt,name=body,proto3" json:"body,omitempty"`
+ // Request URL
+ Url string `protobuf:"bytes,5,opt,name=url,proto3" json:"url,omitempty"`
+ // Read only map of request params
+ Params map[string]string `protobuf:"bytes,6,rep,name=params,proto3" json:"params,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
+ // Map of parameter keys and values to add to the request
+ AddParams map[string]string `protobuf:"bytes,7,rep,name=add_params,json=addParams,proto3" json:"add_params,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
+ // Allows a parameter to have multiple values, currently unsupported
+ ExtendedParams map[string]string `protobuf:"bytes,8,rep,name=extended_params,json=extendedParams,proto3" json:"extended_params,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
+ // List of parameter keys to be removed from the request
+ DeleteParams []string `protobuf:"bytes,9,rep,name=delete_params,json=deleteParams,proto3" json:"delete_params,omitempty"`
+ // Override the response for the request, see ReturnOverrides
+ ReturnOverrides *ReturnOverrides `protobuf:"bytes,10,opt,name=return_overrides,json=returnOverrides,proto3" json:"return_overrides,omitempty"`
+ // Request method, eg GET, POST, etc
+ Method string `protobuf:"bytes,11,opt,name=method,proto3" json:"method,omitempty"`
+ // The raw unprocessed request URL, including query string and fragments
+ RequestUri string `protobuf:"bytes,12,opt,name=request_uri,json=requestUri,proto3" json:"request_uri,omitempty"`
+ // The URL scheme, e.g. http or https
+ Scheme string `protobuf:"bytes,13,opt,name=scheme,proto3" json:"scheme,omitempty"`
+ // The raw request body
+ RawBody []byte `protobuf:"bytes,14,opt,name=raw_body,json=rawBody,proto3" json:"raw_body,omitempty"`
// Has unexported fields.
}
+ Used for middleware calls and contains important fields like headers,
+ parameters, body and URL.
func (*MiniRequestObject) Descriptor() ([]byte, []int)
Deprecated: Use MiniRequestObject.ProtoReflect.Descriptor instead.
@@ -6465,9 +6293,14 @@
func (x *MiniRequestObject) String() string
type Monitor struct {
+
+ // List of quota percentage limits, defined in descending order
TriggerLimits []float64 `protobuf:"fixed64,1,rep,packed,name=trigger_limits,json=triggerLimits,proto3" json:"trigger_limits,omitempty"`
// Has unexported fields.
}
+ Monitors allow API endpoint users, stakeholders or an organisation to be
+ notified by webhook when certain quota limits have been reached for their
+ session token.
func (*Monitor) Descriptor() ([]byte, []int)
Deprecated: Use Monitor.ProtoReflect.Descriptor instead.
@@ -6483,15 +6316,28 @@
func (x *Monitor) String() string
type Object struct {
- HookType HookType `protobuf:"varint,1,opt,name=hook_type,json=hookType,proto3,enum=coprocess.HookType" json:"hook_type,omitempty"`
- HookName string `protobuf:"bytes,2,opt,name=hook_name,json=hookName,proto3" json:"hook_name,omitempty"`
- Request *MiniRequestObject `protobuf:"bytes,3,opt,name=request,proto3" json:"request,omitempty"`
- Session *SessionState `protobuf:"bytes,4,opt,name=session,proto3" json:"session,omitempty"`
- Metadata map[string]string `protobuf:"bytes,5,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
- Spec map[string]string `protobuf:"bytes,6,rep,name=spec,proto3" json:"spec,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
- Response *ResponseObject `protobuf:"bytes,7,opt,name=response,proto3" json:"response,omitempty"`
- // Has unexported fields.
-}
+
+ // The plugin hook type
+ HookType HookType `protobuf:"varint,1,opt,name=hook_type,json=hookType,proto3,enum=coprocess.HookType" json:"hook_type,omitempty"`
+ // The plugin name
+ HookName string `protobuf:"bytes,2,opt,name=hook_name,json=hookName,proto3" json:"hook_name,omitempty"`
+ // The main request data structure used by rich plugins. It’s used for middleware calls
+ // and contains important fields like headers, parameters, body and URL
+ Request *MiniRequestObject `protobuf:"bytes,3,opt,name=request,proto3" json:"request,omitempty"`
+ // Stores information about the current key/user that’s used for authentication
+ Session *SessionState `protobuf:"bytes,4,opt,name=session,proto3" json:"session,omitempty"`
+ // Contains the metadata. This is a dynamic field
+ Metadata map[string]string `protobuf:"bytes,5,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
+ // Contains information about API definition, including APIID, OrgID and config_data
+ Spec map[string]string `protobuf:"bytes,6,rep,name=spec,proto3" json:"spec,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
+ // The ResponseObject is used by response hooks. The fields are populated with the upstream HTTP
+ // response data. All the field contents can be modified.
+ Response *ResponseObject `protobuf:"bytes,7,opt,name=response,proto3" json:"response,omitempty"`
+ // Has unexported fields.
+}
+ Wraps a MiniRequestObject and contains additional fields that are useful for
+ users that implement their own request dispatchers, like the middleware hook
+ type and name
func (*Object) Descriptor() ([]byte, []int)
Deprecated: Use Object.ProtoReflect.Descriptor instead.
@@ -6519,13 +6365,20 @@
func (x *Object) String() string
type ResponseObject struct {
- StatusCode int32 `protobuf:"varint,1,opt,name=status_code,json=statusCode,proto3" json:"status_code,omitempty"`
- RawBody []byte `protobuf:"bytes,2,opt,name=raw_body,json=rawBody,proto3" json:"raw_body,omitempty"`
- Body string `protobuf:"bytes,3,opt,name=body,proto3" json:"body,omitempty"`
- Headers map[string]string `protobuf:"bytes,4,rep,name=headers,proto3" json:"headers,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
- MultivalueHeaders []*Header `protobuf:"bytes,5,rep,name=multivalue_headers,json=multivalueHeaders,proto3" json:"multivalue_headers,omitempty"`
+
+ // HTTP status code received from the upstream
+ StatusCode int32 `protobuf:"varint,1,opt,name=status_code,json=statusCode,proto3" json:"status_code,omitempty"`
+ // Raw bytes of HTTP response body
+ RawBody []byte `protobuf:"bytes,2,opt,name=raw_body,json=rawBody,proto3" json:"raw_body,omitempty"`
+ // HTTP response body. Excluded when the raw_body contains invalid UTF-8 characters
+ Body string `protobuf:"bytes,3,opt,name=body,proto3" json:"body,omitempty"`
+ // Headers received from the upstream
+ Headers map[string]string `protobuf:"bytes,4,rep,name=headers,proto3" json:"headers,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
+ // A list of headers. Useful when header has multiple values. See Header
+ MultivalueHeaders []*Header `protobuf:"bytes,5,rep,name=multivalue_headers,json=multivalueHeaders,proto3" json:"multivalue_headers,omitempty"`
// Has unexported fields.
}
+ Used by response hooks. All fields are modifiable
func (*ResponseObject) Descriptor() ([]byte, []int)
Deprecated: Use ResponseObject.ProtoReflect.Descriptor instead.
@@ -6549,13 +6402,23 @@
func (x *ResponseObject) String() string
type ReturnOverrides struct {
- ResponseCode int32 `protobuf:"varint,1,opt,name=response_code,json=responseCode,proto3" json:"response_code,omitempty"`
- ResponseError string `protobuf:"bytes,2,opt,name=response_error,json=responseError,proto3" json:"response_error,omitempty"`
- Headers map[string]string `protobuf:"bytes,3,rep,name=headers,proto3" json:"headers,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
- OverrideError bool `protobuf:"varint,4,opt,name=override_error,json=overrideError,proto3" json:"override_error,omitempty"`
- ResponseBody string `protobuf:"bytes,5,opt,name=response_body,json=responseBody,proto3" json:"response_body,omitempty"`
+
+ // Override upstream response status code
+ ResponseCode int32 `protobuf:"varint,1,opt,name=response_code,json=responseCode,proto3" json:"response_code,omitempty"`
+ // Override upstream response error message
+ ResponseError string `protobuf:"bytes,2,opt,name=response_error,json=responseError,proto3" json:"response_error,omitempty"`
+ // Override upstream response headers
+ Headers map[string]string `protobuf:"bytes,3,rep,name=headers,proto3" json:"headers,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
+ // If true then override upstream error response with response_error
+ OverrideError bool `protobuf:"varint,4,opt,name=override_error,json=overrideError,proto3" json:"override_error,omitempty"`
+ // Alias of response_error, contains the response body
+ ResponseBody string `protobuf:"bytes,5,opt,name=response_body,json=responseBody,proto3" json:"response_body,omitempty"`
// Has unexported fields.
}
+ Used to override the response for a given HTTP request
+
+ When returned within an Object for a given HTTP request, the upstream
+ reponse is replaced with the fields encapsulated within ReturnOverrides
func (*ReturnOverrides) Descriptor() ([]byte, []int)
Deprecated: Use ReturnOverrides.ProtoReflect.Descriptor instead.
@@ -6579,39 +6442,99 @@
func (x *ReturnOverrides) String() string
type SessionState struct {
- LastCheck int64 `protobuf:"varint,1,opt,name=last_check,json=lastCheck,proto3" json:"last_check,omitempty"`
- Allowance float64 `protobuf:"fixed64,2,opt,name=allowance,proto3" json:"allowance,omitempty"`
- Rate float64 `protobuf:"fixed64,3,opt,name=rate,proto3" json:"rate,omitempty"`
- Per float64 `protobuf:"fixed64,4,opt,name=per,proto3" json:"per,omitempty"`
- Expires int64 `protobuf:"varint,5,opt,name=expires,proto3" json:"expires,omitempty"`
- QuotaMax int64 `protobuf:"varint,6,opt,name=quota_max,json=quotaMax,proto3" json:"quota_max,omitempty"`
- QuotaRenews int64 `protobuf:"varint,7,opt,name=quota_renews,json=quotaRenews,proto3" json:"quota_renews,omitempty"`
- QuotaRemaining int64 `protobuf:"varint,8,opt,name=quota_remaining,json=quotaRemaining,proto3" json:"quota_remaining,omitempty"`
- QuotaRenewalRate int64 `protobuf:"varint,9,opt,name=quota_renewal_rate,json=quotaRenewalRate,proto3" json:"quota_renewal_rate,omitempty"`
- AccessRights map[string]*AccessDefinition `protobuf:"bytes,10,rep,name=access_rights,json=accessRights,proto3" json:"access_rights,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
- OrgId string `protobuf:"bytes,11,opt,name=org_id,json=orgId,proto3" json:"org_id,omitempty"`
- OauthClientId string `protobuf:"bytes,12,opt,name=oauth_client_id,json=oauthClientId,proto3" json:"oauth_client_id,omitempty"`
- OauthKeys map[string]string `protobuf:"bytes,13,rep,name=oauth_keys,json=oauthKeys,proto3" json:"oauth_keys,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
- BasicAuthData *BasicAuthData `protobuf:"bytes,14,opt,name=basic_auth_data,json=basicAuthData,proto3" json:"basic_auth_data,omitempty"`
- JwtData *JWTData `protobuf:"bytes,15,opt,name=jwt_data,json=jwtData,proto3" json:"jwt_data,omitempty"`
- HmacEnabled bool `protobuf:"varint,16,opt,name=hmac_enabled,json=hmacEnabled,proto3" json:"hmac_enabled,omitempty"`
- HmacSecret string `protobuf:"bytes,17,opt,name=hmac_secret,json=hmacSecret,proto3" json:"hmac_secret,omitempty"`
- IsInactive bool `protobuf:"varint,18,opt,name=is_inactive,json=isInactive,proto3" json:"is_inactive,omitempty"`
- ApplyPolicyId string `protobuf:"bytes,19,opt,name=apply_policy_id,json=applyPolicyId,proto3" json:"apply_policy_id,omitempty"`
- DataExpires int64 `protobuf:"varint,20,opt,name=data_expires,json=dataExpires,proto3" json:"data_expires,omitempty"`
- Monitor *Monitor `protobuf:"bytes,21,opt,name=monitor,proto3" json:"monitor,omitempty"`
- EnableDetailedRecording bool `protobuf:"varint,22,opt,name=enable_detailed_recording,json=enableDetailedRecording,proto3" json:"enable_detailed_recording,omitempty"`
- Metadata map[string]string `protobuf:"bytes,23,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
- Tags []string `protobuf:"bytes,24,rep,name=tags,proto3" json:"tags,omitempty"`
- Alias string `protobuf:"bytes,25,opt,name=alias,proto3" json:"alias,omitempty"`
- LastUpdated string `protobuf:"bytes,26,opt,name=last_updated,json=lastUpdated,proto3" json:"last_updated,omitempty"`
- IdExtractorDeadline int64 `protobuf:"varint,27,opt,name=id_extractor_deadline,json=idExtractorDeadline,proto3" json:"id_extractor_deadline,omitempty"`
- SessionLifetime int64 `protobuf:"varint,28,opt,name=session_lifetime,json=sessionLifetime,proto3" json:"session_lifetime,omitempty"`
- ApplyPolicies []string `protobuf:"bytes,29,rep,name=apply_policies,json=applyPolicies,proto3" json:"apply_policies,omitempty"`
- Certificate string `protobuf:"bytes,30,opt,name=certificate,proto3" json:"certificate,omitempty"`
- MaxQueryDepth int64 `protobuf:"varint,31,opt,name=max_query_depth,json=maxQueryDepth,proto3" json:"max_query_depth,omitempty"`
- // Has unexported fields.
-}
+
+ // Deprecated
+ LastCheck int64 `protobuf:"varint,1,opt,name=last_check,json=lastCheck,proto3" json:"last_check,omitempty"`
+ // Deprecated, replaced by rate
+ Allowance float64 `protobuf:"fixed64,2,opt,name=allowance,proto3" json:"allowance,omitempty"`
+ // The number of requests that are allowed in the specified rate limiting window
+ Rate float64 `protobuf:"fixed64,3,opt,name=rate,proto3" json:"rate,omitempty"`
+ // The duration of the rate window, in seconds
+ Per float64 `protobuf:"fixed64,4,opt,name=per,proto3" json:"per,omitempty"`
+ // An epoch that defines when the key should expire
+ Expires int64 `protobuf:"varint,5,opt,name=expires,proto3" json:"expires,omitempty"`
+ // The maximum number of requests allowed during the quota period
+ QuotaMax int64 `protobuf:"varint,6,opt,name=quota_max,json=quotaMax,proto3" json:"quota_max,omitempty"`
+ // An epoch that defines when the quota renews
+ QuotaRenews int64 `protobuf:"varint,7,opt,name=quota_renews,json=quotaRenews,proto3" json:"quota_renews,omitempty"`
+ // The number of requests remaining for this user’s quota (unrelated to rate
+ // limit)
+ QuotaRemaining int64 `protobuf:"varint,8,opt,name=quota_remaining,json=quotaRemaining,proto3" json:"quota_remaining,omitempty"`
+ // The time in seconds during which the quota is valid.
+ // So for 1000 requests per hour, this value would be 3600 while quota_max and
+ // quota_remaining would be 1000
+ QuotaRenewalRate int64 `protobuf:"varint,9,opt,name=quota_renewal_rate,json=quotaRenewalRate,proto3" json:"quota_renewal_rate,omitempty"`
+ // Maps the session's API ID to an AccessDefinition. The AccessDefinition defines the access rights for the API in terms
+ // of allowed: versions and URLs(endpoints). Each URL (endpoint) has a list of allowed methods.
+ AccessRights map[string]*AccessDefinition `protobuf:"bytes,10,rep,name=access_rights,json=accessRights,proto3" json:"access_rights,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
+ // The organisation the session user belongs to. This can be used in conjunction with the org_id
+ // setting in the API Definition object to have tokens owned by organisations
+ OrgId string `protobuf:"bytes,11,opt,name=org_id,json=orgId,proto3" json:"org_id,omitempty"`
+ // OAuth client ID that is set if the token is generated by an OAuth client during an
+ // OAuth authorisation flow
+ OauthClientId string `protobuf:"bytes,12,opt,name=oauth_client_id,json=oauthClientId,proto3" json:"oauth_client_id,omitempty"`
+ // Maps an OAuth client ID with a corresponding access token value. Currently unsupported and under development
+ OauthKeys map[string]string `protobuf:"bytes,13,rep,name=oauth_keys,json=oauthKeys,proto3" json:"oauth_keys,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
+ // Contains a hashed password and the name of the hashing algorithm used
+ BasicAuthData *BasicAuthData `protobuf:"bytes,14,opt,name=basic_auth_data,json=basicAuthData,proto3" json:"basic_auth_data,omitempty"`
+ // Added to sessions where a Tyk key (embedding a shared secret) is used as the public key
+ // for signing the JWT. The JWT token's KID header value references the ID of a Tyk key
+ JwtData *JWTData `protobuf:"bytes,15,opt,name=jwt_data,json=jwtData,proto3" json:"jwt_data,omitempty"`
+ // When set to `true` this indicates generation of a HMAC signature using the secret provided in `hmac_secret`.
+ // If the generated signature matches the signature provided in the Authorizaton header then authentication of
+ // the request has passed
+ HmacEnabled bool `protobuf:"varint,16,opt,name=hmac_enabled,json=hmacEnabled,proto3" json:"hmac_enabled,omitempty"`
+ // The HMAC secret
+ HmacSecret string `protobuf:"bytes,17,opt,name=hmac_secret,json=hmacSecret,proto3" json:"hmac_secret,omitempty"`
+ // Access is denied when this is set to true
+ IsInactive bool `protobuf:"varint,18,opt,name=is_inactive,json=isInactive,proto3" json:"is_inactive,omitempty"`
+ // The policy ID that is bound to the token. Deprecated use apply_policies instead
+ ApplyPolicyId string `protobuf:"bytes,19,opt,name=apply_policy_id,json=applyPolicyId,proto3" json:"apply_policy_id,omitempty"`
+ // A value, in seconds, that defines when data generated by the session token expires in
+ // the analytics DB (must be using Pro edition and MongoDB)
+ DataExpires int64 `protobuf:"varint,20,opt,name=data_expires,json=dataExpires,proto3" json:"data_expires,omitempty"`
+ // Quota monitor settings, currently unsupported in gRPC sessions
+ Monitor *Monitor `protobuf:"bytes,21,opt,name=monitor,proto3" json:"monitor,omitempty"`
+ // Set this value to true to have Tyk store the inbound request and outbound
+ // response data in HTTP Wire format as part of the analytics data
+ EnableDetailedRecording bool `protobuf:"varint,22,opt,name=enable_detailed_recording,json=enableDetailedRecording,proto3" json:"enable_detailed_recording,omitempty"`
+ // Meta data to be included as part of the session that can be used in other
+ // middleware such as transforms and header injection to embed user-specific
+ // data into a request, or alternatively to query the providence of a key
+ Metadata map[string]string `protobuf:"bytes,23,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
+ // List of tags to embed into analytics data when the request completes. If a policy
+ // has tags, those tags take precedence and are used instead
+ Tags []string `protobuf:"bytes,24,rep,name=tags,proto3" json:"tags,omitempty"`
+ // Identifier for the token for use in analytics, to allow easier tracing of hashed
+ // and unhashed tokens
+ Alias string `protobuf:"bytes,25,opt,name=alias,proto3" json:"alias,omitempty"`
+ // A timestamp that represents the time the session was last updated.
+ // With *PostAuth* hooks this is a UNIX timestamp
+ LastUpdated string `protobuf:"bytes,26,opt,name=last_updated,json=lastUpdated,proto3" json:"last_updated,omitempty"`
+ // UNIX timestamp that signifies when a cached key or ID will expire.
+ // This relates to custom authentication, where authenticated keys can be cached to save repeated requests
+ // to the gRPC server.
+ IdExtractorDeadline int64 `protobuf:"varint,27,opt,name=id_extractor_deadline,json=idExtractorDeadline,proto3" json:"id_extractor_deadline,omitempty"`
+ // UNIX timestamp that denotes when the key will automatically expire.
+ // Any·subsequent API request made using the key will be rejected.
+ // Overrides the global session lifetime.
+ SessionLifetime int64 `protobuf:"varint,28,opt,name=session_lifetime,json=sessionLifetime,proto3" json:"session_lifetime,omitempty"`
+ // List of IDs for the policies that are bound to the token
+ ApplyPolicies []string `protobuf:"bytes,29,rep,name=apply_policies,json=applyPolicies,proto3" json:"apply_policies,omitempty"`
+ // The client certificate used to authenticate the request. Exists in the session instance if mTLS is configured
+ // for the API. Currently unsupported
+ Certificate string `protobuf:"bytes,30,opt,name=certificate,proto3" json:"certificate,omitempty"`
+ // For graphQL APIs, if the session key has a maximum query depth limit defined then it is included in the
+ // session instance. Currently unsupported and under development
+ MaxQueryDepth int64 `protobuf:"varint,31,opt,name=max_query_depth,json=maxQueryDepth,proto3" json:"max_query_depth,omitempty"`
+ // Has unexported fields.
+}
+ Created for every authenticated request and stored in Redis.
+
+ Used to track the activity of a given key in different ways, mainly by the
+ built-in Tyk middleware such as the quota middleware or the rate limiter.
+ A GRPC plugin is able to create a SessionState object and store it in the
+ same way built-in authentication mechanisms do
func (*SessionState) Descriptor() ([]byte, []int)
Deprecated: Use SessionState.ProtoReflect.Descriptor instead.
@@ -6687,9 +6610,12 @@
func (x *SessionState) String() string
type StringSlice struct {
+
+ // List of string items
Items []string `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"`
// Has unexported fields.
}
+ List of strings
func (*StringSlice) Descriptor() ([]byte, []int)
Deprecated: Use StringSlice.ProtoReflect.Descriptor instead.
@@ -7018,40 +6944,26 @@
other types. This is a go <1.13 cludge.
const (
- // EventQuotaExceeded is an alias maintained for backwards compatibility.
- EventQuotaExceeded = event.QuotaExceeded
- // EventRateLimitExceeded is an alias maintained for backwards compatibility.
- EventRateLimitExceeded = event.RateLimitExceeded
-
- // EventAuthFailure is an alias maintained for backwards compatibility.
- EventAuthFailure = event.AuthFailure
- // EventKeyExpired is an alias maintained for backwards compatibility.
- EventKeyExpired = event.KeyExpired
- // EventVersionFailure is an alias maintained for backwards compatibility.
- EventVersionFailure = event.VersionFailure
- // EventOrgQuotaExceeded is an alias maintained for backwards compatibility.
- EventOrgQuotaExceeded = event.OrgQuotaExceeded
- // EventOrgRateLimitExceeded is an alias maintained for backwards compatibility.
- EventOrgRateLimitExceeded = event.OrgRateLimitExceeded
- // EventTriggerExceeded is an alias maintained for backwards compatibility.
- EventTriggerExceeded = event.TriggerExceeded
- // EventBreakerTriggered is an alias maintained for backwards compatibility.
- EventBreakerTriggered = event.BreakerTriggered
- // EventBreakerTripped is an alias maintained for backwards compatibility.
- EventBreakerTripped = event.BreakerTripped
- // EventBreakerReset is an alias maintained for backwards compatibility.
- EventBreakerReset = event.BreakerReset
- // EventHOSTDOWN is an alias maintained for backwards compatibility.
- EventHOSTDOWN = event.HostDown
- // EventHOSTUP is an alias maintained for backwards compatibility.
- EventHOSTUP = event.HostUp
- // EventTokenCreated is an alias maintained for backwards compatibility.
- EventTokenCreated = event.TokenCreated
- // EventTokenUpdated is an alias maintained for backwards compatibility.
- EventTokenUpdated = event.TokenUpdated
- // EventTokenDeleted is an alias maintained for backwards compatibility.
- EventTokenDeleted = event.TokenDeleted
+ EventQuotaExceeded apidef.TykEvent = "QuotaExceeded"
+ EventRateLimitExceeded apidef.TykEvent = "RatelimitExceeded"
+ EventAuthFailure apidef.TykEvent = "AuthFailure"
+ EventKeyExpired apidef.TykEvent = "KeyExpired"
+ EventVersionFailure apidef.TykEvent = "VersionFailure"
+ EventOrgQuotaExceeded apidef.TykEvent = "OrgQuotaExceeded"
+ EventOrgRateLimitExceeded apidef.TykEvent = "OrgRateLimitExceeded"
+ EventTriggerExceeded apidef.TykEvent = "TriggerExceeded"
+ EventBreakerTriggered apidef.TykEvent = "BreakerTriggered"
+ EventBreakerTripped apidef.TykEvent = "BreakerTripped"
+ EventBreakerReset apidef.TykEvent = "BreakerReset"
+ EventHOSTDOWN apidef.TykEvent = "HostDown"
+ EventHOSTUP apidef.TykEvent = "HostUp"
+ EventTokenCreated apidef.TykEvent = "TokenCreated"
+ EventTokenUpdated apidef.TykEvent = "TokenUpdated"
+ EventTokenDeleted apidef.TykEvent = "TokenDeleted"
)
+ Register new event types here, the string is the code used to hook at the
+ Api Deifnititon JSON/BSON level
+
const (
MsgAuthFieldMissing = "Authorization field missing"
MsgApiAccessDisallowed = "Access to this API has been disallowed"
@@ -7119,11 +7031,8 @@
const (
// QuotaKeyPrefix serves as a standard prefix for generating quota keys.
QuotaKeyPrefix = "quota-"
-
- // RateLimitKeyPrefix serves as a standard prefix for generating rate limiter keys.
- RateLimitKeyPrefix = rate.LimiterKeyPrefix
-
- // SentinelRateLimitKeyPostfix is appended to the rate limiting key to combine into a sentinel key.
+ // RateLimitKeyPrefix serves as a standard prefix for generating rate limit keys.
+ RateLimitKeyPrefix = "rate-limit-"
SentinelRateLimitKeyPostfix = ".BLOCKED"
)
const (
@@ -7142,18 +7051,11 @@
const CoProcessDefaultKeyPrefix = "coprocess-data:"
CoProcessDefaultKeyPrefix is used as a key prefix for this CP.
-const EH_CoProcessHandler = event.CoProcessHandler
- EH_CoProcessHandler is used for event system, maintained here for backwards
- compatibility.
+const EH_CoProcessHandler apidef.TykEventHandlerName = "cp_dynamic_handler"
+ Constant for event system.
-const EH_JSVMHandler = event.JSVMHandler
- EH_JSVMHandler is aliased for backwards compatibility.
-
-const (
- // EH_LogHandler is an alias maintained for backwards compatibility.
- // It is used to register log handler on an event.
- EH_LogHandler = event.LogHandler
-)
+const EH_JSVMHandler apidef.TykEventHandlerName = "eh_dynamic_handler"
+const EH_LogHandler apidef.TykEventHandlerName = "eh_log_handler"
The name for event handlers as defined in the API Definition JSON/BSON
format
@@ -7250,8 +7152,6 @@
it to base64 and store it in an Event object
func EnsureTransport(host, protocol string) string
- EnsureTransport sanitizes host/protocol pairs and returns a valid URL.
-
func GenerateTestBinaryData() (buf *bytes.Buffer)
func GetAccessDefinitionByAPIIDOrSession(currentSession *user.SessionState, api *APISpec) (accessDef *user.AccessDefinition, allowanceScope string, err error)
func GetTLSClient(cert *tls.Certificate, caCert []byte) *http.Client
@@ -9722,7 +9622,7 @@
func (l *SessionLimiter) Context() context.Context
-func (l *SessionLimiter) ForwardMessage(r *http.Request, currentSession *user.SessionState, rateLimitKey string, quotaKey string, store storage.Handler, enableRL, enableQ bool, api *APISpec, dryRun bool) sessionFailReason
+func (l *SessionLimiter) ForwardMessage(r *http.Request, currentSession *user.SessionState, rateLimitKey string, quotaKey string, store storage.Handler, enableRL, enableQ bool, globalConf *config.Config, api *APISpec, dryRun bool) sessionFailReason
ForwardMessage will enforce rate limiting, returning a non-zero
sessionFailReason if session limits have been exceeded. Key values to manage
rate are Rate and Per, e.g. Rate of 10 messages Per 10 seconds
@@ -10276,9 +10176,8 @@
WH_DELETE WebHookRequestMethod = "DELETE"
WH_PATCH WebHookRequestMethod = "PATCH"
- // EH_WebHook is an alias maintained for backwards compatibility.
- // it is the handler to register a webhook event.
- EH_WebHook = event.WebHookHandler
+ // Define the Event Handler name so we can register it
+ EH_WebHook apidef.TykEventHandlerName = "eh_web_hook_handler"
)
type XPathExtractor struct {
BaseExtractor
@@ -11555,7 +11454,6 @@
func (r TCPTestRunner) Run(t testing.TB, testCases ...TCPTestCase) error
type TestCase struct {
- Host string `json:",omitempty"`
Method string `json:",omitempty"`
Path string `json:",omitempty"`
BaseURL string `json:",omitempty"` |
PR Description updated to latest commit (2bd312e) |
💥 CI tests failed 🙈git-statediff --git a/coprocess/coprocess_common.pb.go b/coprocess/coprocess_common.pb.go
index bdc0686..ccd0561 100644
--- a/coprocess/coprocess_common.pb.go
+++ b/coprocess/coprocess_common.pb.go
@@ -7,10 +7,11 @@
package coprocess
import (
- protoreflect "google.golang.org/protobuf/reflect/protoreflect"
- protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
+
+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
)
const (
diff --git a/coprocess/coprocess_mini_request_object.pb.go b/coprocess/coprocess_mini_request_object.pb.go
index 07136e3..184464b 100644
--- a/coprocess/coprocess_mini_request_object.pb.go
+++ b/coprocess/coprocess_mini_request_object.pb.go
@@ -7,10 +7,11 @@
package coprocess
import (
- protoreflect "google.golang.org/protobuf/reflect/protoreflect"
- protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
+
+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
)
const (
diff --git a/coprocess/coprocess_object.pb.go b/coprocess/coprocess_object.pb.go
index b3b4cd1..6fab2b8 100644
--- a/coprocess/coprocess_object.pb.go
+++ b/coprocess/coprocess_object.pb.go
@@ -7,10 +7,11 @@
package coprocess
import (
- protoreflect "google.golang.org/protobuf/reflect/protoreflect"
- protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
+
+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
)
const (
diff --git a/coprocess/coprocess_object_grpc.pb.go b/coprocess/coprocess_object_grpc.pb.go
index 8b48ff7..8423d03 100644
--- a/coprocess/coprocess_object_grpc.pb.go
+++ b/coprocess/coprocess_object_grpc.pb.go
@@ -8,6 +8,7 @@ package coprocess
import (
context "context"
+
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
diff --git a/coprocess/coprocess_response_object.pb.go b/coprocess/coprocess_response_object.pb.go
index 87283f3..3970c8b 100644
--- a/coprocess/coprocess_response_object.pb.go
+++ b/coprocess/coprocess_response_object.pb.go
@@ -7,10 +7,11 @@
package coprocess
import (
- protoreflect "google.golang.org/protobuf/reflect/protoreflect"
- protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
+
+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
)
const (
diff --git a/coprocess/coprocess_return_overrides.pb.go b/coprocess/coprocess_return_overrides.pb.go
index ddee20b..f3e8454 100644
--- a/coprocess/coprocess_return_overrides.pb.go
+++ b/coprocess/coprocess_return_overrides.pb.go
@@ -7,10 +7,11 @@
package coprocess
import (
- protoreflect "google.golang.org/protobuf/reflect/protoreflect"
- protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
+
+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
)
const (
diff --git a/coprocess/coprocess_session_state.pb.go b/coprocess/coprocess_session_state.pb.go
index b542cc3..b1cbd61 100644
--- a/coprocess/coprocess_session_state.pb.go
+++ b/coprocess/coprocess_session_state.pb.go
@@ -7,10 +7,11 @@
package coprocess
import (
- protoreflect "google.golang.org/protobuf/reflect/protoreflect"
- protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
+
+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
)
const ( Please look at the run or in the Checks tab. |
PR Review
Code feedback:
✨ Review tool usage guide:Overview: The tool can be triggered automatically every time a new PR is opened, or can be invoked manually by commenting on any PR.
See the review usage page for a comprehensive guide on using this tool. |
PR Code Suggestions
✨ Improve tool usage guide:Overview:
See the improve usage page for a comprehensive guide on using this tool. |
@dcs3spp CI is failing on this, also a lot to review. Can you follow godoc style comments in proto files, as discussed previously? |
💥 CI tests failed 🙈git-statediff --git a/coprocess/coprocess_common.pb.go b/coprocess/coprocess_common.pb.go
index bdc0686..ccd0561 100644
--- a/coprocess/coprocess_common.pb.go
+++ b/coprocess/coprocess_common.pb.go
@@ -7,10 +7,11 @@
package coprocess
import (
- protoreflect "google.golang.org/protobuf/reflect/protoreflect"
- protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
+
+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
)
const (
diff --git a/coprocess/coprocess_mini_request_object.pb.go b/coprocess/coprocess_mini_request_object.pb.go
index 07136e3..184464b 100644
--- a/coprocess/coprocess_mini_request_object.pb.go
+++ b/coprocess/coprocess_mini_request_object.pb.go
@@ -7,10 +7,11 @@
package coprocess
import (
- protoreflect "google.golang.org/protobuf/reflect/protoreflect"
- protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
+
+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
)
const (
diff --git a/coprocess/coprocess_object.pb.go b/coprocess/coprocess_object.pb.go
index b3b4cd1..6fab2b8 100644
--- a/coprocess/coprocess_object.pb.go
+++ b/coprocess/coprocess_object.pb.go
@@ -7,10 +7,11 @@
package coprocess
import (
- protoreflect "google.golang.org/protobuf/reflect/protoreflect"
- protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
+
+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
)
const (
diff --git a/coprocess/coprocess_object_grpc.pb.go b/coprocess/coprocess_object_grpc.pb.go
index 8b48ff7..8423d03 100644
--- a/coprocess/coprocess_object_grpc.pb.go
+++ b/coprocess/coprocess_object_grpc.pb.go
@@ -8,6 +8,7 @@ package coprocess
import (
context "context"
+
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
diff --git a/coprocess/coprocess_response_object.pb.go b/coprocess/coprocess_response_object.pb.go
index 87283f3..3970c8b 100644
--- a/coprocess/coprocess_response_object.pb.go
+++ b/coprocess/coprocess_response_object.pb.go
@@ -7,10 +7,11 @@
package coprocess
import (
- protoreflect "google.golang.org/protobuf/reflect/protoreflect"
- protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
+
+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
)
const (
diff --git a/coprocess/coprocess_return_overrides.pb.go b/coprocess/coprocess_return_overrides.pb.go
index ddee20b..f3e8454 100644
--- a/coprocess/coprocess_return_overrides.pb.go
+++ b/coprocess/coprocess_return_overrides.pb.go
@@ -7,10 +7,11 @@
package coprocess
import (
- protoreflect "google.golang.org/protobuf/reflect/protoreflect"
- protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
+
+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
)
const (
diff --git a/coprocess/coprocess_session_state.pb.go b/coprocess/coprocess_session_state.pb.go
index b542cc3..b1cbd61 100644
--- a/coprocess/coprocess_session_state.pb.go
+++ b/coprocess/coprocess_session_state.pb.go
@@ -7,10 +7,11 @@
package coprocess
import (
- protoreflect "google.golang.org/protobuf/reflect/protoreflect"
- protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
+
+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
)
const ( Please look at the run or in the Checks tab. |
Please retry analysis of this Pull-Request directly on SonarCloud |
@titpetric I have updated comment style and fixed previous CI linting error. There is an error relating to Sonar Cloud? |
DX-1084
Description
Related Issue
Motivation and Context
How This Has Been Tested
Screenshots (if appropriate)
Types of changes
Checklist