All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.sisioh.aws4s.dynamodb.model.RichConsumedCapacity.scala Maven / Gradle / Ivy

There is a newer version: 1.0.16
Show newest version
package org.sisioh.aws4s.dynamodb.model

import com.amazonaws.services.dynamodbv2.model.{ Capacity, ConsumedCapacity }
import org.sisioh.aws4s.PimpedType

import scala.collection.JavaConverters._

object ConsumedCapacityFactory {

  def create(): ConsumedCapacity = new ConsumedCapacity()

}

class RichConsumedCapacity(val underlying: ConsumedCapacity) extends AnyVal with PimpedType[ConsumedCapacity] {

  // ---

  def tableNameOpt: Option[Capacity] = Option(underlying.getTable)

  def tableNameOpt_=(value: Option[Capacity]): Unit = underlying.setTable(value.orNull)

  def withTableNameOpt(value: Option[Capacity]): ConsumedCapacity = underlying.withTable(value.orNull)

  // ---

  def localSecondaryIndexesOpt: Option[Map[String, Capacity]] =
    Option(underlying.getLocalSecondaryIndexes).map(_.asScala.toMap)

  def localSecondaryIndexesOpt_=(value: Option[Map[String, Capacity]]): Unit =
    underlying.setLocalSecondaryIndexes(value.map(_.asJava).orNull)

  def withLocalSecondaryIndexesOpt(value: Option[Map[String, Capacity]]): ConsumedCapacity =
    underlying.withLocalSecondaryIndexes(value.map(_.asJava).orNull)

  // ---

  def globalSecondaryIndexesOpt: Option[Map[String, Capacity]] =
    Option(underlying.getGlobalSecondaryIndexes).map(_.asScala.toMap)

  def globalSecondaryIndexesOpt_=(value: Option[Map[String, Capacity]]): Unit =
    underlying.setGlobalSecondaryIndexes(value.map(_.asJava).orNull)

  def withGlobalSecondaryIndexesOpt(value: Option[Map[String, Capacity]]): ConsumedCapacity =
    underlying.withGlobalSecondaryIndexes(value.map(_.asJava).orNull)

  // ---

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy