updateDataSource method

Future<UpdateDataSourceResponse> updateDataSource({
  1. required String apiId,
  2. required String name,
  3. required DataSourceType type,
  4. String? description,
  5. DynamodbDataSourceConfig? dynamodbConfig,
  6. ElasticsearchDataSourceConfig? elasticsearchConfig,
  7. HttpDataSourceConfig? httpConfig,
  8. LambdaDataSourceConfig? lambdaConfig,
  9. RelationalDatabaseDataSourceConfig? relationalDatabaseConfig,
  10. String? serviceRoleArn,
})

Updates a DataSource object.

May throw BadRequestException. May throw ConcurrentModificationException. May throw NotFoundException. May throw UnauthorizedException. May throw InternalFailureException.

Parameter apiId : The API ID.

Parameter name : The new name for the data source.

Parameter type : The new data source type.

Parameter description : The new description for the data source.

Parameter dynamodbConfig : The new Amazon DynamoDB configuration.

Parameter elasticsearchConfig : The new Elasticsearch Service configuration.

Parameter httpConfig : The new HTTP endpoint configuration.

Parameter lambdaConfig : The new AWS Lambda configuration.

Parameter relationalDatabaseConfig : The new relational database configuration.

Parameter serviceRoleArn : The new service role ARN for the data source.

Implementation

Future<UpdateDataSourceResponse> updateDataSource({
  required String apiId,
  required String name,
  required DataSourceType type,
  String? description,
  DynamodbDataSourceConfig? dynamodbConfig,
  ElasticsearchDataSourceConfig? elasticsearchConfig,
  HttpDataSourceConfig? httpConfig,
  LambdaDataSourceConfig? lambdaConfig,
  RelationalDatabaseDataSourceConfig? relationalDatabaseConfig,
  String? serviceRoleArn,
}) async {
  ArgumentError.checkNotNull(apiId, 'apiId');
  ArgumentError.checkNotNull(name, 'name');
  _s.validateStringLength(
    'name',
    name,
    1,
    65536,
    isRequired: true,
  );
  ArgumentError.checkNotNull(type, 'type');
  final $payload = <String, dynamic>{
    'type': type.toValue(),
    if (description != null) 'description': description,
    if (dynamodbConfig != null) 'dynamodbConfig': dynamodbConfig,
    if (elasticsearchConfig != null)
      'elasticsearchConfig': elasticsearchConfig,
    if (httpConfig != null) 'httpConfig': httpConfig,
    if (lambdaConfig != null) 'lambdaConfig': lambdaConfig,
    if (relationalDatabaseConfig != null)
      'relationalDatabaseConfig': relationalDatabaseConfig,
    if (serviceRoleArn != null) 'serviceRoleArn': serviceRoleArn,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/v1/apis/${Uri.encodeComponent(apiId)}/datasources/${Uri.encodeComponent(name)}',
    exceptionFnMap: _exceptionFns,
  );
  return UpdateDataSourceResponse.fromJson(response);
}