예제 #1
0
        /// <summary>Initalizes an instance of EventGridClient</summary>
        /// <param name="endpoint">topic endpoint</param>
        /// <param name="credential">used to connect to Azure</param>
        /// <param name="options">configuring options</param>
        public EventGridClient(Uri endpoint, AzureKeyCredential credential, EventGridClientOptions options)
        {
            Argument.AssertNotNull(credential, nameof(credential));
            options ??= new EventGridClientOptions();
            _hostName = endpoint.Host;
            HttpPipeline pipeline = HttpPipelineBuilder.Build(options, new AzureKeyCredentialPolicy(credential, Constants.SasKeyName));

            _serviceRestClient = new ServiceRestClient(new ClientDiagnostics(options), pipeline, options.GetVersionString());
            _clientDiagnostics = new ClientDiagnostics(options);
        }
예제 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="EventGridClient"/> class.
        /// </summary>
        /// <param name="endpoint">Topic endpoint</param>
        /// <param name="credential">Credential used to connect to Azure</param>
        /// <param name="options">Configuring options</param>
        public EventGridClient(Uri endpoint, SharedAccessSignatureCredential credential, EventGridClientOptions options)
        {
            Argument.AssertNotNull(credential, nameof(credential));
            options ??= new EventGridClientOptions();
            _serializer = options.Serializer ?? new JsonObjectSerializer();
            _endpoint   = endpoint;
            HttpPipeline pipeline = HttpPipelineBuilder.Build(options, new SharedAccessSignatureCredentialPolicy(credential));

            _serviceRestClient = new ServiceRestClient(new ClientDiagnostics(options), pipeline, options.GetVersionString());
            _clientDiagnostics = new ClientDiagnostics(options);
        }