Class EventGridPublisherClientBuilder
- All Implemented Interfaces:
AzureKeyCredentialTrait<EventGridPublisherClientBuilder>
,AzureSasCredentialTrait<EventGridPublisherClientBuilder>
,ConfigurationTrait<EventGridPublisherClientBuilder>
,EndpointTrait<EventGridPublisherClientBuilder>
,HttpTrait<EventGridPublisherClientBuilder>
,TokenCredentialTrait<EventGridPublisherClientBuilder>
-
Constructor Summary
ConstructorDescriptionConstruct a new instance with default building settings. -
Method Summary
Modifier and TypeMethodDescriptionaddPolicy
(HttpPipelinePolicy httpPipelinePolicy) Adds apipeline policy
to apply on each request sent.Build aCloudEvent
publisher client with asynchronous publishing methods and the current settings.Build aCloudEvent
publisher client with synchronous publishing methods and the current settings.Build a custom event publisher client with asynchronous publishing methods and the current settings.Build a custom event publisher client with synchronous publishing methods and the current settings.Build anEventGridEvent
publisher client with asynchronous publishing methods and the current settings.Build anEventGridEvent
publisher client with synchronous publishing methods and the current settings.clientOptions
(ClientOptions clientOptions) Allows for setting common properties such as application ID, headers, proxy configuration, etc.configuration
(Configuration configuration) Set the configuration of HTTP and Azure values.credential
(AzureKeyCredential credential) Set the domain or topic authentication using a key obtained from Azure CLI, Azure portal, or the ARM SDKs.credential
(AzureSasCredential credential) Set the domain or topic authentication using an already obtained Shared Access Signature token.credential
(TokenCredential credential) Sets theTokenCredential
used to authorize requests sent to the service.Set the domain or topic endpoint.httpClient
(HttpClient httpClient) Sets theHttpClient
to use for sending and receiving requests to and from the service.httpLogOptions
(HttpLogOptions httpLogOptions) Sets thelogging configuration
to use when sending and receiving requests to and from the service.pipeline
(HttpPipeline httpPipeline) Sets theHttpPipeline
to use for the service client.retryOptions
(RetryOptions retryOptions) Sets theRetryOptions
for all the requests made through the client.retryPolicy
(RetryPolicy retryPolicy) Add a custom retry policy to the pipeline.serviceVersion
(EventGridServiceVersion serviceVersion) Set the service version to use for requests to the event grid service.
-
Constructor Details
-
EventGridPublisherClientBuilder
public EventGridPublisherClientBuilder()Construct a new instance with default building settings. The endpoint and one credential method must be set in order for the client to be built.
-
-
Method Details
-
addPolicy
Adds apipeline policy
to apply on each request sent.Note: It is important to understand the precedence order of the HttpTrait APIs. In particular, if a
HttpPipeline
is specified, this takes precedence over all other APIs in the trait, and they will be ignored. If noHttpPipeline
is specified, a HTTP pipeline will be constructed internally based on the settings provided to this trait. Additionally, there may be other APIs in types that implement this trait that are also ignored if anHttpPipeline
is specified, so please be sure to refer to the documentation of types that implement this trait to understand the full set of implications.- Specified by:
addPolicy
in interfaceHttpTrait<EventGridPublisherClientBuilder>
- Parameters:
httpPipelinePolicy
- Apipeline policy
.- Returns:
- the builder itself.
-
retryPolicy
Add a custom retry policy to the pipeline. The default isRetryPolicy()
. Setting this is mutually exclusive with usingretryOptions(RetryOptions)
.- Parameters:
retryPolicy
- the retry policy to add.- Returns:
- the builder itself.
-
retryOptions
Sets theRetryOptions
for all the requests made through the client.Note: It is important to understand the precedence order of the HttpTrait APIs. In particular, if a
HttpPipeline
is specified, this takes precedence over all other APIs in the trait, and they will be ignored. If noHttpPipeline
is specified, a HTTP pipeline will be constructed internally based on the settings provided to this trait. Additionally, there may be other APIs in types that implement this trait that are also ignored if anHttpPipeline
is specified, so please be sure to refer to the documentation of types that implement this trait to understand the full set of implications.Setting this is mutually exclusive with using
retryPolicy(RetryPolicy)
.- Specified by:
retryOptions
in interfaceHttpTrait<EventGridPublisherClientBuilder>
- Parameters:
retryOptions
- TheRetryOptions
to use for all the requests made through the client.- Returns:
- the builder itself.
-
clientOptions
Allows for setting common properties such as application ID, headers, proxy configuration, etc. Note that it is recommended that this method be called with an instance of theHttpClientOptions
class (a subclass of theClientOptions
base class). The HttpClientOptions subclass provides more configuration options suitable for HTTP clients, which is applicable for any class that implements this HttpTrait interface.Note: It is important to understand the precedence order of the HttpTrait APIs. In particular, if a
HttpPipeline
is specified, this takes precedence over all other APIs in the trait, and they will be ignored. If noHttpPipeline
is specified, a HTTP pipeline will be constructed internally based on the settings provided to this trait. Additionally, there may be other APIs in types that implement this trait that are also ignored if anHttpPipeline
is specified, so please be sure to refer to the documentation of types that implement this trait to understand the full set of implications.- Specified by:
clientOptions
in interfaceHttpTrait<EventGridPublisherClientBuilder>
- Parameters:
clientOptions
- A configured instance ofHttpClientOptions
.- Returns:
- The updated EventGridPublisherClientBuilder object.
- See Also:
-
configuration
Set the configuration of HTTP and Azure values. A default is already set.- Specified by:
configuration
in interfaceConfigurationTrait<EventGridPublisherClientBuilder>
- Parameters:
configuration
- the configuration to use.- Returns:
- the builder itself.
-
credential
Set the domain or topic authentication using a key obtained from Azure CLI, Azure portal, or the ARM SDKs.- Specified by:
credential
in interfaceAzureKeyCredentialTrait<EventGridPublisherClientBuilder>
- Parameters:
credential
- the key credential to use to authorize the publisher client.- Returns:
- the builder itself.
-
credential
Set the domain or topic authentication using an already obtained Shared Access Signature token.- Specified by:
credential
in interfaceAzureSasCredentialTrait<EventGridPublisherClientBuilder>
- Parameters:
credential
- the sas credential to use.- Returns:
- the builder itself.
-
credential
Sets theTokenCredential
used to authorize requests sent to the service. Refer to the Azure SDK for Java identity and authentication documentation for more details on proper usage of theTokenCredential
type.- Specified by:
credential
in interfaceTokenCredentialTrait<EventGridPublisherClientBuilder>
- Parameters:
credential
-TokenCredential
used to authorize requests sent to the service.- Returns:
- the builder itself.
-
endpoint
Set the domain or topic endpoint. This is the address to publish events to. It must be the full url of the endpoint instead of just the hostname.- Specified by:
endpoint
in interfaceEndpointTrait<EventGridPublisherClientBuilder>
- Parameters:
endpoint
- the endpoint as a url.- Returns:
- the builder itself.
- Throws:
NullPointerException
- ifendpoint
is null.IllegalArgumentException
- ifendpoint
cannot be parsed into a valid URL.
-
httpClient
Sets theHttpClient
to use for sending and receiving requests to and from the service.Note: It is important to understand the precedence order of the HttpTrait APIs. In particular, if a
HttpPipeline
is specified, this takes precedence over all other APIs in the trait, and they will be ignored. If noHttpPipeline
is specified, a HTTP pipeline will be constructed internally based on the settings provided to this trait. Additionally, there may be other APIs in types that implement this trait that are also ignored if anHttpPipeline
is specified, so please be sure to refer to the documentation of types that implement this trait to understand the full set of implications.- Specified by:
httpClient
in interfaceHttpTrait<EventGridPublisherClientBuilder>
- Parameters:
httpClient
- TheHttpClient
to use for requests.- Returns:
- the builder itself.
-
httpLogOptions
Sets thelogging configuration
to use when sending and receiving requests to and from the service. If alogLevel
is not provided, default value ofHttpLogDetailLevel.NONE
is set.Note: It is important to understand the precedence order of the HttpTrait APIs. In particular, if a
HttpPipeline
is specified, this takes precedence over all other APIs in the trait, and they will be ignored. If noHttpPipeline
is specified, a HTTP pipeline will be constructed internally based on the settings provided to this trait. Additionally, there may be other APIs in types that implement this trait that are also ignored if anHttpPipeline
is specified, so please be sure to refer to the documentation of types that implement this trait to understand the full set of implications.- Specified by:
httpLogOptions
in interfaceHttpTrait<EventGridPublisherClientBuilder>
- Parameters:
httpLogOptions
- Thelogging configuration
to use when sending and receiving requests to and from the service.- Returns:
- the builder itself.
-
pipeline
Sets theHttpPipeline
to use for the service client.Note: It is important to understand the precedence order of the HttpTrait APIs. In particular, if a
HttpPipeline
is specified, this takes precedence over all other APIs in the trait, and they will be ignored. If noHttpPipeline
is specified, a HTTP pipeline will be constructed internally based on the settings provided to this trait. Additionally, there may be other APIs in types that implement this trait that are also ignored if anHttpPipeline
is specified, so please be sure to refer to the documentation of types that implement this trait to understand the full set of implications.- Specified by:
pipeline
in interfaceHttpTrait<EventGridPublisherClientBuilder>
- Parameters:
httpPipeline
-HttpPipeline
to use for sending service requests and receiving responses.- Returns:
- the builder itself.
-
serviceVersion
Set the service version to use for requests to the event grid service. SeeEventGridServiceVersion
for more information about possible service versions.- Parameters:
serviceVersion
- the service version to set. By default this will use the latest available version.- Returns:
- the builder itself
-
buildCloudEventPublisherAsyncClient
Build aCloudEvent
publisher client with asynchronous publishing methods and the current settings. An endpoint must be set, and either a pipeline with correct authentication must be set, or a credential must be set in the form of anAzureSasCredential
or aAzureKeyCredential
at the respective methods. All other settings have defaults and are optional.- Returns:
- a publisher client with asynchronous publishing methods.
-
buildEventGridEventPublisherAsyncClient
Build anEventGridEvent
publisher client with asynchronous publishing methods and the current settings. An endpoint must be set, and either a pipeline with correct authentication must be set, or a credential must be set in the form of anAzureSasCredential
or aAzureKeyCredential
at the respective methods. All other settings have defaults and are optional.- Returns:
- a publisher client with asynchronous publishing methods.
-
buildCustomEventPublisherAsyncClient
Build a custom event publisher client with asynchronous publishing methods and the current settings. An endpoint must be set, and either a pipeline with correct authentication must be set, or a credential must be set in the form of anAzureSasCredential
or aAzureKeyCredential
at the respective methods. All other settings have defaults and are optional.- Returns:
- a publisher client with asynchronous publishing methods.
-
buildCloudEventPublisherClient
Build aCloudEvent
publisher client with synchronous publishing methods and the current settings. Endpoint and a credential must be set (either keyCredential or sharedAccessSignatureCredential), all other settings have defaults and/or are optional.- Returns:
- a publisher client with synchronous publishing methods.
-
buildEventGridEventPublisherClient
Build anEventGridEvent
publisher client with synchronous publishing methods and the current settings. Endpoint and a credential must be set (either keyCredential or sharedAccessSignatureCredential), all other settings have defaults and/or are optional.- Returns:
- a publisher client with synchronous publishing methods.
-
buildCustomEventPublisherClient
Build a custom event publisher client with synchronous publishing methods and the current settings. Endpoint and a credential must be set (either keyCredential or sharedAccessSignatureCredential), all other settings have defaults and/or are optional.- Returns:
- a publisher client with synchronous publishing methods.
-