appsync

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: MIT Imports: 31 Imported by: 0

README

AppSync

Parity grade: A · SDK aws-sdk-go-v2/service/appsync@v1.55.0 · last audited 2026-07-12 (4bece540)

Coverage

Metric Value
Operations audited 75 (72 ok, 3 gap)
Feature families 13 (11 ok, 1 partial, 1 gap)
Known gaps 2
Deferred items 2
Resource leaks clean
Known gaps
  • StartSchemaMerge: wrong path (/v1/apis/{apiId}/schemaMerge instead of the real POST /v1/mergedApis/{mergedApiIdentifier}/sourceApiAssociations/{associationId}/merge) AND wrong semantics (real op merges one specific source-API association, keyed by associationId, not just apiId) AND wrong response shape (returns {sourceApiSchemaMetadata:[], status} instead of the real {sourceApiAssociationStatus}). Completely unreachable by a real SDK client today; fixing requires backend.StartSchemaMerge signature change to (mergedAPIID, associationID) plus a real per-association merge-status field. Left untouched (not even path-aliased) since a path-only fix would still be broken on the request/response shape. No bd issue filed yet — recommend filing one.
  • StartDataSourceIntrospection / GetDataSourceIntrospection: wrong path (/v1/dataSource-introspections vs the real /v1/datasources/introspections) AND wrong input contract (handler expects {apiId, dataSourceName}; the real StartDataSourceIntrospectionInput only carries an optional rdsDataApiConfig{resourceArn, databaseName} — it is not tied to any existing AppSync API/DataSource at all). GetDataSourceIntrospection's backend comment already documents it as a no-op stub ("always returns a COMPLETED result"). Completely unreachable by a real SDK client today, and even a path-only fix would still fail on the input mismatch. Left untouched (not even path-aliased) — needs a real backend rework (new rdsDataApiConfig-keyed introspection record, no apiId/dataSourceName coupling) before it's worth making reachable. No bd issue filed yet — recommend filing one.
Deferred
  • ExecuteGraphQL / VTL+JS resolver execution semantics (vtl.go, jseval.go, graphql.go) — route/method verified correct only; the query-execution engine itself was out of scope for this route/wire-shape sweep.
  • CloudTrail-capture chokepoint / pkgs/service integration — not audited (shared/cross-service, out of scope per this task's edit boundary).

More

Documentation

Index

Constants

View Source
const (
	VisibilityGlobal  = "GLOBAL"
	VisibilityPrivate = "PRIVATE"
)

GraphqlAPIVisibility values for the Visibility field on a GraphQL API.

View Source
const (
	IntrospectionConfigEnabled  = "ENABLED"
	IntrospectionConfigDisabled = "DISABLED"
)

IntrospectionConfigEnabled and IntrospectionConfigDisabled are the valid values for IntrospectionConfig.

Variables

View Source
var (
	// ErrNotFound is returned when a resource is not found.
	ErrNotFound = awserr.New("NotFoundException", awserr.ErrNotFound)
	// ErrAlreadyExists is returned when a resource already exists.
	ErrAlreadyExists = awserr.New("BadRequestException", awserr.ErrAlreadyExists)
	// ErrInvalidSchema is returned when the provided schema SDL is invalid.
	ErrInvalidSchema = errors.New("InvalidSchemaError")
	// ErrValidation is returned when input validation fails.
	ErrValidation = awserr.New("BadRequestException", awserr.ErrInvalidParameter)
	// ErrUnsupportedJSCode is returned when EvaluateCode is given an APPSYNC_JS
	// construct the emulator's evaluator does not support. The request is
	// well-formed, but the code uses features beyond the documented patterns the
	// emulator faithfully evaluates (the emulator does not embed a JS engine).
	ErrUnsupportedJSCode = awserr.New("BadRequestException", awserr.ErrInvalidParameter)
)
View Source
var (
	// ErrNoSchema is returned when no schema is defined for an API.
	ErrNoSchema = errors.New("no schema defined for this API")
	// ErrQueryParse is returned when the GraphQL query cannot be parsed.
	ErrQueryParse = errors.New("query parse error")
	// ErrOperationNotFound is returned when the named operation is not found.
	ErrOperationNotFound = errors.New("operation not found")
	// ErrDataSourceNotFound is returned when a data source is not found.
	ErrDataSourceNotFound = errors.New("data source not found")
	// ErrUnsupportedDataSource is returned for unsupported data source types.
	ErrUnsupportedDataSource = errors.New("unsupported data source type")
	// ErrUnsupportedDynamoDBOp is returned for unsupported DynamoDB operations.
	ErrUnsupportedDynamoDBOp = errors.New("unsupported DynamoDB operation")
	// ErrLambdaNotConfigured is returned when no lambda invoker is set.
	ErrLambdaNotConfigured = errors.New("lambda invoker not configured")
	// ErrLambdaMissingConfig is returned when a lambda data source has no config.
	ErrLambdaMissingConfig = errors.New("lambda data source missing lambdaConfig")
	// ErrDynamoDBNotConfigured is returned when no dynamodb backend is set.
	ErrDynamoDBNotConfigured = errors.New("dynamodb backend not configured")
	// ErrDynamoDBMissingConfig is returned when a dynamodb data source has no config.
	ErrDynamoDBMissingConfig = errors.New("dynamodb data source missing dynamodbConfig")
)

Functions

This section is empty.

Types

type API

type API struct {
	Tags         map[string]string `json:"tags,omitempty"`
	DNS          map[string]string `json:"dns,omitempty"`
	EventConfig  *EventConfig      `json:"eventConfig,omitempty"`
	Name         string            `json:"name"`
	APIID        string            `json:"apiId"`
	ARN          string            `json:"arn"`
	OwnerContact string            `json:"ownerContact,omitempty"`
}

API represents an AppSync Event API.

type APIAssociation

type APIAssociation struct {
	DomainName        string `json:"domainName"`
	APIID             string `json:"apiId,omitempty"`
	AssociationStatus string `json:"associationStatus"`
	DeploymentDetail  string `json:"deploymentDetail,omitempty"`
}

APIAssociation represents an association between an API and a domain name.

type APICache

type APICache struct {
	APIID              string `json:"apiId"`
	Type               string `json:"type"`
	Status             string `json:"status"`
	APICachingBehavior string `json:"apiCachingBehavior"`
	TTL                int64  `json:"ttl"`
	TransitEncryption  bool   `json:"transitEncryptionEnabled,omitempty"`
	AtRestEncryption   bool   `json:"atRestEncryptionEnabled,omitempty"`
	HealthMetrics      bool   `json:"healthMetricsConfig,omitempty"`
}

APICache represents an AppSync API cache configuration.

type APIKey

type APIKey struct {
	ID          string `json:"id"`
	Description string `json:"description,omitempty"`
	Expires     int64  `json:"expires,omitempty"`
	Deletes     int64  `json:"deletes,omitempty"`
}

APIKey represents an AppSync API key.

type APIType

type APIType struct {
	ARN         string               `json:"arn"`
	Name        string               `json:"name"`
	Definition  string               `json:"definition,omitempty"`
	Description string               `json:"description,omitempty"`
	Format      TypeDefinitionFormat `json:"format"`
	APIID       string               `json:"apiId,omitempty"`
}

APIType represents an AppSync GraphQL type.

type AdditionalAuthenticationProvider

type AdditionalAuthenticationProvider struct {
	LambdaAuthorizerConfig *LambdaAuthorizerConfig `json:"lambdaAuthorizerConfig,omitempty"`
	OpenIDConnectConfig    *OpenIDConnectConfig    `json:"openIDConnectConfig,omitempty"`
	UserPoolConfig         *CognitoUserPoolConfig  `json:"userPoolConfig,omitempty"`
	AuthenticationType     AuthenticationType      `json:"authenticationType"`
}

AdditionalAuthenticationProvider holds an additional authentication configuration.

type AuthMode

type AuthMode struct {
	AuthType string `json:"authType"` // AuthenticationType value (API_KEY, AWS_IAM, etc.)
}

AuthMode specifies an authorization mode for an Event API.

type AuthProvider

type AuthProvider struct {
	CognitoConfig          *CognitoConfig          `json:"cognitoConfig,omitempty"`
	OpenIDConnectConfig    *OpenIDConnectConfig    `json:"openIDConnectConfig,omitempty"`
	LambdaAuthorizerConfig *LambdaAuthorizerConfig `json:"lambdaAuthorizerConfig,omitempty"`
	AuthType               string                  `json:"authType"`
}

AuthProvider holds an authorization provider for an Event API.

type AuthenticationType

type AuthenticationType string

AuthenticationType represents the authentication type for a GraphQL API.

const (
	// AuthTypeAPIKey uses API key authentication.
	AuthTypeAPIKey AuthenticationType = "API_KEY"
	// AuthTypeIAM uses IAM authentication.
	AuthTypeIAM AuthenticationType = "AWS_IAM"
	// AuthTypeCognito uses Amazon Cognito user pools authentication.
	AuthTypeCognito AuthenticationType = "AMAZON_COGNITO_USER_POOLS"
	// AuthTypeOIDC uses OpenID Connect authentication.
	AuthTypeOIDC AuthenticationType = "OPENID_CONNECT"
	// AuthTypeLambda uses Lambda function authentication.
	AuthTypeLambda AuthenticationType = "AWS_LAMBDA"
)

type AuthorizationConfig

type AuthorizationConfig struct {
	AwsIamConfig      *AwsIamConfig `json:"awsIamConfig,omitempty"`
	AuthorizationType string        `json:"authorizationType"` // AWS_IAM
}

AuthorizationConfig is the authorization configuration for HTTP endpoint data sources.

type AwsIamConfig

type AwsIamConfig struct {
	SigningRegion      string `json:"signingRegion,omitempty"`
	SigningServiceName string `json:"signingServiceName,omitempty"`
}

AwsIamConfig holds IAM SigV4 signing configuration for HTTP data source authorization.

type CachingConfig

type CachingConfig struct {
	CachingKeys []string `json:"cachingKeys,omitempty"`
	TTL         int64    `json:"ttl"`
}

CachingConfig holds the caching configuration for a resolver.

type ChannelNamespace

type ChannelNamespace struct {
	Tags                map[string]string `json:"tags,omitempty"`
	HandlerConfigs      *HandlerConfigs   `json:"handlerConfigs,omitempty"`
	APIID               string            `json:"apiId"`
	Name                string            `json:"name"`
	ChannelNamespaceARN string            `json:"channelNamespaceArn,omitempty"`
	CodeHandlers        string            `json:"codeHandlers,omitempty"`
	PublishAuthModes    []AuthMode        `json:"publishAuthModes,omitempty"`
	SubscribeAuthModes  []AuthMode        `json:"subscribeAuthModes,omitempty"`
	Created             int64             `json:"created,omitempty"`
	LastModified        int64             `json:"lastModified,omitempty"`
}

ChannelNamespace represents an AppSync channel namespace.

type ChannelNamespaceConfig

type ChannelNamespaceConfig struct {
	HandlerConfigs     *HandlerConfigs `json:"handlerConfigs,omitempty"`
	CodeHandlers       string          `json:"codeHandlers,omitempty"`
	PublishAuthModes   []AuthMode      `json:"publishAuthModes,omitempty"`
	SubscribeAuthModes []AuthMode      `json:"subscribeAuthModes,omitempty"`
}

ChannelNamespaceConfig bundles optional auth/handler config for channel namespace operations. Passing nil preserves existing behaviour.

type CognitoConfig

type CognitoConfig struct {
	UserPoolID       string `json:"userPoolId"`
	AWSRegion        string `json:"awsRegion"`
	AppIDClientRegex string `json:"appIdClientRegex,omitempty"`
}

CognitoConfig is the Cognito user pool configuration for Event API auth providers.

type CognitoUserPoolConfig

type CognitoUserPoolConfig struct {
	UserPoolID  string `json:"userPoolId"`
	AWSRegion   string `json:"awsRegion"`
	AppIDClient string `json:"appIdClientRegex,omitempty"`
}

CognitoUserPoolConfig holds the Amazon Cognito user pool configuration for an API.

type DataSource

type DataSource struct {
	Tags                     *tags.Tags                          `json:"tags,omitempty"`
	LambdaConfig             *LambdaDataSourceConfig             `json:"lambdaConfig,omitempty"`
	DynamoDBConfig           *DynamoDBDataSourceConfig           `json:"dynamodbConfig,omitempty"`
	HTTPConfig               *HTTPDataSourceConfig               `json:"httpConfig,omitempty"`
	OpenSearchConfig         *OpenSearchServiceDataSourceConfig  `json:"openSearchServiceConfig,omitempty"`
	EventBridgeConfig        *EventBridgeDataSourceConfig        `json:"eventBridgeConfig,omitempty"`
	RelationalDatabaseConfig *RelationalDatabaseDataSourceConfig `json:"relationalDatabaseConfig,omitempty"`
	DataSourceARN            string                              `json:"dataSourceArn"`
	Name                     string                              `json:"name"`
	Description              string                              `json:"description,omitempty"`
	ServiceRoleARN           string                              `json:"serviceRoleArn,omitempty"`
	APIID                    string                              `json:"apiId"`
	Type                     DataSourceType                      `json:"type"`
}

DataSource represents an AppSync data source.

type DataSourceIntrospectionResult

type DataSourceIntrospectionResult struct {
	IntrospectionID string `json:"introspectionId"`
	Status          string `json:"status"`
	Models          []any  `json:"models,omitempty"`
}

DataSourceIntrospectionResult holds the result of a data source introspection job.

type DataSourceType

type DataSourceType string

DataSourceType represents the type of a data source.

const (
	// DataSourceTypeNone is a no-op data source.
	DataSourceTypeNone DataSourceType = "NONE"
	// DataSourceTypeLambda invokes a Lambda function.
	DataSourceTypeLambda DataSourceType = "AWS_LAMBDA"
	// DataSourceTypeDynamoDB queries a DynamoDB table.
	DataSourceTypeDynamoDB DataSourceType = "AMAZON_DYNAMODB"
	// DataSourceTypeHTTP forwards requests to an HTTP endpoint.
	DataSourceTypeHTTP DataSourceType = "HTTP"
	// DataSourceTypeRelational queries an RDS database.
	DataSourceTypeRelational DataSourceType = "RELATIONAL_DATABASE"
	// DataSourceTypeOpenSearch queries an OpenSearch domain.
	DataSourceTypeOpenSearch DataSourceType = "AMAZON_OPENSEARCH_SERVICE"
	// DataSourceTypeEventBridge sends events to an Amazon EventBridge bus.
	DataSourceTypeEventBridge DataSourceType = "AMAZON_EVENTBRIDGE"
)

type DeltaSyncConfig

type DeltaSyncConfig struct {
	DeltaSyncTableName string `json:"deltaSyncTableName,omitempty"`
	BaseTableTTL       int64  `json:"baseTableTTL,omitempty"`
	DeltaSyncTableTTL  int64  `json:"deltaSyncTableTTL,omitempty"`
}

DeltaSyncConfig holds the Delta Sync configuration for a versioned DynamoDB data source.

type DomainName

type DomainName struct {
	Tags           map[string]string `json:"tags,omitempty"`
	DomainName     string            `json:"domainName"`
	CertificateARN string            `json:"certificateArn"`
	Description    string            `json:"description,omitempty"`
	APIID          string            `json:"apiId,omitempty"`
	AppsyncDomain  string            `json:"appsyncDomainName,omitempty"`
	HostedZoneID   string            `json:"hostedZoneId,omitempty"`
	DomainNameARN  string            `json:"domainNameArn,omitempty"`
}

DomainName represents an AppSync custom domain name.

type DynamoDBBackend

type DynamoDBBackend interface {
	// GetItemRaw executes a DynamoDB GetItem and returns raw JSON bytes.
	GetItemRaw(ctx context.Context, tableName string, key map[string]any) (map[string]any, error)
	// PutItemRaw executes a DynamoDB PutItem with the given item.
	PutItemRaw(ctx context.Context, tableName string, item map[string]any) error
}

DynamoDBBackend is the minimal DynamoDB interface needed for DynamoDB resolvers.

type DynamoDBDataSourceConfig

type DynamoDBDataSourceConfig struct {
	DeltaSyncConfig      *DeltaSyncConfig `json:"deltaSyncConfig,omitempty"`
	TableName            string           `json:"tableName"`
	AWSRegion            string           `json:"awsRegion"`
	UseCallerCredentials bool             `json:"useCallerCredentials"`
	Versioned            bool             `json:"versioned"`
}

DynamoDBDataSourceConfig holds the configuration for a DynamoDB data source.

type EventBridgeDataSourceConfig

type EventBridgeDataSourceConfig struct {
	EventBusARN string `json:"eventBusArn"`
}

EventBridgeDataSourceConfig holds the configuration for an EventBridge data source.

type EventConfig

type EventConfig struct {
	AuthProviders             []AuthProvider `json:"authProviders"`
	ConnectionAuthModes       []AuthMode     `json:"connectionAuthModes"`
	DefaultPublishAuthModes   []AuthMode     `json:"defaultPublishAuthModes"`
	DefaultSubscribeAuthModes []AuthMode     `json:"defaultSubscribeAuthModes"`
}

EventConfig holds the authorization configuration for an Event API.

type Function

type Function struct {
	Runtime                 *Runtime    `json:"runtime,omitempty"`
	SyncConfig              *SyncConfig `json:"syncConfig,omitempty"`
	FunctionARN             string      `json:"functionArn"`
	FunctionID              string      `json:"functionId"`
	APIID                   string      `json:"apiId"`
	Name                    string      `json:"name"`
	Description             string      `json:"description,omitempty"`
	DataSourceName          string      `json:"dataSourceName"`
	FunctionVersion         string      `json:"functionVersion,omitempty"`
	RequestMappingTemplate  string      `json:"requestMappingTemplate,omitempty"`
	ResponseMappingTemplate string      `json:"responseMappingTemplate,omitempty"`
	Code                    string      `json:"code,omitempty"`
	MaxBatchSize            int32       `json:"maxBatchSize,omitempty"`
}

Function represents an AppSync pipeline function.

type GraphqlAPI

type GraphqlAPI struct {
	URIs                              map[string]string                  `json:"uris"`
	Tags                              *tags.Tags                         `json:"tags,omitempty"`
	EnvironmentVariables              map[string]string                  `json:"environmentVariables,omitempty"`
	UserPoolConfig                    *UserPoolConfig                    `json:"userPoolConfig,omitempty"`
	OpenIDConnectConfig               *OpenIDConnectConfig               `json:"openIDConnectConfig,omitempty"`
	LambdaAuthorizerConfig            *LambdaAuthorizerConfig            `json:"lambdaAuthorizerConfig,omitempty"`
	LogConfig                         *LogConfig                         `json:"logConfig,omitempty"`
	Name                              string                             `json:"name"`
	APIID                             string                             `json:"apiId"`
	ARN                               string                             `json:"arn"`
	AuthenticationType                AuthenticationType                 `json:"authenticationType"`
	Visibility                        string                             `json:"visibility,omitempty"`
	Region                            string                             `json:"region"`
	APIType                           string                             `json:"apiType,omitempty"`
	IntrospectionConfig               string                             `json:"introspectionConfig,omitempty"`
	AdditionalAuthenticationProviders []AdditionalAuthenticationProvider `json:"additionalAuthenticationProviders,omitempty"` //nolint:lll // AWS field name is long
	CreatedAt                         int64                              `json:"createdAt,omitempty"`
	UpdatedAt                         int64                              `json:"updatedAt,omitempty"`
	QueryDepthLimit                   int32                              `json:"queryDepthLimit,omitempty"`
	ResolverCountLimit                int32                              `json:"resolverCountLimit,omitempty"`
	XrayEnabled                       bool                               `json:"xrayEnabled,omitempty"`
}

GraphqlAPI represents an AppSync GraphQL API.

type GraphqlAPIConfig

type GraphqlAPIConfig struct {
	UserPoolConfig         *UserPoolConfig
	OpenIDConnectConfig    *OpenIDConnectConfig
	LambdaAuthorizerConfig *LambdaAuthorizerConfig
	LogConfig              *LogConfig
	IntrospectionConfig    string
	QueryDepthLimit        int32
	ResolverCountLimit     int32
}

GraphqlAPIConfig bundles optional auth/logging config for CreateGraphqlAPI and UpdateGraphqlAPI. Passing nil is equivalent to no config — existing behaviour is preserved.

type HTTPDataSourceConfig

type HTTPDataSourceConfig struct {
	AuthorizationConfig *AuthorizationConfig `json:"authorizationConfig,omitempty"`
	Endpoint            string               `json:"endpoint"`
}

HTTPDataSourceConfig holds the configuration for an HTTP endpoint data source.

type Handler

type Handler struct {
	Backend       StorageBackend
	DefaultRegion string
	AccountID     string
}

Handler is the Echo HTTP handler for AppSync operations.

func NewHandler

func NewHandler(backend StorageBackend) *Handler

NewHandler creates a new AppSync handler.

func (*Handler) ChaosOperations

func (h *Handler) ChaosOperations() []string

ChaosOperations returns all operations that can be fault-injected.

func (*Handler) ChaosRegions

func (h *Handler) ChaosRegions() []string

ChaosRegions returns all regions this AppSync instance handles.

func (*Handler) ChaosServiceName

func (h *Handler) ChaosServiceName() string

ChaosServiceName returns the lowercase AWS service name for fault rule matching.

func (*Handler) ExtractOperation

func (h *Handler) ExtractOperation(c *echo.Context) string

ExtractOperation extracts the AppSync operation from the request path.

func (*Handler) ExtractResource

func (h *Handler) ExtractResource(c *echo.Context) string

ExtractResource extracts the API ID from the request path.

func (*Handler) GetSupportedOperations

func (h *Handler) GetSupportedOperations() []string

GetSupportedOperations returns the list of supported AppSync operations.

func (*Handler) Handler

func (h *Handler) Handler() echo.HandlerFunc

Handler returns the Echo handler function for AppSync requests.

func (*Handler) MatchPriority

func (h *Handler) MatchPriority() int

MatchPriority returns the routing priority.

func (*Handler) Name

func (h *Handler) Name() string

Name returns the service name.

func (*Handler) Restore

func (h *Handler) Restore(ctx context.Context, data []byte) error

Restore implements persistence.Persistable by delegating to the backend.

func (*Handler) RouteMatcher

func (h *Handler) RouteMatcher() service.Matcher

RouteMatcher returns a function that matches AppSync management API and GraphQL requests.

The /v2/apis path prefix is shared with API Gateway V2. Both services use the same URL path but send distinct User-Agent values: the AppSync SDK includes "api/appsync/" while the API Gateway V2 SDK includes "api/apigatewayv2/". When the path matches /v2/apis, we only claim the request if the User-Agent indicates AppSync.

func (*Handler) Snapshot

func (h *Handler) Snapshot(ctx context.Context) []byte

Snapshot implements persistence.Persistable by delegating to the backend.

func (*Handler) StartWorker

func (h *Handler) StartWorker(ctx context.Context) error

StartWorker starts the AppSync background workers.

type HandlerConfig

type HandlerConfig struct {
	Integration *Integration `json:"integration,omitempty"`
	Behavior    string       `json:"behavior"` // CODE
}

HandlerConfig is the configuration for a single event handler (OnPublish or OnSubscribe).

type HandlerConfigs

type HandlerConfigs struct {
	OnPublish   *HandlerConfig `json:"onPublish,omitempty"`
	OnSubscribe *HandlerConfig `json:"onSubscribe,omitempty"`
}

HandlerConfigs holds the OnPublish and OnSubscribe handler configurations.

type InMemoryBackend

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

InMemoryBackend is the in-memory implementation of StorageBackend.

Resource collections are backed by *store.Table[T] (see store_setup.go for the registration list and pkgs/store's package doc). Collections nested under a GraphQL/Event API in the original hand-rolled maps (datasources, resolvers, functions, types, channelNamespaces) are now single flat tables keyed by a composite "<apiID>#<localKey>" string, with a secondary store.Index grouping by API ID for the "all children of API X" lookups the nested maps used to answer directly -- see store_setup.go's doc comment for why this is safe (every child value type already carries its own APIID field as a real, wire-serialized identity field, unlike some other services' internal-only parent-ID fields).

func NewInMemoryBackend

func NewInMemoryBackend(accountID, region, endpoint string) *InMemoryBackend

NewInMemoryBackend creates a new in-memory AppSync backend.

func (*InMemoryBackend) AssociateAPI

func (b *InMemoryBackend) AssociateAPI(domainName, apiID string) (*APIAssociation, error)

AssociateAPI associates an API with a custom domain name.

func (*InMemoryBackend) AssociateMergedGraphqlAPI

func (b *InMemoryBackend) AssociateMergedGraphqlAPI(
	sourceAPIIdentifier, mergedAPIIdentifier, description, mergeType string,
) (*SourceAPIAssociation, error)

AssociateMergedGraphqlAPI creates an association from a source API to a merged API.

func (*InMemoryBackend) AssociateSourceGraphqlAPI

func (b *InMemoryBackend) AssociateSourceGraphqlAPI(
	mergedAPIIdentifier, sourceAPIIdentifier, description, mergeType string,
) (*SourceAPIAssociation, error)

AssociateSourceGraphqlAPI creates an association from a merged API to a source API.

func (*InMemoryBackend) CreateAPI

func (b *InMemoryBackend) CreateAPI(
	name, ownerContact string, tagMap map[string]string, eventConfig *EventConfig,
) (*API, error)

CreateAPI creates a new Event API.

func (*InMemoryBackend) CreateAPICache

func (b *InMemoryBackend) CreateAPICache(apiID string, cache *APICache) (*APICache, error)

CreateAPICache creates a cache configuration for a GraphQL API.

func (*InMemoryBackend) CreateAPIKey

func (b *InMemoryBackend) CreateAPIKey(apiID, description string, expires int64) (*APIKey, error)

CreateAPIKey creates an API key for a GraphQL API.

func (*InMemoryBackend) CreateChannelNamespace

func (b *InMemoryBackend) CreateChannelNamespace(
	apiID, name string,
	tagMap map[string]string,
	cfg *ChannelNamespaceConfig,
) (*ChannelNamespace, error)

CreateChannelNamespace creates a channel namespace for an Event API.

func (*InMemoryBackend) CreateDataSource

func (b *InMemoryBackend) CreateDataSource(apiID string, ds *DataSource) (*DataSource, error)

CreateDataSource creates a data source for an API.

func (*InMemoryBackend) CreateDomainName

func (b *InMemoryBackend) CreateDomainName(
	domainName, certificateARN, description string,
	tagMap map[string]string,
) (*DomainName, error)

CreateDomainName creates a custom domain name.

func (*InMemoryBackend) CreateFunction

func (b *InMemoryBackend) CreateFunction(apiID string, f *Function) (*Function, error)

CreateFunction creates an AppSync pipeline function.

func (*InMemoryBackend) CreateGraphqlAPI

func (b *InMemoryBackend) CreateGraphqlAPI(
	name string,
	authType AuthenticationType,
	xrayEnabled bool,
	apiType string,
	visibility string,
	additionalAuthProviders []AdditionalAuthenticationProvider,
	tagMap map[string]string,
	cfg *GraphqlAPIConfig,
) (*GraphqlAPI, error)

CreateGraphqlAPI creates a new GraphQL API.

func (*InMemoryBackend) CreateResolver

func (b *InMemoryBackend) CreateResolver(apiID, typeName string, r *Resolver) (*Resolver, error)

CreateResolver creates a resolver for an API type field.

func (*InMemoryBackend) CreateType

func (b *InMemoryBackend) CreateType(apiID, definition string, format TypeDefinitionFormat) (*APIType, error)

CreateType creates a GraphQL type for an API.

func (*InMemoryBackend) DeleteAPI

func (b *InMemoryBackend) DeleteAPI(apiID string) error

DeleteAPI deletes an Event API and all its channel namespaces.

func (*InMemoryBackend) DeleteAPICache

func (b *InMemoryBackend) DeleteAPICache(apiID string) error

DeleteAPICache deletes the cache configuration for a GraphQL API.

func (*InMemoryBackend) DeleteAPIKey

func (b *InMemoryBackend) DeleteAPIKey(apiID, keyID string) error

DeleteAPIKey deletes an API key from a GraphQL API.

func (*InMemoryBackend) DeleteChannelNamespace

func (b *InMemoryBackend) DeleteChannelNamespace(apiID, name string) error

DeleteChannelNamespace removes a channel namespace from an Event API.

func (*InMemoryBackend) DeleteDataSource

func (b *InMemoryBackend) DeleteDataSource(apiID, name string) error

DeleteDataSource deletes a data source. Returns an error if any resolver in the API still references this data source.

func (*InMemoryBackend) DeleteDomainName

func (b *InMemoryBackend) DeleteDomainName(domainName string) error

DeleteDomainName deletes a custom domain name configuration and its API association.

func (*InMemoryBackend) DeleteFunction

func (b *InMemoryBackend) DeleteFunction(apiID, functionID string) error

DeleteFunction deletes a pipeline function. Returns an error if any resolver's pipeline config still references this function.

func (*InMemoryBackend) DeleteGraphqlAPI

func (b *InMemoryBackend) DeleteGraphqlAPI(apiID string) error

DeleteGraphqlAPI deletes a GraphQL API by ID.

func (*InMemoryBackend) DeleteResolver

func (b *InMemoryBackend) DeleteResolver(apiID, typeName, fieldName string) error

DeleteResolver deletes a resolver.

func (*InMemoryBackend) DeleteType

func (b *InMemoryBackend) DeleteType(apiID, typeName string) error

DeleteType deletes a GraphQL type.

func (*InMemoryBackend) DisassociateAPI

func (b *InMemoryBackend) DisassociateAPI(domainName string) error

DisassociateAPI removes the API association from a domain name.

func (*InMemoryBackend) DisassociateMergedGraphqlAPI

func (b *InMemoryBackend) DisassociateMergedGraphqlAPI(sourceAPIID, associationID string) error

DisassociateMergedGraphqlAPI removes a merged API association from a source API.

func (*InMemoryBackend) DisassociateSourceGraphqlAPI

func (b *InMemoryBackend) DisassociateSourceGraphqlAPI(mergedAPIID, associationID string) error

DisassociateSourceGraphqlAPI removes a source API association from a merged API.

func (*InMemoryBackend) EvaluateCode

func (b *InMemoryBackend) EvaluateCode(code, contextJSON, function, runtime string) (string, error)

EvaluateCode evaluates an APPSYNC_JS module against the supplied context and returns the JSON-stringified return value of the selected handler.

gopherstack does not embed a JavaScript engine, so this evaluates the documented APPSYNC_JS patterns directly (see appsync_js.go). Constructs beyond that set return ErrUnsupportedJSCode rather than a fabricated result, so callers can distinguish "evaluated" from "not supported by the emulator".

func (*InMemoryBackend) EvaluateMappingTemplate

func (b *InMemoryBackend) EvaluateMappingTemplate(template, contextJSON string) (string, error)

EvaluateMappingTemplate evaluates a VTL mapping template with the provided context JSON. The context is expected to be a JSON object with optional "arguments" and "result" keys.

func (*InMemoryBackend) ExecuteGraphQL

func (b *InMemoryBackend) ExecuteGraphQL(
	ctx context.Context,
	apiID, query, operationName string,
	variables map[string]any,
) (map[string]any, error)

ExecuteGraphQL executes a GraphQL query/mutation against the configured resolvers.

func (*InMemoryBackend) FlushAPICache

func (b *InMemoryBackend) FlushAPICache(apiID string) error

FlushAPICache flushes the cache for a GraphQL API.

func (*InMemoryBackend) GetAPI

func (b *InMemoryBackend) GetAPI(apiID string) (*API, error)

GetAPI returns an Event API by ID.

func (*InMemoryBackend) GetAPIAssociation

func (b *InMemoryBackend) GetAPIAssociation(domainName string) (*APIAssociation, error)

GetAPIAssociation returns the API association for a domain name.

func (*InMemoryBackend) GetAPICache

func (b *InMemoryBackend) GetAPICache(apiID string) (*APICache, error)

GetAPICache returns the cache configuration for a GraphQL API.

func (*InMemoryBackend) GetChannelNamespace

func (b *InMemoryBackend) GetChannelNamespace(apiID, name string) (*ChannelNamespace, error)

GetChannelNamespace returns a channel namespace by API ID and name.

func (*InMemoryBackend) GetDataSource

func (b *InMemoryBackend) GetDataSource(apiID, name string) (*DataSource, error)

GetDataSource returns a data source by API ID and name.

func (*InMemoryBackend) GetDataSourceIntrospection

func (b *InMemoryBackend) GetDataSourceIntrospection(introspectionID string) (*DataSourceIntrospectionResult, error)

GetDataSourceIntrospection returns the result of a data source introspection job. Since introspection is a no-op stub, this always returns a COMPLETED result.

func (*InMemoryBackend) GetDomainName

func (b *InMemoryBackend) GetDomainName(domainName string) (*DomainName, error)

GetDomainName returns a custom domain name configuration.

func (*InMemoryBackend) GetFunction

func (b *InMemoryBackend) GetFunction(apiID, functionID string) (*Function, error)

GetFunction returns a pipeline function by ID.

func (*InMemoryBackend) GetGraphqlAPI

func (b *InMemoryBackend) GetGraphqlAPI(apiID string) (*GraphqlAPI, error)

GetGraphqlAPI returns a GraphQL API by ID.

func (*InMemoryBackend) GetGraphqlAPIEnvironmentVariables

func (b *InMemoryBackend) GetGraphqlAPIEnvironmentVariables(apiID string) (map[string]string, error)

GetGraphqlAPIEnvironmentVariables returns environment variables for a GraphQL API.

func (*InMemoryBackend) GetIntrospectionSchema

func (b *InMemoryBackend) GetIntrospectionSchema(apiID, _ string) ([]byte, error)

GetIntrospectionSchema returns the schema SDL for an API.

func (*InMemoryBackend) GetResolver

func (b *InMemoryBackend) GetResolver(apiID, typeName, fieldName string) (*Resolver, error)

GetResolver returns a resolver by API ID, type, and field name.

func (*InMemoryBackend) GetSchemaCreationStatus

func (b *InMemoryBackend) GetSchemaCreationStatus(apiID string) (*Schema, error)

GetSchemaCreationStatus returns the current schema creation status for an API.

func (*InMemoryBackend) GetSourceAPIAssociation

func (b *InMemoryBackend) GetSourceAPIAssociation(mergedAPIID, associationID string) (*SourceAPIAssociation, error)

GetSourceAPIAssociation returns a source API association by merged API ID and association ID.

func (*InMemoryBackend) GetType

func (b *InMemoryBackend) GetType(apiID, typeName string) (*APIType, error)

GetType returns a GraphQL type by name.

func (*InMemoryBackend) ListAPIKeys

func (b *InMemoryBackend) ListAPIKeys(apiID string) ([]*APIKey, error)

ListAPIKeys returns all non-expired API keys for a GraphQL API.

func (*InMemoryBackend) ListAPIs

func (b *InMemoryBackend) ListAPIs() ([]*API, error)

ListAPIs returns all Event APIs.

func (*InMemoryBackend) ListChannelNamespaces

func (b *InMemoryBackend) ListChannelNamespaces(apiID string) ([]*ChannelNamespace, error)

ListChannelNamespaces returns all channel namespaces for an Event API.

func (*InMemoryBackend) ListDataSources

func (b *InMemoryBackend) ListDataSources(apiID string) ([]*DataSource, error)

ListDataSources returns all data sources for an API.

func (*InMemoryBackend) ListDomainNames

func (b *InMemoryBackend) ListDomainNames() ([]*DomainName, error)

ListDomainNames returns all custom domain name configurations.

func (*InMemoryBackend) ListFunctions

func (b *InMemoryBackend) ListFunctions(apiID string) ([]*Function, error)

ListFunctions returns all pipeline functions for a GraphQL API.

func (*InMemoryBackend) ListGraphqlAPIs

func (b *InMemoryBackend) ListGraphqlAPIs(apiType string) ([]*GraphqlAPI, error)

ListGraphqlAPIs returns all GraphQL APIs, optionally filtered by apiType (apiTypeGraphQL or "MERGED").

func (*InMemoryBackend) ListResolvers

func (b *InMemoryBackend) ListResolvers(apiID, typeName string) ([]*Resolver, error)

ListResolvers returns all resolvers for an API type.

func (*InMemoryBackend) ListResolversByFunction

func (b *InMemoryBackend) ListResolversByFunction(apiID, functionID string) ([]*Resolver, error)

ListResolversByFunction returns all resolvers that use a given function.

func (*InMemoryBackend) ListSourceAPIAssociations

func (b *InMemoryBackend) ListSourceAPIAssociations(mergedAPIID string) ([]*SourceAPIAssociation, error)

ListSourceAPIAssociations returns all source API associations for a merged API.

func (*InMemoryBackend) ListTagsForResource

func (b *InMemoryBackend) ListTagsForResource(apiID string) (map[string]string, error)

ListTagsForResource returns all tags on a GraphQL API (v1) or Api (v2 Event API).

func (*InMemoryBackend) ListTypes

func (b *InMemoryBackend) ListTypes(apiID string) ([]*APIType, error)

ListTypes returns all GraphQL types for an API.

func (*InMemoryBackend) ListTypesByAssociation

func (b *InMemoryBackend) ListTypesByAssociation(mergedAPIID, associationID, _ string) ([]*APIType, error)

ListTypesByAssociation lists types associated with a given merged API source association. Since types are stored per-API and not per-association in the in-memory backend, this returns types from the merged API.

func (*InMemoryBackend) PutGraphqlAPIEnvironmentVariables

func (b *InMemoryBackend) PutGraphqlAPIEnvironmentVariables(
	apiID string,
	envVars map[string]string,
) (map[string]string, error)

PutGraphqlAPIEnvironmentVariables replaces the environment variables for a GraphQL API.

func (*InMemoryBackend) Reset

func (b *InMemoryBackend) Reset()

Reset clears all state from the backend, returning it to a clean initial state. Useful for resetting state between tests.

func (*InMemoryBackend) Restore

func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error

Restore loads backend state from a JSON snapshot. It implements persistence.Persistable.

func (*InMemoryBackend) SetDynamoDBBackend

func (b *InMemoryBackend) SetDynamoDBBackend(ddb DynamoDBBackend)

SetDynamoDBBackend configures the DynamoDB backend for DYNAMODB data sources.

func (*InMemoryBackend) SetLambdaInvoker

func (b *InMemoryBackend) SetLambdaInvoker(fn LambdaInvoker)

SetLambdaInvoker configures the Lambda invoker for LAMBDA data sources.

func (*InMemoryBackend) Snapshot

func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte

Snapshot serialises the backend state to JSON. It implements persistence.Persistable.

func (*InMemoryBackend) StartDataSourceIntrospection

func (b *InMemoryBackend) StartDataSourceIntrospection(apiID, dataSourceName string) (string, error)

StartDataSourceIntrospection starts an introspection job for a data source. Returns an introspection ID that can be polled via GetDataSourceIntrospection.

func (*InMemoryBackend) StartSchemaCreation

func (b *InMemoryBackend) StartSchemaCreation(apiID, sdl string) (*Schema, error)

StartSchemaCreation parses and stores the schema SDL for an API.

func (*InMemoryBackend) StartSchemaMerge

func (b *InMemoryBackend) StartSchemaMerge(apiID string) (SchemaStatus, error)

StartSchemaMerge triggers a schema merge for a merged GraphQL API.

func (*InMemoryBackend) SweepExpiredAPIKeys

func (b *InMemoryBackend) SweepExpiredAPIKeys() int

SweepExpiredAPIKeys removes all expired API keys across all GraphQL APIs.

func (*InMemoryBackend) TagResource

func (b *InMemoryBackend) TagResource(apiID string, tagMap map[string]string) error

TagResource adds or updates tags on a GraphQL API (v1) or Api (v2 Event API) — both resource kinds are addressed via "arn:...:appsync:...:apis/{apiId}" and are valid TagResource targets on the wire.

func (*InMemoryBackend) UntagResource

func (b *InMemoryBackend) UntagResource(apiID string, tagKeys []string) error

UntagResource removes tags from a GraphQL API (v1) or Api (v2 Event API).

func (*InMemoryBackend) UpdateAPI

func (b *InMemoryBackend) UpdateAPI(apiID, name, ownerContact string, eventConfig *EventConfig) (*API, error)

UpdateAPI updates an Event API's name, owner contact, or event config.

func (*InMemoryBackend) UpdateAPICache

func (b *InMemoryBackend) UpdateAPICache(apiID string, cache *APICache) (*APICache, error)

UpdateAPICache updates the cache configuration for a GraphQL API.

func (*InMemoryBackend) UpdateAPIKey

func (b *InMemoryBackend) UpdateAPIKey(apiID, keyID, description string, expires int64) (*APIKey, error)

UpdateAPIKey updates an existing API key's description and/or expiry.

func (*InMemoryBackend) UpdateChannelNamespace

func (b *InMemoryBackend) UpdateChannelNamespace(
	apiID, name string, cfg *ChannelNamespaceConfig,
) (*ChannelNamespace, error)

UpdateChannelNamespace updates a channel namespace's code handlers, auth modes, and handler configs.

func (*InMemoryBackend) UpdateDataSource

func (b *InMemoryBackend) UpdateDataSource(apiID, name string, ds *DataSource) (*DataSource, error)

UpdateDataSource updates an existing data source.

func (*InMemoryBackend) UpdateDomainName

func (b *InMemoryBackend) UpdateDomainName(domainName, description, certificateARN string) (*DomainName, error)

UpdateDomainName updates an existing custom domain name configuration.

func (*InMemoryBackend) UpdateFunction

func (b *InMemoryBackend) UpdateFunction(apiID, functionID string, f *Function) (*Function, error)

UpdateFunction updates an existing pipeline function.

func (*InMemoryBackend) UpdateGraphqlAPI

func (b *InMemoryBackend) UpdateGraphqlAPI(
	apiID, name string,
	authType AuthenticationType,
	xrayEnabled *bool,
	visibility string,
	additionalAuthProviders []AdditionalAuthenticationProvider,
	cfg *GraphqlAPIConfig,
) (*GraphqlAPI, error)

UpdateGraphqlAPI updates an existing GraphQL API's name and/or authentication type.

func (*InMemoryBackend) UpdateResolver

func (b *InMemoryBackend) UpdateResolver(apiID, typeName string, r *Resolver) (*Resolver, error)

UpdateResolver updates an existing resolver.

func (*InMemoryBackend) UpdateSourceAPIAssociation

func (b *InMemoryBackend) UpdateSourceAPIAssociation(
	mergedAPIID, associationID, description string,
) (*SourceAPIAssociation, error)

UpdateSourceAPIAssociation updates the description of a source API association.

func (*InMemoryBackend) UpdateType

func (b *InMemoryBackend) UpdateType(
	apiID, typeName, definition string,
	format TypeDefinitionFormat,
) (*APIType, error)

UpdateType updates an existing GraphQL type definition.

type Integration

type Integration struct {
	LambdaConfig   *LambdaDataSourceConfig `json:"lambdaConfig,omitempty"`
	DataSourceName string                  `json:"dataSourceName"`
}

Integration is the data source integration for an event handler.

type Janitor

type Janitor struct {
	Backend  *InMemoryBackend
	Interval time.Duration
}

Janitor is the background worker for AppSync that prunes expired API keys.

func NewJanitor

func NewJanitor(backend *InMemoryBackend) *Janitor

NewJanitor creates a new AppSync janitor.

func (*Janitor) Run

func (j *Janitor) Run(ctx context.Context)

Run executes the janitor loop.

type LambdaAuthorizerConfig

type LambdaAuthorizerConfig struct {
	AuthorizerURI                string `json:"authorizerUri"`
	IdentityValidationExpression string `json:"identityValidationExpression,omitempty"`
	AuthorizerResultTTLInSeconds int32  `json:"authorizerResultTtlInSeconds,omitempty"`
}

LambdaAuthorizerConfig holds the Lambda authorizer configuration for an API.

type LambdaConflictHandlerConfig

type LambdaConflictHandlerConfig struct {
	LambdaConflictHandlerARN string `json:"lambdaConflictHandlerArn,omitempty"`
}

LambdaConflictHandlerConfig holds config for Lambda conflict resolution.

type LambdaDataSourceConfig

type LambdaDataSourceConfig struct {
	LambdaFunctionARN string `json:"lambdaFunctionArn"`
}

LambdaDataSourceConfig holds the configuration for a Lambda data source.

type LambdaInvoker

type LambdaInvoker interface {
	InvokeFunction(ctx context.Context, name, invocationType string, payload []byte) ([]byte, int, error)
}

LambdaInvoker can invoke a Lambda function by name or ARN.

type LogConfig

type LogConfig struct {
	CloudWatchLogsRoleARN string `json:"cloudWatchLogsRoleArn"`
	FieldLogLevel         string `json:"fieldLogLevel"` // NONE, ERROR, ALL
	ExcludeVerboseContent bool   `json:"excludeVerboseContent,omitempty"`
}

LogConfig holds the CloudWatch Logs configuration for a GraphQL API.

type OpenIDConnectConfig

type OpenIDConnectConfig struct {
	Issuer   string `json:"issuer"`
	ClientID string `json:"clientId,omitempty"`
	IatTTL   int64  `json:"iatTTL,omitempty"`
	AuthTTL  int64  `json:"authTTL,omitempty"`
}

OpenIDConnectConfig holds the OpenID Connect configuration for an API.

type OpenSearchServiceDataSourceConfig

type OpenSearchServiceDataSourceConfig struct {
	Endpoint  string `json:"endpoint"`
	AWSRegion string `json:"awsRegion"`
}

OpenSearchServiceDataSourceConfig holds config for an OpenSearch data source.

type Provider

type Provider struct{}

Provider implements service.Provider for the AppSync service.

func (*Provider) Init

Init initializes the AppSync service backend and handler.

func (*Provider) Name

func (p *Provider) Name() string

Name returns the logical name of the provider.

type RDSHTTPEndpointConfig

type RDSHTTPEndpointConfig struct {
	DatabaseName        string `json:"databaseName,omitempty"`
	DBClusterIdentifier string `json:"dbClusterIdentifier,omitempty"`
	AWSRegion           string `json:"awsRegion,omitempty"`
	Schema              string `json:"schema,omitempty"`
	AWSSecretStoreARN   string `json:"awsSecretStoreArn,omitempty"`
}

RDSHTTPEndpointConfig holds the RDS HTTP endpoint configuration.

type RelationalDatabaseDataSourceConfig

type RelationalDatabaseDataSourceConfig struct {
	RDSHTTPEndpointConfig        *RDSHTTPEndpointConfig `json:"rdsHttpEndpointConfig,omitempty"`
	RelationalDatabaseSourceType string                 `json:"relationalDatabaseSourceType,omitempty"`
}

RelationalDatabaseDataSourceConfig holds config for a relational database data source.

type Resolver

type Resolver struct {
	CachingConfig           *CachingConfig `json:"cachingConfig,omitempty"`
	SyncConfig              *SyncConfig    `json:"syncConfig,omitempty"`
	Runtime                 *Runtime       `json:"runtime,omitempty"`
	RequestMappingTemplate  string         `json:"requestMappingTemplate,omitempty"`
	ResponseMappingTemplate string         `json:"responseMappingTemplate,omitempty"`
	DataSourceName          string         `json:"dataSourceName,omitempty"`
	ResolverARN             string         `json:"resolverArn"`
	TypeName                string         `json:"typeName"`
	FieldName               string         `json:"fieldName"`
	APIID                   string         `json:"apiId"`
	Code                    string         `json:"code,omitempty"`
	Kind                    string         `json:"kind,omitempty"`
	PipelineConfig          []string       `json:"pipelineConfig,omitempty"` // function IDs for PIPELINE resolvers
	MaxBatchSize            int32          `json:"maxBatchSize,omitempty"`
}

Resolver represents an AppSync resolver.

type Runtime

type Runtime struct {
	Name           string `json:"name"`           // APPSYNC_JS
	RuntimeVersion string `json:"runtimeVersion"` // 1.0.0
}

Runtime specifies the runtime for APPSYNC_JS resolvers and functions.

type Schema

type Schema struct {
	SDL     string       `json:"sdl"`
	Status  SchemaStatus `json:"status"`
	Details string       `json:"details,omitempty"`
	APIID   string       `json:"apiId"`
	// contains filtered or unexported fields
}

Schema represents a stored GraphQL schema.

type SchemaStatus

type SchemaStatus string

SchemaStatus represents the schema creation status.

const (
	// SchemaStatusProcessing indicates the schema is being processed.
	SchemaStatusProcessing SchemaStatus = "PROCESSING"
	// SchemaStatusActive indicates the schema is active.
	SchemaStatusActive SchemaStatus = "ACTIVE"
	// SchemaStatusDeleting indicates the schema is being deleted.
	SchemaStatusDeleting SchemaStatus = "DELETING"
	// SchemaStatusFailed indicates the schema creation failed.
	SchemaStatusFailed SchemaStatus = "FAILED"
	// SchemaStatusNotApplicable indicates schema creation is not applicable.
	SchemaStatusNotApplicable SchemaStatus = "NOT_APPLICABLE"
)

type SourceAPIAssociation

type SourceAPIAssociation struct {
	SourceAPIAssociationConfig *SourceAPIAssociationConfig `json:"sourceApiAssociationConfig,omitempty"`
	AssociationID              string                      `json:"associationId"`
	AssociationARN             string                      `json:"associationArn"`
	SourceAPIID                string                      `json:"sourceApiId"`
	SourceAPIARN               string                      `json:"sourceApiArn,omitempty"`
	MergedAPIID                string                      `json:"mergedApiId"`
	MergedAPIARN               string                      `json:"mergedApiArn,omitempty"`
	Description                string                      `json:"description,omitempty"`
	AssociationStatus          string                      `json:"associationStatus"`
}

SourceAPIAssociation represents an association between a source API and a merged API.

type SourceAPIAssociationConfig

type SourceAPIAssociationConfig struct {
	MergeType string `json:"mergeType,omitempty"` // MANUAL_MERGE or AUTO_MERGE
}

SourceAPIAssociationConfig describes how source API merging is performed.

type StorageBackend

type StorageBackend interface {
	CreateGraphqlAPI(
		name string,
		authType AuthenticationType,
		xrayEnabled bool,
		apiType string,
		visibility string,
		additionalAuthProviders []AdditionalAuthenticationProvider,
		tagMap map[string]string,
		cfg *GraphqlAPIConfig,
	) (*GraphqlAPI, error)
	GetGraphqlAPI(apiID string) (*GraphqlAPI, error)
	UpdateGraphqlAPI(
		apiID, name string,
		authType AuthenticationType,
		xrayEnabled *bool,
		visibility string,
		additionalAuthProviders []AdditionalAuthenticationProvider,
		cfg *GraphqlAPIConfig,
	) (*GraphqlAPI, error)
	ListGraphqlAPIs(apiType string) ([]*GraphqlAPI, error)
	DeleteGraphqlAPI(apiID string) error
	StartSchemaCreation(apiID, sdl string) (*Schema, error)
	GetSchemaCreationStatus(apiID string) (*Schema, error)
	GetIntrospectionSchema(apiID, format string) ([]byte, error)
	CreateDataSource(apiID string, ds *DataSource) (*DataSource, error)
	GetDataSource(apiID, name string) (*DataSource, error)
	ListDataSources(apiID string) ([]*DataSource, error)
	DeleteDataSource(apiID, name string) error
	CreateResolver(apiID, typeName string, r *Resolver) (*Resolver, error)
	GetResolver(apiID, typeName, fieldName string) (*Resolver, error)
	ListResolvers(apiID, typeName string) ([]*Resolver, error)
	DeleteResolver(apiID, typeName, fieldName string) error
	ExecuteGraphQL(
		ctx context.Context,
		apiID, query, operationName string,
		variables map[string]any,
	) (map[string]any, error)
	// New Event API operations.
	CreateAPI(name, ownerContact string, tagMap map[string]string, eventConfig *EventConfig) (*API, error)
	CreateChannelNamespace(
		apiID, name string, tagMap map[string]string, cfg *ChannelNamespaceConfig,
	) (*ChannelNamespace, error)
	// API key operations.
	CreateAPIKey(apiID, description string, expires int64) (*APIKey, error)
	ListAPIKeys(apiID string) ([]*APIKey, error)
	DeleteAPIKey(apiID, keyID string) error
	// API cache operations.
	CreateAPICache(apiID string, cache *APICache) (*APICache, error)
	GetAPICache(apiID string) (*APICache, error)
	DeleteAPICache(apiID string) error
	// Function operations.
	CreateFunction(apiID string, f *Function) (*Function, error)
	GetFunction(apiID, functionID string) (*Function, error)
	ListFunctions(apiID string) ([]*Function, error)
	DeleteFunction(apiID, functionID string) error
	// Type operations.
	CreateType(apiID, definition string, format TypeDefinitionFormat) (*APIType, error)
	GetType(apiID, typeName string) (*APIType, error)
	ListTypes(apiID string) ([]*APIType, error)
	DeleteType(apiID, typeName string) error
	// DataSource update.
	UpdateDataSource(apiID, name string, ds *DataSource) (*DataSource, error)
	// Resolver update.
	UpdateResolver(apiID, typeName string, r *Resolver) (*Resolver, error)
	// Function update.
	UpdateFunction(apiID, functionID string, f *Function) (*Function, error)
	// Type update.
	UpdateType(apiID, typeName, definition string, format TypeDefinitionFormat) (*APIType, error)
	// API key update.
	UpdateAPIKey(apiID, keyID, description string, expires int64) (*APIKey, error)
	// API cache update and flush.
	UpdateAPICache(apiID string, cache *APICache) (*APICache, error)
	FlushAPICache(apiID string) error
	// Tag operations (GraphQL APIs).
	TagResource(apiID string, tagMap map[string]string) error
	UntagResource(apiID string, tagKeys []string) error
	ListTagsForResource(apiID string) (map[string]string, error)
	// Domain name operations.
	CreateDomainName(domainName, certificateARN, description string, tagMap map[string]string) (*DomainName, error)
	GetDomainName(domainName string) (*DomainName, error)
	UpdateDomainName(domainName, description, certificateARN string) (*DomainName, error)
	ListDomainNames() ([]*DomainName, error)
	DeleteDomainName(domainName string) error
	AssociateAPI(domainName, apiID string) (*APIAssociation, error)
	GetAPIAssociation(domainName string) (*APIAssociation, error)
	DisassociateAPI(domainName string) error
	// Event API (v2) operations.
	GetAPI(apiID string) (*API, error)
	ListAPIs() ([]*API, error)
	UpdateAPI(apiID, name, ownerContact string, eventConfig *EventConfig) (*API, error)
	DeleteAPI(apiID string) error
	// Channel namespace operations.
	GetChannelNamespace(apiID, name string) (*ChannelNamespace, error)
	ListChannelNamespaces(apiID string) ([]*ChannelNamespace, error)
	UpdateChannelNamespace(apiID, name string, cfg *ChannelNamespaceConfig) (*ChannelNamespace, error)
	DeleteChannelNamespace(apiID, name string) error
	// Merged/source API association operations.
	AssociateMergedGraphqlAPI(
		sourceAPIIdentifier, mergedAPIIdentifier, description, mergeType string,
	) (*SourceAPIAssociation, error)
	AssociateSourceGraphqlAPI(
		mergedAPIIdentifier, sourceAPIIdentifier, description, mergeType string,
	) (*SourceAPIAssociation, error)
	GetSourceAPIAssociation(mergedAPIID, associationID string) (*SourceAPIAssociation, error)
	ListSourceAPIAssociations(mergedAPIID string) ([]*SourceAPIAssociation, error)
	DisassociateMergedGraphqlAPI(sourceAPIID, associationID string) error
	DisassociateSourceGraphqlAPI(mergedAPIID, associationID string) error
	// ListResolversByFunction - resolvers attached to a function.
	ListResolversByFunction(apiID, functionID string) ([]*Resolver, error)
	// Environment variable operations on GraphQL APIs.
	GetGraphqlAPIEnvironmentVariables(apiID string) (map[string]string, error)
	PutGraphqlAPIEnvironmentVariables(apiID string, envVars map[string]string) (map[string]string, error)
	// EvaluateMappingTemplate evaluates a VTL request/response mapping template.
	EvaluateMappingTemplate(template, context string) (string, error)
	// EvaluateCode evaluates APPSYNC_JS code.
	EvaluateCode(code, contextJSON, function, runtime string) (string, error)
	// StartDataSourceIntrospection starts an introspection job for a data source.
	StartDataSourceIntrospection(apiID, dataSourceName string) (string, error)
	// GetDataSourceIntrospection returns the result of a data source introspection job.
	GetDataSourceIntrospection(introspectionID string) (*DataSourceIntrospectionResult, error)
	// StartSchemaMerge triggers a schema merge for a merged GraphQL API.
	StartSchemaMerge(apiID string) (SchemaStatus, error)
	// UpdateSourceAPIAssociation updates a source API association on a merged API.
	UpdateSourceAPIAssociation(mergedAPIID, associationID, description string) (*SourceAPIAssociation, error)
	// ListTypesByAssociation lists types for a given merged API source association.
	ListTypesByAssociation(mergedAPIID, associationID, format string) ([]*APIType, error)
}

StorageBackend defines the interface for AppSync storage operations.

type SyncConfig

type SyncConfig struct {
	LambdaConflictHandlerConfig *LambdaConflictHandlerConfig `json:"lambdaConflictHandlerConfig,omitempty"`
	ConflictDetection           string                       `json:"conflictDetection,omitempty"`
	ConflictHandler             string                       `json:"conflictHandler,omitempty"`
}

SyncConfig holds the conflict detection/resolution configuration for a resolver.

type TypeDefinitionFormat

type TypeDefinitionFormat string

TypeDefinitionFormat represents the format of a GraphQL type definition.

const (
	// TypeFormatSDL represents SDL format.
	TypeFormatSDL TypeDefinitionFormat = "SDL"
	// TypeFormatJSON represents JSON format.
	TypeFormatJSON TypeDefinitionFormat = "JSON"
)

type UserPoolConfig

type UserPoolConfig struct {
	UserPoolID       string `json:"userPoolId"`
	AWSRegion        string `json:"awsRegion"`
	DefaultAction    string `json:"defaultAction"` // ALLOW or DENY
	AppIDClientRegex string `json:"appIdClientRegex,omitempty"`
}

UserPoolConfig holds the primary Amazon Cognito user pool configuration for a GraphQL API. Unlike CognitoUserPoolConfig (used in AdditionalAuthProviders), this has DefaultAction.

Jump to

Keyboard shortcuts

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