{-# 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.SecurityHub.Types.AwsSecurityFindingIdentifier
-- 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.SecurityHub.Types.AwsSecurityFindingIdentifier where

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

-- | Identifies a finding to update using @BatchUpdateFindings@.
--
-- /See:/ 'newAwsSecurityFindingIdentifier' smart constructor.
data AwsSecurityFindingIdentifier = AwsSecurityFindingIdentifier'
  { -- | The identifier of the finding that was specified by the finding
    -- provider.
    AwsSecurityFindingIdentifier -> Text
id :: Prelude.Text,
    -- | The ARN generated by Security Hub that uniquely identifies a product
    -- that generates findings. This can be the ARN for a third-party product
    -- that is integrated with Security Hub, or the ARN for a custom
    -- integration.
    AwsSecurityFindingIdentifier -> Text
productArn :: Prelude.Text
  }
  deriving (AwsSecurityFindingIdentifier
-> AwsSecurityFindingIdentifier -> Bool
(AwsSecurityFindingIdentifier
 -> AwsSecurityFindingIdentifier -> Bool)
-> (AwsSecurityFindingIdentifier
    -> AwsSecurityFindingIdentifier -> Bool)
-> Eq AwsSecurityFindingIdentifier
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsSecurityFindingIdentifier
-> AwsSecurityFindingIdentifier -> Bool
$c/= :: AwsSecurityFindingIdentifier
-> AwsSecurityFindingIdentifier -> Bool
== :: AwsSecurityFindingIdentifier
-> AwsSecurityFindingIdentifier -> Bool
$c== :: AwsSecurityFindingIdentifier
-> AwsSecurityFindingIdentifier -> Bool
Prelude.Eq, ReadPrec [AwsSecurityFindingIdentifier]
ReadPrec AwsSecurityFindingIdentifier
Int -> ReadS AwsSecurityFindingIdentifier
ReadS [AwsSecurityFindingIdentifier]
(Int -> ReadS AwsSecurityFindingIdentifier)
-> ReadS [AwsSecurityFindingIdentifier]
-> ReadPrec AwsSecurityFindingIdentifier
-> ReadPrec [AwsSecurityFindingIdentifier]
-> Read AwsSecurityFindingIdentifier
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AwsSecurityFindingIdentifier]
$creadListPrec :: ReadPrec [AwsSecurityFindingIdentifier]
readPrec :: ReadPrec AwsSecurityFindingIdentifier
$creadPrec :: ReadPrec AwsSecurityFindingIdentifier
readList :: ReadS [AwsSecurityFindingIdentifier]
$creadList :: ReadS [AwsSecurityFindingIdentifier]
readsPrec :: Int -> ReadS AwsSecurityFindingIdentifier
$creadsPrec :: Int -> ReadS AwsSecurityFindingIdentifier
Prelude.Read, Int -> AwsSecurityFindingIdentifier -> ShowS
[AwsSecurityFindingIdentifier] -> ShowS
AwsSecurityFindingIdentifier -> String
(Int -> AwsSecurityFindingIdentifier -> ShowS)
-> (AwsSecurityFindingIdentifier -> String)
-> ([AwsSecurityFindingIdentifier] -> ShowS)
-> Show AwsSecurityFindingIdentifier
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsSecurityFindingIdentifier] -> ShowS
$cshowList :: [AwsSecurityFindingIdentifier] -> ShowS
show :: AwsSecurityFindingIdentifier -> String
$cshow :: AwsSecurityFindingIdentifier -> String
showsPrec :: Int -> AwsSecurityFindingIdentifier -> ShowS
$cshowsPrec :: Int -> AwsSecurityFindingIdentifier -> ShowS
Prelude.Show, (forall x.
 AwsSecurityFindingIdentifier -> Rep AwsSecurityFindingIdentifier x)
-> (forall x.
    Rep AwsSecurityFindingIdentifier x -> AwsSecurityFindingIdentifier)
-> Generic AwsSecurityFindingIdentifier
forall x.
Rep AwsSecurityFindingIdentifier x -> AwsSecurityFindingIdentifier
forall x.
AwsSecurityFindingIdentifier -> Rep AwsSecurityFindingIdentifier x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AwsSecurityFindingIdentifier x -> AwsSecurityFindingIdentifier
$cfrom :: forall x.
AwsSecurityFindingIdentifier -> Rep AwsSecurityFindingIdentifier x
Prelude.Generic)

-- |
-- Create a value of 'AwsSecurityFindingIdentifier' 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:
--
-- 'id', 'awsSecurityFindingIdentifier_id' - The identifier of the finding that was specified by the finding
-- provider.
--
-- 'productArn', 'awsSecurityFindingIdentifier_productArn' - The ARN generated by Security Hub that uniquely identifies a product
-- that generates findings. This can be the ARN for a third-party product
-- that is integrated with Security Hub, or the ARN for a custom
-- integration.
newAwsSecurityFindingIdentifier ::
  -- | 'id'
  Prelude.Text ->
  -- | 'productArn'
  Prelude.Text ->
  AwsSecurityFindingIdentifier
newAwsSecurityFindingIdentifier :: Text -> Text -> AwsSecurityFindingIdentifier
newAwsSecurityFindingIdentifier Text
pId_ Text
pProductArn_ =
  AwsSecurityFindingIdentifier' :: Text -> Text -> AwsSecurityFindingIdentifier
AwsSecurityFindingIdentifier'
    { $sel:id:AwsSecurityFindingIdentifier' :: Text
id = Text
pId_,
      $sel:productArn:AwsSecurityFindingIdentifier' :: Text
productArn = Text
pProductArn_
    }

-- | The identifier of the finding that was specified by the finding
-- provider.
awsSecurityFindingIdentifier_id :: Lens.Lens' AwsSecurityFindingIdentifier Prelude.Text
awsSecurityFindingIdentifier_id :: (Text -> f Text)
-> AwsSecurityFindingIdentifier -> f AwsSecurityFindingIdentifier
awsSecurityFindingIdentifier_id = (AwsSecurityFindingIdentifier -> Text)
-> (AwsSecurityFindingIdentifier
    -> Text -> AwsSecurityFindingIdentifier)
-> Lens
     AwsSecurityFindingIdentifier AwsSecurityFindingIdentifier Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsSecurityFindingIdentifier' {Text
id :: Text
$sel:id:AwsSecurityFindingIdentifier' :: AwsSecurityFindingIdentifier -> Text
id} -> Text
id) (\s :: AwsSecurityFindingIdentifier
s@AwsSecurityFindingIdentifier' {} Text
a -> AwsSecurityFindingIdentifier
s {$sel:id:AwsSecurityFindingIdentifier' :: Text
id = Text
a} :: AwsSecurityFindingIdentifier)

-- | The ARN generated by Security Hub that uniquely identifies a product
-- that generates findings. This can be the ARN for a third-party product
-- that is integrated with Security Hub, or the ARN for a custom
-- integration.
awsSecurityFindingIdentifier_productArn :: Lens.Lens' AwsSecurityFindingIdentifier Prelude.Text
awsSecurityFindingIdentifier_productArn :: (Text -> f Text)
-> AwsSecurityFindingIdentifier -> f AwsSecurityFindingIdentifier
awsSecurityFindingIdentifier_productArn = (AwsSecurityFindingIdentifier -> Text)
-> (AwsSecurityFindingIdentifier
    -> Text -> AwsSecurityFindingIdentifier)
-> Lens
     AwsSecurityFindingIdentifier AwsSecurityFindingIdentifier Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsSecurityFindingIdentifier' {Text
productArn :: Text
$sel:productArn:AwsSecurityFindingIdentifier' :: AwsSecurityFindingIdentifier -> Text
productArn} -> Text
productArn) (\s :: AwsSecurityFindingIdentifier
s@AwsSecurityFindingIdentifier' {} Text
a -> AwsSecurityFindingIdentifier
s {$sel:productArn:AwsSecurityFindingIdentifier' :: Text
productArn = Text
a} :: AwsSecurityFindingIdentifier)

instance Core.FromJSON AwsSecurityFindingIdentifier where
  parseJSON :: Value -> Parser AwsSecurityFindingIdentifier
parseJSON =
    String
-> (Object -> Parser AwsSecurityFindingIdentifier)
-> Value
-> Parser AwsSecurityFindingIdentifier
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AwsSecurityFindingIdentifier"
      ( \Object
x ->
          Text -> Text -> AwsSecurityFindingIdentifier
AwsSecurityFindingIdentifier'
            (Text -> Text -> AwsSecurityFindingIdentifier)
-> Parser Text -> Parser (Text -> AwsSecurityFindingIdentifier)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Id")
            Parser (Text -> AwsSecurityFindingIdentifier)
-> Parser Text -> Parser AwsSecurityFindingIdentifier
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"ProductArn")
      )

instance
  Prelude.Hashable
    AwsSecurityFindingIdentifier

instance Prelude.NFData AwsSecurityFindingIdentifier

instance Core.ToJSON AwsSecurityFindingIdentifier where
  toJSON :: AwsSecurityFindingIdentifier -> Value
toJSON AwsSecurityFindingIdentifier' {Text
productArn :: Text
id :: Text
$sel:productArn:AwsSecurityFindingIdentifier' :: AwsSecurityFindingIdentifier -> Text
$sel:id:AwsSecurityFindingIdentifier' :: AwsSecurityFindingIdentifier -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Id" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
id),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ProductArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
productArn)
          ]
      )