Class DestinationUtils
Utilities for the setting up a cognite destination.
Inherited Members
Namespace: Cognite.Extractor.Utils
Assembly: ExtractorUtils.dll
Syntax
public static class DestinationUtils
Fields
| Edit this page View SourceAUTH_CLIENT_NAME
The name of the authenticator client, use this if you wish to add your own HTTP client for authentication.
Declaration
public const string AUTH_CLIENT_NAME = "AuthenticatorClient"
Field Value
Type | Description |
---|---|
string |
Methods
| Edit this page View SourceAddCogniteClient(IServiceCollection, string?, string?, bool, bool, bool, bool)
Adds a configured Cognite client to the services
collection as a transient service
Declaration
public static void AddCogniteClient(this IServiceCollection services, string? appId, string? userAgent = null, bool setLogger = false, bool setMetrics = false, bool setHttpClient = true, bool required = true)
Parameters
Type | Name | Description |
---|---|---|
IServiceCollection | services | The service collection |
string | appId | Identifier of the application using the Cognite API |
string | userAgent | User-Agent header. If added, should conform to RFC 7231: 'Product/Version (Optional comment)' |
bool | setLogger | If true, a ILogger logger is created and used by the client to log calls to the Cognite API (enabled in debug mode) |
bool | setMetrics | If true, a CogniteSdk.IMetrics metrics collector is created and used by the client to report metrics on the number and duration of API requests |
bool | setHttpClient | Default true. If false CogniteSdk Client.Builder is not added to the ServiceCollection. If this is false it must be added before this method is called. |
bool | required | True to fail if cognite configuration is missing |
Configure(Builder, CogniteConfig, string?, string?, IAuthenticator?, ILogger<Client>?, IMetrics?)
Configure a CogniteSdk Client.Builder according to the config
object
Declaration
public static Client.Builder Configure(this Client.Builder clientBuilder, CogniteConfig config, string? appId, string? userAgent = null, IAuthenticator? auth = null, ILogger<Client>? logger = null, IMetrics? metrics = null)
Parameters
Type | Name | Description |
---|---|---|
Client.Builder | clientBuilder | This builder |
CogniteConfig | config | A CogniteConfig configuration object |
string | appId | Identifier of the application using the Cognite API |
string | userAgent | User-agent header |
IAuthenticator | auth | A IAuthenticator authenticator used to obtain bearer access token |
ILogger<Client> | logger | A ILogger logger that the client can use to log calls to the Cognite API (enabled in debug mode) |
IMetrics | metrics | A CogniteSdk.IMetrics metrics collector, that the client can use to report metrics on the number and duration of API requests |
Returns
Type | Description |
---|---|
Client.Builder | A configured builder |
Exceptions
Type | Condition |
---|---|
CogniteUtilsException | Thrown when |
ConfigureCogniteHttpClientHandlers(IHttpClientBuilder)
Add a few HTTP client handlers for retries, timeouts, and certificate policy to an HTTP client builder.
Declaration
public static IHttpClientBuilder ConfigureCogniteHttpClientHandlers(this IHttpClientBuilder builder)
Parameters
Type | Name | Description |
---|---|---|
IHttpClientBuilder | builder | The client builder to modify. |
Returns
Type | Description |
---|---|
IHttpClientBuilder | The given client builder. |
ConfigureSslPolicy(CertificateConfig)
Configure global handling of SSL certificates. This must be called to ignore certificates if you require the .NET standard 2.0 version of the library, since .NET framework lacks local ignoring of SSL errors.
Declaration
public static void ConfigureSslPolicy(CertificateConfig config)
Parameters
Type | Name | Description |
---|---|---|
CertificateConfig | config |