Class ExternalServiceBuilder
- Namespace
- Cratis.Chronicle.ExternalServices
- Assembly
- Cratis.Chronicle.dll
Represents an implementation of IExternalServiceBuilder.
public class ExternalServiceBuilder : IExternalServiceBuilder
- Inheritance
-
ExternalServiceBuilder
- Implements
- Inherited Members
- Extension Methods
Constructors
ExternalServiceBuilder()
public ExternalServiceBuilder()
Methods
Build(string, string)
Builds the ExternalServiceDefinition.
public ExternalServiceDefinition Build(string id, string name)
Parameters
idstringThe identifier of the external service.
namestringThe human-readable name of the external service.
Returns
Http(string)
Configures the service as an HTTP endpoint.
public IExternalServiceBuilder Http(string url)
Parameters
urlstringThe base URL of the endpoint.
Returns
- IExternalServiceBuilder
The builder continuation.
MsSql(string, string, string, string, int)
Configures the service as a Microsoft SQL Server database endpoint.
public IExternalServiceBuilder MsSql(string host, string database, string username, string password, int port = 0)
Parameters
hoststringThe database host.
databasestringThe database name.
usernamestringThe username used to connect.
passwordstringThe password used to connect.
portintThe database port. Leave as 0 to use the provider default.
Returns
- IExternalServiceBuilder
The builder continuation.
PostgreSql(string, string, string, string, int)
Configures the service as a PostgreSQL database endpoint.
public IExternalServiceBuilder PostgreSql(string host, string database, string username, string password, int port = 0)
Parameters
hoststringThe database host.
databasestringThe database name.
usernamestringThe username used to connect.
passwordstringThe password used to connect.
portintThe database port. Leave as 0 to use the provider default.
Returns
- IExternalServiceBuilder
The builder continuation.
WithBasicAuth(string, string)
Configures basic authentication for an HTTP endpoint.
public IExternalServiceBuilder WithBasicAuth(string username, string password)
Parameters
Returns
- IExternalServiceBuilder
The builder continuation.
WithBearerToken(string)
Configures bearer token authentication for an HTTP endpoint.
public IExternalServiceBuilder WithBearerToken(string token)
Parameters
tokenstringThe bearer token.
Returns
- IExternalServiceBuilder
The builder continuation.
WithHeader(string, string)
Adds a header to send with every HTTP request.
public IExternalServiceBuilder WithHeader(string key, string value)
Parameters
Returns
- IExternalServiceBuilder
The builder continuation.
WithOAuth(string, string, string)
Configures OAuth authentication for an HTTP endpoint.
public IExternalServiceBuilder WithOAuth(string authority, string clientId, string clientSecret)
Parameters
authoritystringThe OAuth authority.
clientIdstringThe OAuth client ID.
clientSecretstringThe OAuth client secret.
Returns
- IExternalServiceBuilder
The builder continuation.
WithOAuth(string, string, string, string)
Configures OAuth client credentials with an optional scope.
public IExternalServiceBuilder WithOAuth(string authority, string clientId, string clientSecret, string scope)
Parameters
authoritystringThe authority.
clientIdstringThe client identifier.
clientSecretstringThe client secret.
scopestringThe requested scope.
Returns
- IExternalServiceBuilder
The builder continuation.
Exceptions
- NotSupportedException
The builder does not support scoped OAuth configuration.
WithOption(string, string)
Adds a provider-specific option to a database endpoint's connection string.
public IExternalServiceBuilder WithOption(string key, string value)
Parameters
Returns
- IExternalServiceBuilder
The builder continuation.