{-# 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.SSM.Types.OpsItemIdentity
-- 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.SSM.Types.OpsItemIdentity where

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

-- | Information about the user or resource that created an OpsItem event.
--
-- /See:/ 'newOpsItemIdentity' smart constructor.
data OpsItemIdentity = OpsItemIdentity'
  { -- | The Amazon Resource Name (ARN) of the IAM entity that created the
    -- OpsItem event.
    OpsItemIdentity -> Maybe Text
arn :: Prelude.Maybe Prelude.Text
  }
  deriving (OpsItemIdentity -> OpsItemIdentity -> Bool
(OpsItemIdentity -> OpsItemIdentity -> Bool)
-> (OpsItemIdentity -> OpsItemIdentity -> Bool)
-> Eq OpsItemIdentity
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OpsItemIdentity -> OpsItemIdentity -> Bool
$c/= :: OpsItemIdentity -> OpsItemIdentity -> Bool
== :: OpsItemIdentity -> OpsItemIdentity -> Bool
$c== :: OpsItemIdentity -> OpsItemIdentity -> Bool
Prelude.Eq, ReadPrec [OpsItemIdentity]
ReadPrec OpsItemIdentity
Int -> ReadS OpsItemIdentity
ReadS [OpsItemIdentity]
(Int -> ReadS OpsItemIdentity)
-> ReadS [OpsItemIdentity]
-> ReadPrec OpsItemIdentity
-> ReadPrec [OpsItemIdentity]
-> Read OpsItemIdentity
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OpsItemIdentity]
$creadListPrec :: ReadPrec [OpsItemIdentity]
readPrec :: ReadPrec OpsItemIdentity
$creadPrec :: ReadPrec OpsItemIdentity
readList :: ReadS [OpsItemIdentity]
$creadList :: ReadS [OpsItemIdentity]
readsPrec :: Int -> ReadS OpsItemIdentity
$creadsPrec :: Int -> ReadS OpsItemIdentity
Prelude.Read, Int -> OpsItemIdentity -> ShowS
[OpsItemIdentity] -> ShowS
OpsItemIdentity -> String
(Int -> OpsItemIdentity -> ShowS)
-> (OpsItemIdentity -> String)
-> ([OpsItemIdentity] -> ShowS)
-> Show OpsItemIdentity
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OpsItemIdentity] -> ShowS
$cshowList :: [OpsItemIdentity] -> ShowS
show :: OpsItemIdentity -> String
$cshow :: OpsItemIdentity -> String
showsPrec :: Int -> OpsItemIdentity -> ShowS
$cshowsPrec :: Int -> OpsItemIdentity -> ShowS
Prelude.Show, (forall x. OpsItemIdentity -> Rep OpsItemIdentity x)
-> (forall x. Rep OpsItemIdentity x -> OpsItemIdentity)
-> Generic OpsItemIdentity
forall x. Rep OpsItemIdentity x -> OpsItemIdentity
forall x. OpsItemIdentity -> Rep OpsItemIdentity x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OpsItemIdentity x -> OpsItemIdentity
$cfrom :: forall x. OpsItemIdentity -> Rep OpsItemIdentity x
Prelude.Generic)

-- |
-- Create a value of 'OpsItemIdentity' 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:
--
-- 'arn', 'opsItemIdentity_arn' - The Amazon Resource Name (ARN) of the IAM entity that created the
-- OpsItem event.
newOpsItemIdentity ::
  OpsItemIdentity
newOpsItemIdentity :: OpsItemIdentity
newOpsItemIdentity =
  OpsItemIdentity' :: Maybe Text -> OpsItemIdentity
OpsItemIdentity' {$sel:arn:OpsItemIdentity' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing}

-- | The Amazon Resource Name (ARN) of the IAM entity that created the
-- OpsItem event.
opsItemIdentity_arn :: Lens.Lens' OpsItemIdentity (Prelude.Maybe Prelude.Text)
opsItemIdentity_arn :: (Maybe Text -> f (Maybe Text))
-> OpsItemIdentity -> f OpsItemIdentity
opsItemIdentity_arn = (OpsItemIdentity -> Maybe Text)
-> (OpsItemIdentity -> Maybe Text -> OpsItemIdentity)
-> Lens OpsItemIdentity OpsItemIdentity (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OpsItemIdentity' {Maybe Text
arn :: Maybe Text
$sel:arn:OpsItemIdentity' :: OpsItemIdentity -> Maybe Text
arn} -> Maybe Text
arn) (\s :: OpsItemIdentity
s@OpsItemIdentity' {} Maybe Text
a -> OpsItemIdentity
s {$sel:arn:OpsItemIdentity' :: Maybe Text
arn = Maybe Text
a} :: OpsItemIdentity)

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

instance Prelude.Hashable OpsItemIdentity

instance Prelude.NFData OpsItemIdentity