示例#1
0
        public PurviewCatalogClient(Uri endpoint, TokenCredential credential, PurviewCatalogClientOptions options = null)
        {
            Argument.AssertNotNull(endpoint, nameof(endpoint));
            Argument.AssertNotNull(credential, nameof(credential));
            options ??= new PurviewCatalogClientOptions();

            ClientDiagnostics = new ClientDiagnostics(options);
            _tokenCredential  = credential;
            _pipeline         = HttpPipelineBuilder.Build(options, Array.Empty <HttpPipelinePolicy>(), new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier());
            _endpoint         = endpoint;
            _apiVersion       = options.Version;
        }
示例#2
0
        public PurviewCatalogClient(Uri endpoint, TokenCredential credential, PurviewCatalogClientOptions options = null)
        {
            if (endpoint == null)
            {
                throw new ArgumentNullException(nameof(endpoint));
            }
            if (credential == null)
            {
                throw new ArgumentNullException(nameof(credential));
            }

            options ??= new PurviewCatalogClientOptions();
            _clientDiagnostics = new ClientDiagnostics(options);
            var authPolicy = new BearerTokenAuthenticationPolicy(credential, AuthorizationScopes);

            Pipeline      = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { authPolicy, new LowLevelCallbackPolicy() });
            this.endpoint = endpoint;
            apiVersion    = options.Version;
        }