resolvers
Creates, updates, deletes or gets a resolver resource or lists resolvers in a region
Overview
| Name | resolvers |
| Type | Resource |
| Description | The When you submit an update, CFNLong updates resources based on differences between what you submit and the stack's current template. To cause this resource to be updated you must change a property value for this resource in the CFNshort template. Changing the S3 file content without changing a property value will not result in an update operation. |
| Id | awscc.appsync.resolvers |
Fields
- get (all properties)
- list (identifiers only)
| Name | Datatype | Description |
|---|---|---|
api_id | string | The APSYlong GraphQL API to which you want to attach this resolver. |
caching_config | object | The caching configuration for the resolver. |
code | string | The resolver code that contains the request and response functions. When code is used, the runtime is required. The runtime value must be APPSYNC_JS. |
code_s3_location | string | The Amazon S3 endpoint. |
data_source_name | string | The resolver data source name. |
field_name | string | The GraphQL field on a type that invokes the resolver. |
kind | string | The resolver type.+ UNIT: A UNIT resolver type. A UNIT resolver is the default resolver type. You can use a UNIT resolver to run a GraphQL query against a single data source.+ PIPELINE: A PIPELINE resolver type. You can use a PIPELINE resolver to invoke a series of Function objects in a serial manner. You can use a pipeline resolver to run a GraphQL query against multiple data sources. |
max_batch_size | integer | The maximum number of resolver request inputs that will be sent to a single LAMlong function in a BatchInvoke operation. |
pipeline_config | object | Functions linked with the pipeline resolver. |
request_mapping_template | string | The request mapping template.Request mapping templates are optional when using a Lambda data source. For all other data sources, a request mapping template is required. |
request_mapping_template_s3_location | string | The location of a request mapping template in an S3 bucket. Use this if you want to provision with a template file in S3 rather than embedding it in your CFNshort template. |
resolver_arn | string | |
response_mapping_template | string | The response mapping template. |
response_mapping_template_s3_location | string | The location of a response mapping template in an S3 bucket. Use this if you want to provision with a template file in S3 rather than embedding it in your CFNshort template. |
runtime | object | Describes a runtime used by an APSYlong resolver or APSYlong function. Specifies the name and version of the runtime to use. Note that if a runtime is specified, code must also be specified. |
sync_config | object | The SyncConfig for a resolver attached to a versioned data source. |
type_name | string | The GraphQL type that invokes this resolver. |
metrics_config | string | Enables or disables enhanced resolver metrics for specified resolvers. Note that MetricsConfig won't be used unless the resolverLevelMetricsBehavior value is set to PER_RESOLVER_METRICS. If the resolverLevelMetricsBehavior is set to FULL_REQUEST_RESOLVER_METRICS instead, MetricsConfig will be ignored. However, you can still set its value. |
region | string | AWS region. |
| Name | Datatype | Description |
|---|---|---|
resolver_arn | string | |
region | string | AWS region. |
For more information, see AWS::AppSync::Resolver.
Methods
| Name | Resource | Accessible by | Required Params |
|---|---|---|---|
create_resource | resolvers | INSERT | TypeName, ApiId, FieldName, region |
delete_resource | resolvers | DELETE | Identifier, region |
update_resource | resolvers | UPDATE | Identifier, PatchDocument, region |
list_resources | resolvers_list_only | SELECT | region |
get_resource | resolvers | SELECT | Identifier, region |
SELECT examples
- get (all properties)
- list (identifiers only)
Gets all properties from an individual resolver.
SELECT
region,
api_id,
caching_config,
code,
code_s3_location,
data_source_name,
field_name,
kind,
max_batch_size,
pipeline_config,
request_mapping_template,
request_mapping_template_s3_location,
resolver_arn,
response_mapping_template,
response_mapping_template_s3_location,
runtime,
sync_config,
type_name,
metrics_config
FROM awscc.appsync.resolvers
WHERE
region = '{{ region }}' AND
Identifier = '{{ resolver_arn }}';
Lists all resolvers in a region.
SELECT
region,
resolver_arn
FROM awscc.appsync.resolvers_list_only
WHERE
region = '{{ region }}';
INSERT example
Use the following StackQL query and manifest file to create a new resolver resource, using stack-deploy.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO awscc.appsync.resolvers (
ApiId,
FieldName,
TypeName,
region
)
SELECT
'{{ api_id }}',
'{{ field_name }}',
'{{ type_name }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
/*+ create */
INSERT INTO awscc.appsync.resolvers (
ApiId,
CachingConfig,
Code,
CodeS3Location,
DataSourceName,
FieldName,
Kind,
MaxBatchSize,
PipelineConfig,
RequestMappingTemplate,
RequestMappingTemplateS3Location,
ResponseMappingTemplate,
ResponseMappingTemplateS3Location,
Runtime,
SyncConfig,
TypeName,
MetricsConfig,
region
)
SELECT
'{{ api_id }}',
'{{ caching_config }}',
'{{ code }}',
'{{ code_s3_location }}',
'{{ data_source_name }}',
'{{ field_name }}',
'{{ kind }}',
'{{ max_batch_size }}',
'{{ pipeline_config }}',
'{{ request_mapping_template }}',
'{{ request_mapping_template_s3_location }}',
'{{ response_mapping_template }}',
'{{ response_mapping_template_s3_location }}',
'{{ runtime }}',
'{{ sync_config }}',
'{{ type_name }}',
'{{ metrics_config }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: resolver
props:
- name: api_id
value: '{{ api_id }}'
- name: caching_config
value:
caching_keys:
- '{{ caching_keys[0] }}'
ttl: null
- name: code
value: '{{ code }}'
- name: code_s3_location
value: '{{ code_s3_location }}'
- name: data_source_name
value: '{{ data_source_name }}'
- name: field_name
value: '{{ field_name }}'
- name: kind
value: '{{ kind }}'
- name: max_batch_size
value: '{{ max_batch_size }}'
- name: pipeline_config
value:
functions:
- '{{ functions[0] }}'
- name: request_mapping_template
value: '{{ request_mapping_template }}'
- name: request_mapping_template_s3_location
value: '{{ request_mapping_template_s3_location }}'
- name: response_mapping_template
value: '{{ response_mapping_template }}'
- name: response_mapping_template_s3_location
value: '{{ response_mapping_template_s3_location }}'
- name: runtime
value:
runtime_version: '{{ runtime_version }}'
name: '{{ name }}'
- name: sync_config
value:
conflict_handler: '{{ conflict_handler }}'
conflict_detection: '{{ conflict_detection }}'
lambda_conflict_handler_config:
lambda_conflict_handler_arn: '{{ lambda_conflict_handler_arn }}'
- name: type_name
value: '{{ type_name }}'
- name: metrics_config
value: '{{ metrics_config }}'
UPDATE example
Use the following StackQL query and manifest file to update a resolver resource, using stack-deploy.
/*+ update */
UPDATE awscc.appsync.resolvers
SET PatchDocument = string('{{ {
"CachingConfig": caching_config,
"Code": code,
"CodeS3Location": code_s3_location,
"DataSourceName": data_source_name,
"Kind": kind,
"MaxBatchSize": max_batch_size,
"PipelineConfig": pipeline_config,
"RequestMappingTemplate": request_mapping_template,
"RequestMappingTemplateS3Location": request_mapping_template_s3_location,
"ResponseMappingTemplate": response_mapping_template,
"ResponseMappingTemplateS3Location": response_mapping_template_s3_location,
"Runtime": runtime,
"SyncConfig": sync_config,
"MetricsConfig": metrics_config
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ resolver_arn }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
DELETE example
/*+ delete */
DELETE FROM awscc.appsync.resolvers
WHERE
Identifier = '{{ resolver_arn }}' AND
region = '{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
Additional Parameters
Mutable resources in the Cloud Control provider support additional optional parameters which can be supplied with INSERT, UPDATE, or DELETE operations. These include:
| Parameter | Description |
|---|---|
ClientToken | A unique identifier to ensure the idempotency of the resource request.This allows the provider to accurately distinguish between retries and new requests.A client token is valid for 36 hours once used. After that, a resource request with the same client token is treated as a new request. If you do not specify a client token, one is generated for inclusion in the request. |
RoleArn | The ARN of the IAM role used to perform this resource operation.The role specified must have the permissions required for this operation.If you do not specify a role, a temporary session is created using your AWS user credentials. |
TypeVersionId | For private resource types, the type version to use in this resource operation.If you do not specify a resource version, the default version is used. |
Permissions
To operate on the resolvers resource, the following permissions are required:
- Create
- Read
- Update
- Delete
- List
s3:GetObject,
appsync:CreateResolver,
appsync:GetResolver
appsync:GetResolver
s3:GetObject,
appsync:UpdateResolver
appsync:DeleteResolver
appsync:ListResolvers