create_resolver
async
¶
create_resolver(
api_id: String,
type_name: ResourceName,
field_name: ResourceName,
*,
config_overrides: Optional[AsyncAppSyncClientConfig] = None,
data_source_name: Optional[ResourceName] = None,
request_mapping_template: Optional[MappingTemplate] = None,
response_mapping_template: Optional[MappingTemplate] = None,
kind: Optional[ResolverKind] = None,
pipeline_config: Optional[PipelineConfig] = None,
sync_config: Optional[SyncConfig] = None,
caching_config: Optional[CachingConfig] = None,
max_batch_size: Optional[MaxBatchSize] = None,
runtime: Optional[AppSyncRuntime] = None,
code: Optional[Code] = None,
metrics_config: Optional[ResolverLevelMetricsConfig] = None,
) -> CreateResolverResponse
Creates a Resolver object.
A resolver converts incoming requests into a format that a data source can understand, and converts the data source's responses into GraphQL.
Parameters:
-
api_id(String) –The ID for the GraphQL API for which the resolver is being created.
-
type_name(ResourceName) –The name of the
Type. -
field_name(ResourceName) –The name of the field to attach the resolver to.
-
data_source_name(Optional[ResourceName], default:None) –The name of the data source for which the resolver is being created.
-
request_mapping_template(Optional[MappingTemplate], default:None) –The mapping template to use for requests.
A resolver uses a request mapping template to convert a GraphQL expression into a format that a data source can understand. Mapping templates are written in Apache Velocity Template Language (VTL).
VTL request mapping templates are optional when using an Lambda data source. For all other data sources, VTL request and response mapping templates are required.
-
response_mapping_template(Optional[MappingTemplate], default:None) –The mapping template to use for responses from the data source.
-
kind(Optional[ResolverKind], default:None) –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
Functionobjects in a serial manner. You can use a pipeline resolver to run a GraphQL query against multiple data sources.
-
-
pipeline_config(Optional[PipelineConfig], default:None) –The
PipelineConfig. -
sync_config(Optional[SyncConfig], default:None) –The
SyncConfigfor a resolver attached to a versioned data source. -
caching_config(Optional[CachingConfig], default:None) –The caching configuration for the resolver.
-
max_batch_size(Optional[MaxBatchSize], default:None) –The maximum batching size for a resolver.
-
code(Optional[Code], default:None) –The
resolvercode that contains the request and response functions. When code is used, theruntimeis required. Theruntimevalue must beAPPSYNC_JS. -
metrics_config(Optional[ResolverLevelMetricsConfig], default:None) –Enables or disables enhanced resolver metrics for specified resolvers. Note that
metricsConfigwon't be used unless theresolverLevelMetricsBehaviorvalue is set toPER_RESOLVER_METRICS. If theresolverLevelMetricsBehavioris set toFULL_REQUEST_RESOLVER_METRICSinstead,metricsConfigwill be ignored. However, you can still set its value.metricsConfigcan beENABLEDorDISABLED.
Raises:
-
BadRequestException–The request is not well formed. For example, a value is invalid or a required field is missing. Check the field values, and then try again.
-
ConcurrentModificationException–Another modification is in progress at this time and it must complete before you can make your change.
-
InternalFailureException–An internal AppSync error occurred. Try your request again.
-
NotFoundException–The resource specified in the request was not found. Check the resource, and then try again.
-
UnauthorizedException–You aren't authorized to perform this operation.
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_appsync/_services/async_app_sync.py
1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 | |