sendApiAsset method

Future<SendApiAssetResponse> sendApiAsset({
  1. required String assetId,
  2. required String dataSetId,
  3. required String revisionId,
  4. String? body,
  5. String? method,
  6. String? path,
  7. Map<String, String>? queryStringParameters,
  8. Map<String, String>? requestHeaders,
})

This operation invokes an API Gateway API asset. The request is proxied to the provider’s API Gateway API.

May throw AccessDeniedException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw ValidationException.

Parameter assetId : Asset ID value for the API request.

Parameter dataSetId : Data set ID value for the API request.

Parameter revisionId : Revision ID value for the API request.

Parameter body : The request body.

Parameter method : HTTP method value for the API request. Alternatively, you can use the appropriate verb in your request.

Parameter path : URI path value for the API request. Alternatively, you can set the URI path directly by invoking /v1/{pathValue}.

Parameter queryStringParameters : Attach query string parameters to the end of the URI (for example, /v1/examplePath?exampleParam=exampleValue).

Parameter requestHeaders : Any header value prefixed with x-amzn-dataexchange-header- will have that stripped before sending the Asset API request. Use this when you want to override a header that AWS Data Exchange uses. Alternatively, you can use the header without a prefix to the HTTP request.

Implementation

Future<SendApiAssetResponse> sendApiAsset({
  required String assetId,
  required String dataSetId,
  required String revisionId,
  String? body,
  String? method,
  String? path,
  Map<String, String>? queryStringParameters,
  Map<String, String>? requestHeaders,
}) async {
  final headers = <String, String>{
    'x-amzn-dataexchange-asset-id': assetId.toString(),
    'x-amzn-dataexchange-data-set-id': dataSetId.toString(),
    'x-amzn-dataexchange-revision-id': revisionId.toString(),
    if (method != null) 'x-amzn-dataexchange-http-method': method.toString(),
    if (path != null) 'x-amzn-dataexchange-path': path.toString(),
    if (requestHeaders != null)
      ...requestHeaders.map(
          (key, value) => MapEntry('x-amzn-dataexchange-header-$key', value)),
  };
  final response = await _protocol.sendRaw(
    payload: body,
    method: 'POST',
    requestUri: '/v1',
    headers: headers,
    exceptionFnMap: _exceptionFns,
  );
  final $json = await _s.jsonFromResponse(response);
  return SendApiAssetResponse(
    body: jsonEncode($json),
    responseHeaders: _s.extractHeaderMapValues(response.headers, ''),
  );
}