apihandler

package
v0.129.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 1, 2023 License: Apache-2.0 Imports: 55 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WG_PREFIX       = "wg_"
	WG_LIVE         = WG_PREFIX + "live"
	WG_VARIABLES    = WG_PREFIX + "variables"
	WG_CACHE_HEADER = "X-Wg-Cache"
)
View Source
const (
	ErrMsgOperationParseFailed         = "failed to parse operation: %w"
	ErrMsgOperationNormalizationFailed = "failed to normalize operation: %w"
	ErrMsgOperationValidationFailed    = "operation validation failed: %w"
)

Variables

This section is empty.

Functions

func MergeJsonRightIntoLeft

func MergeJsonRightIntoLeft(left, right []byte) []byte

MergeJsonRightIntoLeft merges the right JSON into the left JSON while overriding the left side

func NewApiTransport

func NewApiTransport(tripper http.RoundTripper, api *Api, hooksClient *hooks.Client, enableDebugMode bool, enableStreamingMode bool) http.RoundTripper

func NewRequestFromWunderGraphClientRequest added in v0.92.0

func NewRequestFromWunderGraphClientRequest(ctx context.Context, body []byte) (*http.Request, error)

Types

type Api added in v0.110.0

type Api struct {
	PrimaryHost           string
	Hosts                 []string
	EngineConfiguration   *wgpb.EngineConfiguration
	EnableSingleFlight    bool
	EnableGraphqlEndpoint bool
	Operations            []*wgpb.Operation
	InvalidOperationNames []string
	CorsConfiguration     *wgpb.CorsConfiguration
	DeploymentId          string
	CacheConfig           *wgpb.ApiCacheConfig // TODO: extract from proto
	ApiConfigHash         string
	AuthenticationConfig  *wgpb.ApiAuthenticationConfig
	S3UploadConfiguration []*wgpb.S3UploadConfiguration
	Webhooks              []*wgpb.WebhookConfiguration
	Options               *Options
}

func (*Api) HasCookieAuthEnabled added in v0.110.0

func (api *Api) HasCookieAuthEnabled() bool

type ApiTransport

type ApiTransport struct {
	// contains filtered or unexported fields
}

func (*ApiTransport) RoundTrip

func (t *ApiTransport) RoundTrip(request *http.Request) (*http.Response, error)

type ApiTransportFactory added in v0.112.0

type ApiTransportFactory interface {
	RoundTripper(tripper http.RoundTripper, enableStreamingMode bool) http.RoundTripper
	DefaultTransportTimeout() time.Duration
}

func NewApiTransportFactory added in v0.93.2

func NewApiTransportFactory(api *Api, hooksClient *hooks.Client, enableDebugMode bool) ApiTransportFactory

type Builder

type Builder struct {
	// contains filtered or unexported fields
}

func NewBuilder

func NewBuilder(pool *pool.Pool,
	log *zap.Logger,
	loader *engineconfigloader.EngineConfigLoader,
	hooksClient *hooks.Client,
	config BuilderConfig,
) *Builder

func (*Builder) BuildAndMountApiHandler

func (r *Builder) BuildAndMountApiHandler(ctx context.Context, router *mux.Router, api *Api) (streamClosers []chan struct{}, err error)

func (*Builder) Close added in v0.120.0

func (r *Builder) Close() error

type BuilderConfig

type BuilderConfig struct {
	InsecureCookies            bool
	ForceHttpsRedirects        bool
	EnableDebugMode            bool
	EnableIntrospection        bool
	GitHubAuthDemoClientID     string
	GitHubAuthDemoClientSecret string
	HookServerURL              string
	DevMode                    bool
}

type Claims

type Claims struct {
	Name string `json:"name"`
	jwt.StandardClaims
}

type EndpointUnavailableHandler

type EndpointUnavailableHandler struct {
	OperationName string
	Logger        *zap.Logger
}

func (*EndpointUnavailableHandler) ServeHTTP

type FunctionsHandler added in v0.126.0

type FunctionsHandler struct {
	// contains filtered or unexported fields
}

func (*FunctionsHandler) ServeHTTP added in v0.126.0

func (h *FunctionsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type GraphQLHandler

type GraphQLHandler struct {
	// contains filtered or unexported fields
}

func (*GraphQLHandler) ServeHTTP

func (h *GraphQLHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type GraphQLPlaygroundHandler

type GraphQLPlaygroundHandler struct {
	// contains filtered or unexported fields
}

func (*GraphQLPlaygroundHandler) ServeHTTP

type InternalApiHandler

type InternalApiHandler struct {
	// contains filtered or unexported fields
}

func (*InternalApiHandler) ServeHTTP

func (h *InternalApiHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type InternalBuilder

type InternalBuilder struct {
	// contains filtered or unexported fields
}

func NewInternalBuilder

func NewInternalBuilder(pool *pool.Pool, log *zap.Logger, hooksClient *hooks.Client, loader *engineconfigloader.EngineConfigLoader) *InternalBuilder

func (*InternalBuilder) BuildAndMountInternalApiHandler

func (i *InternalBuilder) BuildAndMountInternalApiHandler(ctx context.Context, router *mux.Router, api *Api) (streamClosers []chan struct{}, err error)

type InternalSubscriptionApiHandler added in v0.129.0

type InternalSubscriptionApiHandler struct {
	// contains filtered or unexported fields
}

func (*InternalSubscriptionApiHandler) ServeHTTP added in v0.129.0

type Listener added in v0.110.0

type Listener struct {
	Host string
	Port uint16
}

type Logging added in v0.110.0

type Logging struct {
	Level zapcore.Level
}

type MutationHandler

type MutationHandler struct {
	// contains filtered or unexported fields
}

func (*MutationHandler) ServeHTTP

func (h *MutationHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type OperationMetaData

type OperationMetaData struct {
	OperationName string
	OperationType wgpb.OperationType
}

func (*OperationMetaData) GetOperationTypeString

func (o *OperationMetaData) GetOperationTypeString() string

type Options added in v0.110.0

type Options struct {
	ServerUrl      string
	PublicNodeUrl  string
	Listener       *Listener
	Logging        Logging
	DefaultTimeout time.Duration
}

type QueryHandler

type QueryHandler struct {
	// contains filtered or unexported fields
}

func (*QueryHandler) ServeHTTP

func (h *QueryHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type QueryResolver

type QueryResolver interface {
	ResolveGraphQLResponse(ctx *resolve.Context, response *resolve.GraphQLResponse, data []byte, writer io.Writer) (err error)
}

type SubscriptionHandler

type SubscriptionHandler struct {
	// contains filtered or unexported fields
}

func (*SubscriptionHandler) ServeHTTP

func (h *SubscriptionHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL