{-# 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.MobileDeviceAccessMatchedRule
-- 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.MobileDeviceAccessMatchedRule where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The rule that a simulated user matches.
--
-- /See:/ 'newMobileDeviceAccessMatchedRule' smart constructor.
data MobileDeviceAccessMatchedRule = MobileDeviceAccessMatchedRule'
  { -- | Identifier of the rule that a simulated user matches.
    MobileDeviceAccessMatchedRule -> Maybe Text
mobileDeviceAccessRuleId :: Prelude.Maybe Prelude.Text,
    -- | Name of a rule that a simulated user matches.
    MobileDeviceAccessMatchedRule -> Maybe Text
name :: Prelude.Maybe Prelude.Text
  }
  deriving (MobileDeviceAccessMatchedRule
-> MobileDeviceAccessMatchedRule -> Bool
(MobileDeviceAccessMatchedRule
 -> MobileDeviceAccessMatchedRule -> Bool)
-> (MobileDeviceAccessMatchedRule
    -> MobileDeviceAccessMatchedRule -> Bool)
-> Eq MobileDeviceAccessMatchedRule
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MobileDeviceAccessMatchedRule
-> MobileDeviceAccessMatchedRule -> Bool
$c/= :: MobileDeviceAccessMatchedRule
-> MobileDeviceAccessMatchedRule -> Bool
== :: MobileDeviceAccessMatchedRule
-> MobileDeviceAccessMatchedRule -> Bool
$c== :: MobileDeviceAccessMatchedRule
-> MobileDeviceAccessMatchedRule -> Bool
Prelude.Eq, ReadPrec [MobileDeviceAccessMatchedRule]
ReadPrec MobileDeviceAccessMatchedRule
Int -> ReadS MobileDeviceAccessMatchedRule
ReadS [MobileDeviceAccessMatchedRule]
(Int -> ReadS MobileDeviceAccessMatchedRule)
-> ReadS [MobileDeviceAccessMatchedRule]
-> ReadPrec MobileDeviceAccessMatchedRule
-> ReadPrec [MobileDeviceAccessMatchedRule]
-> Read MobileDeviceAccessMatchedRule
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MobileDeviceAccessMatchedRule]
$creadListPrec :: ReadPrec [MobileDeviceAccessMatchedRule]
readPrec :: ReadPrec MobileDeviceAccessMatchedRule
$creadPrec :: ReadPrec MobileDeviceAccessMatchedRule
readList :: ReadS [MobileDeviceAccessMatchedRule]
$creadList :: ReadS [MobileDeviceAccessMatchedRule]
readsPrec :: Int -> ReadS MobileDeviceAccessMatchedRule
$creadsPrec :: Int -> ReadS MobileDeviceAccessMatchedRule
Prelude.Read, Int -> MobileDeviceAccessMatchedRule -> ShowS
[MobileDeviceAccessMatchedRule] -> ShowS
MobileDeviceAccessMatchedRule -> String
(Int -> MobileDeviceAccessMatchedRule -> ShowS)
-> (MobileDeviceAccessMatchedRule -> String)
-> ([MobileDeviceAccessMatchedRule] -> ShowS)
-> Show MobileDeviceAccessMatchedRule
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MobileDeviceAccessMatchedRule] -> ShowS
$cshowList :: [MobileDeviceAccessMatchedRule] -> ShowS
show :: MobileDeviceAccessMatchedRule -> String
$cshow :: MobileDeviceAccessMatchedRule -> String
showsPrec :: Int -> MobileDeviceAccessMatchedRule -> ShowS
$cshowsPrec :: Int -> MobileDeviceAccessMatchedRule -> ShowS
Prelude.Show, (forall x.
 MobileDeviceAccessMatchedRule
 -> Rep MobileDeviceAccessMatchedRule x)
-> (forall x.
    Rep MobileDeviceAccessMatchedRule x
    -> MobileDeviceAccessMatchedRule)
-> Generic MobileDeviceAccessMatchedRule
forall x.
Rep MobileDeviceAccessMatchedRule x
-> MobileDeviceAccessMatchedRule
forall x.
MobileDeviceAccessMatchedRule
-> Rep MobileDeviceAccessMatchedRule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep MobileDeviceAccessMatchedRule x
-> MobileDeviceAccessMatchedRule
$cfrom :: forall x.
MobileDeviceAccessMatchedRule
-> Rep MobileDeviceAccessMatchedRule x
Prelude.Generic)

-- |
-- Create a value of 'MobileDeviceAccessMatchedRule' 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:
--
-- 'mobileDeviceAccessRuleId', 'mobileDeviceAccessMatchedRule_mobileDeviceAccessRuleId' - Identifier of the rule that a simulated user matches.
--
-- 'name', 'mobileDeviceAccessMatchedRule_name' - Name of a rule that a simulated user matches.
newMobileDeviceAccessMatchedRule ::
  MobileDeviceAccessMatchedRule
newMobileDeviceAccessMatchedRule :: MobileDeviceAccessMatchedRule
newMobileDeviceAccessMatchedRule =
  MobileDeviceAccessMatchedRule' :: Maybe Text -> Maybe Text -> MobileDeviceAccessMatchedRule
MobileDeviceAccessMatchedRule'
    { $sel:mobileDeviceAccessRuleId:MobileDeviceAccessMatchedRule' :: Maybe Text
mobileDeviceAccessRuleId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:MobileDeviceAccessMatchedRule' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Identifier of the rule that a simulated user matches.
mobileDeviceAccessMatchedRule_mobileDeviceAccessRuleId :: Lens.Lens' MobileDeviceAccessMatchedRule (Prelude.Maybe Prelude.Text)
mobileDeviceAccessMatchedRule_mobileDeviceAccessRuleId :: (Maybe Text -> f (Maybe Text))
-> MobileDeviceAccessMatchedRule -> f MobileDeviceAccessMatchedRule
mobileDeviceAccessMatchedRule_mobileDeviceAccessRuleId = (MobileDeviceAccessMatchedRule -> Maybe Text)
-> (MobileDeviceAccessMatchedRule
    -> Maybe Text -> MobileDeviceAccessMatchedRule)
-> Lens
     MobileDeviceAccessMatchedRule
     MobileDeviceAccessMatchedRule
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MobileDeviceAccessMatchedRule' {Maybe Text
mobileDeviceAccessRuleId :: Maybe Text
$sel:mobileDeviceAccessRuleId:MobileDeviceAccessMatchedRule' :: MobileDeviceAccessMatchedRule -> Maybe Text
mobileDeviceAccessRuleId} -> Maybe Text
mobileDeviceAccessRuleId) (\s :: MobileDeviceAccessMatchedRule
s@MobileDeviceAccessMatchedRule' {} Maybe Text
a -> MobileDeviceAccessMatchedRule
s {$sel:mobileDeviceAccessRuleId:MobileDeviceAccessMatchedRule' :: Maybe Text
mobileDeviceAccessRuleId = Maybe Text
a} :: MobileDeviceAccessMatchedRule)

-- | Name of a rule that a simulated user matches.
mobileDeviceAccessMatchedRule_name :: Lens.Lens' MobileDeviceAccessMatchedRule (Prelude.Maybe Prelude.Text)
mobileDeviceAccessMatchedRule_name :: (Maybe Text -> f (Maybe Text))
-> MobileDeviceAccessMatchedRule -> f MobileDeviceAccessMatchedRule
mobileDeviceAccessMatchedRule_name = (MobileDeviceAccessMatchedRule -> Maybe Text)
-> (MobileDeviceAccessMatchedRule
    -> Maybe Text -> MobileDeviceAccessMatchedRule)
-> Lens
     MobileDeviceAccessMatchedRule
     MobileDeviceAccessMatchedRule
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MobileDeviceAccessMatchedRule' {Maybe Text
name :: Maybe Text
$sel:name:MobileDeviceAccessMatchedRule' :: MobileDeviceAccessMatchedRule -> Maybe Text
name} -> Maybe Text
name) (\s :: MobileDeviceAccessMatchedRule
s@MobileDeviceAccessMatchedRule' {} Maybe Text
a -> MobileDeviceAccessMatchedRule
s {$sel:name:MobileDeviceAccessMatchedRule' :: Maybe Text
name = Maybe Text
a} :: MobileDeviceAccessMatchedRule)

instance Core.FromJSON MobileDeviceAccessMatchedRule where
  parseJSON :: Value -> Parser MobileDeviceAccessMatchedRule
parseJSON =
    String
-> (Object -> Parser MobileDeviceAccessMatchedRule)
-> Value
-> Parser MobileDeviceAccessMatchedRule
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"MobileDeviceAccessMatchedRule"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> MobileDeviceAccessMatchedRule
MobileDeviceAccessMatchedRule'
            (Maybe Text -> Maybe Text -> MobileDeviceAccessMatchedRule)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> MobileDeviceAccessMatchedRule)
forall (f :: * -> *) a b. Functor 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
"MobileDeviceAccessRuleId")
            Parser (Maybe Text -> MobileDeviceAccessMatchedRule)
-> Parser (Maybe Text) -> Parser MobileDeviceAccessMatchedRule
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
"Name")
      )

instance
  Prelude.Hashable
    MobileDeviceAccessMatchedRule

instance Prelude.NFData MobileDeviceAccessMatchedRule