Skip to content

update_data_source

update_data_source(
    api_id: String,
    name: ResourceName,
    type: DataSourceType,
    *,
    config_overrides: Optional[AppSyncClientConfig] = None,
    description: Optional[String] = None,
    service_role_arn: Optional[String] = None,
    dynamodb_config: Optional[DynamodbDataSourceConfig] = None,
    lambda_config: Optional[LambdaDataSourceConfig] = None,
    elasticsearch_config: Optional[ElasticsearchDataSourceConfig] = None,
    open_search_service_config: Optional[OpenSearchServiceDataSourceConfig] = None,
    http_config: Optional[HttpDataSourceConfig] = None,
    relational_database_config: Optional[RelationalDatabaseDataSourceConfig] = None,
    event_bridge_config: Optional[EventBridgeDataSourceConfig] = None,
    metrics_config: Optional[DataSourceLevelMetricsConfig] = None,
) -> UpdateDataSourceResponse

Updates a DataSource object.

Parameters:

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_data_source(
    self,
    api_id: "capo_appsync.types.string.String",
    name: "capo_appsync.types.resource_name.ResourceName",
    type: "capo_appsync.types.data_source_type.DataSourceType",
    *,
    config_overrides: Optional[AppSyncClientConfig] = None,
    description: Optional["capo_appsync.types.string.String"] = None,
    service_role_arn: Optional["capo_appsync.types.string.String"] = None,
    dynamodb_config: Optional[
        "capo_appsync.types.dynamodb_data_source_config.DynamodbDataSourceConfig"
    ] = None,
    lambda_config: Optional[
        "capo_appsync.types.lambda_data_source_config.LambdaDataSourceConfig"
    ] = None,
    elasticsearch_config: Optional[
        "capo_appsync.types.elasticsearch_data_source_config.ElasticsearchDataSourceConfig"
    ] = None,
    open_search_service_config: Optional[
        "capo_appsync.types.open_search_service_data_source_config.OpenSearchServiceDataSourceConfig"
    ] = None,
    http_config: Optional[
        "capo_appsync.types.http_data_source_config.HttpDataSourceConfig"
    ] = None,
    relational_database_config: Optional[
        "capo_appsync.types.relational_database_data_source_config.RelationalDatabaseDataSourceConfig"
    ] = None,
    event_bridge_config: Optional[
        "capo_appsync.types.event_bridge_data_source_config.EventBridgeDataSourceConfig"
    ] = None,
    metrics_config: Optional[
        "capo_appsync.types.data_source_level_metrics_config.DataSourceLevelMetricsConfig"
    ] = None,
) -> "capo_appsync.types.update_data_source_response.UpdateDataSourceResponse":
    """<p>Updates a <code>DataSource</code> object.</p>

    Args:
        api_id: <p>The API ID.</p>
        name: <p>The new name for the data source.</p>
        description: <p>The new description for the data source.</p>
        type: <p>The new data source type.</p>
        service_role_arn: <p>The new service role Amazon Resource Name (ARN) for the data source.</p>
        dynamodb_config: <p>The new Amazon DynamoDB configuration.</p>
        lambda_config: <p>The new Lambda configuration.</p>
        elasticsearch_config: <p>The new OpenSearch configuration.</p> <p>As of September 2021, Amazon Elasticsearch service is Amazon OpenSearch Service. This configuration is deprecated. Instead, use <a>UpdateDataSourceRequest$openSearchServiceConfig</a> to update an OpenSearch data source.</p>
        open_search_service_config: <p>The new OpenSearch configuration.</p>
        http_config: <p>The new HTTP endpoint configuration.</p>
        relational_database_config: <p>The new relational database configuration.</p>
        event_bridge_config: <p>The new Amazon EventBridge settings.</p>
        metrics_config: <p>Enables or disables enhanced data source metrics for specified data sources. Note that <code>metricsConfig</code> won't be used unless the <code>dataSourceLevelMetricsBehavior</code> value is set to <code>PER_DATA_SOURCE_METRICS</code>. If the <code>dataSourceLevelMetricsBehavior</code> is set to <code>FULL_REQUEST_DATA_SOURCE_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_data_source_request.UpdateDataSourceRequest]",
    ) -> OperationResponse[
        "capo_appsync.types.update_data_source_response.UpdateDataSourceResponse"
    ]:
        import capo_appsync._operations.aws_deepdish_control_plane_service.update_data_source

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateDataSource")
    )
    input_: capo_appsync.types.update_data_source_request.UpdateDataSourceRequest = {
        "api_id": api_id,
        "name": name,
        "type": type,
    }
    if description is not None:
        input_["description"] = description
    if service_role_arn is not None:
        input_["service_role_arn"] = service_role_arn
    if dynamodb_config is not None:
        input_["dynamodb_config"] = dynamodb_config
    if lambda_config is not None:
        input_["lambda_config"] = lambda_config
    if elasticsearch_config is not None:
        input_["elasticsearch_config"] = elasticsearch_config
    if open_search_service_config is not None:
        input_["open_search_service_config"] = open_search_service_config
    if http_config is not None:
        input_["http_config"] = http_config
    if relational_database_config is not None:
        input_["relational_database_config"] = relational_database_config
    if event_bridge_config is not None:
        input_["event_bridge_config"] = event_bridge_config
    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