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

zio.aws.workmail.model.MobileDeviceAccessRule.scala Maven / Gradle / Ivy

There is a newer version: 7.28.29.5
Show newest version
package zio.aws.workmail.model
import java.time.Instant
import zio.prelude.data.Optional
import zio.aws.core.{AwsError, BuilderHelper}
import zio.ZIO
import zio.aws.workmail.model.primitives.{
  DeviceType,
  MobileDeviceAccessRuleDescription,
  MobileDeviceAccessRuleId,
  Timestamp,
  DeviceUserAgent,
  DeviceModel,
  MobileDeviceAccessRuleName,
  DeviceOperatingSystem
}
import scala.jdk.CollectionConverters._
final case class MobileDeviceAccessRule(
    mobileDeviceAccessRuleId: Optional[MobileDeviceAccessRuleId] =
      Optional.Absent,
    name: Optional[MobileDeviceAccessRuleName] = Optional.Absent,
    description: Optional[MobileDeviceAccessRuleDescription] = Optional.Absent,
    effect: Optional[zio.aws.workmail.model.MobileDeviceAccessRuleEffect] =
      Optional.Absent,
    deviceTypes: Optional[Iterable[DeviceType]] = Optional.Absent,
    notDeviceTypes: Optional[Iterable[DeviceType]] = Optional.Absent,
    deviceModels: Optional[Iterable[DeviceModel]] = Optional.Absent,
    notDeviceModels: Optional[Iterable[DeviceModel]] = Optional.Absent,
    deviceOperatingSystems: Optional[Iterable[DeviceOperatingSystem]] =
      Optional.Absent,
    notDeviceOperatingSystems: Optional[Iterable[DeviceOperatingSystem]] =
      Optional.Absent,
    deviceUserAgents: Optional[Iterable[DeviceUserAgent]] = Optional.Absent,
    notDeviceUserAgents: Optional[Iterable[DeviceUserAgent]] = Optional.Absent,
    dateCreated: Optional[Timestamp] = Optional.Absent,
    dateModified: Optional[Timestamp] = Optional.Absent
) {
  def buildAwsValue()
      : software.amazon.awssdk.services.workmail.model.MobileDeviceAccessRule = {
    import MobileDeviceAccessRule.zioAwsBuilderHelper.BuilderOps
    software.amazon.awssdk.services.workmail.model.MobileDeviceAccessRule
      .builder()
      .optionallyWith(
        mobileDeviceAccessRuleId.map(value =>
          MobileDeviceAccessRuleId.unwrap(value): java.lang.String
        )
      )(_.mobileDeviceAccessRuleId)
      .optionallyWith(
        name.map(value =>
          MobileDeviceAccessRuleName.unwrap(value): java.lang.String
        )
      )(_.name)
      .optionallyWith(
        description.map(value =>
          MobileDeviceAccessRuleDescription.unwrap(value): java.lang.String
        )
      )(_.description)
      .optionallyWith(effect.map(value => value.unwrap))(_.effect)
      .optionallyWith(
        deviceTypes.map(value =>
          value.map { item =>
            DeviceType.unwrap(item): java.lang.String
          }.asJavaCollection
        )
      )(_.deviceTypes)
      .optionallyWith(
        notDeviceTypes.map(value =>
          value.map { item =>
            DeviceType.unwrap(item): java.lang.String
          }.asJavaCollection
        )
      )(_.notDeviceTypes)
      .optionallyWith(
        deviceModels.map(value =>
          value.map { item =>
            DeviceModel.unwrap(item): java.lang.String
          }.asJavaCollection
        )
      )(_.deviceModels)
      .optionallyWith(
        notDeviceModels.map(value =>
          value.map { item =>
            DeviceModel.unwrap(item): java.lang.String
          }.asJavaCollection
        )
      )(_.notDeviceModels)
      .optionallyWith(
        deviceOperatingSystems.map(value =>
          value.map { item =>
            DeviceOperatingSystem.unwrap(item): java.lang.String
          }.asJavaCollection
        )
      )(_.deviceOperatingSystems)
      .optionallyWith(
        notDeviceOperatingSystems.map(value =>
          value.map { item =>
            DeviceOperatingSystem.unwrap(item): java.lang.String
          }.asJavaCollection
        )
      )(_.notDeviceOperatingSystems)
      .optionallyWith(
        deviceUserAgents.map(value =>
          value.map { item =>
            DeviceUserAgent.unwrap(item): java.lang.String
          }.asJavaCollection
        )
      )(_.deviceUserAgents)
      .optionallyWith(
        notDeviceUserAgents.map(value =>
          value.map { item =>
            DeviceUserAgent.unwrap(item): java.lang.String
          }.asJavaCollection
        )
      )(_.notDeviceUserAgents)
      .optionallyWith(
        dateCreated.map(value => Timestamp.unwrap(value): Instant)
      )(_.dateCreated)
      .optionallyWith(
        dateModified.map(value => Timestamp.unwrap(value): Instant)
      )(_.dateModified)
      .build()
  }
  def asReadOnly: zio.aws.workmail.model.MobileDeviceAccessRule.ReadOnly =
    zio.aws.workmail.model.MobileDeviceAccessRule.wrap(buildAwsValue())
}
object MobileDeviceAccessRule {
  private lazy val zioAwsBuilderHelper: BuilderHelper[
    software.amazon.awssdk.services.workmail.model.MobileDeviceAccessRule
  ] = BuilderHelper.apply
  trait ReadOnly {
    def asEditable: zio.aws.workmail.model.MobileDeviceAccessRule =
      zio.aws.workmail.model.MobileDeviceAccessRule(
        mobileDeviceAccessRuleId.map(value => value),
        name.map(value => value),
        description.map(value => value),
        effect.map(value => value),
        deviceTypes.map(value => value),
        notDeviceTypes.map(value => value),
        deviceModels.map(value => value),
        notDeviceModels.map(value => value),
        deviceOperatingSystems.map(value => value),
        notDeviceOperatingSystems.map(value => value),
        deviceUserAgents.map(value => value),
        notDeviceUserAgents.map(value => value),
        dateCreated.map(value => value),
        dateModified.map(value => value)
      )
    def mobileDeviceAccessRuleId: Optional[MobileDeviceAccessRuleId]
    def name: Optional[MobileDeviceAccessRuleName]
    def description: Optional[MobileDeviceAccessRuleDescription]
    def effect: Optional[zio.aws.workmail.model.MobileDeviceAccessRuleEffect]
    def deviceTypes: Optional[List[DeviceType]]
    def notDeviceTypes: Optional[List[DeviceType]]
    def deviceModels: Optional[List[DeviceModel]]
    def notDeviceModels: Optional[List[DeviceModel]]
    def deviceOperatingSystems: Optional[List[DeviceOperatingSystem]]
    def notDeviceOperatingSystems: Optional[List[DeviceOperatingSystem]]
    def deviceUserAgents: Optional[List[DeviceUserAgent]]
    def notDeviceUserAgents: Optional[List[DeviceUserAgent]]
    def dateCreated: Optional[Timestamp]
    def dateModified: Optional[Timestamp]
    def getMobileDeviceAccessRuleId
        : ZIO[Any, AwsError, MobileDeviceAccessRuleId] = AwsError
      .unwrapOptionField("mobileDeviceAccessRuleId", mobileDeviceAccessRuleId)
    def getName: ZIO[Any, AwsError, MobileDeviceAccessRuleName] =
      AwsError.unwrapOptionField("name", name)
    def getDescription: ZIO[Any, AwsError, MobileDeviceAccessRuleDescription] =
      AwsError.unwrapOptionField("description", description)
    def getEffect: ZIO[
      Any,
      AwsError,
      zio.aws.workmail.model.MobileDeviceAccessRuleEffect
    ] = AwsError.unwrapOptionField("effect", effect)
    def getDeviceTypes: ZIO[Any, AwsError, List[DeviceType]] =
      AwsError.unwrapOptionField("deviceTypes", deviceTypes)
    def getNotDeviceTypes: ZIO[Any, AwsError, List[DeviceType]] =
      AwsError.unwrapOptionField("notDeviceTypes", notDeviceTypes)
    def getDeviceModels: ZIO[Any, AwsError, List[DeviceModel]] =
      AwsError.unwrapOptionField("deviceModels", deviceModels)
    def getNotDeviceModels: ZIO[Any, AwsError, List[DeviceModel]] =
      AwsError.unwrapOptionField("notDeviceModels", notDeviceModels)
    def getDeviceOperatingSystems
        : ZIO[Any, AwsError, List[DeviceOperatingSystem]] = AwsError
      .unwrapOptionField("deviceOperatingSystems", deviceOperatingSystems)
    def getNotDeviceOperatingSystems
        : ZIO[Any, AwsError, List[DeviceOperatingSystem]] = AwsError
      .unwrapOptionField("notDeviceOperatingSystems", notDeviceOperatingSystems)
    def getDeviceUserAgents: ZIO[Any, AwsError, List[DeviceUserAgent]] =
      AwsError.unwrapOptionField("deviceUserAgents", deviceUserAgents)
    def getNotDeviceUserAgents: ZIO[Any, AwsError, List[DeviceUserAgent]] =
      AwsError.unwrapOptionField("notDeviceUserAgents", notDeviceUserAgents)
    def getDateCreated: ZIO[Any, AwsError, Timestamp] =
      AwsError.unwrapOptionField("dateCreated", dateCreated)
    def getDateModified: ZIO[Any, AwsError, Timestamp] =
      AwsError.unwrapOptionField("dateModified", dateModified)
  }
  private final class Wrapper(
      impl: software.amazon.awssdk.services.workmail.model.MobileDeviceAccessRule
  ) extends zio.aws.workmail.model.MobileDeviceAccessRule.ReadOnly {
    override val mobileDeviceAccessRuleId: Optional[MobileDeviceAccessRuleId] =
      zio.aws.core.internal
        .optionalFromNullable(impl.mobileDeviceAccessRuleId())
        .map(value =>
          zio.aws.workmail.model.primitives.MobileDeviceAccessRuleId(value)
        )
    override val name: Optional[MobileDeviceAccessRuleName] =
      zio.aws.core.internal
        .optionalFromNullable(impl.name())
        .map(value =>
          zio.aws.workmail.model.primitives.MobileDeviceAccessRuleName(value)
        )
    override val description: Optional[MobileDeviceAccessRuleDescription] =
      zio.aws.core.internal
        .optionalFromNullable(impl.description())
        .map(value =>
          zio.aws.workmail.model.primitives
            .MobileDeviceAccessRuleDescription(value)
        )
    override val effect
        : Optional[zio.aws.workmail.model.MobileDeviceAccessRuleEffect] =
      zio.aws.core.internal
        .optionalFromNullable(impl.effect())
        .map(value =>
          zio.aws.workmail.model.MobileDeviceAccessRuleEffect.wrap(value)
        )
    override val deviceTypes: Optional[List[DeviceType]] = zio.aws.core.internal
      .optionalFromNullable(impl.deviceTypes())
      .map(value =>
        value.asScala.map { item =>
          zio.aws.workmail.model.primitives.DeviceType(item)
        }.toList
      )
    override val notDeviceTypes: Optional[List[DeviceType]] =
      zio.aws.core.internal
        .optionalFromNullable(impl.notDeviceTypes())
        .map(value =>
          value.asScala.map { item =>
            zio.aws.workmail.model.primitives.DeviceType(item)
          }.toList
        )
    override val deviceModels: Optional[List[DeviceModel]] =
      zio.aws.core.internal
        .optionalFromNullable(impl.deviceModels())
        .map(value =>
          value.asScala.map { item =>
            zio.aws.workmail.model.primitives.DeviceModel(item)
          }.toList
        )
    override val notDeviceModels: Optional[List[DeviceModel]] =
      zio.aws.core.internal
        .optionalFromNullable(impl.notDeviceModels())
        .map(value =>
          value.asScala.map { item =>
            zio.aws.workmail.model.primitives.DeviceModel(item)
          }.toList
        )
    override val deviceOperatingSystems: Optional[List[DeviceOperatingSystem]] =
      zio.aws.core.internal
        .optionalFromNullable(impl.deviceOperatingSystems())
        .map(value =>
          value.asScala.map { item =>
            zio.aws.workmail.model.primitives.DeviceOperatingSystem(item)
          }.toList
        )
    override val notDeviceOperatingSystems
        : Optional[List[DeviceOperatingSystem]] = zio.aws.core.internal
      .optionalFromNullable(impl.notDeviceOperatingSystems())
      .map(value =>
        value.asScala.map { item =>
          zio.aws.workmail.model.primitives.DeviceOperatingSystem(item)
        }.toList
      )
    override val deviceUserAgents: Optional[List[DeviceUserAgent]] =
      zio.aws.core.internal
        .optionalFromNullable(impl.deviceUserAgents())
        .map(value =>
          value.asScala.map { item =>
            zio.aws.workmail.model.primitives.DeviceUserAgent(item)
          }.toList
        )
    override val notDeviceUserAgents: Optional[List[DeviceUserAgent]] =
      zio.aws.core.internal
        .optionalFromNullable(impl.notDeviceUserAgents())
        .map(value =>
          value.asScala.map { item =>
            zio.aws.workmail.model.primitives.DeviceUserAgent(item)
          }.toList
        )
    override val dateCreated: Optional[Timestamp] = zio.aws.core.internal
      .optionalFromNullable(impl.dateCreated())
      .map(value => zio.aws.workmail.model.primitives.Timestamp(value))
    override val dateModified: Optional[Timestamp] = zio.aws.core.internal
      .optionalFromNullable(impl.dateModified())
      .map(value => zio.aws.workmail.model.primitives.Timestamp(value))
  }
  def wrap(
      impl: software.amazon.awssdk.services.workmail.model.MobileDeviceAccessRule
  ): zio.aws.workmail.model.MobileDeviceAccessRule.ReadOnly = new Wrapper(impl)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy