client.config
Module client.config
Declarations
ballerinax/client.config Ballerina library
Overview
The Ballerinax Client Config contains common client config utils and Ballerina types for Ballerinax connectors.
Functions
constructHTTPClientConfig
function constructHTTPClientConfig(ConnectionConfig config) returns ClientConfiguration|error
Construct http:ClientConfiguration
from Connection config record of a connector.
Parameters
- config ConnectionConfig - Connection config record of connector
Return Type
- ClientConfiguration|error - Created
http:ClientConfiguration
record or error
Constants
client.config: CHUNKING_ALWAYS
Always set chunking header in the response.
client.config: CHUNKING_AUTO
If the payload is less than 8KB, content-length header is set in the outbound request/response, otherwise chunking header is set in the outbound request/response.}
client.config: CHUNKING_NEVER
Never set the chunking header even if the payload is larger than 8KB in the outbound request/response.
client.config: KEEPALIVE_ALWAYS
Keeps the connection alive irrespective of the connection
header value }
client.config: KEEPALIVE_AUTO
Decides to keep the connection alive or not based on the connection
header of the client request }
client.config: KEEPALIVE_NEVER
Closes the connection irrespective of the connection
header value }
Enums
client.config: CredentialBearer
Represents the credential-bearing methods.
Members
Records
client.config: ClientHttp1Settings
Provides settings related to HTTP/1.x protocol.
Fields
- keepAlive KeepAlive(default KEEPALIVE_AUTO) - Specifies whether to reuse a connection for multiple requests
- chunking Chunking(default CHUNKING_AUTO) - The chunking behaviour of the request
- proxy ProxyConfig? - Proxy server related options
client.config: ConnectionConfig
Client configuration details.
Fields
- auth AuthConfig? - Configurations related to client authentication
- httpVersion HttpVersion(default http:HTTP_2_0) - The HTTP version understood by the client
- http1Settings ClientHttp1Settings? - Configurations related to HTTP/1.x protocol
- http2Settings ClientHttp2Settings? - Configurations related to HTTP/2 protocol
- timeout decimal(default 60) - The maximum time to wait (in seconds) for a response before closing the connection
- forwarded string(default "disable") - The choice of setting
forwarded
/x-forwarded
header
- poolConfig PoolConfiguration? - Configurations associated with request pooling
- cache CacheConfig? - Specifies the way of handling compression (
accept-encoding
) header
- compression Compression(default http:COMPRESSION_AUTO) - Specifies the way of handling compression (
accept-encoding
) header
- circuitBreaker CircuitBreakerConfig? - Configurations associated with the behaviour of the Circuit Breaker
- retryConfig RetryConfig? - Configurations associated with retrying
- responseLimits ResponseLimitConfigs? - Configurations associated with inbound response size limits
- secureSocket ClientSecureSocket? - SSL/TLS-related options
- proxy ProxyConfig? - Proxy server related options
- validation boolean(default true) - Enables the inbound payload validation functionalty which provided by the constraint package. Enabled by default
client.config: OAuth2ClientCredentialsGrantConfig
Represents the data structure, which is used to configure the OAuth2 client credentials grant type.
Fields
- tokenUrl string - Token URL of the token endpoint
- clientId string - Client ID of the client authentication
- clientSecret string - Client secret of the client authentication
- scopes string[]? - Scope(s) of the access request
- defaultTokenExpTime decimal? - Expiration time (in seconds) of the tokens if the token endpoint response does not contain an
expires_in
field
- clockSkew decimal? - Clock skew (in seconds) that can be used to avoid token validation failures due to clock synchronization problems
- credentialBearer CredentialBearer? - Bearer of the authentication credentials, which is sent to the token endpoint
client.config: OAuth2JwtBearerGrantConfig
Represents the data structure, which is used to configure the OAuth2 JWT bearer grant type.
Fields
- tokenUrl string - Token URL of the token endpoint
- assertion string - A single JWT for the JWT bearer grant type
- clientId string? - Client ID of the client authentication
- clientSecret string? - Client secret of the client authentication
- scopes string[]? - Scope(s) of the access request
- defaultTokenExpTime decimal? - Expiration time (in seconds) of the tokens if the token endpoint response does not contain an
expires_in
field
- clockSkew decimal? - Clock skew (in seconds) that can be used to avoid token validation failures due to clock synchronization problems
- credentialBearer CredentialBearer? - Bearer of the authentication credentials, which is sent to the token endpoint
client.config: OAuth2PasswordGrantConfig
Represents the data structure, which is used to configure the OAuth2 password grant type.
Fields
- tokenUrl string - Token URL of the token endpoint
- username string - Username for the password grant type
- password string - Password for the password grant type
- clientId string? - Client ID of the client authentication
- clientSecret string? - Client secret of the client authentication
- scopes string[]? - Scope(s) of the access request
- refreshConfig record {| refreshUrl string, scopes string[], optionalParams map<string>, credentialBearer CredentialBearer |}? - Configurations for refreshing the access token
- defaultTokenExpTime decimal? - Expiration time (in seconds) of the tokens if the token endpoint response does not contain an
expires_in
field
- clockSkew decimal? - Clock skew (in seconds) that can be used to avoid token validation failures due to clock synchronization problems
- credentialBearer CredentialBearer? - Bearer of the authentication credentials, which is sent to the token endpoint
client.config: OAuth2RefreshTokenGrantConfig
Represents OAuth2 refresh token grant configurations for OAuth2 authentication.
Fields
- refreshUrl string - Refresh token URL of the token endpoint
- refreshToken string - Refresh token for the token endpoint
- clientId string - Client ID of the client authentication
- clientSecret string - Client secret of the client authentication
- scopes string[]? - Scope(s) of the access request
- defaultTokenExpTime decimal? - Expiration time (in seconds) of the tokens if the token endpoint response does not contain an
expires_in
field
- clockSkew decimal? - Clock skew (in seconds) that can be used to avoid token validation failures due to clock synchronization problems
- credentialBearer CredentialBearer? - Bearer of the authentication credentials, which is sent to the token endpoint
client.config: ProxyConfig
Proxy server configurations to be used with the HTTP client endpoint.
Fields
- host string(default "") - Host name of the proxy server
- port int(default 0) - Proxy server port
- userName string(default "") - Proxy server username
- password string(default "") - proxy server password
Union types
client.config: AuthConfig
AuthConfig
Defines the authentication configurations.
client.config: Chunking
Chunking
Defines the possible values for the chunking configuration in HTTP services and clients.
AUTO
: If the payload is less than 8KB, content-length header is set in the outbound request/response,
otherwise chunking header is set in the outbound request/response
ALWAYS
: Always set chunking header in the response
NEVER
: Never set the chunking header even if the payload is larger than 8KB in the outbound request/response
client.config: KeepAlive
KeepAlive
Defines the possible values for the keep-alive configuration in service and client endpoints.
Import
import ballerinax/client.config;
Metadata
Released date: almost 2 years ago
Version: 1.0.1
Compatibility
Platform: any
Ballerina version: 2201.2.0
GraalVM compatible: Yes
Pull count
Total: 99570
Current verison: 99545
Weekly downloads
Other versions
1.0.1
1.0.0Dependencies