{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.IoT.Types.SecurityProfileTargetMapping where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IoT.Types.SecurityProfileIdentifier
import Amazonka.IoT.Types.SecurityProfileTarget
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
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]
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
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.
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'
    { $sel:securityProfileIdentifier:SecurityProfileTargetMapping' :: Maybe SecurityProfileIdentifier
securityProfileIdentifier =
        forall a. Maybe a
Prelude.Nothing,
      $sel:target:SecurityProfileTargetMapping' :: Maybe SecurityProfileTarget
target = forall a. Maybe a
Prelude.Nothing
    }

-- | Information that identifies the security profile.
securityProfileTargetMapping_securityProfileIdentifier :: Lens.Lens' SecurityProfileTargetMapping (Prelude.Maybe SecurityProfileIdentifier)
securityProfileTargetMapping_securityProfileIdentifier :: Lens'
  SecurityProfileTargetMapping (Maybe SecurityProfileIdentifier)
securityProfileTargetMapping_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 :: Lens' SecurityProfileTargetMapping (Maybe SecurityProfileTarget)
securityProfileTargetMapping_target = 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 Data.FromJSON SecurityProfileTargetMapping where
  parseJSON :: Value -> Parser SecurityProfileTargetMapping
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"SecurityProfileTargetMapping"
      ( \Object
x ->
          Maybe SecurityProfileIdentifier
-> Maybe SecurityProfileTarget -> SecurityProfileTargetMapping
SecurityProfileTargetMapping'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"securityProfileIdentifier")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"target")
      )

instance
  Prelude.Hashable
    SecurityProfileTargetMapping
  where
  hashWithSalt :: Int -> SecurityProfileTargetMapping -> Int
hashWithSalt Int
_salt SecurityProfileTargetMapping' {Maybe SecurityProfileIdentifier
Maybe SecurityProfileTarget
target :: Maybe SecurityProfileTarget
securityProfileIdentifier :: Maybe SecurityProfileIdentifier
$sel:target:SecurityProfileTargetMapping' :: SecurityProfileTargetMapping -> Maybe SecurityProfileTarget
$sel:securityProfileIdentifier:SecurityProfileTargetMapping' :: SecurityProfileTargetMapping -> Maybe SecurityProfileIdentifier
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SecurityProfileIdentifier
securityProfileIdentifier
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SecurityProfileTarget
target

instance Prelude.NFData SecurityProfileTargetMapping where
  rnf :: SecurityProfileTargetMapping -> ()
rnf SecurityProfileTargetMapping' {Maybe SecurityProfileIdentifier
Maybe SecurityProfileTarget
target :: Maybe SecurityProfileTarget
securityProfileIdentifier :: Maybe SecurityProfileIdentifier
$sel:target:SecurityProfileTargetMapping' :: SecurityProfileTargetMapping -> Maybe SecurityProfileTarget
$sel:securityProfileIdentifier:SecurityProfileTargetMapping' :: SecurityProfileTargetMapping -> Maybe SecurityProfileIdentifier
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe SecurityProfileIdentifier
securityProfileIdentifier
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe SecurityProfileTarget
target