public HealthApiClient(Uri endpoint = null, WebPubSubServiceClientOptions options = null) { endpoint ??= new Uri(""); options ??= new WebPubSubServiceClientOptions(); _clientDiagnostics = new ClientDiagnostics(options); Pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }, Array.Empty <HttpPipelinePolicy>(), new ResponseClassifier()); this.endpoint = endpoint; apiVersion = options.Version; }
public HealthApiClient(string endpoint, WebPubSubServiceClientOptions options) { Argument.AssertNotNull(endpoint, nameof(endpoint)); options ??= new WebPubSubServiceClientOptions(); ClientDiagnostics = new ClientDiagnostics(options, true); _pipeline = HttpPipelineBuilder.Build(options, Array.Empty <HttpPipelinePolicy>(), Array.Empty <HttpPipelinePolicy>(), new ResponseClassifier()); _endpoint = endpoint; _apiVersion = options.Version; }
public HealthApiClient(string endpoint, WebPubSubServiceClientOptions options = null) { if (endpoint == null) { throw new ArgumentNullException(nameof(endpoint)); } options ??= new WebPubSubServiceClientOptions(); _clientDiagnostics = new ClientDiagnostics(options); _pipeline = HttpPipelineBuilder.Build(options, Array.Empty <HttpPipelinePolicy>(), Array.Empty <HttpPipelinePolicy>(), new ResponseClassifier()); _endpoint = endpoint; _apiVersion = options.Version; }
internal WebPubSubServiceClient(Uri endpoint, AzureKeyCredential credential, WebPubSubServiceClientOptions options) { if (credential == default) { throw new ArgumentNullException(nameof(credential)); } if (options == default) { options = new WebPubSubServiceClientOptions(); } ClientDiagnostics clientDiagnostics = new ClientDiagnostics(options); HttpPipeline pipeline = HttpPipelineBuilder.Build(options, new WebPubSubAuthenticationPolicy(credential)); RestClient = new WebPubSubRestClient(clientDiagnostics, pipeline, endpoint, options.Version); _clientDiagnostics = clientDiagnostics; }
/// <summary> Initializes a new instance of WebPubSubServiceClient. </summary> /// <param name="endpoint"> server parameter. </param> /// <param name="hub"> Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore. </param> /// <param name="credential"> A token credential used to authenticate to an Azure Service. </param> /// <param name="options"> The options for configuring the client. </param> public WebPubSubServiceClient(Uri endpoint, string hub, TokenCredential credential, WebPubSubServiceClientOptions options) : this(endpoint, hub, options) { Argument.AssertNotNull(credential, nameof(credential)); _tokenCredential = credential; HttpPipelinePolicy[] perCallPolicies; if (options.ReverseProxyEndpoint != null) { perCallPolicies = new HttpPipelinePolicy[] { new ReverseProxyPolicy(options.ReverseProxyEndpoint), new LowLevelCallbackPolicy() }; } else { perCallPolicies = new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }; } _pipeline = HttpPipelineBuilder.Build( options, perCallPolicies: perCallPolicies, perRetryPolicies: new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(credential, WebPubSubServiceClientOptions.CredentialScopeName) }, new ResponseClassifier() ); }
/// <summary> /// Initializes a new instance of the <see cref="WebPubSubServiceClient"/>. /// </summary> /// <param name="connectionString">Connection string contains Endpoint and AccessKey.</param> /// <param name="hub">Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.</param> /// <param name="options"></param> public WebPubSubServiceClient(string connectionString, string hub, WebPubSubServiceClientOptions options) : this(ParseConnectionString(connectionString), hub, options) { }
/// <summary> Initializes a new instance of WebPubSubServiceClient. </summary> /// <param name="endpoint"> server parameter. </param> /// <param name="hub"> Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore. </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 WebPubSubServiceClient(Uri endpoint, string hub, AzureKeyCredential credential, WebPubSubServiceClientOptions options) : this(endpoint, hub, options) { Argument.AssertNotNull(credential, nameof(credential)); _credential = credential; HttpPipelinePolicy[] perCallPolicies; if (options.ReverseProxyEndpoint != null) { perCallPolicies = new HttpPipelinePolicy[] { new ReverseProxyPolicy(options.ReverseProxyEndpoint) }; } else { perCallPolicies = Array.Empty <HttpPipelinePolicy>(); } _pipeline = HttpPipelineBuilder.Build( options, perCallPolicies: perCallPolicies, perRetryPolicies: new HttpPipelinePolicy[] { new WebPubSubAuthenticationPolicy(credential) }, new ResponseClassifier() ); }
/// <summary> Initializes a new instance of WebPubSubServiceClient. </summary> /// <param name="endpoint"> server parameter. </param> /// <param name="hub"> Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore. </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 WebPubSubServiceClient(Uri endpoint, string hub, AzureKeyCredential credential, WebPubSubServiceClientOptions options) { Argument.AssertNotNull(endpoint, nameof(endpoint)); Argument.AssertNotNull(hub, nameof(hub)); Argument.AssertNotNull(credential, nameof(credential)); this._credential = credential; this.hub = hub; this.endpoint = endpoint; options ??= new WebPubSubServiceClientOptions(); _clientDiagnostics = new ClientDiagnostics(options); apiVersion = options.Version; HttpPipelinePolicy[] perCallPolicies; if (options.ReverseProxyEndpoint != null) { perCallPolicies = new HttpPipelinePolicy[] { new ApimPolicy(options.ReverseProxyEndpoint), new LowLevelCallbackPolicy() }; } else { perCallPolicies = new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }; } Pipeline = HttpPipelineBuilder.Build( options, perCallPolicies: perCallPolicies, perRetryPolicies: new HttpPipelinePolicy[] { new WebPubSubAuthenticationPolicy(credential) }, new ResponseClassifier() ); }
/// <summary> /// Initializes a new instance of the <see cref="WebPubSubServiceClient"/>. /// </summary> /// <param name="endpoint"></param> /// <param name="hub">Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.</param> /// <param name="credential"></param> /// <param name="options"></param> public WebPubSubServiceClient(Uri endpoint, string hub, AzureKeyCredential credential, WebPubSubServiceClientOptions options) : this(endpoint, credential, options) { _endpoint = endpoint; _hub = hub; _credential = credential; }