{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# 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.CreateMobileDeviceAccessRule
-- 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)
--
-- Creates a new mobile device access rule for the specified Amazon
-- WorkMail organization.
module Amazonka.WorkMail.CreateMobileDeviceAccessRule
  ( -- * Creating a Request
    CreateMobileDeviceAccessRule (..),
    newCreateMobileDeviceAccessRule,

    -- * Request Lenses
    createMobileDeviceAccessRule_clientToken,
    createMobileDeviceAccessRule_deviceUserAgents,
    createMobileDeviceAccessRule_deviceTypes,
    createMobileDeviceAccessRule_notDeviceTypes,
    createMobileDeviceAccessRule_notDeviceOperatingSystems,
    createMobileDeviceAccessRule_deviceModels,
    createMobileDeviceAccessRule_deviceOperatingSystems,
    createMobileDeviceAccessRule_description,
    createMobileDeviceAccessRule_notDeviceUserAgents,
    createMobileDeviceAccessRule_notDeviceModels,
    createMobileDeviceAccessRule_organizationId,
    createMobileDeviceAccessRule_name,
    createMobileDeviceAccessRule_effect,

    -- * Destructuring the Response
    CreateMobileDeviceAccessRuleResponse (..),
    newCreateMobileDeviceAccessRuleResponse,

    -- * Response Lenses
    createMobileDeviceAccessRuleResponse_mobileDeviceAccessRuleId,
    createMobileDeviceAccessRuleResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.WorkMail.Types

-- | /See:/ 'newCreateMobileDeviceAccessRule' smart constructor.
data CreateMobileDeviceAccessRule = CreateMobileDeviceAccessRule'
  { -- | The idempotency token for the client request.
    CreateMobileDeviceAccessRule -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
    -- | Device user agents that the rule will match.
    CreateMobileDeviceAccessRule -> Maybe (NonEmpty Text)
deviceUserAgents :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
    -- | Device types that the rule will match.
    CreateMobileDeviceAccessRule -> Maybe (NonEmpty Text)
deviceTypes :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
    -- | Device types that the rule __will not__ match. All other device types
    -- will match.
    CreateMobileDeviceAccessRule -> Maybe (NonEmpty Text)
notDeviceTypes :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
    -- | Device operating systems that the rule __will not__ match. All other
    -- device operating systems will match.
    CreateMobileDeviceAccessRule -> Maybe (NonEmpty Text)
notDeviceOperatingSystems :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
    -- | Device models that the rule will match.
    CreateMobileDeviceAccessRule -> Maybe (NonEmpty Text)
deviceModels :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
    -- | Device operating systems that the rule will match.
    CreateMobileDeviceAccessRule -> Maybe (NonEmpty Text)
deviceOperatingSystems :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
    -- | The rule description.
    CreateMobileDeviceAccessRule -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | Device user agents that the rule __will not__ match. All other device
    -- user agents will match.
    CreateMobileDeviceAccessRule -> Maybe (NonEmpty Text)
notDeviceUserAgents :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
    -- | Device models that the rule __will not__ match. All other device models
    -- will match.
    CreateMobileDeviceAccessRule -> Maybe (NonEmpty Text)
notDeviceModels :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
    -- | The Amazon WorkMail organization under which the rule will be created.
    CreateMobileDeviceAccessRule -> Text
organizationId :: Prelude.Text,
    -- | The rule name.
    CreateMobileDeviceAccessRule -> Text
name :: Prelude.Text,
    -- | The effect of the rule when it matches. Allowed values are @ALLOW@ or
    -- @DENY@.
    CreateMobileDeviceAccessRule -> MobileDeviceAccessRuleEffect
effect :: MobileDeviceAccessRuleEffect
  }
  deriving (CreateMobileDeviceAccessRule
-> CreateMobileDeviceAccessRule -> Bool
(CreateMobileDeviceAccessRule
 -> CreateMobileDeviceAccessRule -> Bool)
-> (CreateMobileDeviceAccessRule
    -> CreateMobileDeviceAccessRule -> Bool)
-> Eq CreateMobileDeviceAccessRule
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateMobileDeviceAccessRule
-> CreateMobileDeviceAccessRule -> Bool
$c/= :: CreateMobileDeviceAccessRule
-> CreateMobileDeviceAccessRule -> Bool
== :: CreateMobileDeviceAccessRule
-> CreateMobileDeviceAccessRule -> Bool
$c== :: CreateMobileDeviceAccessRule
-> CreateMobileDeviceAccessRule -> Bool
Prelude.Eq, ReadPrec [CreateMobileDeviceAccessRule]
ReadPrec CreateMobileDeviceAccessRule
Int -> ReadS CreateMobileDeviceAccessRule
ReadS [CreateMobileDeviceAccessRule]
(Int -> ReadS CreateMobileDeviceAccessRule)
-> ReadS [CreateMobileDeviceAccessRule]
-> ReadPrec CreateMobileDeviceAccessRule
-> ReadPrec [CreateMobileDeviceAccessRule]
-> Read CreateMobileDeviceAccessRule
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateMobileDeviceAccessRule]
$creadListPrec :: ReadPrec [CreateMobileDeviceAccessRule]
readPrec :: ReadPrec CreateMobileDeviceAccessRule
$creadPrec :: ReadPrec CreateMobileDeviceAccessRule
readList :: ReadS [CreateMobileDeviceAccessRule]
$creadList :: ReadS [CreateMobileDeviceAccessRule]
readsPrec :: Int -> ReadS CreateMobileDeviceAccessRule
$creadsPrec :: Int -> ReadS CreateMobileDeviceAccessRule
Prelude.Read, Int -> CreateMobileDeviceAccessRule -> ShowS
[CreateMobileDeviceAccessRule] -> ShowS
CreateMobileDeviceAccessRule -> String
(Int -> CreateMobileDeviceAccessRule -> ShowS)
-> (CreateMobileDeviceAccessRule -> String)
-> ([CreateMobileDeviceAccessRule] -> ShowS)
-> Show CreateMobileDeviceAccessRule
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateMobileDeviceAccessRule] -> ShowS
$cshowList :: [CreateMobileDeviceAccessRule] -> ShowS
show :: CreateMobileDeviceAccessRule -> String
$cshow :: CreateMobileDeviceAccessRule -> String
showsPrec :: Int -> CreateMobileDeviceAccessRule -> ShowS
$cshowsPrec :: Int -> CreateMobileDeviceAccessRule -> ShowS
Prelude.Show, (forall x.
 CreateMobileDeviceAccessRule -> Rep CreateMobileDeviceAccessRule x)
-> (forall x.
    Rep CreateMobileDeviceAccessRule x -> CreateMobileDeviceAccessRule)
-> Generic CreateMobileDeviceAccessRule
forall x.
Rep CreateMobileDeviceAccessRule x -> CreateMobileDeviceAccessRule
forall x.
CreateMobileDeviceAccessRule -> Rep CreateMobileDeviceAccessRule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateMobileDeviceAccessRule x -> CreateMobileDeviceAccessRule
$cfrom :: forall x.
CreateMobileDeviceAccessRule -> Rep CreateMobileDeviceAccessRule x
Prelude.Generic)

-- |
-- Create a value of 'CreateMobileDeviceAccessRule' 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:
--
-- 'clientToken', 'createMobileDeviceAccessRule_clientToken' - The idempotency token for the client request.
--
-- 'deviceUserAgents', 'createMobileDeviceAccessRule_deviceUserAgents' - Device user agents that the rule will match.
--
-- 'deviceTypes', 'createMobileDeviceAccessRule_deviceTypes' - Device types that the rule will match.
--
-- 'notDeviceTypes', 'createMobileDeviceAccessRule_notDeviceTypes' - Device types that the rule __will not__ match. All other device types
-- will match.
--
-- 'notDeviceOperatingSystems', 'createMobileDeviceAccessRule_notDeviceOperatingSystems' - Device operating systems that the rule __will not__ match. All other
-- device operating systems will match.
--
-- 'deviceModels', 'createMobileDeviceAccessRule_deviceModels' - Device models that the rule will match.
--
-- 'deviceOperatingSystems', 'createMobileDeviceAccessRule_deviceOperatingSystems' - Device operating systems that the rule will match.
--
-- 'description', 'createMobileDeviceAccessRule_description' - The rule description.
--
-- 'notDeviceUserAgents', 'createMobileDeviceAccessRule_notDeviceUserAgents' - Device user agents that the rule __will not__ match. All other device
-- user agents will match.
--
-- 'notDeviceModels', 'createMobileDeviceAccessRule_notDeviceModels' - Device models that the rule __will not__ match. All other device models
-- will match.
--
-- 'organizationId', 'createMobileDeviceAccessRule_organizationId' - The Amazon WorkMail organization under which the rule will be created.
--
-- 'name', 'createMobileDeviceAccessRule_name' - The rule name.
--
-- 'effect', 'createMobileDeviceAccessRule_effect' - The effect of the rule when it matches. Allowed values are @ALLOW@ or
-- @DENY@.
newCreateMobileDeviceAccessRule ::
  -- | 'organizationId'
  Prelude.Text ->
  -- | 'name'
  Prelude.Text ->
  -- | 'effect'
  MobileDeviceAccessRuleEffect ->
  CreateMobileDeviceAccessRule
newCreateMobileDeviceAccessRule :: Text
-> Text
-> MobileDeviceAccessRuleEffect
-> CreateMobileDeviceAccessRule
newCreateMobileDeviceAccessRule
  Text
pOrganizationId_
  Text
pName_
  MobileDeviceAccessRuleEffect
pEffect_ =
    CreateMobileDeviceAccessRule' :: Maybe Text
-> Maybe (NonEmpty Text)
-> Maybe (NonEmpty Text)
-> Maybe (NonEmpty Text)
-> Maybe (NonEmpty Text)
-> Maybe (NonEmpty Text)
-> Maybe (NonEmpty Text)
-> Maybe Text
-> Maybe (NonEmpty Text)
-> Maybe (NonEmpty Text)
-> Text
-> Text
-> MobileDeviceAccessRuleEffect
-> CreateMobileDeviceAccessRule
CreateMobileDeviceAccessRule'
      { $sel:clientToken:CreateMobileDeviceAccessRule' :: Maybe Text
clientToken =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:deviceUserAgents:CreateMobileDeviceAccessRule' :: Maybe (NonEmpty Text)
deviceUserAgents = Maybe (NonEmpty Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:deviceTypes:CreateMobileDeviceAccessRule' :: Maybe (NonEmpty Text)
deviceTypes = Maybe (NonEmpty Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:notDeviceTypes:CreateMobileDeviceAccessRule' :: Maybe (NonEmpty Text)
notDeviceTypes = Maybe (NonEmpty Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:notDeviceOperatingSystems:CreateMobileDeviceAccessRule' :: Maybe (NonEmpty Text)
notDeviceOperatingSystems = Maybe (NonEmpty Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:deviceModels:CreateMobileDeviceAccessRule' :: Maybe (NonEmpty Text)
deviceModels = Maybe (NonEmpty Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:deviceOperatingSystems:CreateMobileDeviceAccessRule' :: Maybe (NonEmpty Text)
deviceOperatingSystems = Maybe (NonEmpty Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:description:CreateMobileDeviceAccessRule' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:notDeviceUserAgents:CreateMobileDeviceAccessRule' :: Maybe (NonEmpty Text)
notDeviceUserAgents = Maybe (NonEmpty Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:notDeviceModels:CreateMobileDeviceAccessRule' :: Maybe (NonEmpty Text)
notDeviceModels = Maybe (NonEmpty Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:organizationId:CreateMobileDeviceAccessRule' :: Text
organizationId = Text
pOrganizationId_,
        $sel:name:CreateMobileDeviceAccessRule' :: Text
name = Text
pName_,
        $sel:effect:CreateMobileDeviceAccessRule' :: MobileDeviceAccessRuleEffect
effect = MobileDeviceAccessRuleEffect
pEffect_
      }

-- | The idempotency token for the client request.
createMobileDeviceAccessRule_clientToken :: Lens.Lens' CreateMobileDeviceAccessRule (Prelude.Maybe Prelude.Text)
createMobileDeviceAccessRule_clientToken :: (Maybe Text -> f (Maybe Text))
-> CreateMobileDeviceAccessRule -> f CreateMobileDeviceAccessRule
createMobileDeviceAccessRule_clientToken = (CreateMobileDeviceAccessRule -> Maybe Text)
-> (CreateMobileDeviceAccessRule
    -> Maybe Text -> CreateMobileDeviceAccessRule)
-> Lens
     CreateMobileDeviceAccessRule
     CreateMobileDeviceAccessRule
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMobileDeviceAccessRule' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:CreateMobileDeviceAccessRule' :: CreateMobileDeviceAccessRule -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: CreateMobileDeviceAccessRule
s@CreateMobileDeviceAccessRule' {} Maybe Text
a -> CreateMobileDeviceAccessRule
s {$sel:clientToken:CreateMobileDeviceAccessRule' :: Maybe Text
clientToken = Maybe Text
a} :: CreateMobileDeviceAccessRule)

-- | Device user agents that the rule will match.
createMobileDeviceAccessRule_deviceUserAgents :: Lens.Lens' CreateMobileDeviceAccessRule (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
createMobileDeviceAccessRule_deviceUserAgents :: (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> CreateMobileDeviceAccessRule -> f CreateMobileDeviceAccessRule
createMobileDeviceAccessRule_deviceUserAgents = (CreateMobileDeviceAccessRule -> Maybe (NonEmpty Text))
-> (CreateMobileDeviceAccessRule
    -> Maybe (NonEmpty Text) -> CreateMobileDeviceAccessRule)
-> Lens
     CreateMobileDeviceAccessRule
     CreateMobileDeviceAccessRule
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMobileDeviceAccessRule' {Maybe (NonEmpty Text)
deviceUserAgents :: Maybe (NonEmpty Text)
$sel:deviceUserAgents:CreateMobileDeviceAccessRule' :: CreateMobileDeviceAccessRule -> Maybe (NonEmpty Text)
deviceUserAgents} -> Maybe (NonEmpty Text)
deviceUserAgents) (\s :: CreateMobileDeviceAccessRule
s@CreateMobileDeviceAccessRule' {} Maybe (NonEmpty Text)
a -> CreateMobileDeviceAccessRule
s {$sel:deviceUserAgents:CreateMobileDeviceAccessRule' :: Maybe (NonEmpty Text)
deviceUserAgents = Maybe (NonEmpty Text)
a} :: CreateMobileDeviceAccessRule) ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
 -> CreateMobileDeviceAccessRule -> f CreateMobileDeviceAccessRule)
-> ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
    -> Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> CreateMobileDeviceAccessRule
-> f CreateMobileDeviceAccessRule
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
-> Iso
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
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
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Device types that the rule will match.
createMobileDeviceAccessRule_deviceTypes :: Lens.Lens' CreateMobileDeviceAccessRule (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
createMobileDeviceAccessRule_deviceTypes :: (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> CreateMobileDeviceAccessRule -> f CreateMobileDeviceAccessRule
createMobileDeviceAccessRule_deviceTypes = (CreateMobileDeviceAccessRule -> Maybe (NonEmpty Text))
-> (CreateMobileDeviceAccessRule
    -> Maybe (NonEmpty Text) -> CreateMobileDeviceAccessRule)
-> Lens
     CreateMobileDeviceAccessRule
     CreateMobileDeviceAccessRule
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMobileDeviceAccessRule' {Maybe (NonEmpty Text)
deviceTypes :: Maybe (NonEmpty Text)
$sel:deviceTypes:CreateMobileDeviceAccessRule' :: CreateMobileDeviceAccessRule -> Maybe (NonEmpty Text)
deviceTypes} -> Maybe (NonEmpty Text)
deviceTypes) (\s :: CreateMobileDeviceAccessRule
s@CreateMobileDeviceAccessRule' {} Maybe (NonEmpty Text)
a -> CreateMobileDeviceAccessRule
s {$sel:deviceTypes:CreateMobileDeviceAccessRule' :: Maybe (NonEmpty Text)
deviceTypes = Maybe (NonEmpty Text)
a} :: CreateMobileDeviceAccessRule) ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
 -> CreateMobileDeviceAccessRule -> f CreateMobileDeviceAccessRule)
-> ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
    -> Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> CreateMobileDeviceAccessRule
-> f CreateMobileDeviceAccessRule
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
-> Iso
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
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
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Device types that the rule __will not__ match. All other device types
-- will match.
createMobileDeviceAccessRule_notDeviceTypes :: Lens.Lens' CreateMobileDeviceAccessRule (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
createMobileDeviceAccessRule_notDeviceTypes :: (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> CreateMobileDeviceAccessRule -> f CreateMobileDeviceAccessRule
createMobileDeviceAccessRule_notDeviceTypes = (CreateMobileDeviceAccessRule -> Maybe (NonEmpty Text))
-> (CreateMobileDeviceAccessRule
    -> Maybe (NonEmpty Text) -> CreateMobileDeviceAccessRule)
-> Lens
     CreateMobileDeviceAccessRule
     CreateMobileDeviceAccessRule
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMobileDeviceAccessRule' {Maybe (NonEmpty Text)
notDeviceTypes :: Maybe (NonEmpty Text)
$sel:notDeviceTypes:CreateMobileDeviceAccessRule' :: CreateMobileDeviceAccessRule -> Maybe (NonEmpty Text)
notDeviceTypes} -> Maybe (NonEmpty Text)
notDeviceTypes) (\s :: CreateMobileDeviceAccessRule
s@CreateMobileDeviceAccessRule' {} Maybe (NonEmpty Text)
a -> CreateMobileDeviceAccessRule
s {$sel:notDeviceTypes:CreateMobileDeviceAccessRule' :: Maybe (NonEmpty Text)
notDeviceTypes = Maybe (NonEmpty Text)
a} :: CreateMobileDeviceAccessRule) ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
 -> CreateMobileDeviceAccessRule -> f CreateMobileDeviceAccessRule)
-> ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
    -> Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> CreateMobileDeviceAccessRule
-> f CreateMobileDeviceAccessRule
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
-> Iso
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
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
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Device operating systems that the rule __will not__ match. All other
-- device operating systems will match.
createMobileDeviceAccessRule_notDeviceOperatingSystems :: Lens.Lens' CreateMobileDeviceAccessRule (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
createMobileDeviceAccessRule_notDeviceOperatingSystems :: (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> CreateMobileDeviceAccessRule -> f CreateMobileDeviceAccessRule
createMobileDeviceAccessRule_notDeviceOperatingSystems = (CreateMobileDeviceAccessRule -> Maybe (NonEmpty Text))
-> (CreateMobileDeviceAccessRule
    -> Maybe (NonEmpty Text) -> CreateMobileDeviceAccessRule)
-> Lens
     CreateMobileDeviceAccessRule
     CreateMobileDeviceAccessRule
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMobileDeviceAccessRule' {Maybe (NonEmpty Text)
notDeviceOperatingSystems :: Maybe (NonEmpty Text)
$sel:notDeviceOperatingSystems:CreateMobileDeviceAccessRule' :: CreateMobileDeviceAccessRule -> Maybe (NonEmpty Text)
notDeviceOperatingSystems} -> Maybe (NonEmpty Text)
notDeviceOperatingSystems) (\s :: CreateMobileDeviceAccessRule
s@CreateMobileDeviceAccessRule' {} Maybe (NonEmpty Text)
a -> CreateMobileDeviceAccessRule
s {$sel:notDeviceOperatingSystems:CreateMobileDeviceAccessRule' :: Maybe (NonEmpty Text)
notDeviceOperatingSystems = Maybe (NonEmpty Text)
a} :: CreateMobileDeviceAccessRule) ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
 -> CreateMobileDeviceAccessRule -> f CreateMobileDeviceAccessRule)
-> ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
    -> Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> CreateMobileDeviceAccessRule
-> f CreateMobileDeviceAccessRule
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
-> Iso
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
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
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Device models that the rule will match.
createMobileDeviceAccessRule_deviceModels :: Lens.Lens' CreateMobileDeviceAccessRule (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
createMobileDeviceAccessRule_deviceModels :: (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> CreateMobileDeviceAccessRule -> f CreateMobileDeviceAccessRule
createMobileDeviceAccessRule_deviceModels = (CreateMobileDeviceAccessRule -> Maybe (NonEmpty Text))
-> (CreateMobileDeviceAccessRule
    -> Maybe (NonEmpty Text) -> CreateMobileDeviceAccessRule)
-> Lens
     CreateMobileDeviceAccessRule
     CreateMobileDeviceAccessRule
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMobileDeviceAccessRule' {Maybe (NonEmpty Text)
deviceModels :: Maybe (NonEmpty Text)
$sel:deviceModels:CreateMobileDeviceAccessRule' :: CreateMobileDeviceAccessRule -> Maybe (NonEmpty Text)
deviceModels} -> Maybe (NonEmpty Text)
deviceModels) (\s :: CreateMobileDeviceAccessRule
s@CreateMobileDeviceAccessRule' {} Maybe (NonEmpty Text)
a -> CreateMobileDeviceAccessRule
s {$sel:deviceModels:CreateMobileDeviceAccessRule' :: Maybe (NonEmpty Text)
deviceModels = Maybe (NonEmpty Text)
a} :: CreateMobileDeviceAccessRule) ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
 -> CreateMobileDeviceAccessRule -> f CreateMobileDeviceAccessRule)
-> ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
    -> Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> CreateMobileDeviceAccessRule
-> f CreateMobileDeviceAccessRule
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
-> Iso
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
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
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Device operating systems that the rule will match.
createMobileDeviceAccessRule_deviceOperatingSystems :: Lens.Lens' CreateMobileDeviceAccessRule (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
createMobileDeviceAccessRule_deviceOperatingSystems :: (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> CreateMobileDeviceAccessRule -> f CreateMobileDeviceAccessRule
createMobileDeviceAccessRule_deviceOperatingSystems = (CreateMobileDeviceAccessRule -> Maybe (NonEmpty Text))
-> (CreateMobileDeviceAccessRule
    -> Maybe (NonEmpty Text) -> CreateMobileDeviceAccessRule)
-> Lens
     CreateMobileDeviceAccessRule
     CreateMobileDeviceAccessRule
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMobileDeviceAccessRule' {Maybe (NonEmpty Text)
deviceOperatingSystems :: Maybe (NonEmpty Text)
$sel:deviceOperatingSystems:CreateMobileDeviceAccessRule' :: CreateMobileDeviceAccessRule -> Maybe (NonEmpty Text)
deviceOperatingSystems} -> Maybe (NonEmpty Text)
deviceOperatingSystems) (\s :: CreateMobileDeviceAccessRule
s@CreateMobileDeviceAccessRule' {} Maybe (NonEmpty Text)
a -> CreateMobileDeviceAccessRule
s {$sel:deviceOperatingSystems:CreateMobileDeviceAccessRule' :: Maybe (NonEmpty Text)
deviceOperatingSystems = Maybe (NonEmpty Text)
a} :: CreateMobileDeviceAccessRule) ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
 -> CreateMobileDeviceAccessRule -> f CreateMobileDeviceAccessRule)
-> ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
    -> Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> CreateMobileDeviceAccessRule
-> f CreateMobileDeviceAccessRule
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
-> Iso
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
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
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The rule description.
createMobileDeviceAccessRule_description :: Lens.Lens' CreateMobileDeviceAccessRule (Prelude.Maybe Prelude.Text)
createMobileDeviceAccessRule_description :: (Maybe Text -> f (Maybe Text))
-> CreateMobileDeviceAccessRule -> f CreateMobileDeviceAccessRule
createMobileDeviceAccessRule_description = (CreateMobileDeviceAccessRule -> Maybe Text)
-> (CreateMobileDeviceAccessRule
    -> Maybe Text -> CreateMobileDeviceAccessRule)
-> Lens
     CreateMobileDeviceAccessRule
     CreateMobileDeviceAccessRule
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMobileDeviceAccessRule' {Maybe Text
description :: Maybe Text
$sel:description:CreateMobileDeviceAccessRule' :: CreateMobileDeviceAccessRule -> Maybe Text
description} -> Maybe Text
description) (\s :: CreateMobileDeviceAccessRule
s@CreateMobileDeviceAccessRule' {} Maybe Text
a -> CreateMobileDeviceAccessRule
s {$sel:description:CreateMobileDeviceAccessRule' :: Maybe Text
description = Maybe Text
a} :: CreateMobileDeviceAccessRule)

-- | Device user agents that the rule __will not__ match. All other device
-- user agents will match.
createMobileDeviceAccessRule_notDeviceUserAgents :: Lens.Lens' CreateMobileDeviceAccessRule (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
createMobileDeviceAccessRule_notDeviceUserAgents :: (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> CreateMobileDeviceAccessRule -> f CreateMobileDeviceAccessRule
createMobileDeviceAccessRule_notDeviceUserAgents = (CreateMobileDeviceAccessRule -> Maybe (NonEmpty Text))
-> (CreateMobileDeviceAccessRule
    -> Maybe (NonEmpty Text) -> CreateMobileDeviceAccessRule)
-> Lens
     CreateMobileDeviceAccessRule
     CreateMobileDeviceAccessRule
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMobileDeviceAccessRule' {Maybe (NonEmpty Text)
notDeviceUserAgents :: Maybe (NonEmpty Text)
$sel:notDeviceUserAgents:CreateMobileDeviceAccessRule' :: CreateMobileDeviceAccessRule -> Maybe (NonEmpty Text)
notDeviceUserAgents} -> Maybe (NonEmpty Text)
notDeviceUserAgents) (\s :: CreateMobileDeviceAccessRule
s@CreateMobileDeviceAccessRule' {} Maybe (NonEmpty Text)
a -> CreateMobileDeviceAccessRule
s {$sel:notDeviceUserAgents:CreateMobileDeviceAccessRule' :: Maybe (NonEmpty Text)
notDeviceUserAgents = Maybe (NonEmpty Text)
a} :: CreateMobileDeviceAccessRule) ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
 -> CreateMobileDeviceAccessRule -> f CreateMobileDeviceAccessRule)
-> ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
    -> Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> CreateMobileDeviceAccessRule
-> f CreateMobileDeviceAccessRule
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
-> Iso
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
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
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Device models that the rule __will not__ match. All other device models
-- will match.
createMobileDeviceAccessRule_notDeviceModels :: Lens.Lens' CreateMobileDeviceAccessRule (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
createMobileDeviceAccessRule_notDeviceModels :: (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> CreateMobileDeviceAccessRule -> f CreateMobileDeviceAccessRule
createMobileDeviceAccessRule_notDeviceModels = (CreateMobileDeviceAccessRule -> Maybe (NonEmpty Text))
-> (CreateMobileDeviceAccessRule
    -> Maybe (NonEmpty Text) -> CreateMobileDeviceAccessRule)
-> Lens
     CreateMobileDeviceAccessRule
     CreateMobileDeviceAccessRule
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMobileDeviceAccessRule' {Maybe (NonEmpty Text)
notDeviceModels :: Maybe (NonEmpty Text)
$sel:notDeviceModels:CreateMobileDeviceAccessRule' :: CreateMobileDeviceAccessRule -> Maybe (NonEmpty Text)
notDeviceModels} -> Maybe (NonEmpty Text)
notDeviceModels) (\s :: CreateMobileDeviceAccessRule
s@CreateMobileDeviceAccessRule' {} Maybe (NonEmpty Text)
a -> CreateMobileDeviceAccessRule
s {$sel:notDeviceModels:CreateMobileDeviceAccessRule' :: Maybe (NonEmpty Text)
notDeviceModels = Maybe (NonEmpty Text)
a} :: CreateMobileDeviceAccessRule) ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
 -> CreateMobileDeviceAccessRule -> f CreateMobileDeviceAccessRule)
-> ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
    -> Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> CreateMobileDeviceAccessRule
-> f CreateMobileDeviceAccessRule
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
-> Iso
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
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
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The Amazon WorkMail organization under which the rule will be created.
createMobileDeviceAccessRule_organizationId :: Lens.Lens' CreateMobileDeviceAccessRule Prelude.Text
createMobileDeviceAccessRule_organizationId :: (Text -> f Text)
-> CreateMobileDeviceAccessRule -> f CreateMobileDeviceAccessRule
createMobileDeviceAccessRule_organizationId = (CreateMobileDeviceAccessRule -> Text)
-> (CreateMobileDeviceAccessRule
    -> Text -> CreateMobileDeviceAccessRule)
-> Lens
     CreateMobileDeviceAccessRule CreateMobileDeviceAccessRule Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMobileDeviceAccessRule' {Text
organizationId :: Text
$sel:organizationId:CreateMobileDeviceAccessRule' :: CreateMobileDeviceAccessRule -> Text
organizationId} -> Text
organizationId) (\s :: CreateMobileDeviceAccessRule
s@CreateMobileDeviceAccessRule' {} Text
a -> CreateMobileDeviceAccessRule
s {$sel:organizationId:CreateMobileDeviceAccessRule' :: Text
organizationId = Text
a} :: CreateMobileDeviceAccessRule)

-- | The rule name.
createMobileDeviceAccessRule_name :: Lens.Lens' CreateMobileDeviceAccessRule Prelude.Text
createMobileDeviceAccessRule_name :: (Text -> f Text)
-> CreateMobileDeviceAccessRule -> f CreateMobileDeviceAccessRule
createMobileDeviceAccessRule_name = (CreateMobileDeviceAccessRule -> Text)
-> (CreateMobileDeviceAccessRule
    -> Text -> CreateMobileDeviceAccessRule)
-> Lens
     CreateMobileDeviceAccessRule CreateMobileDeviceAccessRule Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMobileDeviceAccessRule' {Text
name :: Text
$sel:name:CreateMobileDeviceAccessRule' :: CreateMobileDeviceAccessRule -> Text
name} -> Text
name) (\s :: CreateMobileDeviceAccessRule
s@CreateMobileDeviceAccessRule' {} Text
a -> CreateMobileDeviceAccessRule
s {$sel:name:CreateMobileDeviceAccessRule' :: Text
name = Text
a} :: CreateMobileDeviceAccessRule)

-- | The effect of the rule when it matches. Allowed values are @ALLOW@ or
-- @DENY@.
createMobileDeviceAccessRule_effect :: Lens.Lens' CreateMobileDeviceAccessRule MobileDeviceAccessRuleEffect
createMobileDeviceAccessRule_effect :: (MobileDeviceAccessRuleEffect -> f MobileDeviceAccessRuleEffect)
-> CreateMobileDeviceAccessRule -> f CreateMobileDeviceAccessRule
createMobileDeviceAccessRule_effect = (CreateMobileDeviceAccessRule -> MobileDeviceAccessRuleEffect)
-> (CreateMobileDeviceAccessRule
    -> MobileDeviceAccessRuleEffect -> CreateMobileDeviceAccessRule)
-> Lens
     CreateMobileDeviceAccessRule
     CreateMobileDeviceAccessRule
     MobileDeviceAccessRuleEffect
     MobileDeviceAccessRuleEffect
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMobileDeviceAccessRule' {MobileDeviceAccessRuleEffect
effect :: MobileDeviceAccessRuleEffect
$sel:effect:CreateMobileDeviceAccessRule' :: CreateMobileDeviceAccessRule -> MobileDeviceAccessRuleEffect
effect} -> MobileDeviceAccessRuleEffect
effect) (\s :: CreateMobileDeviceAccessRule
s@CreateMobileDeviceAccessRule' {} MobileDeviceAccessRuleEffect
a -> CreateMobileDeviceAccessRule
s {$sel:effect:CreateMobileDeviceAccessRule' :: MobileDeviceAccessRuleEffect
effect = MobileDeviceAccessRuleEffect
a} :: CreateMobileDeviceAccessRule)

instance Core.AWSRequest CreateMobileDeviceAccessRule where
  type
    AWSResponse CreateMobileDeviceAccessRule =
      CreateMobileDeviceAccessRuleResponse
  request :: CreateMobileDeviceAccessRule
-> Request CreateMobileDeviceAccessRule
request = Service
-> CreateMobileDeviceAccessRule
-> Request CreateMobileDeviceAccessRule
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateMobileDeviceAccessRule
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateMobileDeviceAccessRule)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateMobileDeviceAccessRule))
-> Logger
-> Service
-> Proxy CreateMobileDeviceAccessRule
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateMobileDeviceAccessRule)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text -> Int -> CreateMobileDeviceAccessRuleResponse
CreateMobileDeviceAccessRuleResponse'
            (Maybe Text -> Int -> CreateMobileDeviceAccessRuleResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateMobileDeviceAccessRuleResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"MobileDeviceAccessRuleId")
            Either String (Int -> CreateMobileDeviceAccessRuleResponse)
-> Either String Int
-> Either String CreateMobileDeviceAccessRuleResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance
  Prelude.Hashable
    CreateMobileDeviceAccessRule

instance Prelude.NFData CreateMobileDeviceAccessRule

instance Core.ToHeaders CreateMobileDeviceAccessRule where
  toHeaders :: CreateMobileDeviceAccessRule -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateMobileDeviceAccessRule -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"WorkMailService.CreateMobileDeviceAccessRule" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON CreateMobileDeviceAccessRule where
  toJSON :: CreateMobileDeviceAccessRule -> Value
toJSON CreateMobileDeviceAccessRule' {Maybe (NonEmpty Text)
Maybe Text
Text
MobileDeviceAccessRuleEffect
effect :: MobileDeviceAccessRuleEffect
name :: Text
organizationId :: Text
notDeviceModels :: Maybe (NonEmpty Text)
notDeviceUserAgents :: Maybe (NonEmpty Text)
description :: Maybe Text
deviceOperatingSystems :: Maybe (NonEmpty Text)
deviceModels :: Maybe (NonEmpty Text)
notDeviceOperatingSystems :: Maybe (NonEmpty Text)
notDeviceTypes :: Maybe (NonEmpty Text)
deviceTypes :: Maybe (NonEmpty Text)
deviceUserAgents :: Maybe (NonEmpty Text)
clientToken :: Maybe Text
$sel:effect:CreateMobileDeviceAccessRule' :: CreateMobileDeviceAccessRule -> MobileDeviceAccessRuleEffect
$sel:name:CreateMobileDeviceAccessRule' :: CreateMobileDeviceAccessRule -> Text
$sel:organizationId:CreateMobileDeviceAccessRule' :: CreateMobileDeviceAccessRule -> Text
$sel:notDeviceModels:CreateMobileDeviceAccessRule' :: CreateMobileDeviceAccessRule -> Maybe (NonEmpty Text)
$sel:notDeviceUserAgents:CreateMobileDeviceAccessRule' :: CreateMobileDeviceAccessRule -> Maybe (NonEmpty Text)
$sel:description:CreateMobileDeviceAccessRule' :: CreateMobileDeviceAccessRule -> Maybe Text
$sel:deviceOperatingSystems:CreateMobileDeviceAccessRule' :: CreateMobileDeviceAccessRule -> Maybe (NonEmpty Text)
$sel:deviceModels:CreateMobileDeviceAccessRule' :: CreateMobileDeviceAccessRule -> Maybe (NonEmpty Text)
$sel:notDeviceOperatingSystems:CreateMobileDeviceAccessRule' :: CreateMobileDeviceAccessRule -> Maybe (NonEmpty Text)
$sel:notDeviceTypes:CreateMobileDeviceAccessRule' :: CreateMobileDeviceAccessRule -> Maybe (NonEmpty Text)
$sel:deviceTypes:CreateMobileDeviceAccessRule' :: CreateMobileDeviceAccessRule -> Maybe (NonEmpty Text)
$sel:deviceUserAgents:CreateMobileDeviceAccessRule' :: CreateMobileDeviceAccessRule -> Maybe (NonEmpty Text)
$sel:clientToken:CreateMobileDeviceAccessRule' :: CreateMobileDeviceAccessRule -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"ClientToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
clientToken,
            (Text
"DeviceUserAgents" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (NonEmpty Text -> Pair) -> Maybe (NonEmpty Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Text)
deviceUserAgents,
            (Text
"DeviceTypes" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (NonEmpty Text -> Pair) -> Maybe (NonEmpty Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Text)
deviceTypes,
            (Text
"NotDeviceTypes" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (NonEmpty Text -> Pair) -> Maybe (NonEmpty Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Text)
notDeviceTypes,
            (Text
"NotDeviceOperatingSystems" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (NonEmpty Text -> Pair) -> Maybe (NonEmpty Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Text)
notDeviceOperatingSystems,
            (Text
"DeviceModels" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (NonEmpty Text -> Pair) -> Maybe (NonEmpty Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Text)
deviceModels,
            (Text
"DeviceOperatingSystems" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (NonEmpty Text -> Pair) -> Maybe (NonEmpty Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Text)
deviceOperatingSystems,
            (Text
"Description" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
description,
            (Text
"NotDeviceUserAgents" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (NonEmpty Text -> Pair) -> Maybe (NonEmpty Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Text)
notDeviceUserAgents,
            (Text
"NotDeviceModels" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (NonEmpty Text -> Pair) -> Maybe (NonEmpty Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Text)
notDeviceModels,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"OrganizationId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
organizationId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Effect" Text -> MobileDeviceAccessRuleEffect -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= MobileDeviceAccessRuleEffect
effect)
          ]
      )

instance Core.ToPath CreateMobileDeviceAccessRule where
  toPath :: CreateMobileDeviceAccessRule -> ByteString
toPath = ByteString -> CreateMobileDeviceAccessRule -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery CreateMobileDeviceAccessRule where
  toQuery :: CreateMobileDeviceAccessRule -> QueryString
toQuery = QueryString -> CreateMobileDeviceAccessRule -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newCreateMobileDeviceAccessRuleResponse' smart constructor.
data CreateMobileDeviceAccessRuleResponse = CreateMobileDeviceAccessRuleResponse'
  { -- | The identifier for the newly created mobile device access rule.
    CreateMobileDeviceAccessRuleResponse -> Maybe Text
mobileDeviceAccessRuleId :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    CreateMobileDeviceAccessRuleResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateMobileDeviceAccessRuleResponse
-> CreateMobileDeviceAccessRuleResponse -> Bool
(CreateMobileDeviceAccessRuleResponse
 -> CreateMobileDeviceAccessRuleResponse -> Bool)
-> (CreateMobileDeviceAccessRuleResponse
    -> CreateMobileDeviceAccessRuleResponse -> Bool)
-> Eq CreateMobileDeviceAccessRuleResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateMobileDeviceAccessRuleResponse
-> CreateMobileDeviceAccessRuleResponse -> Bool
$c/= :: CreateMobileDeviceAccessRuleResponse
-> CreateMobileDeviceAccessRuleResponse -> Bool
== :: CreateMobileDeviceAccessRuleResponse
-> CreateMobileDeviceAccessRuleResponse -> Bool
$c== :: CreateMobileDeviceAccessRuleResponse
-> CreateMobileDeviceAccessRuleResponse -> Bool
Prelude.Eq, ReadPrec [CreateMobileDeviceAccessRuleResponse]
ReadPrec CreateMobileDeviceAccessRuleResponse
Int -> ReadS CreateMobileDeviceAccessRuleResponse
ReadS [CreateMobileDeviceAccessRuleResponse]
(Int -> ReadS CreateMobileDeviceAccessRuleResponse)
-> ReadS [CreateMobileDeviceAccessRuleResponse]
-> ReadPrec CreateMobileDeviceAccessRuleResponse
-> ReadPrec [CreateMobileDeviceAccessRuleResponse]
-> Read CreateMobileDeviceAccessRuleResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateMobileDeviceAccessRuleResponse]
$creadListPrec :: ReadPrec [CreateMobileDeviceAccessRuleResponse]
readPrec :: ReadPrec CreateMobileDeviceAccessRuleResponse
$creadPrec :: ReadPrec CreateMobileDeviceAccessRuleResponse
readList :: ReadS [CreateMobileDeviceAccessRuleResponse]
$creadList :: ReadS [CreateMobileDeviceAccessRuleResponse]
readsPrec :: Int -> ReadS CreateMobileDeviceAccessRuleResponse
$creadsPrec :: Int -> ReadS CreateMobileDeviceAccessRuleResponse
Prelude.Read, Int -> CreateMobileDeviceAccessRuleResponse -> ShowS
[CreateMobileDeviceAccessRuleResponse] -> ShowS
CreateMobileDeviceAccessRuleResponse -> String
(Int -> CreateMobileDeviceAccessRuleResponse -> ShowS)
-> (CreateMobileDeviceAccessRuleResponse -> String)
-> ([CreateMobileDeviceAccessRuleResponse] -> ShowS)
-> Show CreateMobileDeviceAccessRuleResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateMobileDeviceAccessRuleResponse] -> ShowS
$cshowList :: [CreateMobileDeviceAccessRuleResponse] -> ShowS
show :: CreateMobileDeviceAccessRuleResponse -> String
$cshow :: CreateMobileDeviceAccessRuleResponse -> String
showsPrec :: Int -> CreateMobileDeviceAccessRuleResponse -> ShowS
$cshowsPrec :: Int -> CreateMobileDeviceAccessRuleResponse -> ShowS
Prelude.Show, (forall x.
 CreateMobileDeviceAccessRuleResponse
 -> Rep CreateMobileDeviceAccessRuleResponse x)
-> (forall x.
    Rep CreateMobileDeviceAccessRuleResponse x
    -> CreateMobileDeviceAccessRuleResponse)
-> Generic CreateMobileDeviceAccessRuleResponse
forall x.
Rep CreateMobileDeviceAccessRuleResponse x
-> CreateMobileDeviceAccessRuleResponse
forall x.
CreateMobileDeviceAccessRuleResponse
-> Rep CreateMobileDeviceAccessRuleResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateMobileDeviceAccessRuleResponse x
-> CreateMobileDeviceAccessRuleResponse
$cfrom :: forall x.
CreateMobileDeviceAccessRuleResponse
-> Rep CreateMobileDeviceAccessRuleResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateMobileDeviceAccessRuleResponse' 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', 'createMobileDeviceAccessRuleResponse_mobileDeviceAccessRuleId' - The identifier for the newly created mobile device access rule.
--
-- 'httpStatus', 'createMobileDeviceAccessRuleResponse_httpStatus' - The response's http status code.
newCreateMobileDeviceAccessRuleResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateMobileDeviceAccessRuleResponse
newCreateMobileDeviceAccessRuleResponse :: Int -> CreateMobileDeviceAccessRuleResponse
newCreateMobileDeviceAccessRuleResponse Int
pHttpStatus_ =
  CreateMobileDeviceAccessRuleResponse' :: Maybe Text -> Int -> CreateMobileDeviceAccessRuleResponse
CreateMobileDeviceAccessRuleResponse'
    { $sel:mobileDeviceAccessRuleId:CreateMobileDeviceAccessRuleResponse' :: Maybe Text
mobileDeviceAccessRuleId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateMobileDeviceAccessRuleResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The identifier for the newly created mobile device access rule.
createMobileDeviceAccessRuleResponse_mobileDeviceAccessRuleId :: Lens.Lens' CreateMobileDeviceAccessRuleResponse (Prelude.Maybe Prelude.Text)
createMobileDeviceAccessRuleResponse_mobileDeviceAccessRuleId :: (Maybe Text -> f (Maybe Text))
-> CreateMobileDeviceAccessRuleResponse
-> f CreateMobileDeviceAccessRuleResponse
createMobileDeviceAccessRuleResponse_mobileDeviceAccessRuleId = (CreateMobileDeviceAccessRuleResponse -> Maybe Text)
-> (CreateMobileDeviceAccessRuleResponse
    -> Maybe Text -> CreateMobileDeviceAccessRuleResponse)
-> Lens
     CreateMobileDeviceAccessRuleResponse
     CreateMobileDeviceAccessRuleResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMobileDeviceAccessRuleResponse' {Maybe Text
mobileDeviceAccessRuleId :: Maybe Text
$sel:mobileDeviceAccessRuleId:CreateMobileDeviceAccessRuleResponse' :: CreateMobileDeviceAccessRuleResponse -> Maybe Text
mobileDeviceAccessRuleId} -> Maybe Text
mobileDeviceAccessRuleId) (\s :: CreateMobileDeviceAccessRuleResponse
s@CreateMobileDeviceAccessRuleResponse' {} Maybe Text
a -> CreateMobileDeviceAccessRuleResponse
s {$sel:mobileDeviceAccessRuleId:CreateMobileDeviceAccessRuleResponse' :: Maybe Text
mobileDeviceAccessRuleId = Maybe Text
a} :: CreateMobileDeviceAccessRuleResponse)

-- | The response's http status code.
createMobileDeviceAccessRuleResponse_httpStatus :: Lens.Lens' CreateMobileDeviceAccessRuleResponse Prelude.Int
createMobileDeviceAccessRuleResponse_httpStatus :: (Int -> f Int)
-> CreateMobileDeviceAccessRuleResponse
-> f CreateMobileDeviceAccessRuleResponse
createMobileDeviceAccessRuleResponse_httpStatus = (CreateMobileDeviceAccessRuleResponse -> Int)
-> (CreateMobileDeviceAccessRuleResponse
    -> Int -> CreateMobileDeviceAccessRuleResponse)
-> Lens
     CreateMobileDeviceAccessRuleResponse
     CreateMobileDeviceAccessRuleResponse
     Int
     Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMobileDeviceAccessRuleResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateMobileDeviceAccessRuleResponse' :: CreateMobileDeviceAccessRuleResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateMobileDeviceAccessRuleResponse
s@CreateMobileDeviceAccessRuleResponse' {} Int
a -> CreateMobileDeviceAccessRuleResponse
s {$sel:httpStatus:CreateMobileDeviceAccessRuleResponse' :: Int
httpStatus = Int
a} :: CreateMobileDeviceAccessRuleResponse)

instance
  Prelude.NFData
    CreateMobileDeviceAccessRuleResponse