object DynamoDb
An idiomatic DynamoDb client integrated with Monix ecosystem.
It is built on top of the DynamoDbAsyncClient, reason why all the exposed methods expect an implicit instance of the client to be in the scope of the call.
- Source
- DynamoDb.scala
- Alphabetic
- By Inheritance
- DynamoDb
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def create(credentialsProvider: AwsCredentialsProvider, region: Region, endpoint: Option[String] = None, httpClient: Option[SdkAsyncHttpClient] = None): Resource[Task, DynamoDb]
Creates a Resource that will use the passed-by-parameter AWS configurations to acquire and release a Monix DynamoDb client.
Creates a Resource that will use the passed-by-parameter AWS configurations to acquire and release a Monix DynamoDb client.
Example
import cats.effect.Resource import monix.eval.Task import software.amazon.awssdk.auth.credentials.DefaultCredentialsProvider import software.amazon.awssdk.regions.Region val defaultCredentials = DefaultCredentialsProvider.create() val dynamoDbResource: Resource[Task, DynamoDb] = DynamoDb.create(defaultCredentials, Region.AWS_GLOBAL)
- credentialsProvider
the strategy for loading credentials and authenticate to AWS DynamoDb
- region
an Amazon Web Services region that hosts a set of Amazon services.
- endpoint
the endpoint url with which the SDK should communicate.
- httpClient
sets the SdkAsyncHttpClient that the SDK service client will use to make HTTP calls.
- returns
a Resource of Task that allocates and releases a Monix DynamoDb client.
- def createUnsafe(credentialsProvider: AwsCredentialsProvider, region: Region, endpoint: Option[String] = None, httpClient: Option[SdkAsyncHttpClient] = None): DynamoDb
Creates a new DynamoDb instance out of the the passed AWS configurations.
Creates a new DynamoDb instance out of the the passed AWS configurations.
It provides a fast forward access to the DynamoDb that avoids dealing with Resource, however in this case, the created resources will not be released like in create. Thus, it is the user's responsability to close the connection.
Example
import monix.execution.Scheduler.Implicits.global import software.amazon.awssdk.auth.credentials.DefaultCredentialsProvider import software.amazon.awssdk.regions.Region val defaultCred = DefaultCredentialsProvider.create() val dynamoDb: DynamoDb = DynamoDb.createUnsafe(defaultCred, Region.AWS_GLOBAL) // do your stuff here dynamoDb.close.runToFuture
- credentialsProvider
Strategy for loading credentials and authenticate to AWS.
- region
An Amazon Web Services region that hosts a set of Amazon services.
- endpoint
The endpoint url which the SDK should communicate to.
- httpClient
Sets the SdkAsyncHttpClient that the SDK service client will use to make HTTP calls.
- returns
a Resource of Task that allocates and releases a Monix DynamoDb client.
- Annotations
- @UnsafeBecauseImpure()
- def createUnsafe(dynamoDbAsyncClient: DynamoDbAsyncClient): DynamoDb
Creates a instance of DynamoDb out of a DynamoDbAsyncClient.
Creates a instance of DynamoDb out of a DynamoDbAsyncClient.
It provides a fast forward access to the DynamoDb that avoids dealing with Resource.
Unsafe because the state of the passed DynamoDbAsyncClient is not guaranteed, it can either be malformed or closed, which would result in underlying failures.
- dynamoDbAsyncClient
an instance of a DynamoDbAsyncClient.
- returns
An instance of the Monix DynamoDb client
- Annotations
- @UnsafeBecauseImpure()
- See also
DynamoDb.fromConfig and DynamoDb.create for a pure usage of DynamoDb. They both will make sure that the connection is created with the required resources and guarantee that the client was not previously closed.
Example
import software.amazon.awssdk.auth.credentials.DefaultCredentialsProvider import software.amazon.awssdk.regions.Region.AWS_GLOBAL import software.amazon.awssdk.services.dynamodb.DynamoDbAsyncClient val asyncClient: DynamoDbAsyncClient = DynamoDbAsyncClient .builder() .credentialsProvider(DefaultCredentialsProvider.create()) .region(AWS_GLOBAL) .build() val dynamoDb: DynamoDb = DynamoDb.createUnsafe(asyncClient)
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- def fromConfig(monixAwsConf: Task[MonixAwsConf]): Resource[Task, DynamoDb]
Provides a resource that uses the values from the config file to acquire and release a DynamoDb instance.
Provides a resource that uses the values from the config file to acquire and release a DynamoDb instance.
The config will come from MonixAwsConf which it is actually obtained from the
application.conf
file present under theresources
folder.Example
import monix.connect.aws.auth.MonixAwsConf import monix.eval.Task import monix.connect.dynamodb.DynamoDb val awsConf: Task[MonixAwsConf] = MonixAwsConf.load() DynamoDb.fromConfig(awsConf).use { dynamoDb => //business logic here Task.unit }
- monixAwsConf
a task containing the monix aws config read from config file.
- returns
a Resource of Task that acquires and releases DynamoDb.
- def fromConfig(monixAwsConf: MonixAwsConf): Resource[Task, DynamoDb]
Provides a resource that uses the values from the config file to acquire and release a DynamoDb instance.
Provides a resource that uses the values from the config file to acquire and release a DynamoDb instance.
The config will come from MonixAwsConf which it is actually obtained from the
application.conf
file present under theresources
folder.Example
import monix.connect.aws.auth.MonixAwsConf import monix.connect.dynamodb.DynamoDb import monix.eval.Task import software.amazon.awssdk.regions.Region MonixAwsConf.load().flatMap{ awsConf => // you can update your config from code too val updatedAwsConf = awsConf.copy(region = Region.AP_SOUTH_1) DynamoDb.fromConfig(updatedAwsConf).use { dynamoDb => //business logic here Task.unit } }
- monixAwsConf
the monix aws config read from config file.
- returns
a Resource of Task that acquires and releases DynamoDb.
- def fromConfig(namingConvention: NamingConvention = KebabCase): Resource[Task, DynamoDb]
Provides a resource that uses the values from the config file to acquire and release a DynamoDb instance.
Provides a resource that uses the values from the config file to acquire and release a DynamoDb instance.
It does not requires any input parameter as it expect the aws config to be set from
application.conf
, which has to be placed under theresources
folder and will overwrite the defaults values from:https://github.com/monix/monix-connect/blob/master/aws-auth/src/main/resources/reference.conf
.Example
import monix.connect.aws.auth.MonixAwsConf import monix.connect.dynamodb.DynamoDb import monix.eval.Task DynamoDb.fromConfig.use { dynamoDb => //business logic here Task.unit }
- returns
a Resource of Task that allocates and releases a Monix DynamoDb client.
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
Deprecated Value Members
- def consumer[In <: DynamoDbRequest, Out <: DynamoDbResponse](retries: Int = 0, delayAfterFailure: Option[FiniteDuration] = None)(implicit dynamoDbOp: DynamoDbOp[In, Out], client: DynamoDbAsyncClient): Consumer[In, Unit]
- Annotations
- @deprecated
- Deprecated
moved to the companion trait as
sink
- def fromConfig: Resource[Task, DynamoDb]
Provides a resource that uses the values from the config file to acquire and release a DynamoDb instance.
Provides a resource that uses the values from the config file to acquire and release a DynamoDb instance.
It does not requires any input parameter as it expect the aws config to be set from
application.conf
, which has to be placed under theresources
folder and will overwrite the defaults values from:https://github.com/monix/monix-connect/blob/master/aws-auth/src/main/resources/reference.conf
.Example
import monix.connect.aws.auth.MonixAwsConf import monix.connect.dynamodb.DynamoDb import monix.eval.Task DynamoDb.fromConfig.use { dynamoDb => //business logic here Task.unit }
- returns
a Resource of Task that allocates and releases a Monix DynamoDb client.
- Annotations
- @deprecated
- Deprecated
(Since version 0.6.1) Use
fromConfig(namingConvention)
- def transformer[In <: DynamoDbRequest, Out <: DynamoDbResponse](retries: Int = 0, delayAfterFailure: Option[FiniteDuration] = None)(implicit dynamoDbOp: DynamoDbOp[In, Out], client: DynamoDbAsyncClient): (Observable[In]) => Observable[Out]
- Annotations
- @deprecated
- Deprecated
moved to the companion trait for safer usage