{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.WorkMail.Types.MobileDeviceAccessOverride
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.WorkMail.Types.MobileDeviceAccessOverride where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.WorkMail.Types.MobileDeviceAccessRuleEffect

-- | The override object.
--
-- /See:/ 'newMobileDeviceAccessOverride' smart constructor.
data MobileDeviceAccessOverride = MobileDeviceAccessOverride'
  { -- | The effect of the override, @ALLOW@ or @DENY@.
    MobileDeviceAccessOverride -> Maybe MobileDeviceAccessRuleEffect
effect :: Prelude.Maybe MobileDeviceAccessRuleEffect,
    -- | The WorkMail user to which the access override applies.
    MobileDeviceAccessOverride -> Maybe Text
userId :: Prelude.Maybe Prelude.Text,
    -- | The date the override was first created.
    MobileDeviceAccessOverride -> Maybe POSIX
dateCreated :: Prelude.Maybe Core.POSIX,
    -- | The date the override was last modified.
    MobileDeviceAccessOverride -> Maybe POSIX
dateModified :: Prelude.Maybe Core.POSIX,
    -- | The device to which the override applies.
    MobileDeviceAccessOverride -> Maybe Text
deviceId :: Prelude.Maybe Prelude.Text,
    -- | A description of the override.
    MobileDeviceAccessOverride -> Maybe Text
description :: Prelude.Maybe Prelude.Text
  }
  deriving (MobileDeviceAccessOverride -> MobileDeviceAccessOverride -> Bool
(MobileDeviceAccessOverride -> MobileDeviceAccessOverride -> Bool)
-> (MobileDeviceAccessOverride
    -> MobileDeviceAccessOverride -> Bool)
-> Eq MobileDeviceAccessOverride
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MobileDeviceAccessOverride -> MobileDeviceAccessOverride -> Bool
$c/= :: MobileDeviceAccessOverride -> MobileDeviceAccessOverride -> Bool
== :: MobileDeviceAccessOverride -> MobileDeviceAccessOverride -> Bool
$c== :: MobileDeviceAccessOverride -> MobileDeviceAccessOverride -> Bool
Prelude.Eq, ReadPrec [MobileDeviceAccessOverride]
ReadPrec MobileDeviceAccessOverride
Int -> ReadS MobileDeviceAccessOverride
ReadS [MobileDeviceAccessOverride]
(Int -> ReadS MobileDeviceAccessOverride)
-> ReadS [MobileDeviceAccessOverride]
-> ReadPrec MobileDeviceAccessOverride
-> ReadPrec [MobileDeviceAccessOverride]
-> Read MobileDeviceAccessOverride
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MobileDeviceAccessOverride]
$creadListPrec :: ReadPrec [MobileDeviceAccessOverride]
readPrec :: ReadPrec MobileDeviceAccessOverride
$creadPrec :: ReadPrec MobileDeviceAccessOverride
readList :: ReadS [MobileDeviceAccessOverride]
$creadList :: ReadS [MobileDeviceAccessOverride]
readsPrec :: Int -> ReadS MobileDeviceAccessOverride
$creadsPrec :: Int -> ReadS MobileDeviceAccessOverride
Prelude.Read, Int -> MobileDeviceAccessOverride -> ShowS
[MobileDeviceAccessOverride] -> ShowS
MobileDeviceAccessOverride -> String
(Int -> MobileDeviceAccessOverride -> ShowS)
-> (MobileDeviceAccessOverride -> String)
-> ([MobileDeviceAccessOverride] -> ShowS)
-> Show MobileDeviceAccessOverride
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MobileDeviceAccessOverride] -> ShowS
$cshowList :: [MobileDeviceAccessOverride] -> ShowS
show :: MobileDeviceAccessOverride -> String
$cshow :: MobileDeviceAccessOverride -> String
showsPrec :: Int -> MobileDeviceAccessOverride -> ShowS
$cshowsPrec :: Int -> MobileDeviceAccessOverride -> ShowS
Prelude.Show, (forall x.
 MobileDeviceAccessOverride -> Rep MobileDeviceAccessOverride x)
-> (forall x.
    Rep MobileDeviceAccessOverride x -> MobileDeviceAccessOverride)
-> Generic MobileDeviceAccessOverride
forall x.
Rep MobileDeviceAccessOverride x -> MobileDeviceAccessOverride
forall x.
MobileDeviceAccessOverride -> Rep MobileDeviceAccessOverride x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep MobileDeviceAccessOverride x -> MobileDeviceAccessOverride
$cfrom :: forall x.
MobileDeviceAccessOverride -> Rep MobileDeviceAccessOverride x
Prelude.Generic)

-- |
-- Create a value of 'MobileDeviceAccessOverride' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'effect', 'mobileDeviceAccessOverride_effect' - The effect of the override, @ALLOW@ or @DENY@.
--
-- 'userId', 'mobileDeviceAccessOverride_userId' - The WorkMail user to which the access override applies.
--
-- 'dateCreated', 'mobileDeviceAccessOverride_dateCreated' - The date the override was first created.
--
-- 'dateModified', 'mobileDeviceAccessOverride_dateModified' - The date the override was last modified.
--
-- 'deviceId', 'mobileDeviceAccessOverride_deviceId' - The device to which the override applies.
--
-- 'description', 'mobileDeviceAccessOverride_description' - A description of the override.
newMobileDeviceAccessOverride ::
  MobileDeviceAccessOverride
newMobileDeviceAccessOverride :: MobileDeviceAccessOverride
newMobileDeviceAccessOverride =
  MobileDeviceAccessOverride' :: Maybe MobileDeviceAccessRuleEffect
-> Maybe Text
-> Maybe POSIX
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> MobileDeviceAccessOverride
MobileDeviceAccessOverride'
    { $sel:effect:MobileDeviceAccessOverride' :: Maybe MobileDeviceAccessRuleEffect
effect =
        Maybe MobileDeviceAccessRuleEffect
forall a. Maybe a
Prelude.Nothing,
      $sel:userId:MobileDeviceAccessOverride' :: Maybe Text
userId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:dateCreated:MobileDeviceAccessOverride' :: Maybe POSIX
dateCreated = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:dateModified:MobileDeviceAccessOverride' :: Maybe POSIX
dateModified = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:deviceId:MobileDeviceAccessOverride' :: Maybe Text
deviceId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:description:MobileDeviceAccessOverride' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The effect of the override, @ALLOW@ or @DENY@.
mobileDeviceAccessOverride_effect :: Lens.Lens' MobileDeviceAccessOverride (Prelude.Maybe MobileDeviceAccessRuleEffect)
mobileDeviceAccessOverride_effect :: (Maybe MobileDeviceAccessRuleEffect
 -> f (Maybe MobileDeviceAccessRuleEffect))
-> MobileDeviceAccessOverride -> f MobileDeviceAccessOverride
mobileDeviceAccessOverride_effect = (MobileDeviceAccessOverride -> Maybe MobileDeviceAccessRuleEffect)
-> (MobileDeviceAccessOverride
    -> Maybe MobileDeviceAccessRuleEffect
    -> MobileDeviceAccessOverride)
-> Lens
     MobileDeviceAccessOverride
     MobileDeviceAccessOverride
     (Maybe MobileDeviceAccessRuleEffect)
     (Maybe MobileDeviceAccessRuleEffect)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MobileDeviceAccessOverride' {Maybe MobileDeviceAccessRuleEffect
effect :: Maybe MobileDeviceAccessRuleEffect
$sel:effect:MobileDeviceAccessOverride' :: MobileDeviceAccessOverride -> Maybe MobileDeviceAccessRuleEffect
effect} -> Maybe MobileDeviceAccessRuleEffect
effect) (\s :: MobileDeviceAccessOverride
s@MobileDeviceAccessOverride' {} Maybe MobileDeviceAccessRuleEffect
a -> MobileDeviceAccessOverride
s {$sel:effect:MobileDeviceAccessOverride' :: Maybe MobileDeviceAccessRuleEffect
effect = Maybe MobileDeviceAccessRuleEffect
a} :: MobileDeviceAccessOverride)

-- | The WorkMail user to which the access override applies.
mobileDeviceAccessOverride_userId :: Lens.Lens' MobileDeviceAccessOverride (Prelude.Maybe Prelude.Text)
mobileDeviceAccessOverride_userId :: (Maybe Text -> f (Maybe Text))
-> MobileDeviceAccessOverride -> f MobileDeviceAccessOverride
mobileDeviceAccessOverride_userId = (MobileDeviceAccessOverride -> Maybe Text)
-> (MobileDeviceAccessOverride
    -> Maybe Text -> MobileDeviceAccessOverride)
-> Lens
     MobileDeviceAccessOverride
     MobileDeviceAccessOverride
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MobileDeviceAccessOverride' {Maybe Text
userId :: Maybe Text
$sel:userId:MobileDeviceAccessOverride' :: MobileDeviceAccessOverride -> Maybe Text
userId} -> Maybe Text
userId) (\s :: MobileDeviceAccessOverride
s@MobileDeviceAccessOverride' {} Maybe Text
a -> MobileDeviceAccessOverride
s {$sel:userId:MobileDeviceAccessOverride' :: Maybe Text
userId = Maybe Text
a} :: MobileDeviceAccessOverride)

-- | The date the override was first created.
mobileDeviceAccessOverride_dateCreated :: Lens.Lens' MobileDeviceAccessOverride (Prelude.Maybe Prelude.UTCTime)
mobileDeviceAccessOverride_dateCreated :: (Maybe UTCTime -> f (Maybe UTCTime))
-> MobileDeviceAccessOverride -> f MobileDeviceAccessOverride
mobileDeviceAccessOverride_dateCreated = (MobileDeviceAccessOverride -> Maybe POSIX)
-> (MobileDeviceAccessOverride
    -> Maybe POSIX -> MobileDeviceAccessOverride)
-> Lens
     MobileDeviceAccessOverride
     MobileDeviceAccessOverride
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MobileDeviceAccessOverride' {Maybe POSIX
dateCreated :: Maybe POSIX
$sel:dateCreated:MobileDeviceAccessOverride' :: MobileDeviceAccessOverride -> Maybe POSIX
dateCreated} -> Maybe POSIX
dateCreated) (\s :: MobileDeviceAccessOverride
s@MobileDeviceAccessOverride' {} Maybe POSIX
a -> MobileDeviceAccessOverride
s {$sel:dateCreated:MobileDeviceAccessOverride' :: Maybe POSIX
dateCreated = Maybe POSIX
a} :: MobileDeviceAccessOverride) ((Maybe POSIX -> f (Maybe POSIX))
 -> MobileDeviceAccessOverride -> f MobileDeviceAccessOverride)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> MobileDeviceAccessOverride
-> f MobileDeviceAccessOverride
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The date the override was last modified.
mobileDeviceAccessOverride_dateModified :: Lens.Lens' MobileDeviceAccessOverride (Prelude.Maybe Prelude.UTCTime)
mobileDeviceAccessOverride_dateModified :: (Maybe UTCTime -> f (Maybe UTCTime))
-> MobileDeviceAccessOverride -> f MobileDeviceAccessOverride
mobileDeviceAccessOverride_dateModified = (MobileDeviceAccessOverride -> Maybe POSIX)
-> (MobileDeviceAccessOverride
    -> Maybe POSIX -> MobileDeviceAccessOverride)
-> Lens
     MobileDeviceAccessOverride
     MobileDeviceAccessOverride
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MobileDeviceAccessOverride' {Maybe POSIX
dateModified :: Maybe POSIX
$sel:dateModified:MobileDeviceAccessOverride' :: MobileDeviceAccessOverride -> Maybe POSIX
dateModified} -> Maybe POSIX
dateModified) (\s :: MobileDeviceAccessOverride
s@MobileDeviceAccessOverride' {} Maybe POSIX
a -> MobileDeviceAccessOverride
s {$sel:dateModified:MobileDeviceAccessOverride' :: Maybe POSIX
dateModified = Maybe POSIX
a} :: MobileDeviceAccessOverride) ((Maybe POSIX -> f (Maybe POSIX))
 -> MobileDeviceAccessOverride -> f MobileDeviceAccessOverride)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> MobileDeviceAccessOverride
-> f MobileDeviceAccessOverride
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The device to which the override applies.
mobileDeviceAccessOverride_deviceId :: Lens.Lens' MobileDeviceAccessOverride (Prelude.Maybe Prelude.Text)
mobileDeviceAccessOverride_deviceId :: (Maybe Text -> f (Maybe Text))
-> MobileDeviceAccessOverride -> f MobileDeviceAccessOverride
mobileDeviceAccessOverride_deviceId = (MobileDeviceAccessOverride -> Maybe Text)
-> (MobileDeviceAccessOverride
    -> Maybe Text -> MobileDeviceAccessOverride)
-> Lens
     MobileDeviceAccessOverride
     MobileDeviceAccessOverride
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MobileDeviceAccessOverride' {Maybe Text
deviceId :: Maybe Text
$sel:deviceId:MobileDeviceAccessOverride' :: MobileDeviceAccessOverride -> Maybe Text
deviceId} -> Maybe Text
deviceId) (\s :: MobileDeviceAccessOverride
s@MobileDeviceAccessOverride' {} Maybe Text
a -> MobileDeviceAccessOverride
s {$sel:deviceId:MobileDeviceAccessOverride' :: Maybe Text
deviceId = Maybe Text
a} :: MobileDeviceAccessOverride)

-- | A description of the override.
mobileDeviceAccessOverride_description :: Lens.Lens' MobileDeviceAccessOverride (Prelude.Maybe Prelude.Text)
mobileDeviceAccessOverride_description :: (Maybe Text -> f (Maybe Text))
-> MobileDeviceAccessOverride -> f MobileDeviceAccessOverride
mobileDeviceAccessOverride_description = (MobileDeviceAccessOverride -> Maybe Text)
-> (MobileDeviceAccessOverride
    -> Maybe Text -> MobileDeviceAccessOverride)
-> Lens
     MobileDeviceAccessOverride
     MobileDeviceAccessOverride
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MobileDeviceAccessOverride' {Maybe Text
description :: Maybe Text
$sel:description:MobileDeviceAccessOverride' :: MobileDeviceAccessOverride -> Maybe Text
description} -> Maybe Text
description) (\s :: MobileDeviceAccessOverride
s@MobileDeviceAccessOverride' {} Maybe Text
a -> MobileDeviceAccessOverride
s {$sel:description:MobileDeviceAccessOverride' :: Maybe Text
description = Maybe Text
a} :: MobileDeviceAccessOverride)

instance Core.FromJSON MobileDeviceAccessOverride where
  parseJSON :: Value -> Parser MobileDeviceAccessOverride
parseJSON =
    String
-> (Object -> Parser MobileDeviceAccessOverride)
-> Value
-> Parser MobileDeviceAccessOverride
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"MobileDeviceAccessOverride"
      ( \Object
x ->
          Maybe MobileDeviceAccessRuleEffect
-> Maybe Text
-> Maybe POSIX
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> MobileDeviceAccessOverride
MobileDeviceAccessOverride'
            (Maybe MobileDeviceAccessRuleEffect
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe Text
 -> MobileDeviceAccessOverride)
-> Parser (Maybe MobileDeviceAccessRuleEffect)
-> Parser
     (Maybe Text
      -> Maybe POSIX
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> MobileDeviceAccessOverride)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe MobileDeviceAccessRuleEffect)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Effect")
            Parser
  (Maybe Text
   -> Maybe POSIX
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> MobileDeviceAccessOverride)
-> Parser (Maybe Text)
-> Parser
     (Maybe POSIX
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> MobileDeviceAccessOverride)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"UserId")
            Parser
  (Maybe POSIX
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> MobileDeviceAccessOverride)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe POSIX
      -> Maybe Text -> Maybe Text -> MobileDeviceAccessOverride)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DateCreated")
            Parser
  (Maybe POSIX
   -> Maybe Text -> Maybe Text -> MobileDeviceAccessOverride)
-> Parser (Maybe POSIX)
-> Parser (Maybe Text -> Maybe Text -> MobileDeviceAccessOverride)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DateModified")
            Parser (Maybe Text -> Maybe Text -> MobileDeviceAccessOverride)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> MobileDeviceAccessOverride)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DeviceId")
            Parser (Maybe Text -> MobileDeviceAccessOverride)
-> Parser (Maybe Text) -> Parser MobileDeviceAccessOverride
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Description")
      )

instance Prelude.Hashable MobileDeviceAccessOverride

instance Prelude.NFData MobileDeviceAccessOverride