Class EventGridPublisherClientBuilder
- java.lang.Object
-
- com.azure.messaging.eventgrid.EventGridPublisherClientBuilder
-
- All Implemented Interfaces:
com.azure.core.client.traits.AzureKeyCredentialTrait<EventGridPublisherClientBuilder>
,com.azure.core.client.traits.AzureSasCredentialTrait<EventGridPublisherClientBuilder>
,com.azure.core.client.traits.ConfigurationTrait<EventGridPublisherClientBuilder>
,com.azure.core.client.traits.EndpointTrait<EventGridPublisherClientBuilder>
,com.azure.core.client.traits.HttpTrait<EventGridPublisherClientBuilder>
,com.azure.core.client.traits.TokenCredentialTrait<EventGridPublisherClientBuilder>
public final class EventGridPublisherClientBuilder extends Object implements com.azure.core.client.traits.TokenCredentialTrait<EventGridPublisherClientBuilder>, com.azure.core.client.traits.AzureKeyCredentialTrait<EventGridPublisherClientBuilder>, com.azure.core.client.traits.AzureSasCredentialTrait<EventGridPublisherClientBuilder>, com.azure.core.client.traits.HttpTrait<EventGridPublisherClientBuilder>, com.azure.core.client.traits.ConfigurationTrait<EventGridPublisherClientBuilder>, com.azure.core.client.traits.EndpointTrait<EventGridPublisherClientBuilder>
A Builder class to create service clients that can publish events to EventGrid.- See Also:
EventGridPublisherAsyncClient
,EventGridEvent
,CloudEvent
-
-
Constructor Summary
Constructors Constructor Description EventGridPublisherClientBuilder()
Construct a new instance with default building settings.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description EventGridPublisherClientBuilder
addPolicy(com.azure.core.http.policy.HttpPipelinePolicy httpPipelinePolicy)
Adds apipeline policy
to apply on each request sent.EventGridPublisherAsyncClient<com.azure.core.models.CloudEvent>
buildCloudEventPublisherAsyncClient()
Build aCloudEvent
publisher client with asynchronous publishing methods and the current settings.EventGridPublisherClient<com.azure.core.models.CloudEvent>
buildCloudEventPublisherClient()
Build aCloudEvent
publisher client with synchronous publishing methods and the current settings.EventGridPublisherAsyncClient<com.azure.core.util.BinaryData>
buildCustomEventPublisherAsyncClient()
Build a custom event publisher client with asynchronous publishing methods and the current settings.EventGridPublisherClient<com.azure.core.util.BinaryData>
buildCustomEventPublisherClient()
Build a custom event publisher client with synchronous publishing methods and the current settings.EventGridPublisherAsyncClient<EventGridEvent>
buildEventGridEventPublisherAsyncClient()
Build anEventGridEvent
publisher client with asynchronous publishing methods and the current settings.EventGridPublisherClient<EventGridEvent>
buildEventGridEventPublisherClient()
Build anEventGridEvent
publisher client with synchronous publishing methods and the current settings.EventGridPublisherClientBuilder
clientOptions(com.azure.core.util.ClientOptions clientOptions)
Allows for setting common properties such as application ID, headers, proxy configuration, etc.EventGridPublisherClientBuilder
configuration(com.azure.core.util.Configuration configuration)
Set the configuration of HTTP and Azure values.EventGridPublisherClientBuilder
credential(com.azure.core.credential.AzureKeyCredential credential)
Set the domain or topic authentication using a key obtained from Azure CLI, Azure portal, or the ARM SDKs.EventGridPublisherClientBuilder
credential(com.azure.core.credential.AzureSasCredential credential)
Set the domain or topic authentication using an already obtained Shared Access Signature token.EventGridPublisherClientBuilder
credential(com.azure.core.credential.TokenCredential credential)
Sets theTokenCredential
used to authorize requests sent to the service.EventGridPublisherClientBuilder
endpoint(String endpoint)
Set the domain or topic endpoint.EventGridPublisherClientBuilder
httpClient(com.azure.core.http.HttpClient httpClient)
Sets theHttpClient
to use for sending and receiving requests to and from the service.EventGridPublisherClientBuilder
httpLogOptions(com.azure.core.http.policy.HttpLogOptions httpLogOptions)
Sets thelogging configuration
to use when sending and receiving requests to and from the service.EventGridPublisherClientBuilder
pipeline(com.azure.core.http.HttpPipeline httpPipeline)
Sets theHttpPipeline
to use for the service client.EventGridPublisherClientBuilder
retryOptions(com.azure.core.http.policy.RetryOptions retryOptions)
Sets theRetryOptions
for all the requests made through the client.EventGridPublisherClientBuilder
retryPolicy(com.azure.core.http.policy.RetryPolicy retryPolicy)
Add a custom retry policy to the pipeline.EventGridPublisherClientBuilder
serviceVersion(EventGridServiceVersion serviceVersion)
Set the service version to use for requests to the event grid service.
-
-
-
Method Detail
-
addPolicy
public EventGridPublisherClientBuilder addPolicy(com.azure.core.http.policy.HttpPipelinePolicy httpPipelinePolicy)
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 interfacecom.azure.core.client.traits.HttpTrait<EventGridPublisherClientBuilder>
- Parameters:
httpPipelinePolicy
- Apipeline policy
.- Returns:
- the builder itself.
-
retryPolicy
public EventGridPublisherClientBuilder retryPolicy(com.azure.core.http.policy.RetryPolicy 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
public EventGridPublisherClientBuilder retryOptions(com.azure.core.http.policy.RetryOptions 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 interfacecom.azure.core.client.traits.HttpTrait<EventGridPublisherClientBuilder>
- Parameters:
retryOptions
- TheRetryOptions
to use for all the requests made through the client.- Returns:
- the builder itself.
-
clientOptions
public EventGridPublisherClientBuilder clientOptions(com.azure.core.util.ClientOptions 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 interfacecom.azure.core.client.traits.HttpTrait<EventGridPublisherClientBuilder>
- Parameters:
clientOptions
- A configured instance ofHttpClientOptions
.- Returns:
- The updated EventGridPublisherClientBuilder object.
- See Also:
HttpClientOptions
-
configuration
public EventGridPublisherClientBuilder configuration(com.azure.core.util.Configuration configuration)
Set the configuration of HTTP and Azure values. A default is already set.- Specified by:
configuration
in interfacecom.azure.core.client.traits.ConfigurationTrait<EventGridPublisherClientBuilder>
- Parameters:
configuration
- the configuration to use.- Returns:
- the builder itself.
-
credential
public EventGridPublisherClientBuilder credential(com.azure.core.credential.AzureKeyCredential credential)
Set the domain or topic authentication using a key obtained from Azure CLI, Azure portal, or the ARM SDKs.- Specified by:
credential
in interfacecom.azure.core.client.traits.AzureKeyCredentialTrait<EventGridPublisherClientBuilder>
- Parameters:
credential
- the key credential to use to authorize the publisher client.- Returns:
- the builder itself.
-
credential
public EventGridPublisherClientBuilder credential(com.azure.core.credential.AzureSasCredential credential)
Set the domain or topic authentication using an already obtained Shared Access Signature token.- Specified by:
credential
in interfacecom.azure.core.client.traits.AzureSasCredentialTrait<EventGridPublisherClientBuilder>
- Parameters:
credential
- the sas credential to use.- Returns:
- the builder itself.
-
credential
public EventGridPublisherClientBuilder credential(com.azure.core.credential.TokenCredential 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 interfacecom.azure.core.client.traits.TokenCredentialTrait<EventGridPublisherClientBuilder>
- Parameters:
credential
-TokenCredential
used to authorize requests sent to the service.- Returns:
- the builder itself.
-
endpoint
public EventGridPublisherClientBuilder endpoint(String 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 interfacecom.azure.core.client.traits.EndpointTrait<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
public EventGridPublisherClientBuilder httpClient(com.azure.core.http.HttpClient 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 interfacecom.azure.core.client.traits.HttpTrait<EventGridPublisherClientBuilder>
- Parameters:
httpClient
- TheHttpClient
to use for requests.- Returns:
- the builder itself.
-
httpLogOptions
public EventGridPublisherClientBuilder httpLogOptions(com.azure.core.http.policy.HttpLogOptions 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 interfacecom.azure.core.client.traits.HttpTrait<EventGridPublisherClientBuilder>
- Parameters:
httpLogOptions
- Thelogging configuration
to use when sending and receiving requests to and from the service.- Returns:
- the builder itself.
-
pipeline
public EventGridPublisherClientBuilder pipeline(com.azure.core.http.HttpPipeline httpPipeline)
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 interfacecom.azure.core.client.traits.HttpTrait<EventGridPublisherClientBuilder>
- Parameters:
httpPipeline
-HttpPipeline
to use for sending service requests and receiving responses.- Returns:
- the builder itself.
-
serviceVersion
public EventGridPublisherClientBuilder serviceVersion(EventGridServiceVersion 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
public EventGridPublisherAsyncClient<com.azure.core.models.CloudEvent> 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
public EventGridPublisherAsyncClient<EventGridEvent> 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
public EventGridPublisherAsyncClient<com.azure.core.util.BinaryData> 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
public EventGridPublisherClient<com.azure.core.models.CloudEvent> 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
public EventGridPublisherClient<EventGridEvent> 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
public EventGridPublisherClient<com.azure.core.util.BinaryData> 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.
-
-