Class CallSettings
Settings to determine how an RPC operates. This type is immutable.
Inheritance
Inherited Members
Namespace: Google.Api.Gax.Grpc
Assembly: Google.Api.Gax.Grpc.dll
Syntax
public sealed class CallSettings
Constructors
CallSettings(Nullable<CancellationToken>, CallCredentials, Expiration, RetrySettings, Action<Metadata>, WriteOptions, ContextPropagationToken)
Constructs an instance with the specified settings.
Declaration
public CallSettings(CancellationToken? cancellationToken, CallCredentials credentials, Expiration expiration, RetrySettings retry, Action<Metadata> headerMutation, WriteOptions writeOptions, ContextPropagationToken propagationToken)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<System.Threading.CancellationToken> | cancellationToken | Cancellation token that can be used for cancelling the call. |
CallCredentials | credentials | Credentials to use for the call. |
Expiration | expiration | Expiration to use, or null for default expiration behavior. |
RetrySettings | retry | Retry to use, or null for default retry behavior. |
System.Action<Metadata> | headerMutation | Action to modify the headers to send at the beginning of the call. |
WriteOptions | writeOptions | WriteOptions that will be used for the call. |
ContextPropagationToken | propagationToken | ContextPropagationToken for propagating settings from a parent call. |
CallSettings(Nullable<CancellationToken>, CallCredentials, Expiration, RetrySettings, Action<Metadata>, WriteOptions, ContextPropagationToken, Action<Metadata>, Action<Metadata>)
Constructs an instance with the specified settings.
Declaration
public CallSettings(CancellationToken? cancellationToken, CallCredentials credentials, Expiration expiration, RetrySettings retry, Action<Metadata> headerMutation, WriteOptions writeOptions, ContextPropagationToken propagationToken, Action<Metadata> responseMetadataHandler, Action<Metadata> trailingMetadataHandler)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<System.Threading.CancellationToken> | cancellationToken | Cancellation token that can be used for cancelling the call. |
CallCredentials | credentials | Credentials to use for the call. |
Expiration | expiration | Expiration to use, or null for default expiration behavior. |
RetrySettings | retry | Retry to use, or null for default retry behavior. |
System.Action<Metadata> | headerMutation | Action to modify the headers to send at the beginning of the call. |
WriteOptions | writeOptions | WriteOptions that will be used for the call. |
ContextPropagationToken | propagationToken | ContextPropagationToken for propagating settings from a parent call. |
System.Action<Metadata> | responseMetadataHandler | Action to invoke when response metadata is received. |
System.Action<Metadata> | trailingMetadataHandler | Action to invoke when trailing metadata is received. |
Properties
CancellationToken
Cancellation token that can be used for cancelling the call.
Declaration
public CancellationToken? CancellationToken { get; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Threading.CancellationToken> |
Credentials
Credentials to use for the call.
Declaration
public CallCredentials Credentials { get; }
Property Value
Type | Description |
---|---|
CallCredentials |
Expiration
The expiration for the call (either a timeout or a deadline), or null for the default expiration.
Declaration
public Expiration Expiration { get; }
Property Value
Type | Description |
---|---|
Expiration |
HeaderMutation
Delegate to mutate the metadata which will be sent at the start of the call, typically to add custom headers.
Declaration
public Action<Metadata> HeaderMutation { get; }
Property Value
Type | Description |
---|---|
System.Action<Metadata> |
PropagationToken
ContextPropagationToken for propagating settings from a parent call.
Declaration
public ContextPropagationToken PropagationToken { get; }
Property Value
Type | Description |
---|---|
ContextPropagationToken |
ResponseMetadataHandler
Delegate to receive the metadata associated with a response.
Declaration
public Action<Metadata> ResponseMetadataHandler { get; }
Property Value
Type | Description |
---|---|
System.Action<Metadata> |
Retry
RetrySettings to use, or null for default retry behavior.
Declaration
public RetrySettings Retry { get; }
Property Value
Type | Description |
---|---|
RetrySettings |
TrailingMetadataHandler
Delegate to receive the metadata sent after the response.
Declaration
public Action<Metadata> TrailingMetadataHandler { get; }
Property Value
Type | Description |
---|---|
System.Action<Metadata> |
WriteOptions
WriteOptions that will be used for the call.
Declaration
public WriteOptions WriteOptions { get; }
Property Value
Type | Description |
---|---|
WriteOptions |
Methods
FromCallCredentials(CallCredentials)
Creates a CallSettings for the specified call credentials, or returns null
if credentials
is null.
Declaration
public static CallSettings FromCallCredentials(CallCredentials credentials)
Parameters
Type | Name | Description |
---|---|---|
CallCredentials | credentials | The call credentials for the new settings. |
Returns
Type | Description |
---|---|
CallSettings | A new instance, or null if |
FromCancellationToken(CancellationToken)
Creates a CallSettings for the specified cancellation token.
Declaration
public static CallSettings FromCancellationToken(CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.Threading.CancellationToken | cancellationToken | The cancellation token for the new settings. |
Returns
Type | Description |
---|---|
CallSettings | A new instance. |
FromExpiration(Expiration)
Creates a CallSettings for the specified call expiration, or returns null
if expiration
is null.
Declaration
public static CallSettings FromExpiration(Expiration expiration)
Parameters
Type | Name | Description |
---|---|---|
Expiration | expiration | The call timing for the new settings. |
Returns
Type | Description |
---|---|
CallSettings | A new instance or null if |
FromFieldMask(String)
Creates a CallSettings that will include a field mask in the request, to limit which fields are returned in the response.
Declaration
public static CallSettings FromFieldMask(string fieldMask)
Parameters
Type | Name | Description |
---|---|---|
System.String | fieldMask | The field mask for the request. Must not be null. |
Returns
Type | Description |
---|---|
CallSettings | A new instance. |
Remarks
The precise effect on the request is not guaranteed: it may be through a header or a side-channel, for example. Likewise the effect of combining multiple settings containing field masks is not specified.
FromHeader(String, String)
Creates a CallSettings for the specified header name and value.
Declaration
public static CallSettings FromHeader(string name, string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the header to add. Must not be null. |
System.String | value | The value of the header to add. Must not be null. |
Returns
Type | Description |
---|---|
CallSettings | A new instance. |
FromHeaderMutation(Action<Metadata>)
Creates a CallSettings for the specified header mutation, or returns null
if headerMutation
is null.
Declaration
public static CallSettings FromHeaderMutation(Action<Metadata> headerMutation)
Parameters
Type | Name | Description |
---|---|---|
System.Action<Metadata> | headerMutation | Action to modify the headers to send at the beginning of the call. |
Returns
Type | Description |
---|---|
CallSettings | A new instance, or null if |
FromResponseMetadataHandler(Action<Metadata>)
Creates a CallSettings for the specified response metadata handler, or returns null
if responseMetadataHandler
is null.
Declaration
public static CallSettings FromResponseMetadataHandler(Action<Metadata> responseMetadataHandler)
Parameters
Type | Name | Description |
---|---|---|
System.Action<Metadata> | responseMetadataHandler | Action to receive response metadata when the call completes. |
Returns
Type | Description |
---|---|
CallSettings | A new instance, or null if |
FromRetry(RetrySettings)
Creates a CallSettings for the specified retry settings, or returns null
if retry
is null.
Declaration
public static CallSettings FromRetry(RetrySettings retry)
Parameters
Type | Name | Description |
---|---|---|
RetrySettings | retry | The call timing for the new settings. |
Returns
Type | Description |
---|---|
CallSettings | A new instance or null if |
FromTrailingMetadataHandler(Action<Metadata>)
Creates a CallSettings for the specified trailing metadata handler, or returns null
if trailingMetadataHandler
is null.
Declaration
public static CallSettings FromTrailingMetadataHandler(Action<Metadata> trailingMetadataHandler)
Parameters
Type | Name | Description |
---|---|---|
System.Action<Metadata> | trailingMetadataHandler | Action to receive trailing metadata when the call completes. |
Returns
Type | Description |
---|---|
CallSettings | A new instance, or null if |