/// <summary> Initializes a new instance of LogClient. </summary>
        /// <param name="clientDiagnostics"> The handler for diagnostic messaging in the client. </param>
        /// <param name="pipeline"> The HTTP pipeline for sending and receiving REST requests and responses. </param>
        /// <param name="endpoint"> Supported Cognitive Services endpoint. </param>
        internal PersonalizerAdministrationClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint)
        {
            string stringEndpoint = endpoint.AbsoluteUri;

            LogRestClient = new LogRestClient(_clientDiagnostics, _pipeline, stringEndpoint);
            ServiceConfigurationRestClient = new ServiceConfigurationRestClient(_clientDiagnostics, _pipeline, stringEndpoint);
            ModelRestClient       = new ModelRestClient(_clientDiagnostics, _pipeline, stringEndpoint);
            EvaluationsRestClient = new EvaluationsRestClient(_clientDiagnostics, _pipeline, stringEndpoint);
            PolicyRestClient      = new PolicyRestClient(_clientDiagnostics, _pipeline, stringEndpoint);
            _clientDiagnostics    = clientDiagnostics;
            _pipeline             = pipeline;
        }
 /// <summary> Get properties of the Personalizer logs. </summary>
 /// <param name="cancellationToken"> The cancellation token to use. </param>
 public virtual Response <PersonalizerLogProperties> GetPersonalizerLogProperties(CancellationToken cancellationToken = default)
 {
     using var scope = _clientDiagnostics.CreateScope("PersonalizerAdministrationClient.GetPersonalizerLogProperties");
     scope.Start();
     try
     {
         return(LogRestClient.GetProperties(cancellationToken));
     }
     catch (Exception e)
     {
         scope.Failed(e);
         throw;
     }
 }
 /// <summary> Get properties of the Personalizer logs. </summary>
 /// <param name="cancellationToken"> The cancellation token to use. </param>
 public virtual async Task <Response <PersonalizerLogProperties> > GetPersonalizerLogPropertiesAsync(CancellationToken cancellationToken = default)
 {
     using var scope = _clientDiagnostics.CreateScope("PersonalizerAdministrationClient.GetPersonalizerLogProperties");
     scope.Start();
     try
     {
         return(await LogRestClient.GetPropertiesAsync(cancellationToken).ConfigureAwait(false));
     }
     catch (Exception e)
     {
         scope.Failed(e);
         throw;
     }
 }
Beispiel #4
0
        public LogClient(string endpoint, AzureKeyCredential credential, PersonalizerClientOptions options = null)
        {
            if (endpoint == null)
            {
                throw new ArgumentNullException(nameof(endpoint));
            }
            if (credential == null)
            {
                throw new ArgumentNullException(nameof(credential));
            }

            options ??= new PersonalizerClientOptions();
            _clientDiagnostics = new ClientDiagnostics(options);
            _pipeline          = HttpPipelineBuilder.Build(options, new AzureKeyCredentialPolicy(credential, "Ocp-Apim-Subscription-Key"));
            RestClient         = new LogRestClient(_clientDiagnostics, _pipeline, endpoint);
        }
Beispiel #5
0
        public LogClient(string endpoint, TokenCredential credential, PersonalizerClientOptions options = null)
        {
            if (endpoint == null)
            {
                throw new ArgumentNullException(nameof(endpoint));
            }
            if (credential == null)
            {
                throw new ArgumentNullException(nameof(credential));
            }

            options ??= new PersonalizerClientOptions();
            _clientDiagnostics = new ClientDiagnostics(options);
            string[] scopes = { "https://cognitiveservices.azure.com/.default" };
            _pipeline  = HttpPipelineBuilder.Build(options, new BearerTokenAuthenticationPolicy(credential, scopes));
            RestClient = new LogRestClient(_clientDiagnostics, _pipeline, endpoint);
        }
        /// <summary> Initializes a new instance of PersonalizerClient. </summary>
        /// <param name="endpoint"> Supported Cognitive Services endpoint. </param>
        /// <param name="credential"> A credential used to authenticate to an Azure Service. </param>
        /// <param name="options"> The options for configuring the client. </param>
        public PersonalizerAdministrationClient(Uri endpoint, AzureKeyCredential credential, PersonalizerClientOptions options = null)
        {
            if (endpoint == null)
            {
                throw new ArgumentNullException(nameof(endpoint));
            }
            if (credential == null)
            {
                throw new ArgumentNullException(nameof(credential));
            }

            options ??= new PersonalizerClientOptions();
            _clientDiagnostics = new ClientDiagnostics(options);
            _pipeline          = HttpPipelineBuilder.Build(options, new AzureKeyCredentialPolicy(credential, "Ocp-Apim-Subscription-Key"));
            string stringEndpoint = endpoint.AbsoluteUri;

            LogRestClient = new LogRestClient(_clientDiagnostics, _pipeline, stringEndpoint);
            ServiceConfigurationRestClient = new ServiceConfigurationRestClient(_clientDiagnostics, _pipeline, stringEndpoint);
            ModelRestClient       = new ModelRestClient(_clientDiagnostics, _pipeline, stringEndpoint);
            EvaluationsRestClient = new EvaluationsRestClient(_clientDiagnostics, _pipeline, stringEndpoint);
            PolicyRestClient      = new PolicyRestClient(_clientDiagnostics, _pipeline, stringEndpoint);
        }
        /// <summary> Initializes a new instance of PersonalizerClient. </summary>
        /// <param name="endpoint"> Supported Cognitive Services endpoint. </param>
        /// <param name="credential"> A credential used to authenticate to an Azure Service. </param>
        /// <param name="options"> The options for configuring the client. </param>
        public PersonalizerAdministrationClient(Uri endpoint, TokenCredential credential, PersonalizerClientOptions options = null)
        {
            if (endpoint == null)
            {
                throw new ArgumentNullException(nameof(endpoint));
            }
            if (credential == null)
            {
                throw new ArgumentNullException(nameof(credential));
            }

            options ??= new PersonalizerClientOptions();
            _clientDiagnostics = new ClientDiagnostics(options);
            string[] scopes = { "https://cognitiveservices.azure.com/.default" };
            _pipeline = HttpPipelineBuilder.Build(options, new BearerTokenAuthenticationPolicy(credential, scopes));
            string stringEndpoint = endpoint.AbsoluteUri;

            LogRestClient = new LogRestClient(_clientDiagnostics, _pipeline, stringEndpoint);
            ServiceConfigurationRestClient = new ServiceConfigurationRestClient(_clientDiagnostics, _pipeline, stringEndpoint);
            ModelRestClient       = new ModelRestClient(_clientDiagnostics, _pipeline, stringEndpoint);
            EvaluationsRestClient = new EvaluationsRestClient(_clientDiagnostics, _pipeline, stringEndpoint);
            PolicyRestClient      = new PolicyRestClient(_clientDiagnostics, _pipeline, stringEndpoint);
        }
Beispiel #8
0
 internal LogClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string endpoint)
 {
     RestClient         = new LogRestClient(clientDiagnostics, pipeline, endpoint);
     _clientDiagnostics = clientDiagnostics;
     _pipeline          = pipeline;
 }