Documentation
¶
Index ¶
- Constants
- func AppendInternalTrafficSignature(rawURL, canonicalPath, secret string) string
- func CanonicalImagorPathFromRequestPath(requestPath string) (string, bool)
- func ResolveProcessingBaseURL(template, spaceKey string) string
- func SignInternalTraffic(canonicalPath, secret string) string
- func VerifyInternalTrafficRequest(r *http.Request, secret string) bool
- func WithRequestMetadata(ctx context.Context, metadata RequestMetadata) context.Context
- type HTTPTemplatePreviewRenderClient
- type NodeConfig
- type NodeHooks
- type ProcessorDecorator
- type RequestMetadata
- type RuntimeConfig
- type RuntimeFactory
- type SpaceConfig
- type SpaceConfigReader
- type TemplatePreviewRenderClient
- type TemplatePreviewRenderRequest
- type TemplatePreviewRenderResponse
- type UsageBatch
- type UsageBatchApplyResult
- type UsageBatchItem
- type UsageClass
- type UsageRecorder
Constants ¶
View Source
const ( // InternalTemplatePreviewRenderPath is the private processing endpoint path // management calls for synchronous template preview renders. InternalTemplatePreviewRenderPath = "/internal/template-renders/preview" // InternalProcessingUsageBatchesPath is the private management endpoint path // processing nodes call to flush aggregated usage deltas. InternalProcessingUsageBatchesPath = "/internal/processing/usage-batches" // InternalAPISecretHeader carries the shared secret for internal management // to processing and processing to management requests. InternalAPISecretHeader = "X-Internal-API-Secret" // InternalTrafficQueryParam marks internally generated preview/browse traffic // so processing usage can classify it as non-billable. InternalTrafficQueryParam = "it" )
View Source
const ( PreviewPathPrefix = "/preview/" PreviewTokenQuery = "pt" PreviewTokenAudience = "processing-preview" PreviewTokenKind = "editor-preview" )
View Source
const InternalTrafficSignerTruncate = 32
Variables ¶
This section is empty.
Functions ¶
func SignInternalTraffic ¶
func WithRequestMetadata ¶
func WithRequestMetadata(ctx context.Context, metadata RequestMetadata) context.Context
Types ¶
type HTTPTemplatePreviewRenderClient ¶
type HTTPTemplatePreviewRenderClient struct {
// contains filtered or unexported fields
}
func NewHTTPTemplatePreviewRenderClient ¶
func NewHTTPTemplatePreviewRenderClient(baseURL, internalAPISecret string) *HTTPTemplatePreviewRenderClient
func (*HTTPTemplatePreviewRenderClient) RenderTemplatePreview ¶
func (c *HTTPTemplatePreviewRenderClient) RenderTemplatePreview(ctx context.Context, req TemplatePreviewRenderRequest) (*TemplatePreviewRenderResponse, error)
type NodeConfig ¶
type NodeConfig struct {
Runtime RuntimeConfig
}
type NodeHooks ¶
type NodeHooks struct {
ProcessorDecorator ProcessorDecorator
UsageRecorder UsageRecorder
Processors []imagor.Processor
}
type ProcessorDecorator ¶
type RequestMetadata ¶
type RequestMetadata struct {
OrgID string
SpaceID string
Class UsageClass
}
func MarkRecorded ¶
func MarkRecorded(ctx context.Context) (RequestMetadata, bool)
func RequestMetadataFromContext ¶
func RequestMetadataFromContext(ctx context.Context) (RequestMetadata, bool)
type RuntimeConfig ¶
type RuntimeFactory ¶
type RuntimeFactory = func(runtimeCfg RuntimeConfig, logger *zap.Logger) (SpaceConfigReader, imagor.Loader, error)
type SpaceConfig ¶
type SpaceConfig interface {
GetOrgID() string
GetKey() string
GetPrefix() string
GetBucket() string
GetRegion() string
GetEndpoint() string
GetAccessKeyID() string
GetSecretKey() string
GetUsePathStyle() bool
GetCustomDomain() string
IsSuspended() bool
GetSignerAlgorithm() string
GetSignerTruncate() int
GetImagorSecret() string
GetImagorCORSOrigins() []string
}
func ResolveSpaceFromHost ¶
func ResolveSpaceFromHost(store SpaceConfigReader, host, baseDomain string) SpaceConfig
type SpaceConfigReader ¶
type SpaceConfigReader interface {
Get(key string) (SpaceConfig, bool)
GetByHostname(hostname string) (SpaceConfig, bool)
Start(ctx context.Context) error
Ready() bool
}
type TemplatePreviewRenderClient ¶
type TemplatePreviewRenderClient interface {
RenderTemplatePreview(ctx context.Context, req TemplatePreviewRenderRequest) (*TemplatePreviewRenderResponse, error)
}
TemplatePreviewRenderClient is implemented by management-side clients that call a private processing endpoint for synchronous template preview renders.
type TemplatePreviewRenderRequest ¶
type TemplatePreviewRenderRequest struct {
SpaceKey string
SourceImagePath string
TemplateJSON string
PreviewParams imagorpath.Params
}
TemplatePreviewRenderRequest describes the synchronous preview render input management can send to a processing node.
type TemplatePreviewRenderResponse ¶
TemplatePreviewRenderResponse carries the rendered preview image bytes.
type UsageBatch ¶
type UsageBatch struct {
NodeID string `json:"node_id"`
BatchID string `json:"batch_id"`
SentAt time.Time `json:"sent_at"`
Items []UsageBatchItem `json:"items"`
}
type UsageBatchApplyResult ¶
type UsageBatchItem ¶
type UsageClass ¶
type UsageClass string
const ( UsageClassBillableProduction UsageClass = "billable_production" UsageClassInternalNonBillable UsageClass = "internal_non_billable" )
Click to show internal directories.
Click to hide internal directories.