Exemplo n.º 1
0
        /// <summary>
        /// Initializes the ModelsRepositoryClient with custom client <paramref name="options"/> while pointing to
        /// a custom <paramref name="repositoryUri"/>.
        /// </summary>
        /// <param name="repositoryUri">
        /// The models repository Uri. This can be a remote endpoint or local directory.
        /// </param>
        /// <param name="options">
        /// ModelsRepositoryClientOptions to configure client behavior.
        /// </param>
        public ModelsRepositoryClient(Uri repositoryUri, ModelsRepositoryClientOptions options = default)
        {
            if (options == null)
            {
                options = new ModelsRepositoryClientOptions();
            }

            RepositoryUri      = repositoryUri;
            _clientOptions     = options;
            _clientDiagnostics = new ClientDiagnostics(options);
            _repositoryHandler = new RepositoryHandler(RepositoryUri, _clientDiagnostics, _clientOptions);
        }
Exemplo n.º 2
0
        public RepositoryHandler(Uri repositoryUri, ClientDiagnostics clientDiagnostics, ModelsRepositoryClientOptions options)
        {
            Argument.AssertNotNull(options, nameof(options));

            _clientOptions     = options;
            _clientDiagnostics = clientDiagnostics;
            _clientId          = Guid.NewGuid();
            _repositoryUri     = repositoryUri;
            _modelFetcher      = _repositoryUri.Scheme == ModelsRepositoryConstants.UriFileSchema
                ? new FileModelFetcher(_clientDiagnostics)
                : new HttpModelFetcher(_clientDiagnostics, _clientOptions);
            ModelsRepositoryEventSource.Instance.InitFetcher(_clientId, repositoryUri.Scheme);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Initializes the ModelsRepositoryClient with custom client <paramref name="options"/> while pointing to
 /// the <see href="https://devicemodels.azure.com">Azure IoT Models Repository</see> service global endpoint.
 /// </summary>
 /// <param name="options">
 /// ModelsRepositoryClientOptions to configure client behavior.
 /// </param>
 public ModelsRepositoryClient(ModelsRepositoryClientOptions options) :
     this(new Uri(ModelsRepositoryConstants.DefaultModelsRepository), options)
 {
 }