Functions

authenticateResource
I

Uses for declarative auth design, where the authentication/authorization decision is taken by reading the auth annotations provided in service/resource and the Authorization header of request.

createHttpCachingClient
I

Creates an HTTP client capable of caching HTTP responses.

createHttpSecureClient
I

Creates an HTTP client capable of securing HTTP requests with authentication.

invokeEndpoint
I

The HEAD remote function implementation of the Circuit Breaker.

parseHeader
I

Parses the given header value to extract its value and parameter map.

authenticateResource

function authenticateResource(Service serviceRef, string methodName, string[ ] resourcePath)
Isolated Function

Uses for declarative auth design, where the authentication/authorization decision is taken by reading the auth annotations provided in service/resource and the Authorization header of request.

Parameters

  • serviceRef Service
  • The service reference where the resource locates

  • methodName string
  • The name of the subjected resource

  • resourcePath string[ ]
  • The relative path

createHttpCachingClient

function createHttpCachingClient(string url, ClientConfiguration config, CacheConfig cacheConfig) returns HttpClient | ClientError
Isolated Function

Creates an HTTP client capable of caching HTTP responses.

Parameters

  • url string
  • The URL of the HTTP endpoint to connect

  • config ClientConfiguration
  • The configurations for the client endpoint associated with the caching client

  • cacheConfig CacheConfig
  • The configurations for the HTTP cache to be used with the caching client

Return Type

(HttpClient | ClientError)

An http:HttpCachingClient instance, which wraps the base http:Client with a caching layer or else an http:ClientError

createHttpSecureClient

function createHttpSecureClient(string url, ClientConfiguration config) returns HttpClient | ClientError
Isolated Function

Creates an HTTP client capable of securing HTTP requests with authentication.

Parameters

Return Type

(HttpClient | ClientError)

Created secure HTTP client

invokeEndpoint

function invokeEndpoint(string path, Request outRequest, HttpOperation requestAction, HttpClient httpClient, string verb) returns HttpResponse | ClientError
Isolated Function

The HEAD remote function implementation of the Circuit Breaker. This wraps the head function of the underlying HTTP remote function provider.

Parameters

  • outRequest Request
  • A Request struct

  • httpClient HttpClient
  • HTTP client which uses to call the relevant functions

  • verb string (default "")
  • HTTP verb used for submit method

Return Type

(HttpResponse | ClientError)

The response for the request or an http:ClientError if failed to establish communication with the upstream server

parseHeader

function parseHeader(string headerValue) returns [string, map<any>] | ClientError
Isolated Function

Parses the given header value to extract its value and parameter map.

Parameters

  • headerValue string
  • The header value

Return Type

([string, map<any>] | ClientError)

A tuple containing the value and its parameter map or else an http:ClientError if the header parsing fails