{-# 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.IoT.Types.SecurityProfileTargetMapping
-- 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.IoT.Types.SecurityProfileTargetMapping where

import qualified Amazonka.Core as Core
import Amazonka.IoT.Types.SecurityProfileIdentifier
import Amazonka.IoT.Types.SecurityProfileTarget
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Information about a security profile and the target associated with it.
--
-- /See:/ 'newSecurityProfileTargetMapping' smart constructor.
data SecurityProfileTargetMapping = SecurityProfileTargetMapping'
  { -- | Information that identifies the security profile.
    SecurityProfileTargetMapping -> Maybe SecurityProfileIdentifier
securityProfileIdentifier :: Prelude.Maybe SecurityProfileIdentifier,
    -- | Information about the target (thing group) associated with the security
    -- profile.
    SecurityProfileTargetMapping -> Maybe SecurityProfileTarget
target :: Prelude.Maybe SecurityProfileTarget
  }
  deriving (SecurityProfileTargetMapping
-> SecurityProfileTargetMapping -> Bool
(SecurityProfileTargetMapping
 -> SecurityProfileTargetMapping -> Bool)
-> (SecurityProfileTargetMapping
    -> SecurityProfileTargetMapping -> Bool)
-> Eq SecurityProfileTargetMapping
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SecurityProfileTargetMapping
-> SecurityProfileTargetMapping -> Bool
$c/= :: SecurityProfileTargetMapping
-> SecurityProfileTargetMapping -> Bool
== :: SecurityProfileTargetMapping
-> SecurityProfileTargetMapping -> Bool
$c== :: SecurityProfileTargetMapping
-> SecurityProfileTargetMapping -> Bool
Prelude.Eq, ReadPrec [SecurityProfileTargetMapping]
ReadPrec SecurityProfileTargetMapping
Int -> ReadS SecurityProfileTargetMapping
ReadS [SecurityProfileTargetMapping]
(Int -> ReadS SecurityProfileTargetMapping)
-> ReadS [SecurityProfileTargetMapping]
-> ReadPrec SecurityProfileTargetMapping
-> ReadPrec [SecurityProfileTargetMapping]
-> Read SecurityProfileTargetMapping
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SecurityProfileTargetMapping]
$creadListPrec :: ReadPrec [SecurityProfileTargetMapping]
readPrec :: ReadPrec SecurityProfileTargetMapping
$creadPrec :: ReadPrec SecurityProfileTargetMapping
readList :: ReadS [SecurityProfileTargetMapping]
$creadList :: ReadS [SecurityProfileTargetMapping]
readsPrec :: Int -> ReadS SecurityProfileTargetMapping
$creadsPrec :: Int -> ReadS SecurityProfileTargetMapping
Prelude.Read, Int -> SecurityProfileTargetMapping -> ShowS
[SecurityProfileTargetMapping] -> ShowS
SecurityProfileTargetMapping -> String
(Int -> SecurityProfileTargetMapping -> ShowS)
-> (SecurityProfileTargetMapping -> String)
-> ([SecurityProfileTargetMapping] -> ShowS)
-> Show SecurityProfileTargetMapping
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SecurityProfileTargetMapping] -> ShowS
$cshowList :: [SecurityProfileTargetMapping] -> ShowS
show :: SecurityProfileTargetMapping -> String
$cshow :: SecurityProfileTargetMapping -> String
showsPrec :: Int -> SecurityProfileTargetMapping -> ShowS
$cshowsPrec :: Int -> SecurityProfileTargetMapping -> ShowS
Prelude.Show, (forall x.
 SecurityProfileTargetMapping -> Rep SecurityProfileTargetMapping x)
-> (forall x.
    Rep SecurityProfileTargetMapping x -> SecurityProfileTargetMapping)
-> Generic SecurityProfileTargetMapping
forall x.
Rep SecurityProfileTargetMapping x -> SecurityProfileTargetMapping
forall x.
SecurityProfileTargetMapping -> Rep SecurityProfileTargetMapping x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SecurityProfileTargetMapping x -> SecurityProfileTargetMapping
$cfrom :: forall x.
SecurityProfileTargetMapping -> Rep SecurityProfileTargetMapping x
Prelude.Generic)

-- |
-- Create a value of 'SecurityProfileTargetMapping' 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:
--
-- 'securityProfileIdentifier', 'securityProfileTargetMapping_securityProfileIdentifier' - Information that identifies the security profile.
--
-- 'target', 'securityProfileTargetMapping_target' - Information about the target (thing group) associated with the security
-- profile.
newSecurityProfileTargetMapping ::
  SecurityProfileTargetMapping
newSecurityProfileTargetMapping :: SecurityProfileTargetMapping
newSecurityProfileTargetMapping =
  SecurityProfileTargetMapping' :: Maybe SecurityProfileIdentifier
-> Maybe SecurityProfileTarget -> SecurityProfileTargetMapping
SecurityProfileTargetMapping'
    { $sel:securityProfileIdentifier:SecurityProfileTargetMapping' :: Maybe SecurityProfileIdentifier
securityProfileIdentifier =
        Maybe SecurityProfileIdentifier
forall a. Maybe a
Prelude.Nothing,
      $sel:target:SecurityProfileTargetMapping' :: Maybe SecurityProfileTarget
target = Maybe SecurityProfileTarget
forall a. Maybe a
Prelude.Nothing
    }

-- | Information that identifies the security profile.
securityProfileTargetMapping_securityProfileIdentifier :: Lens.Lens' SecurityProfileTargetMapping (Prelude.Maybe SecurityProfileIdentifier)
securityProfileTargetMapping_securityProfileIdentifier :: (Maybe SecurityProfileIdentifier
 -> f (Maybe SecurityProfileIdentifier))
-> SecurityProfileTargetMapping -> f SecurityProfileTargetMapping
securityProfileTargetMapping_securityProfileIdentifier = (SecurityProfileTargetMapping -> Maybe SecurityProfileIdentifier)
-> (SecurityProfileTargetMapping
    -> Maybe SecurityProfileIdentifier -> SecurityProfileTargetMapping)
-> Lens
     SecurityProfileTargetMapping
     SecurityProfileTargetMapping
     (Maybe SecurityProfileIdentifier)
     (Maybe SecurityProfileIdentifier)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SecurityProfileTargetMapping' {Maybe SecurityProfileIdentifier
securityProfileIdentifier :: Maybe SecurityProfileIdentifier
$sel:securityProfileIdentifier:SecurityProfileTargetMapping' :: SecurityProfileTargetMapping -> Maybe SecurityProfileIdentifier
securityProfileIdentifier} -> Maybe SecurityProfileIdentifier
securityProfileIdentifier) (\s :: SecurityProfileTargetMapping
s@SecurityProfileTargetMapping' {} Maybe SecurityProfileIdentifier
a -> SecurityProfileTargetMapping
s {$sel:securityProfileIdentifier:SecurityProfileTargetMapping' :: Maybe SecurityProfileIdentifier
securityProfileIdentifier = Maybe SecurityProfileIdentifier
a} :: SecurityProfileTargetMapping)

-- | Information about the target (thing group) associated with the security
-- profile.
securityProfileTargetMapping_target :: Lens.Lens' SecurityProfileTargetMapping (Prelude.Maybe SecurityProfileTarget)
securityProfileTargetMapping_target :: (Maybe SecurityProfileTarget -> f (Maybe SecurityProfileTarget))
-> SecurityProfileTargetMapping -> f SecurityProfileTargetMapping
securityProfileTargetMapping_target = (SecurityProfileTargetMapping -> Maybe SecurityProfileTarget)
-> (SecurityProfileTargetMapping
    -> Maybe SecurityProfileTarget -> SecurityProfileTargetMapping)
-> Lens
     SecurityProfileTargetMapping
     SecurityProfileTargetMapping
     (Maybe SecurityProfileTarget)
     (Maybe SecurityProfileTarget)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SecurityProfileTargetMapping' {Maybe SecurityProfileTarget
target :: Maybe SecurityProfileTarget
$sel:target:SecurityProfileTargetMapping' :: SecurityProfileTargetMapping -> Maybe SecurityProfileTarget
target} -> Maybe SecurityProfileTarget
target) (\s :: SecurityProfileTargetMapping
s@SecurityProfileTargetMapping' {} Maybe SecurityProfileTarget
a -> SecurityProfileTargetMapping
s {$sel:target:SecurityProfileTargetMapping' :: Maybe SecurityProfileTarget
target = Maybe SecurityProfileTarget
a} :: SecurityProfileTargetMapping)

instance Core.FromJSON SecurityProfileTargetMapping where
  parseJSON :: Value -> Parser SecurityProfileTargetMapping
parseJSON =
    String
-> (Object -> Parser SecurityProfileTargetMapping)
-> Value
-> Parser SecurityProfileTargetMapping
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SecurityProfileTargetMapping"
      ( \Object
x ->
          Maybe SecurityProfileIdentifier
-> Maybe SecurityProfileTarget -> SecurityProfileTargetMapping
SecurityProfileTargetMapping'
            (Maybe SecurityProfileIdentifier
 -> Maybe SecurityProfileTarget -> SecurityProfileTargetMapping)
-> Parser (Maybe SecurityProfileIdentifier)
-> Parser
     (Maybe SecurityProfileTarget -> SecurityProfileTargetMapping)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe SecurityProfileIdentifier)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"securityProfileIdentifier")
            Parser
  (Maybe SecurityProfileTarget -> SecurityProfileTargetMapping)
-> Parser (Maybe SecurityProfileTarget)
-> Parser SecurityProfileTargetMapping
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe SecurityProfileTarget)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"target")
      )

instance
  Prelude.Hashable
    SecurityProfileTargetMapping

instance Prelude.NFData SecurityProfileTargetMapping