Skip to content

update_resolver

update_resolver(
    api_id: String,
    type_name: ResourceName,
    field_name: ResourceName,
    *,
    config_overrides: Optional[AppSyncClientConfig] = 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,
) -> UpdateResolverResponse

Updates a Resolver object.

Parameters:

  • api_id (String) –

    The API ID.

  • type_name (ResourceName) –

    The new type name.

  • field_name (ResourceName) –

    The new field name.

  • data_source_name (Optional[ResourceName], default: None ) –

    The new data source name.

  • request_mapping_template (Optional[MappingTemplate], default: None ) –

    The new request mapping template.

    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 new response mapping template.

  • 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 Function objects 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 SyncConfig for 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 resolver code that contains the request and response functions. When code is used, the runtime is required. The runtime value must be APPSYNC_JS.

  • metrics_config (Optional[ResolverLevelMetricsConfig], default: None ) –

    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.

    metricsConfig can be ENABLED or DISABLED.

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/app_sync.py
def update_resolver(
    self,
    api_id: "capo_appsync.types.string.String",
    type_name: "capo_appsync.types.resource_name.ResourceName",
    field_name: "capo_appsync.types.resource_name.ResourceName",
    *,
    config_overrides: Optional[AppSyncClientConfig] = None,
    data_source_name: Optional[
        "capo_appsync.types.resource_name.ResourceName"
    ] = None,
    request_mapping_template: Optional[
        "capo_appsync.types.mapping_template.MappingTemplate"
    ] = None,
    response_mapping_template: Optional[
        "capo_appsync.types.mapping_template.MappingTemplate"
    ] = None,
    kind: Optional["capo_appsync.types.resolver_kind.ResolverKind"] = None,
    pipeline_config: Optional[
        "capo_appsync.types.pipeline_config.PipelineConfig"
    ] = None,
    sync_config: Optional["capo_appsync.types.sync_config.SyncConfig"] = None,
    caching_config: Optional[
        "capo_appsync.types.caching_config.CachingConfig"
    ] = None,
    max_batch_size: Optional[
        "capo_appsync.types.max_batch_size.MaxBatchSize"
    ] = None,
    runtime: Optional["capo_appsync.types.app_sync_runtime.AppSyncRuntime"] = None,
    code: Optional["capo_appsync.types.code.Code"] = None,
    metrics_config: Optional[
        "capo_appsync.types.resolver_level_metrics_config.ResolverLevelMetricsConfig"
    ] = None,
) -> "capo_appsync.types.update_resolver_response.UpdateResolverResponse":
    """<p>Updates a <code>Resolver</code> object.</p>

    Args:
        api_id: <p>The API ID.</p>
        type_name: <p>The new type name.</p>
        field_name: <p>The new field name.</p>
        data_source_name: <p>The new data source name.</p>
        request_mapping_template: <p>The new request mapping template.</p> <p>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).</p> <p>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.</p>
        response_mapping_template: <p>The new response mapping template.</p>
        kind: <p>The resolver type.</p> <ul> <li> <p> <b>UNIT</b>: 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.</p> </li> <li> <p> <b>PIPELINE</b>: A PIPELINE resolver type. You can use a PIPELINE resolver to invoke a series of <code>Function</code> objects in a serial manner. You can use a pipeline resolver to run a GraphQL query against multiple data sources.</p> </li> </ul>
        pipeline_config: <p>The <code>PipelineConfig</code>.</p>
        sync_config: <p>The <code>SyncConfig</code> for a resolver attached to a versioned data source.</p>
        caching_config: <p>The caching configuration for the resolver.</p>
        max_batch_size: <p>The maximum batching size for a resolver.</p>
        code: <p>The <code>resolver</code> code that contains the request and response functions. When code is used, the <code>runtime</code> is required. The <code>runtime</code> value must be <code>APPSYNC_JS</code>.</p>
        metrics_config: <p>Enables or disables enhanced resolver metrics for specified resolvers. Note that <code>metricsConfig</code> won't be used unless the <code>resolverLevelMetricsBehavior</code> value is set to <code>PER_RESOLVER_METRICS</code>. If the <code>resolverLevelMetricsBehavior</code> is set to <code>FULL_REQUEST_RESOLVER_METRICS</code> instead, <code>metricsConfig</code> will be ignored. However, you can still set its value.</p> <p> <code>metricsConfig</code> can be <code>ENABLED</code> or <code>DISABLED</code>.</p>

    Raises:
        capo_appsync.errors.bad_request_exception.BadRequestException: <p>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.</p>
        capo_appsync.errors.concurrent_modification_exception.ConcurrentModificationException: <p>Another modification is in progress at this time and it must complete before you can make your change.</p>
        capo_appsync.errors.internal_failure_exception.InternalFailureException: <p>An internal AppSync error occurred. Try your request again.</p>
        capo_appsync.errors.not_found_exception.NotFoundException: <p>The resource specified in the request was not found. Check the resource, and then try again.</p>
        capo_appsync.errors.unauthorized_exception.UnauthorizedException: <p>You aren't authorized to perform this operation.</p>
        capo_appsync.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_appsync.types.update_resolver_request.UpdateResolverRequest]",
    ) -> OperationResponse[
        "capo_appsync.types.update_resolver_response.UpdateResolverResponse"
    ]:
        import capo_appsync._operations.aws_deepdish_control_plane_service.update_resolver

        output, http_response = (
            capo_appsync._operations.aws_deepdish_control_plane_service.update_resolver.update_resolver(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateResolver")
    )
    input_: capo_appsync.types.update_resolver_request.UpdateResolverRequest = {
        "api_id": api_id,
        "type_name": type_name,
        "field_name": field_name,
    }
    if data_source_name is not None:
        input_["data_source_name"] = data_source_name
    if request_mapping_template is not None:
        input_["request_mapping_template"] = request_mapping_template
    if response_mapping_template is not None:
        input_["response_mapping_template"] = response_mapping_template
    if kind is not None:
        input_["kind"] = kind
    if pipeline_config is not None:
        input_["pipeline_config"] = pipeline_config
    if sync_config is not None:
        input_["sync_config"] = sync_config
    if caching_config is not None:
        input_["caching_config"] = caching_config
    if max_batch_size is not None:
        input_["max_batch_size"] = max_batch_size
    if runtime is not None:
        input_["runtime"] = runtime
    if code is not None:
        input_["code"] = code
    if metrics_config is not None:
        input_["metrics_config"] = metrics_config

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output