Exemple #1
0
 internal LogsBatchQuery(ClientDiagnostics clientDiagnostics, QueryRestClient restClient, RowBinder rowBinder)
 {
     _clientDiagnostics = clientDiagnostics;
     _restClient        = restClient;
     _rowBinder         = rowBinder;
     _batch             = new BatchRequest();
 }
        /// <summary>
        /// Initializes a new instance of <see cref="LogsClient"/>.
        /// </summary>
        /// <param name="credential">The <see cref="TokenCredential"/> instance to use for authentication.</param>
        /// <param name="options">The <see cref="LogsClientOptions"/> instance to use as client configuration.</param>
        public LogsClient(TokenCredential credential, LogsClientOptions options)
        {
            Argument.AssertNotNull(credential, nameof(credential));

            options ??= new LogsClientOptions();

            _clientDiagnostics = new ClientDiagnostics(options);
            _pipeline          = HttpPipelineBuilder.Build(options, new BearerTokenAuthenticationPolicy(credential, "https://api.loganalytics.io//.default"));
            _queryClient       = new QueryRestClient(_clientDiagnostics, _pipeline);
            _rowBinder         = new RowBinder();
        }
Exemple #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));

            options ??= new LogsQueryClientOptions();
            endpoint           = new Uri(endpoint, options.GetVersionString());
            _clientDiagnostics = new ClientDiagnostics(options);
            _pipeline          = HttpPipelineBuilder.Build(options, new BearerTokenAuthenticationPolicy(
                                                               credential,
                                                               options.AuthenticationScope ?? "https://api.loganalytics.io//.default"));
            _queryClient = new QueryRestClient(_clientDiagnostics, _pipeline, endpoint);
            _rowBinder   = new RowBinder();
        }