{-# 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.FMS.Types.ActionTarget
-- 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.FMS.Types.ActionTarget where

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

-- | Describes a remediation action target.
--
-- /See:/ 'newActionTarget' smart constructor.
data ActionTarget = ActionTarget'
  { -- | A description of the remediation action target.
    ActionTarget -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The ID of the remediation target.
    ActionTarget -> Maybe Text
resourceId :: Prelude.Maybe Prelude.Text
  }
  deriving (ActionTarget -> ActionTarget -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ActionTarget -> ActionTarget -> Bool
$c/= :: ActionTarget -> ActionTarget -> Bool
== :: ActionTarget -> ActionTarget -> Bool
$c== :: ActionTarget -> ActionTarget -> Bool
Prelude.Eq, ReadPrec [ActionTarget]
ReadPrec ActionTarget
Int -> ReadS ActionTarget
ReadS [ActionTarget]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ActionTarget]
$creadListPrec :: ReadPrec [ActionTarget]
readPrec :: ReadPrec ActionTarget
$creadPrec :: ReadPrec ActionTarget
readList :: ReadS [ActionTarget]
$creadList :: ReadS [ActionTarget]
readsPrec :: Int -> ReadS ActionTarget
$creadsPrec :: Int -> ReadS ActionTarget
Prelude.Read, Int -> ActionTarget -> ShowS
[ActionTarget] -> ShowS
ActionTarget -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ActionTarget] -> ShowS
$cshowList :: [ActionTarget] -> ShowS
show :: ActionTarget -> String
$cshow :: ActionTarget -> String
showsPrec :: Int -> ActionTarget -> ShowS
$cshowsPrec :: Int -> ActionTarget -> ShowS
Prelude.Show, forall x. Rep ActionTarget x -> ActionTarget
forall x. ActionTarget -> Rep ActionTarget x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ActionTarget x -> ActionTarget
$cfrom :: forall x. ActionTarget -> Rep ActionTarget x
Prelude.Generic)

-- |
-- Create a value of 'ActionTarget' 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:
--
-- 'description', 'actionTarget_description' - A description of the remediation action target.
--
-- 'resourceId', 'actionTarget_resourceId' - The ID of the remediation target.
newActionTarget ::
  ActionTarget
newActionTarget :: ActionTarget
newActionTarget =
  ActionTarget'
    { $sel:description:ActionTarget' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:resourceId:ActionTarget' :: Maybe Text
resourceId = forall a. Maybe a
Prelude.Nothing
    }

-- | A description of the remediation action target.
actionTarget_description :: Lens.Lens' ActionTarget (Prelude.Maybe Prelude.Text)
actionTarget_description :: Lens' ActionTarget (Maybe Text)
actionTarget_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActionTarget' {Maybe Text
description :: Maybe Text
$sel:description:ActionTarget' :: ActionTarget -> Maybe Text
description} -> Maybe Text
description) (\s :: ActionTarget
s@ActionTarget' {} Maybe Text
a -> ActionTarget
s {$sel:description:ActionTarget' :: Maybe Text
description = Maybe Text
a} :: ActionTarget)

-- | The ID of the remediation target.
actionTarget_resourceId :: Lens.Lens' ActionTarget (Prelude.Maybe Prelude.Text)
actionTarget_resourceId :: Lens' ActionTarget (Maybe Text)
actionTarget_resourceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActionTarget' {Maybe Text
resourceId :: Maybe Text
$sel:resourceId:ActionTarget' :: ActionTarget -> Maybe Text
resourceId} -> Maybe Text
resourceId) (\s :: ActionTarget
s@ActionTarget' {} Maybe Text
a -> ActionTarget
s {$sel:resourceId:ActionTarget' :: Maybe Text
resourceId = Maybe Text
a} :: ActionTarget)

instance Data.FromJSON ActionTarget where
  parseJSON :: Value -> Parser ActionTarget
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ActionTarget"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> ActionTarget
ActionTarget'
            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
"Description")
            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
"ResourceId")
      )

instance Prelude.Hashable ActionTarget where
  hashWithSalt :: Int -> ActionTarget -> Int
hashWithSalt Int
_salt ActionTarget' {Maybe Text
resourceId :: Maybe Text
description :: Maybe Text
$sel:resourceId:ActionTarget' :: ActionTarget -> Maybe Text
$sel:description:ActionTarget' :: ActionTarget -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
resourceId

instance Prelude.NFData ActionTarget where
  rnf :: ActionTarget -> ()
rnf ActionTarget' {Maybe Text
resourceId :: Maybe Text
description :: Maybe Text
$sel:resourceId:ActionTarget' :: ActionTarget -> Maybe Text
$sel:description:ActionTarget' :: ActionTarget -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
resourceId