grpc
Related modules
Module grpc

ballerina/grpc
Overview
This module provides APIs for connecting and interacting with gRPC endpoints.
gRPC is an inter-process communication technology that allows you to connect, invoke, and operate distributed, heterogeneous applications as easily as making a local function call. The gRPC protocol is layered over HTTP/2 and uses Protocol Buffers for marshaling/unmarshaling messages. This makes gRPC highly efficient on wire and a simple service definition framework.
When you develop a gRPC application, the first thing you do is define a service definition using Protocol Buffers.
Protocol buffers
This is a mechanism to serialize the structured data introduced by Google and used by the gRPC framework. Defining the service using Protocol Buffers includes defining remote methods in the service and defining message types that are sent across the network. A sample service definition is shown below.
gRPC allows client applications to directly call the server-side methods using the auto-generated stubs. Protocol Buffer compiler is used to generate the stubs for the specified language. In Ballerina, the stubs are generated using the built-in 'Protocol Buffers to Ballerina' tool.
For information on how to generate Ballerina code for Protocol Buffers definition, see Write a gRPC service with Ballerina.
gRPC communication patterns
The common communication pattern between a client and server is simple request-response style communication. However, with gRPC, you can leverage different inter-process communication patterns other than the simple request-response pattern. This module supports four fundamental communication patterns used in gRPC-based applications: simple RPC(unary RPC), server streaming RPC, client streaming RPC, and bidirectional streaming RPC.
Simple RPC (Unary RPC)
In this pattern, the client invokes a remote function of a server and sends a single request to the server. The server sends a single response in return to the client along with status details.
Implement the gRPC server
The code snippet given below contains a service that sends a response to each request.
Implement the gRPC client
The code snippet given below calls the above service in a synchronized manner using an auto-generated Ballerina stub.
Server streaming RPC
In server-side streaming RPC, the server sends back a sequence of responses after getting the client's request message. After sending all the server responses, the server marks the end of the stream by sending the server status details. You can invoke this in a non-blocking manner.
Implement the gRPC server
The code snippet given below contains a service that sends a sequence of responses to each request.
Implement the gRPC server
The code snippet given below calls the above service using the auto-generated Ballerina client stub and reads multiple server responses using a stream.
Here, the message stream is ended with a ()
value.
Client streaming RPC
In client streaming RPC, the client sends multiple messages to the server instead of a single request. The server sends back a single response to the client.
Implement the gRPC server
The code snippet given below contains a service that receives a sequence of requests from the client and sends a single response in return.
Implement the gRPC server
The code snippet given below calls the above service using the auto-generated Ballerina client stub and sends multiple request messages from the server.
Bidirectional streaming RPC
In bidirectional streaming RPC, the client is sending a request to the server as a stream of messages. The server also responds with a stream of messages.
Implement the gRPC server
The code snippet given below includes a service that handles bidirectional streaming.
Implement the gRPC server
The code snippet given below calls the above service using the auto-generated Ballerina client stub and sends multiple request messages to the server and receives multiple responses from the server.
Advanced use cases
Use the TLS protocol
The Ballerina gRPC module allows the use of TLS in communication. This setting expects a secure socket to be set in the connection configuration as shown below.
Configure TLS in server side
Configure TLS in client side
Use headers
The Ballerina gRPC module allows to send/receive headers with the request and response using the context record type. The context record type consists of two fields called headers and content. E.g: For the string message, a type generated context record type will be as follows.
Use headers at the client side
Use headers at the server side
Use deadlines
Deadlines allow gRPC clients to specify how long they are willing to wait for an RPC to complete before the RPC is
terminated with the DEADLINE_EXCEEDED
error. In Ballerina, a deadline value is set directly to the headers and it is sent
via the request headers.
Set a deadline in the request headers
Check the deadlines
Listeners
grpc: Listener
The server listener of which one or more services can be registered so that the Ballerina program can offer a service through this listener.
Constructor
Gets called when the endpoint is being initialized during the module init time.
listener grpc:Listener listenerEp = new (9092);
init (int port, *ListenerConfiguration config)
- port int - The listener port
- config *ListenerConfiguration - The listener endpoint configuration
attach
Gets called every time a service attaches itself to this endpoint - also happens at module init time.
Parameters
- grpcService Service - The type of the service to be registered
Return Type
- error? - An
error
if an error occurs while attaching the service or else()
'start
function 'start() returns error?
Starts the registered service.
Return Type
- error? - An
error
if an error occurs while starting the server or else()
gracefulStop
function gracefulStop() returns error?
Stops the service listener gracefully. Already-accepted requests will be served before the connection closure.
Return Type
- error? - An
error
if an error occurred during the listener stopping process or else()
immediateStop
function immediateStop() returns error?
Stops the registered service.
Return Type
- error? - An
error
if an error occurs while stopping the server or else()
detach
Detaches an HTTP or WebSocket service from the listener. Note that detaching a WebSocket service would not affect the functionality of the existing connections.
Parameters
- grpcService Service - The service to be detached
Return Type
- error? - An
error
if an error occurred during the detaching of the service or else()
Clients
grpc: Caller
The base client used in the generated client code to provide remote functions for interacting with the caller.
send
function send(anydata res) returns Error?
Sends the outbound response to the caller.
Parameters
- res anydata -
- The outbound response message
Return Type
- Error? -
- A
grpc:Error
if an error occurs while sending the response or else()
- A
complete
function complete() returns Error?
Informs the caller, when the server has sent all the messages.
Return Type
- Error? - A
grpc:Error
if an error occurs while sending the response or else()
sendError
Sends a server error to the caller.
Parameters
- err Error - Error instance.
Return Type
- Error? - A
grpc:Error
if an error occurs while sending the response or else()
getId
function getId() returns int
Returns the unique identification of the caller.
Return Type
- int - caller ID
isCancelled
function isCancelled() returns boolean
Checks whether the connection is closed by the caller.
Return Type
- boolean - True if the caller has already closed the connection or else false
grpc: Client
The base client used in the generated client code to provide the capability for initiating the contact and executing remote calls with a remote gRPC service.
Constructor
Gets invoked to initialize the endpoint. During the initialization, the configurations provided through the config
record are used for the endpoint initialization.
HelloWorldClient helloWorldClient = check new("http://localhost:9091");
init (string url, *ClientConfiguration config)
- url string - The server URL
- config *ClientConfiguration -
- The client endpoint configurations
executeSimpleRPC
function executeSimpleRPC(string methodID, anydata payload, map<string|string[]> headers) returns ([anydata, map<string|string[]>]|Error)
Calls when executing a unary gRPC service.
Parameters
- methodID string - Remote service method ID
- payload anydata - Request message. The message type varies with the remote service method parameter
Return Type
executeServerStreaming
function executeServerStreaming(string methodID, anydata payload, map<string|string[]> headers) returns [stream<anydata, Error?>, map<string|string[]>]|Error
Calls when executing a server streaming call with a gRPC service.
Parameters
- methodID string - Remote service method ID
- payload anydata - Request message. The message type varies with the remote service method parameter
Return Type
executeClientStreaming
function executeClientStreaming(string methodID, map<string|string[]> headers) returns StreamingClient|Error
Calls when executing a client streaming call with a gRPC service.
Parameters
- methodID string - Remote service method ID
Return Type
- StreamingClient|Error - A
grpc:StreamingClient
object or agrpc:Error
when an error occurs
executeBidirectionalStreaming
function executeBidirectionalStreaming(string methodID, map<string|string[]> headers) returns StreamingClient|Error
Calls when executing a bi-directional streaming call with a gRPC service.
Parameters
- methodID string - Remote service method ID
Return Type
- StreamingClient|Error - A
grpc:StreamingClient
object or agrpc:Error
when an error occurs
initStub
function initStub(AbstractClientEndpoint clientEndpoint, string descriptorKey, map<any> descriptorMap) returns Error?
Calls when initializing the client endpoint with the service descriptor data extracted from the proto file.
Parameters
- clientEndpoint AbstractClientEndpoint - Client endpoint
- descriptorKey string - Key of the proto descriptor
- descriptorMap map<any> (default {}) - Proto descriptor map with all the dependent descriptors
Return Type
- Error? - A
grpc:Error
if an error occurs while initializing the stub or else()
grpc: ClientOAuth2Handler
Defines the OAuth2 handler for client authentication.
Constructor
Initializes the OAuth2 handler for client authentication.
init (OAuth2GrantConfig config)
- config OAuth2GrantConfig - OAuth2 refresh token grant configurations
enrich
Enriches the headers with the relevant authentication requirements.
Return Type
- map<string|string[]>|ClientAuthError - The updated
map<string|string[]>
headers map instance or else agrpc:ClientAuthError
in case of an error
grpc: ListenerLdapUserStoreBasicAuthHandler
Defines the LDAP store Basic Auth handler for listener authentication.
Constructor
Initializes the LDAP user store Basic Auth handler for listener authentication.
init (LdapUserStoreConfig config)
- config LdapUserStoreConfig - LDAP user store configurations
authenticate
function authenticate(map<string|string[]> headers) returns UserDetails|UnauthenticatedError
Authenticates with the relevant authentication requirements.
Return Type
- UserDetails|UnauthenticatedError - The
auth:UserDetails
instance or else angrpc:UnauthenticatedError
error
authorize
function authorize(UserDetails userDetails, string|string[] expectedScopes) returns PermissionDeniedError?
Authorizes with the relevant authorization requirements.
Parameters
- userDetails UserDetails - The
auth:UserDetails
instance which is received from authentication results
Return Type
- PermissionDeniedError? -
()
, if it is successful or else agrpc:PermissionDeniedError
error
grpc: ListenerOAuth2Handler
Defines the OAuth2 handler for listener authentication.
Constructor
Initializes the OAuth2 handler for the listener authentication.
init (OAuth2IntrospectionConfig config)
- config OAuth2IntrospectionConfig - OAuth2 introspection server configurations
authorize
function authorize(map<string|string[]> headers, string|string[]? expectedScopes, map<string>? optionalParams) returns IntrospectionResponse|UnauthenticatedError|PermissionDeniedError
Authorizes with the relevant authentication & authorization requirements.
Parameters
Return Type
- IntrospectionResponse|UnauthenticatedError|PermissionDeniedError - The
oauth2:IntrospectionResponse
instance or elsegrpc:UnauthenticatedError
orgrpc:PermissionDeniedError
type error
grpc: ServerReflectionServerReflectionResponseCaller
This is used for internal purposes to support reflection.
sendServerReflectionResponse
function sendServerReflectionResponse(ServerReflectionResponse response) returns Error?
Parameters
- response ServerReflectionResponse -
sendError
Parameters
- response Error -
complete
function complete() returns Error?
getId
function getId() returns int
isCancelled
function isCancelled() returns boolean
grpc: StreamingClient
The base client used in the generated client code to provide the gRPC streaming client actions for interacting with the gRPC server.
send
function send(anydata res) returns Error?
Sends the request message to the server.
Parameters
- res anydata - The inbound request message
Return Type
- Error? - A
grpc:Error
if an error occurs while sending the response or else()
complete
function complete() returns Error?
Informs the server when the caller has sent all the messages.
Return Type
- Error? - A
grpc:Error
if an error occurs while sending the response or else()
sendError
Sends an error message to the server.
Parameters
- err Error - Error instance
Return Type
- Error? - A
grpc:Error
if an error occurs while sending the response or else()
receive
Receives server responses in client streaming and bidirectional streaming.
Functions
authenticateResource
function authenticateResource(Service serviceRef)
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
getDeadline
Returns the deadline value as time:Utc
. This can be used to get the deadline and propagate it to subsequent internal calls.
getHeader
Returns the header value with the specified header name. If there are more than one header values for the specified header name, the first value is returned.
Parameters
- headerName string - The header name
getHeaders
Gets all the transport headers with the specified header name.
Parameters
- headerName string - The header name
isCancelled
Checks whether the deadline is already exceeded or not.
setCompression
function setCompression(CompressionType compressionType, map<string|string[]> headerMap) returns map<string|string[]>
Enables the compression support by adding the grpc-encoding
header to the given headers.
Parameters
- compressionType CompressionType - The compression type.
setDeadline
Enables the deadline by adding the deadline
header to the given headers.
Parameters
- deadline Utc - The deadline time value (this should be a specific time and not a duration)
Classes
grpc: ClientBasicAuthHandler
Defines the Basic Auth handler for client authentication.
Constructor
Initializes the Basic Auth handler for client authentication.
init (CredentialsConfig config)
- config CredentialsConfig - The Basic Auth credentials
enrich
Enriches the headers with the relevant authentication requirements.
Return Type
- map<string|string[]>|ClientAuthError - The updated
map<string|string[]>
headers map instance or else agrpc:ClientAuthError
in case of an error
grpc: ClientBearerTokenAuthHandler
Defines the Bearer token auth handler for client authentication.
Constructor
Initializes the Bearer token auth handler for client authentication.
init (BearerTokenConfig config)
- config BearerTokenConfig - The Bearer token
enrich
Enriches the headers with the relevant authentication requirements.
Return Type
- map<string|string[]>|ClientAuthError - The Bearer token as a
string
or else agrpc:ClientAuthError
in case of an error
grpc: ClientSelfSignedJwtAuthHandler
Defines the self signed JWT handler for client authentication.
Constructor
Initializes the self-signed JWT handler for client authentication.
init (JwtIssuerConfig config)
- config JwtIssuerConfig - JWT issuer configurations
enrich
Enriches the headers with the relevant authentication requirements.
Return Type
- map<string|string[]>|ClientAuthError - The updated
map<string|string[]>
headers map instance or else agrpc:ClientAuthError
in case of an error
grpc: ListenerFileUserStoreBasicAuthHandler
Defines the file store Basic Auth handler for listener authentication.
Constructor
Initializes the grpc:ListenerFileUserStoreBasicAuthHandler
object.
init (FileUserStoreConfig config)
- config FileUserStoreConfig {} - The
grpc:FileUserStoreConfig
instance
authenticate
function authenticate(map<string|string[]> headers) returns UserDetails|UnauthenticatedError
Authenticates with the relevant authentication requirements.
Return Type
- UserDetails|UnauthenticatedError - The
auth:UserDetails
instance or else anUnauthenticatedError
error
authorize
function authorize(UserDetails userDetails, string|string[] expectedScopes) returns PermissionDeniedError?
Authorizes with the relevant authorization requirements.
Parameters
- userDetails UserDetails - The
auth:UserDetails
instance which is received from authentication results
Return Type
- PermissionDeniedError? -
()
, if it is successful or else aPermissionDeniedError
error
grpc: ListenerJwtAuthHandler
Defines the JWT auth handler for listener authentication.
Constructor
Initializes the JWT auth handler for the listener authentication.
init (JwtValidatorConfig config)
- config JwtValidatorConfig - JWT validator configurations
authenticate
function authenticate(map<string|string[]> headers) returns Payload|UnauthenticatedError
Authenticates with the relevant authentication requirements.
Return Type
- Payload|UnauthenticatedError - The
jwt:Payload
instance or else angrpc:UnauthenticatedError
error
authorize
function authorize(Payload jwtPayload, string|string[] expectedScopes) returns PermissionDeniedError?
Authorizes with the relevant authorization requirements.
Parameters
- jwtPayload Payload - The
jwt:Payload
instance which is received from authentication results
Return Type
- PermissionDeniedError? -
()
, if it is successful or else agrpc:PermissionDeniedError
error
Object types
grpc: AbstractClientEndpoint
Represents the abstract gRPC client endpoint. This abstract object is used in the generated client.
grpc: Service
The gRPC service type.
Records
grpc: AccessLogConfiguration
Represents gRPC access log configuration.
Fields
- console boolean(default false) - Boolean value to enable or disable console access logs
- path string? - Optional file path to store access logs
grpc: BearerTokenConfig
Represents token for Bearer token authentication.
Fields
- token string - Bearer token for authentication
grpc: CertKey
Represents combination of certificate, private key and private key password if encrypted.
Fields
- certFile string - A file containing the certificate
- keyFile string - A file containing the private key
- keyPassword string? - Password of the private key if it is encrypted
grpc: ClientConfiguration
Configurations for managing the gRPC client endpoint.
Fields
- timeout decimal(default 60) - The maximum time to wait(in seconds) for a response before closing the connection
- poolConfig PoolConfiguration?(default ()) - Connection pool configuration
- secureSocket ClientSecureSocket?(default ()) - SSL/TLS related options
- compression Compression(default COMPRESSION_AUTO) - Specifies the way of handling compression (
accept-encoding
) header
- retryConfiguration RetryConfiguration?(default ()) - Configures the retry functionality
- auth ClientAuthConfig?(default ()) - Configurations related to client authentication
- maxInboundMessageSize int(default 4194304) - The maximum message size to be permitted for inbound messages. Default value is 4 MB
grpc: ClientSecureSocket
Configurations for facilitating secure communication with a remote gRPC endpoint.
Fields
- enable boolean(default true) - Enable SSL validation
- cert TrustStore|string? - Configurations associated with the
crypto:TrustStore
or a single certificate file that the client trusts
- certValidation record {| 'type CertValidationType, cacheSize int, cacheValidityPeriod int |}? - Certificate validation against OCSP_CRL, OCSP_STAPLING related options
- ciphers string[]? - List of ciphers to be used eg: TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA
- verifyHostName boolean(default true) - Enable/disable host name verification
- shareSession boolean(default true) - Enable/disable new SSL session creation
- handshakeTimeout decimal? - SSL handshake time out(in seconds)
- sessionTimeout decimal? - SSL session time out(in seconds)
grpc: CredentialsConfig
Represents credentials for Basic Auth authentication.
Fields
- Fields Included from * CredentialsConfig
grpc: DescriptorData
Service descriptor data generated at the compile time.
Fields
- value string - Descriptor, which should be set at the compile time
grpc: ErrorResponse
This is used for internal purposes to support reflection. This represents the error code and error message sent by the server when an error occurs.
Fields
- error_code int(default 0) - error codes adhering to
grpc::StatusCode
- error_message string(default "") - related error message sent by the server
grpc: ExtensionNumberResponse
This is used for internal purposes to support reflection. A list of extension numbers sent by the server answering all_extension_numbers_of_type request.
Fields
- base_type_name string(default "") - full name of the base type, including the package name. The format is
<package>.<type>
- extension_number int[](default []) - list of extension numbers
grpc: ExtensionRequest
This is used for internal purposes to support reflection.
The type name and extension number sent by the client when requesting file_containing_extension
.
Fields
- containing_type string(default "") - fully-qualified type name. The format should be
<package>.<type>
- extension_number int(default 0) - specific extension number
grpc: FileDescriptorResponse
This is used for internal purposes to support reflection.
Serialized FileDescriptorProto
messages sent by the server answering a
file_by_filename
, file_containing_symbol
, or file_containing_extension
request.
Fields
- file_descriptor_proto byte[](default []) - serialized
FileDescriptorProto
messages
grpc: FileUserStoreConfig
Represents file user store configurations for Basic Auth authentication.
grpc: FileUserStoreConfigWithScopes
Represents the auth annotation for file user store configurations with scopes.
Fields
- fileUserStoreConfig FileUserStoreConfig - File user store configurations for Basic Auth authentication
grpc: GrpcServiceConfig
Contains the configurations for a gRPC service.
Fields
- auth ListenerAuthConfig[]? - Listener authenticaton configurations
grpc: JwtIssuerConfig
Represents JWT issuer configurations for JWT authentication.
Fields
- Fields Included from * IssuerConfig
grpc: JwtValidatorConfig
Represents JWT validator configurations for JWT authentication.
Fields
- Fields Included from * ValidatorConfig
- issuer string
- username string
- audience string|string[]
- jwtId string
- keyId string
- customClaims map<json>
- clockSkew decimal
- signatureConfig ValidatorSignatureConfig
- cacheConfig CacheConfig
- anydata...
- scopeKey string(default "scope") - The key used to fetch the scopes
grpc: JwtValidatorConfigWithScopes
Represents the auth annotation for JWT validator configurations with scopes.
Fields
- jwtValidatorConfig JwtValidatorConfig - JWT validator configurations for JWT authentication
grpc: LdapUserStoreConfig
Represents LDAP user store configurations for Basic Auth authentication.
Fields
- Fields Included from * LdapUserStoreConfig
- domainName string
- connectionUrl string
- connectionName string
- connectionPassword string
- userSearchBase string
- userEntryObjectClass string
- userNameAttribute string
- userNameSearchFilter string
- userNameListFilter string
- groupSearchBase string[]
- groupEntryObjectClass string
- groupNameAttribute string
- groupNameSearchFilter string
- groupNameListFilter string
- membershipAttribute string
- userRolesCacheEnabled boolean
- connectionPoolingEnabled boolean
- connectionTimeout decimal
- readTimeout decimal
- secureSocket SecureSocket
grpc: LdapUserStoreConfigWithScopes
Represents the auth annotation for LDAP user store configurations with scopes.
Fields
- ldapUserStoreConfig LdapUserStoreConfig - LDAP user store configurations for Basic Auth authentication
grpc: ListenerConfiguration
Configurations for managing the gRPC server endpoint.
Fields
- host string(default "0.0.0.0") - The server hostname
- secureSocket ListenerSecureSocket?(default ()) - The SSL configurations for the server endpoint
- timeout decimal(default DEFAULT_LISTENER_TIMEOUT) - Period of time in seconds that a connection waits for a read/write operation. Use value 0 to disable the timeout
- maxInboundMessageSize int(default 4194304) - The maximum message size to be permitted for inbound messages. Default value is 4 MB
- reflectionEnabled boolean(default false) - Support reflection
grpc: ListenerSecureSocket
Configurations for facilitating secure communication for the gRPC server endpoint.
Fields
- mutualSsl record {| verifyClient VerifyClient, cert TrustStore|string |}? - Configurations associated with mutual SSL operations
- certValidation record {| 'type CertValidationType, cacheSize int, cacheValidityPeriod int |}? - Certificate validation against OCSP_CRL, OCSP_STAPLING related options
- ciphers string[](default [ "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256", "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256", "TLS_DHE_RSA_WITH_AES_128_CBC_SHA256", "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA", "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA", "TLS_DHE_RSA_WITH_AES_128_CBC_SHA", "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256", "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", "TLS_DHE_RSA_WITH_AES_128_GCM_SHA256" ]) - List of ciphers to be used eg: TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA
- shareSession boolean(default true) - Enable/Disable new SSL session creation
- handshakeTimeout decimal? - SSL handshake time out(in seconds)
- sessionTimeout decimal? - SSL session time out(in seconds)
grpc: ListServiceResponse
This is used for internal purposes to support reflection.
A list of ServiceResponse
sent by the server answering list_services request.
Fields
- 'service ServiceResponse[](default []) - list of
ServiceResponse
s
grpc: Local
Presents a read-only view of the local address.
Fields
- host string(default "") - The local host name/IP
- port int(default 0) - The local port
grpc: OAuth2ClientCredentialsGrantConfig
Represents OAuth2 client credentials grant configurations for OAuth2 authentication.
Fields
- Fields Included from * ClientCredentialsGrantConfig
grpc: OAuth2IntrospectionConfig
Represents OAuth2 introspection server configurations for OAuth2 authentication.
Fields
- Fields Included from * IntrospectionConfig
- url string
- tokenTypeHint string
- optionalParams map<string>
- cacheConfig CacheConfig
- defaultTokenExpTime decimal
- clientConfig ClientConfiguration
- anydata...
- scopeKey string(default "scope") - The key used to fetch the scopes
grpc: OAuth2IntrospectionConfigWithScopes
Represents the auth annotation for OAuth2 introspection server configurations with scopes.
Fields
- oauth2IntrospectionConfig OAuth2IntrospectionConfig - OAuth2 introspection server configurations for OAuth2 authentication
grpc: OAuth2JwtBearerGrantConfig
Represents OAuth2 JWT bearer grant configurations for OAuth2 authentication.
Fields
- Fields Included from * JwtBearerGrantConfig
grpc: OAuth2PasswordGrantConfig
Represents OAuth2 password grant configurations for OAuth2 authentication.
Fields
- Fields Included from * PasswordGrantConfig
- tokenUrl string
- username string
- password string
- clientId string
- clientSecret string
- scopes string|string[]
- refreshConfig RefreshConfig|"INFER_REFRESH_CONFIG"
- defaultTokenExpTime decimal
- clockSkew decimal
- optionalParams map<string>
- credentialBearer CredentialBearer
- clientConfig ClientConfiguration
grpc: OAuth2RefreshTokenGrantConfig
Represents OAuth2 refresh token grant configurations for OAuth2 authentication.
Fields
- Fields Included from * RefreshTokenGrantConfig
grpc: PoolConfiguration
Configurations for managing the gRPC client connection pool.
Fields
- maxActiveConnections int(default maxActiveConnections) - Max active connections per route(host:port). The default value is -1, which indicates unlimited
- maxIdleConnections int(default maxIdleConnections) - Maximum number of idle connections allowed per pool
- waitTime decimal(default waitTime) - Maximum amount of time the client should wait for an idle connection before it sends an error when the pool is exhausted
- maxActiveStreamsPerConnection int(default maxActiveStreamsPerConnection) - Maximum active streams per connection. This only applies to HTTP/2
grpc: Remote
Presents a read-only view of the remote address.
Fields
- host string(default "") - The remote host name/IP
- port int(default 0) - The remote port
grpc: RetryConfiguration
Configurations for facilitating the retry capability of the gRPC client.
Fields
- retryCount int - Maximum number of retry attempts in a failure scenario
- interval decimal - Initial interval(in seconds) between the retry attempts
- maxInterval decimal - Maximum interval(in seconds) between two retry attempts
- backoffFactor decimal - Retry interval will be multiplied by this factor, in between retry attempts
- errorTypes ErrorType[](default defaultErrorTypes) - Error types which should be considered as failure scenarios to retry
grpc: ServerReflectionRequest
This is used for internal purposes to support reflection.
The message sent by the client when calling ServerReflectionInfo
method.
Fields
- host string(default "") - fully-qualified type name
- file_by_filename string? - used to find a proto file by the file name
- file_containing_symbol string? - used to find the proto file that declares the given fully-qualified symbol name
- file_containing_extension ExtensionRequest? - find the proto file which defines an extension extending the given message type with the given field number.
- all_extension_numbers_of_type string? - used to find the tag numbers used by all known extensions of the given message type
- list_services string? - used to list the full names of registered services
grpc: ServerReflectionResponse
This is used for internal purposes to support reflection.
The message sent by the server to answer ServerReflectionInfo
method.
Fields
- valid_host string(default "") - valid host as a string
- original_request ServerReflectionRequest(default {}) - original request send by the client
- file_descriptor_response FileDescriptorResponse? - used to answer
file_by_filename
,file_containing_symbol
,file_containing_extension
requests with transitive dependencies
- all_extension_numbers_response ExtensionNumberResponse? - used to answer
all_extension_numbers_of_type
requst
- list_services_response ListServiceResponse? - used to answer list_services request
- error_response ErrorResponse? - used when an error occurs
grpc: ServiceDescriptorData
Service descriptor data generated at the compile time.
Fields
- descriptor string(default "") - Service descriptor, which should be set at the compile time
- descMap map<anydata>(default {}) - Service-dependent descriptor map, which should be set at the compile time
grpc: ServiceResponse
This is used for internal purposes to support reflection.
The information of a single service used by ListServiceResponse
to answer list_services
request.
Fields
- name string(default "") - full name of a registered service, including its package name. The format is
<package>.<service>
grpc: TraceLogAdvancedConfiguration
Represents gRPC trace log configuration.
Fields
- console boolean(default false) - Boolean value to enable or disable console trace logs
- path string? - Optional file path to store trace logs
- host string? - Optional socket hostname to publish the trace logs
- port int? - Optional socket port to publish the trace logs
Enums
grpc: CertValidationType
Represents certification validation type options.
Members
grpc: CompressionType
Compression types that are supported. GZIP - Gzip compression
Members
grpc: Protocol
Represents protocol options.
Members
grpc: VerifyClient
Represents client verify options.
Members
Constants
grpc: AUTH_HEADER
Represents the Authorization header name.
grpc: AUTH_SCHEME_BASIC
The prefix used to denote the Basic authentication scheme.
grpc: AUTH_SCHEME_BEARER
The prefix used to denote the Bearer authentication scheme.
grpc: COMPRESSION_ALWAYS
Always set accept-encoding/content-encoding in outbound request/response.
grpc: COMPRESSION_AUTO
When service behaves as a HTTP gateway inbound request/response accept-encoding option is set as the outbound request/response accept-encoding/content-encoding option.
grpc: COMPRESSION_NEVER
Never set accept-encoding/content-encoding header in outbound request/response.
grpc: DEALINE_HEADER
Represents the deadline header name.
grpc: PERMISSION_DENIED_ERROR_MSG
The permission denied error message.
grpc: UNAUTHENTICATED_ERROR_MSG
The permission denied error message.
Annotations
grpc: Descriptor
Service descriptor annotation.
grpc: ServiceConfig
The annotation which is used to configure a gRPC service.
grpc: ServiceDescriptor
Service descriptor annotation.
Types
grpc: ClientAuthConfig
Defines the authentication configurations for the HTTP client.
grpc: Compression
Represents compression options.
AUTO
: When the service behaves as a HTTP gateway, the inbound request/response accept-encoding option is set as the
outbound request/response accept-encoding/content-encoding option
ALWAYS
: Always set accept-encoding/content-encoding in outbound request/response
NEVER
: Never set accept-encoding/content-encoding header in outbound request/response
grpc: ErrorType
Represents gRPC related error types.
grpc: ListenerAuthConfig
Defines the authentication configurations for the gRPC listener.
grpc: OAuth2GrantConfig
Represents OAuth2 grant configurations for OAuth2 authentication.
Errors
grpc: AbortedError
Represents error occur when operation is aborted.
grpc: AllRetryAttemptsFailed
Represents error scenario where the maximum retry attempts are done and still received an error.
grpc: AlreadyExistsError
Represents error occur when attempt to create an entity which already exists.
grpc: CancelledError
Represents the operation canceled(typically by the caller) error.
grpc: ClientAuthError
Represents an error when client authentication error occured.
grpc: DataLossError
Represents unrecoverable data loss or corruption erros.
grpc: DataMismatchError
Represents an error when expected data type is not available.
grpc: DeadlineExceededError
Represents operation expired before completion error.
grpc: Error
Represents gRPC related errors.
grpc: FailedPreconditionError
Represents error occur when operation is rejected because the system is not in a state required for the operation's execution.
grpc: InternalError
Represents internal error.
grpc: InvalidArgumentError
Represents client specified an invalid argument error.
grpc: NotFoundError
Represents requested entity (e.g., file or directory) not found error.
grpc: OutOfRangeError
Represents error occur when specified value is out of range.
grpc: PermissionDeniedError
Represents error occur when the caller does not have permission to execute the specified operation.
grpc: ResiliencyError
Represents all the resiliency-related errors.
grpc: ResourceExhaustedError
Represents error occur when the resource is exhausted.
grpc: StreamClosedError
Represents an error when calling next when the stream has closed.
grpc: UnauthenticatedError
Represents error occur when the request does not have valid authentication credentials for the operation.
grpc: UnavailableError
Represents error occur when the service is currently unavailable.
grpc: UnimplementedError
Represents error occur when operation is not implemented or not supported/enabled in this service.
grpc: UnKnownError
Represents unknown error(e.g., Status value received is unknown).