apihandler

package
v0.141.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2023 License: Apache-2.0 Imports: 57 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WgEnvCsrfSecret = "WG_CSRF_TOKEN_SECRET"
	WgEnvHashKey    = "WG_SECURE_COOKIE_HASH_KEY"
	WgEnvBlockKey   = "WG_SECURE_COOKIE_BLOCK_KEY"
)
View Source
const (
	WgCacheHeader           = "X-Wg-Cache"
	WgInternalApiCallHeader = "X-WG-Internal-GraphQL-API"

	WgPrefix             = "wg_"
	WgVariables          = WgPrefix + "variables"
	WgLiveParam          = WgPrefix + "live"
	WgJsonPatchParam     = WgPrefix + "json_patch"
	WgSseParam           = WgPrefix + "sse"
	WgSubscribeOnceParam = WgPrefix + "subscribe_once"
)
View Source
const (
	ErrMsgOperationParseFailed         = "failed to parse operation: %w"
	ErrMsgOperationNormalizationFailed = "failed to normalize operation: %w"
	ErrMsgOperationValidationFailed    = "operation validation failed: %w"
	ErrMsgOperationPlanningFailed      = "operation planning 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, enableRequestLogging 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
	CookieBasedSecrets    *CookieBasedSecrets
}

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, enableRequestLogging 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
	EnableRequestLogging       bool
	EnableIntrospection        bool
	GitHubAuthDemoClientID     string
	GitHubAuthDemoClientSecret string
	DevMode                    bool
}

type Claims

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

type CookieBasedSecrets added in v0.131.2

type CookieBasedSecrets struct {
	CsrfSecret []byte
	BlockKey   []byte
	HashKey    []byte
}

func NewCookieBasedSecrets added in v0.131.2

func NewCookieBasedSecrets() (cookieBasedSecrets *CookieBasedSecrets, warnMessages []string)

func NewDevModeCookieBasedSecrets added in v0.131.2

func NewDevModeCookieBasedSecrets() (cookieBasedSecrets *CookieBasedSecrets, errorMessages []string)

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)

type SubscriptionResolver added in v0.131.1

type SubscriptionResolver interface {
	ResolveGraphQLSubscription(ctx *resolve.Context, subscription *resolve.GraphQLSubscription, writer resolve.FlushWriter) (err error)
}

type WgRequestParams added in v0.131.1

type WgRequestParams struct {
	UseJsonPatch bool
	UseSse       bool
	SubsribeOnce bool
}

func NewWgRequestParams added in v0.131.1

func NewWgRequestParams(r *http.Request) WgRequestParams

Jump to

Keyboard shortcuts

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