/// <summary>
        /// Initializes a new instance of <see cref="LogsQueryClient"/>.
        /// </summary>
        /// <param name="endpoint">The service endpoint to use.</param>
        /// <param name="credential">The <see cref="TokenCredential"/> instance to use for authentication.</param>
        /// <param name="options">The <see cref="LogsQueryClientOptions"/> instance to use as client configuration.</param>
        public LogsQueryClient(Uri endpoint, TokenCredential credential, LogsQueryClientOptions options)
        {
            Argument.AssertNotNull(credential, nameof(credential));
            Argument.AssertNotNull(endpoint, nameof(endpoint));

            options ??= new LogsQueryClientOptions();
            endpoint           = new Uri(endpoint, options.GetVersionString());
            _clientDiagnostics = new ClientDiagnostics(options);
            _pipeline          = HttpPipelineBuilder.Build(options, new BearerTokenAuthenticationPolicy(credential, "https://api.loganalytics.io//.default"));
            _queryClient       = new QueryRestClient(_clientDiagnostics, _pipeline, endpoint);
            _rowBinder         = new RowBinder();
        }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of <see cref="LogsQueryClient"/>.
        /// </summary>
        /// <param name="endpoint">The service endpoint to use.</param>
        /// <param name="credential">The <see cref="TokenCredential"/> instance to use for authentication.</param>
        /// <param name="options">The <see cref="LogsQueryClientOptions"/> instance to use as client configuration.</param>
        public LogsQueryClient(Uri endpoint, TokenCredential credential, LogsQueryClientOptions options)
        {
            Argument.AssertNotNull(credential, nameof(credential));
            Argument.AssertNotNull(endpoint, nameof(endpoint));

            Endpoint = endpoint;
            options ??= new LogsQueryClientOptions();
            var scope = $"{endpoint.AbsoluteUri}/.default";

            endpoint           = new Uri(endpoint, options.GetVersionString());
            _clientDiagnostics = new ClientDiagnostics(options);
            _pipeline          = HttpPipelineBuilder.Build(options, new BearerTokenAuthenticationPolicy(credential, scope));
            _queryClient       = new QueryRestClient(_clientDiagnostics, _pipeline, endpoint);
        }
Пример #3
0
        /// <summary>
        /// Initializes a new instance of <see cref="LogsQueryClient"/>.
        /// </summary>
        /// <param name="endpoint">The service endpoint to use.</param>
        /// <param name="credential">The <see cref="TokenCredential"/> instance to use for authentication.</param>
        /// <param name="options">The <see cref="LogsQueryClientOptions"/> instance to use as client configuration.</param>
        public LogsQueryClient(Uri endpoint, TokenCredential credential, LogsQueryClientOptions options)
        {
            Argument.AssertNotNull(credential, nameof(credential));
            Argument.AssertNotNull(endpoint, nameof(endpoint));

            Endpoint = endpoint;
            options ??= new LogsQueryClientOptions();
            endpoint           = new Uri(endpoint, options.GetVersionString());
            _clientDiagnostics = new ClientDiagnostics(options);
            _pipeline          = HttpPipelineBuilder.Build(options, new BearerTokenAuthenticationPolicy(
                                                               credential,
                                                               $"{options.Audience ?? LogsQueryClientAudience.AzurePublicCloud}//.default"));
            _queryClient = new QueryRestClient(_clientDiagnostics, _pipeline, endpoint);
        }
Пример #4
0
 /// <summary>
 /// Initializes a new instance of <see cref="LogsQueryClient"/>. Uses the default 'https://api.loganalytics.io' endpoint.
 /// </summary>
 /// <param name="credential">The <see cref="TokenCredential"/> instance to use for authentication.</param>
 /// <param name="options">The <see cref="LogsQueryClientOptions"/> instance to use as client configuration.</param>
 public LogsQueryClient(TokenCredential credential, LogsQueryClientOptions options) : this(_defaultEndpoint, credential, options)
 {
 }