/// <summary> /// Initializes a new instance of the <see cref="EventGridPublisherClient"/> class. /// </summary> /// <param name="endpoint">The topic endpoint. For example, "https://TOPIC-NAME.REGION-NAME-1.eventgrid.azure.net/api/events".</param> /// <param name="credential">The Shared Access Signature credential used to connect to Azure. This signature /// can be constructed using the <see cref="EventGridSasBuilder"/>.</param> /// <param name="options">The set of options to use for configuring the client.</param> public EventGridPublisherClient(Uri endpoint, AzureSasCredential credential, EventGridPublisherClientOptions options = default) { Argument.AssertNotNull(credential, nameof(credential)); options ??= new EventGridPublisherClientOptions(); _endpoint = endpoint; HttpPipeline pipeline = HttpPipelineBuilder.Build(options, new EventGridSharedAccessSignatureCredentialPolicy(credential)); _serviceRestClient = new EventGridRestClient(new ClientDiagnostics(options), pipeline, options.Version.GetVersionString()); _clientDiagnostics = new ClientDiagnostics(options); }
/// <summary>Initalizes a new instance of the <see cref="EventGridPublisherClient"/> class.</summary> /// <param name="endpoint">The topic endpoint. For example, "https://TOPIC-NAME.REGION-NAME-1.eventgrid.azure.net/api/events".</param> /// <param name="credential">The key credential used to authenticate with the service.</param> /// <param name="options">The set of options to use for configuring the client.</param> public EventGridPublisherClient(Uri endpoint, AzureKeyCredential credential, EventGridPublisherClientOptions options) { Argument.AssertNotNull(credential, nameof(credential)); options ??= new EventGridPublisherClientOptions(); _apiVersion = options.Version.GetVersionString(); _endpoint = endpoint; _key = credential; _pipeline = HttpPipelineBuilder.Build(options, new AzureKeyCredentialPolicy(credential, Constants.SasKeyName)); _serviceRestClient = new EventGridRestClient(new ClientDiagnostics(options), _pipeline, options.Version.GetVersionString()); _clientDiagnostics = new ClientDiagnostics(options); }