Class AwsBaseService
An abstract base class for AWS services with common functionality for managing AWS service configurations, retries, and circuit breakers.
Inheritance
Implements
Inherited Members
Namespace: Innovt.Cloud.AWS
Assembly: Innovt.Cloud.AWS.dll
Syntax
[CLSCompliant(false)]
public abstract class AwsBaseService : IDisposable
Constructors
| Edit this page View SourceAwsBaseService(ILogger, IAwsConfiguration)
Initializes a new instance of the AwsBaseService class with a logger and AWS configuration.
Declaration
protected AwsBaseService(ILogger logger, IAwsConfiguration configuration)
Parameters
Type | Name | Description |
---|---|---|
ILogger | logger | The logger for logging service activities. |
IAwsConfiguration | configuration | The AWS configuration for the service. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
AwsBaseService(ILogger, IAwsConfiguration, string)
Initializes a new instance of the AwsBaseService class with a logger, AWS configuration, and AWS region.
Declaration
protected AwsBaseService(ILogger logger, IAwsConfiguration configuration, string region)
Parameters
Type | Name | Description |
---|---|---|
ILogger | logger | The logger for logging service activities. |
IAwsConfiguration | configuration | The AWS configuration for the service. |
string | region | The AWS region for the service. |
Properties
| Edit this page View SourceConfiguration
Declaration
protected IAwsConfiguration Configuration { get; }
Property Value
Type | Description |
---|---|
IAwsConfiguration |
ExponentialBackoffInSeconds
It represents the exponential backoffice in seconds
Declaration
public int ExponentialBackoffInSeconds { get; set; }
Property Value
Type | Description |
---|---|
int |
Logger
Gets the logger for logging service activities.
Declaration
protected ILogger Logger { get; }
Property Value
Type | Description |
---|---|
ILogger |
Methods
| Edit this page View SourceCreateCircuitBreaker<T, T1>()
Declaration
protected virtual AsyncCircuitBreakerPolicy CreateCircuitBreaker<T, T1>() where T : Exception where T1 : Exception
Returns
Type | Description |
---|---|
AsyncCircuitBreakerPolicy |
Type Parameters
Name | Description |
---|---|
T | |
T1 |
CreateDefaultRetryAsyncPolicy()
Basic Retry Policy using AmazonServiceException
Declaration
protected virtual AsyncRetryPolicy CreateDefaultRetryAsyncPolicy()
Returns
Type | Description |
---|---|
AsyncRetryPolicy |
CreateDefaultRetryPolicy()
Creates a default retry policy for handling AmazonServiceException exceptions with specific HTTP status codes(ServiceUnavailable or InternalServerError).
Declaration
protected virtual RetryPolicy CreateDefaultRetryPolicy()
Returns
Type | Description |
---|---|
RetryPolicy |
CreateRetryAsyncPolicy<T>()
Creates an asynchronous retry policy for handling exceptions of type T.
Declaration
protected virtual AsyncRetryPolicy CreateRetryAsyncPolicy<T>() where T : Exception
Returns
Type | Description |
---|---|
AsyncRetryPolicy | An asynchronous retry policy. |
Type Parameters
Name | Description |
---|---|
T | The type of exception to handle. |
CreateRetryAsyncPolicy<T, T1>()
Creates an asynchronous retry policy for handling exceptions of type T and T1.
Declaration
protected virtual AsyncRetryPolicy CreateRetryAsyncPolicy<T, T1>() where T : Exception where T1 : Exception
Returns
Type | Description |
---|---|
AsyncRetryPolicy | An asynchronous retry policy. |
Type Parameters
Name | Description |
---|---|
T | The first type of exception to handle. |
T1 | The second type of exception to handle. |
CreateRetryAsyncPolicy<T, T1, T2>()
Declaration
protected virtual AsyncRetryPolicy CreateRetryAsyncPolicy<T, T1, T2>() where T : Exception where T1 : Exception where T2 : Exception
Returns
Type | Description |
---|---|
AsyncRetryPolicy |
Type Parameters
Name | Description |
---|---|
T | |
T1 | |
T2 |
CreateRetryAsyncPolicy<T, T1, T2, T3>()
Declaration
protected virtual AsyncRetryPolicy CreateRetryAsyncPolicy<T, T1, T2, T3>() where T : Exception where T1 : Exception where T2 : Exception where T3 : Exception
Returns
Type | Description |
---|---|
AsyncRetryPolicy |
Type Parameters
Name | Description |
---|---|
T | |
T1 | |
T2 | |
T3 |
CreateRetryAsyncPolicy<T, T1, T2, T3, T4>()
Declaration
protected virtual AsyncRetryPolicy CreateRetryAsyncPolicy<T, T1, T2, T3, T4>() where T : Exception where T1 : Exception where T2 : Exception where T3 : Exception where T4 : Exception
Returns
Type | Description |
---|---|
AsyncRetryPolicy |
Type Parameters
Name | Description |
---|---|
T | |
T1 | |
T2 | |
T3 | |
T4 |
CreateService<T>()
This method will decide about Configuration or Profile AWS Services
Declaration
protected T CreateService<T>() where T : IAmazonService
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
Dispose()
Disposes of the resources used by the service.
Declaration
public void Dispose()
Dispose(bool)
Disposes of resources used by the AwsBaseService.
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
bool | disposing | True if called from the Dispose method; false if called from the finalizer. |
DisposeServices()
Disposes of any services used by the AwsBaseService.
Declaration
protected abstract void DisposeServices()
~AwsBaseService()
Finalizer for AwsBaseService.
Declaration
protected ~AwsBaseService()
GetServiceRegionEndPoint()
Gets the AWS service region endpoint based on the configured region.
Declaration
protected RegionEndpoint? GetServiceRegionEndPoint()
Returns
Type | Description |
---|---|
RegionEndpoint | The AWS service region endpoint. |