appsync

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2026 License: MIT Imports: 33 Imported by: 0

README

AppSync

Parity grade: A · SDK aws-sdk-go-v2/service/appsync@v1.56.4 · last audited 2026-08-15 (198990e82)

Coverage

Metric Value
Operations audited 74 (74 ok)
Feature families 14 (14 ok)
Known gaps 4
Deferred items 2
Resource leaks clean
Known gaps
  • PIPELINE resolver before-mapping (RequestMappingTemplate / Code's request handler, at the resolver level, not a Function's) is intentionally not evaluated (bd: gopherstack-ivwh). On real AppSync its only observable effects beyond building a request object nothing here consumes are writing to ctx.stash (read by later pipeline functions) and short-circuiting the pipeline via util.error/an early return -- neither of which this evaluator's documented subset implements. Evaluating it and discarding the result would be pointless busywork; skipping it is the honest reflection of what's supported. See executePipeline's doc comment in graphql.go.
  • The APPSYNC_JS evaluator (jseval.go) supports a documented subset of real JS: return <object/array/json literal>;, context member expressions, and the pure util.* helpers (toJson/parseJson/error/appendError/unauthorized) -- not control flow, loops, variable bindings, or DynamoDB-specific helpers like util.dynamodb.get()/put(). A JS DynamoDB resolver must therefore return the raw {operation,key/item} object literal directly (mirroring what a VTL template renders) rather than using util.dynamodb.* sugar. Constructs outside the subset return ErrUnsupportedJSCode rather than a fabricated result -- see jseval.go's doc comment for the full supported-pattern list.
  • 2026-08-15: GraphqlApi missing real dns/enhancedMetricsConfig/mergedApiExecutionRoleArn/wafWebAclArn members -- none tracked anywhere in this backend (merged-API execution role, WAF ACL association, and enhanced metrics config are all unsimulated cross-feature concepts). Api (Event API) missing real created timestamp (optional, not required) and wafWebAclArn, same reason. DataSource missing the deprecated legacy elasticsearchConfig member (real AWS docs steer new integrations to openSearchServiceConfig instead).
  • 2026-08-15: DataSource/Resolver/Function/ApiCache/APIType/DomainNameConfig each carry a fabricated apiId field on their own wire object (none of the corresponding real types has one -- apiId lives on the URL path only); DataSource also carries a fabricated tags field (the real DataSource type has no tags member, consistent with handler_create_tags_test.go's existing finding that DataSource ARNs aren't a TagResource target). GraphqlApi.Region/CreatedAt/UpdatedAt are also fabricated (no such real members). All harmless -- a real client silently ignores unknown JSON keys -- and disclosed rather than fixed to avoid 6+ call-site changes for no functional benefit; see services/_WRAPPER_KEY_SWEEP_REMAINDER.md's appsync section.
Deferred
  • CloudTrail-capture chokepoint / pkgs/service integration — not audited (shared/cross-service, out of scope per this task's edit boundary).
  • DataSourceIntrospection real model content: gopherstack has no RDS Data API backend to introspect against, so StartDataSourceIntrospection/GetDataSourceIntrospection always complete SUCCESS with an empty models list rather than real table/column data. Wire shape, error codes (BadRequestException on missing/incomplete rdsDataApiConfig, NotFoundException on unknown introspectionId), and persisted per-ID state are all real and field-diffed against the SDK; only the introspected content is out of scope. Would require a services/rds (or similar) cross-service integration to fix — out of this task's services/appsync/ 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.

View Source
const (
	DataSourceIntrospectionStatusProcessing = "PROCESSING"
	DataSourceIntrospectionStatusFailed     = "FAILED"
	DataSourceIntrospectionStatusSuccess    = "SUCCESS"
)

DataSourceIntrospectionStatus values for a DataSourceIntrospection job, matching aws-sdk-go-v2/service/appsync/types.DataSourceIntrospectionStatus exactly.

View Source
const (
	SourceAPIAssociationStatusMergeScheduled          = "MERGE_SCHEDULED"
	SourceAPIAssociationStatusMergeFailed             = "MERGE_FAILED"
	SourceAPIAssociationStatusMergeSuccess            = "MERGE_SUCCESS"
	SourceAPIAssociationStatusMergeInProgress         = "MERGE_IN_PROGRESS"
	SourceAPIAssociationStatusAutoMergeScheduleFailed = "AUTO_MERGE_SCHEDULE_FAILED"
	SourceAPIAssociationStatusDeletionScheduled       = "DELETION_SCHEDULED"
	SourceAPIAssociationStatusDeletionInProgress      = "DELETION_IN_PROGRESS"
	SourceAPIAssociationStatusDeletionFailed          = "DELETION_FAILED"
)

SourceAPIAssociationStatus values, matching aws-sdk-go-v2/service/appsync/types.SourceApiAssociationStatus exactly.

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")
	// ErrFunctionNotFound is returned when a PIPELINE resolver's PipelineConfig
	// references a function ID that doesn't exist.
	ErrFunctionNotFound = errors.New("function 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's wire key is "apiArn", not "arn" -- verified against the real
	// deserializer (appsync@v1.56.4 deserializers.go:12050), which is the only
	// field name real clients recognize to discover an Event API's ARN.
	ARN          string `json:"apiArn"`
	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"`
	MetricsConfig            string                              `json:"metricsConfig,omitempty"`
}

DataSource represents an AppSync data source.

MetricsConfig ("ENABLED"/"DISABLED") is a real, accepted-and-echoed member (types.DataSourceLevelMetricsConfig, verified against deserializers.go:13625 response-side and serializers.go request-side) that was previously unmodeled entirely -- a real client's CreateDataSource/ UpdateDataSource MetricsConfig value was silently dropped.

type DataSourceIntrospection added in v1.2.0

type DataSourceIntrospection struct {
	RDSDataAPIConfig          *RDSDataAPIConfig              `json:"rdsDataApiConfig,omitempty"`
	IntrospectionResult       *DataSourceIntrospectionResult `json:"introspectionResult,omitempty"`
	IntrospectionID           string                         `json:"introspectionId"`
	IntrospectionStatus       string                         `json:"introspectionStatus"`
	IntrospectionStatusDetail string                         `json:"introspectionStatusDetail,omitempty"`
}

DataSourceIntrospection is the persisted record of a StartDataSourceIntrospection job, keyed by IntrospectionID. Unlike the rest of this service's resources, a real introspection job is NOT coupled to any AppSync GraphqlApi/DataSource -- it introspects an RDS Data API-backed database directly from the caller-supplied RDSDataAPIConfig (see StartDataSourceIntrospectionInput in the real SDK, which carries only an optional rdsDataApiConfig, no apiId/dataSourceName). The RDSDataAPIConfig field is internal record-keeping only -- it is never part of either operation's wire response.

type DataSourceIntrospectionModel added in v1.2.0

type DataSourceIntrospectionModel struct {
	PrimaryKey *DataSourceIntrospectionModelIndex   `json:"primaryKey,omitempty"`
	Name       string                               `json:"name,omitempty"`
	SDL        string                               `json:"sdl,omitempty"`
	Fields     []*DataSourceIntrospectionModelField `json:"fields,omitempty"`
	Indexes    []*DataSourceIntrospectionModelIndex `json:"indexes,omitempty"`
}

DataSourceIntrospectionModel is the introspected data for a single model (e.g. a database table). Matches aws-sdk-go-v2/service/appsync/types.DataSourceIntrospectionModel.

type DataSourceIntrospectionModelField added in v1.2.0

type DataSourceIntrospectionModelField struct {
	Type   *DataSourceIntrospectionModelFieldType `json:"type,omitempty"`
	Name   string                                 `json:"name,omitempty"`
	Length int64                                  `json:"length,omitempty"`
}

DataSourceIntrospectionModelField represents one field retrieved from introspected data. Matches aws-sdk-go-v2/service/appsync/types.DataSourceIntrospectionModelField.

type DataSourceIntrospectionModelFieldType added in v1.2.0

type DataSourceIntrospectionModelFieldType struct {
	Type   *DataSourceIntrospectionModelFieldType `json:"type,omitempty"`
	Kind   string                                 `json:"kind,omitempty"`
	Name   string                                 `json:"name,omitempty"`
	Values []string                               `json:"values,omitempty"`
}

DataSourceIntrospectionModelFieldType represents the type data for one introspected field. Matches aws-sdk-go-v2/service/appsync/types.DataSourceIntrospectionModelFieldType.

type DataSourceIntrospectionModelIndex added in v1.2.0

type DataSourceIntrospectionModelIndex struct {
	Name   string   `json:"name,omitempty"`
	Fields []string `json:"fields,omitempty"`
}

DataSourceIntrospectionModelIndex is an index retrieved from introspected data. Matches aws-sdk-go-v2/service/appsync/types.DataSourceIntrospectionModelIndex.

type DataSourceIntrospectionResult

type DataSourceIntrospectionResult struct {
	NextToken string                          `json:"nextToken,omitempty"`
	Models    []*DataSourceIntrospectionModel `json:"models,omitempty"`
}

DataSourceIntrospectionResult is the populated result of a completed introspection. Matches aws-sdk-go-v2/service/appsync/types.DataSourceIntrospectionResult.

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 {
	LogConfig                 *EventLogConfig `json:"logConfig,omitempty"`
	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.

LogConfig was previously unmodeled entirely: real CreateApiInput/ UpdateApiInput both accept it nested under eventConfig (serializers.go's awsRestjson1_serializeDocumentEventConfig has a "logConfig" case), and the real Api response type echoes it back, but gopherstack's EventConfig struct had no field for it at all -- json.Unmarshal silently dropped a real client's CreateApi/UpdateApi EventConfig.LogConfig every time.

type EventLogConfig added in v1.3.1

type EventLogConfig struct {
	CloudWatchLogsRoleARN string `json:"cloudWatchLogsRoleArn"`
	LogLevel              string `json:"logLevel"`
}

EventLogConfig holds the CloudWatch Logs configuration for an Event API. Distinct from GraphqlAPI's LogConfig -- real appsync.types.EventLogConfig has only these two members (verified: appsync@v1.56.4 deserializers.go's awsRestjson1_deserializeDocumentEventLogConfig case list), no excludeVerboseContent field like the GraphqlApi LogConfig has.

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:"-"`
	UserPoolConfig                    *UserPoolConfig                    `json:"userPoolConfig,omitempty"`
	OpenIDConnectConfig               *OpenIDConnectConfig               `json:"openIDConnectConfig,omitempty"`
	LambdaAuthorizerConfig            *LambdaAuthorizerConfig            `json:"lambdaAuthorizerConfig,omitempty"`
	LogConfig                         *LogConfig                         `json:"logConfig,omitempty"`
	AuthenticationType                AuthenticationType                 `json:"authenticationType"`
	IntrospectionConfig               string                             `json:"introspectionConfig,omitempty"`
	ARN                               string                             `json:"arn"`
	Name                              string                             `json:"name"`
	Visibility                        string                             `json:"visibility,omitempty"`
	Region                            string                             `json:"region"`
	APIType                           string                             `json:"apiType,omitempty"`
	APIID                             string                             `json:"apiId"`
	Owner                             string                             `json:"owner,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.

EnvironmentVariables is deliberately excluded from the wire (json:"-"): the real GraphqlApi type has no such member (verified against the real deserializer, appsync@v1.56.4 deserializers.go:14999-15185, which has no "environmentVariables" case) -- env vars are exposed only via the dedicated GetGraphqlApiEnvironmentVariables/PutGraphqlApiEnvironmentVariables ops. Before this fix, GetGraphqlApi/ListGraphqlApis/CreateGraphqlApi/ UpdateGraphqlApi all leaked a caller's real environment-variable values into a response AWS never puts them in, once PutGraphqlApiEnvironmentVariables had been called. Region/CreatedAt/UpdatedAt are also fabricated (not on the real type either) but harmless (no customer data) and left on the wire, disclosed rather than fixed -- see PARITY.md.

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 SDK user-agent markers: 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 SDK identification indicates AppSync. That identification is checked in both the User-Agent header (set by native SDKs) and the X-Amz-User-Agent header (used by the AWS SDK for JavaScript in a browser, which cannot set User-Agent itself) -- see service.MatchesUserAgentMarker.

"/v1/tags/{arn}" is shared with Batch/CodeArtifact/Kafka/MQ/Pinpoint/Polly, each of which expose the same real AWS SDK tagging endpoint under their own /v1/ namespace, so the tags branch is ARN-scoped via isAppSyncTagPath instead of a bare prefix match -- an unguarded match here claims every other service's tag requests too (see isBatchTagPath in services/batch/handler.go for the mirrored guard on that side).

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) (*DataSourceIntrospection, error)

GetDataSourceIntrospection returns the persisted record of a previously started introspection job.

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(cfg *RDSDataAPIConfig) (*DataSourceIntrospection, error)

StartDataSourceIntrospection starts an RDS Data API introspection job. Unlike every other Create/Start operation in this backend, the real AWS operation is NOT scoped to an existing AppSync API or DataSource -- it introspects the RDS cluster named by cfg directly (see StartDataSourceIntrospectionInput in the real SDK: the only field is an optional rdsDataApiConfig). gopherstack has no real RDS Data API connectivity to introspect against, so every well-formed request completes synchronously with a SUCCESS status and an empty model list -- the wire-accurate shape and error semantics of introspecting a genuine (if schema-less) database, persisted so it can be retrieved again by ID 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(mergedAPIID, associationID string) (string, error)

StartSchemaMerge merges the schema of one source API association into its merged API, keyed by (mergedAPIID, associationID) -- matching the real StartSchemaMergeInput, which requires BOTH mergedApiIdentifier and associationId (a merge always targets one specific association, never "the merged API" as a whole). Merges in this emulator are synchronous and always succeed (no conflicting-schema detection), returning the association's new sourceApiAssociationStatus.

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) TaggedResources added in v1.3.1

func (b *InMemoryBackend) TaggedResources() []TaggedEntry

TaggedResources returns every GraphQL API (v1) and Event API (v2) that carries at least one tag, keyed by ARN -- the two resource kinds taggable through the generic TagResource/UntagResource/ListTagsForResource ops (see TagResource's doc comment).

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 RDSDataAPIConfig added in v1.2.0

type RDSDataAPIConfig struct {
	DatabaseName string `json:"databaseName"`
	ResourceARN  string `json:"resourceArn"`
	SecretARN    string `json:"secretArn"`
}

RDSDataAPIConfig carries the metadata needed to introspect an RDS cluster via the RDS Data API. Field names match aws-sdk-go-v2/service/appsync/types.RdsDataApiConfig.

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"`
	ResolverARN             string         `json:"resolverArn"`
	ResponseMappingTemplate string         `json:"responseMappingTemplate,omitempty"`
	DataSourceName          string         `json:"dataSourceName,omitempty"`
	RequestMappingTemplate  string         `json:"requestMappingTemplate,omitempty"`
	TypeName                string         `json:"typeName"`
	FieldName               string         `json:"fieldName"`
	APIID                   string         `json:"apiId"`
	Code                    string         `json:"code,omitempty"`
	Kind                    string         `json:"kind,omitempty"`
	MetricsConfig           string         `json:"metricsConfig,omitempty"`
	PipelineConfig          []string       `json:"pipelineConfig,omitempty"`
	MaxBatchSize            int32          `json:"maxBatchSize,omitempty"`
}

Resolver represents an AppSync resolver.

MetricsConfig ("ENABLED"/"DISABLED") is a real, accepted-and-echoed member (types.ResolverLevelMetricsConfig, verified against deserializers.go:16248 response-side and the paired request serializer) that was previously unmodeled entirely -- a real client's CreateResolver/ UpdateResolver MetricsConfig value was silently dropped.

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:"sourceApiAssociationStatus"`
	AssociationStatusDetail    string                      `json:"sourceApiAssociationStatusDetail,omitempty"`
}

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

AssociationStatus's wire key is "sourceApiAssociationStatus", NOT "associationStatus" -- verified against the real deserializer (appsync@v1.56.4 deserializers.go:16488). This is a sibling trap: the similarly-named ApiAssociation type (domain-name associations) genuinely does use the plain "associationStatus" key (deserializers.go:12175); a real client's SourceApiAssociation.SourceApiAssociationStatus field was always empty regardless of backend state before this fix.

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 RDS Data API introspection job. Not
	// scoped to any existing AppSync API/DataSource -- see DataSourceIntrospection's
	// doc comment in models.go.
	StartDataSourceIntrospection(cfg *RDSDataAPIConfig) (*DataSourceIntrospection, error)
	// GetDataSourceIntrospection returns the persisted record of an introspection job.
	GetDataSourceIntrospection(introspectionID string) (*DataSourceIntrospection, error)
	// StartSchemaMerge merges one source API association's schema into its merged API.
	StartSchemaMerge(mergedAPIID, associationID string) (string, 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 TaggedEntry added in v1.3.1

type TaggedEntry struct {
	Tags map[string]string
	ARN  string
}

TaggedEntry pairs a resource ARN with its tag set, for the Resource Groups Tagging API's GetResources (see cli.go's wireTaggingAppSync).

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