getConnectionFunction method

Future<GetConnectionFunctionResult> getConnectionFunction({
  1. required String identifier,
  2. FunctionStage? stage,
})

Gets a connection function.

May throw AccessDenied. May throw EntityNotFound. May throw UnsupportedOperation.

Parameter identifier : The connection function's identifier.

Parameter stage : The connection function's stage.

Implementation

Future<GetConnectionFunctionResult> getConnectionFunction({
  required String identifier,
  FunctionStage? stage,
}) async {
  final $query = <String, List<String>>{
    if (stage != null) 'Stage': [stage.value],
  };
  final $result = await _protocol.sendRaw(
    method: 'GET',
    requestUri:
        '/2020-05-31/connection-function/${Uri.encodeComponent(identifier)}',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return GetConnectionFunctionResult(
    connectionFunctionCode: await $result.stream.toBytes(),
    contentType: _s.extractHeaderStringValue($result.headers, 'Content-Type'),
    eTag: _s.extractHeaderStringValue($result.headers, 'ETag'),
  );
}