validate method

Future validate(
  1. IContext? context
)

Validates this connection parameters

  • context (optional) transaction id to trace execution through call chain. Returns Future that return null if validation passed successfully. Throws ConfigException

Implementation

Future validate(IContext? context) async {
  final uri = getFunctionUri();
  final protocol = getProtocol();
  final appName = getAppName();
  final functionName = getFunctionName();

  if (uri == null &&
      (appName == null || functionName == null || protocol == null)) {
    throw ConfigException(
        context != null ? ContextResolver.getTraceId(context) : null,
        'NO_CONNECTION_URI',
        'No uri, app_name and function_name is configured in Auzre function uri');
  }

  if (protocol != null && 'http' != protocol && 'https' != protocol) {
    throw ConfigException(
            context != null ? ContextResolver.getTraceId(context) : null,
            'WRONG_PROTOCOL',
            'Protocol is not supported by REST connection')
        .withDetails('protocol', protocol);
  }
}