{-# 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.OpsMetadata
-- 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.OpsMetadata where

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

-- | Operational metadata for an application in Application Manager.
--
-- /See:/ 'newOpsMetadata' smart constructor.
data OpsMetadata = OpsMetadata'
  { -- | The Amazon Resource Name (ARN) of the OpsMetadata Object or blob.
    OpsMetadata -> Maybe Text
opsMetadataArn :: Prelude.Maybe Prelude.Text,
    -- | The ID of the Application Manager application.
    OpsMetadata -> Maybe Text
resourceId :: Prelude.Maybe Prelude.Text,
    -- | The date the OpsMetadata object was last updated.
    OpsMetadata -> Maybe POSIX
lastModifiedDate :: Prelude.Maybe Core.POSIX,
    -- | The user name who last updated the OpsMetadata object.
    OpsMetadata -> Maybe Text
lastModifiedUser :: Prelude.Maybe Prelude.Text,
    -- | The date the OpsMetadata objects was created.
    OpsMetadata -> Maybe POSIX
creationDate :: Prelude.Maybe Core.POSIX
  }
  deriving (OpsMetadata -> OpsMetadata -> Bool
(OpsMetadata -> OpsMetadata -> Bool)
-> (OpsMetadata -> OpsMetadata -> Bool) -> Eq OpsMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OpsMetadata -> OpsMetadata -> Bool
$c/= :: OpsMetadata -> OpsMetadata -> Bool
== :: OpsMetadata -> OpsMetadata -> Bool
$c== :: OpsMetadata -> OpsMetadata -> Bool
Prelude.Eq, ReadPrec [OpsMetadata]
ReadPrec OpsMetadata
Int -> ReadS OpsMetadata
ReadS [OpsMetadata]
(Int -> ReadS OpsMetadata)
-> ReadS [OpsMetadata]
-> ReadPrec OpsMetadata
-> ReadPrec [OpsMetadata]
-> Read OpsMetadata
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OpsMetadata]
$creadListPrec :: ReadPrec [OpsMetadata]
readPrec :: ReadPrec OpsMetadata
$creadPrec :: ReadPrec OpsMetadata
readList :: ReadS [OpsMetadata]
$creadList :: ReadS [OpsMetadata]
readsPrec :: Int -> ReadS OpsMetadata
$creadsPrec :: Int -> ReadS OpsMetadata
Prelude.Read, Int -> OpsMetadata -> ShowS
[OpsMetadata] -> ShowS
OpsMetadata -> String
(Int -> OpsMetadata -> ShowS)
-> (OpsMetadata -> String)
-> ([OpsMetadata] -> ShowS)
-> Show OpsMetadata
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OpsMetadata] -> ShowS
$cshowList :: [OpsMetadata] -> ShowS
show :: OpsMetadata -> String
$cshow :: OpsMetadata -> String
showsPrec :: Int -> OpsMetadata -> ShowS
$cshowsPrec :: Int -> OpsMetadata -> ShowS
Prelude.Show, (forall x. OpsMetadata -> Rep OpsMetadata x)
-> (forall x. Rep OpsMetadata x -> OpsMetadata)
-> Generic OpsMetadata
forall x. Rep OpsMetadata x -> OpsMetadata
forall x. OpsMetadata -> Rep OpsMetadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OpsMetadata x -> OpsMetadata
$cfrom :: forall x. OpsMetadata -> Rep OpsMetadata x
Prelude.Generic)

-- |
-- Create a value of 'OpsMetadata' 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:
--
-- 'opsMetadataArn', 'opsMetadata_opsMetadataArn' - The Amazon Resource Name (ARN) of the OpsMetadata Object or blob.
--
-- 'resourceId', 'opsMetadata_resourceId' - The ID of the Application Manager application.
--
-- 'lastModifiedDate', 'opsMetadata_lastModifiedDate' - The date the OpsMetadata object was last updated.
--
-- 'lastModifiedUser', 'opsMetadata_lastModifiedUser' - The user name who last updated the OpsMetadata object.
--
-- 'creationDate', 'opsMetadata_creationDate' - The date the OpsMetadata objects was created.
newOpsMetadata ::
  OpsMetadata
newOpsMetadata :: OpsMetadata
newOpsMetadata =
  OpsMetadata' :: Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe POSIX
-> OpsMetadata
OpsMetadata'
    { $sel:opsMetadataArn:OpsMetadata' :: Maybe Text
opsMetadataArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:resourceId:OpsMetadata' :: Maybe Text
resourceId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:lastModifiedDate:OpsMetadata' :: Maybe POSIX
lastModifiedDate = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:lastModifiedUser:OpsMetadata' :: Maybe Text
lastModifiedUser = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:creationDate:OpsMetadata' :: Maybe POSIX
creationDate = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Name (ARN) of the OpsMetadata Object or blob.
opsMetadata_opsMetadataArn :: Lens.Lens' OpsMetadata (Prelude.Maybe Prelude.Text)
opsMetadata_opsMetadataArn :: (Maybe Text -> f (Maybe Text)) -> OpsMetadata -> f OpsMetadata
opsMetadata_opsMetadataArn = (OpsMetadata -> Maybe Text)
-> (OpsMetadata -> Maybe Text -> OpsMetadata)
-> Lens OpsMetadata OpsMetadata (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OpsMetadata' {Maybe Text
opsMetadataArn :: Maybe Text
$sel:opsMetadataArn:OpsMetadata' :: OpsMetadata -> Maybe Text
opsMetadataArn} -> Maybe Text
opsMetadataArn) (\s :: OpsMetadata
s@OpsMetadata' {} Maybe Text
a -> OpsMetadata
s {$sel:opsMetadataArn:OpsMetadata' :: Maybe Text
opsMetadataArn = Maybe Text
a} :: OpsMetadata)

-- | The ID of the Application Manager application.
opsMetadata_resourceId :: Lens.Lens' OpsMetadata (Prelude.Maybe Prelude.Text)
opsMetadata_resourceId :: (Maybe Text -> f (Maybe Text)) -> OpsMetadata -> f OpsMetadata
opsMetadata_resourceId = (OpsMetadata -> Maybe Text)
-> (OpsMetadata -> Maybe Text -> OpsMetadata)
-> Lens OpsMetadata OpsMetadata (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OpsMetadata' {Maybe Text
resourceId :: Maybe Text
$sel:resourceId:OpsMetadata' :: OpsMetadata -> Maybe Text
resourceId} -> Maybe Text
resourceId) (\s :: OpsMetadata
s@OpsMetadata' {} Maybe Text
a -> OpsMetadata
s {$sel:resourceId:OpsMetadata' :: Maybe Text
resourceId = Maybe Text
a} :: OpsMetadata)

-- | The date the OpsMetadata object was last updated.
opsMetadata_lastModifiedDate :: Lens.Lens' OpsMetadata (Prelude.Maybe Prelude.UTCTime)
opsMetadata_lastModifiedDate :: (Maybe UTCTime -> f (Maybe UTCTime))
-> OpsMetadata -> f OpsMetadata
opsMetadata_lastModifiedDate = (OpsMetadata -> Maybe POSIX)
-> (OpsMetadata -> Maybe POSIX -> OpsMetadata)
-> Lens OpsMetadata OpsMetadata (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OpsMetadata' {Maybe POSIX
lastModifiedDate :: Maybe POSIX
$sel:lastModifiedDate:OpsMetadata' :: OpsMetadata -> Maybe POSIX
lastModifiedDate} -> Maybe POSIX
lastModifiedDate) (\s :: OpsMetadata
s@OpsMetadata' {} Maybe POSIX
a -> OpsMetadata
s {$sel:lastModifiedDate:OpsMetadata' :: Maybe POSIX
lastModifiedDate = Maybe POSIX
a} :: OpsMetadata) ((Maybe POSIX -> f (Maybe POSIX)) -> OpsMetadata -> f OpsMetadata)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> OpsMetadata
-> f OpsMetadata
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The user name who last updated the OpsMetadata object.
opsMetadata_lastModifiedUser :: Lens.Lens' OpsMetadata (Prelude.Maybe Prelude.Text)
opsMetadata_lastModifiedUser :: (Maybe Text -> f (Maybe Text)) -> OpsMetadata -> f OpsMetadata
opsMetadata_lastModifiedUser = (OpsMetadata -> Maybe Text)
-> (OpsMetadata -> Maybe Text -> OpsMetadata)
-> Lens OpsMetadata OpsMetadata (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OpsMetadata' {Maybe Text
lastModifiedUser :: Maybe Text
$sel:lastModifiedUser:OpsMetadata' :: OpsMetadata -> Maybe Text
lastModifiedUser} -> Maybe Text
lastModifiedUser) (\s :: OpsMetadata
s@OpsMetadata' {} Maybe Text
a -> OpsMetadata
s {$sel:lastModifiedUser:OpsMetadata' :: Maybe Text
lastModifiedUser = Maybe Text
a} :: OpsMetadata)

-- | The date the OpsMetadata objects was created.
opsMetadata_creationDate :: Lens.Lens' OpsMetadata (Prelude.Maybe Prelude.UTCTime)
opsMetadata_creationDate :: (Maybe UTCTime -> f (Maybe UTCTime))
-> OpsMetadata -> f OpsMetadata
opsMetadata_creationDate = (OpsMetadata -> Maybe POSIX)
-> (OpsMetadata -> Maybe POSIX -> OpsMetadata)
-> Lens OpsMetadata OpsMetadata (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OpsMetadata' {Maybe POSIX
creationDate :: Maybe POSIX
$sel:creationDate:OpsMetadata' :: OpsMetadata -> Maybe POSIX
creationDate} -> Maybe POSIX
creationDate) (\s :: OpsMetadata
s@OpsMetadata' {} Maybe POSIX
a -> OpsMetadata
s {$sel:creationDate:OpsMetadata' :: Maybe POSIX
creationDate = Maybe POSIX
a} :: OpsMetadata) ((Maybe POSIX -> f (Maybe POSIX)) -> OpsMetadata -> f OpsMetadata)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> OpsMetadata
-> f OpsMetadata
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

instance Core.FromJSON OpsMetadata where
  parseJSON :: Value -> Parser OpsMetadata
parseJSON =
    String
-> (Object -> Parser OpsMetadata) -> Value -> Parser OpsMetadata
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"OpsMetadata"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe POSIX
-> OpsMetadata
OpsMetadata'
            (Maybe Text
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe POSIX
 -> OpsMetadata)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe POSIX -> Maybe Text -> Maybe POSIX -> OpsMetadata)
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
"OpsMetadataArn")
            Parser
  (Maybe Text
   -> Maybe POSIX -> Maybe Text -> Maybe POSIX -> OpsMetadata)
-> Parser (Maybe Text)
-> Parser (Maybe POSIX -> Maybe Text -> Maybe POSIX -> OpsMetadata)
forall (f :: * -> *) a b. Applicative f => 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
"ResourceId")
            Parser (Maybe POSIX -> Maybe Text -> Maybe POSIX -> OpsMetadata)
-> Parser (Maybe POSIX)
-> Parser (Maybe Text -> Maybe POSIX -> OpsMetadata)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LastModifiedDate")
            Parser (Maybe Text -> Maybe POSIX -> OpsMetadata)
-> Parser (Maybe Text) -> Parser (Maybe POSIX -> OpsMetadata)
forall (f :: * -> *) a b. Applicative f => 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
"LastModifiedUser")
            Parser (Maybe POSIX -> OpsMetadata)
-> Parser (Maybe POSIX) -> Parser OpsMetadata
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CreationDate")
      )

instance Prelude.Hashable OpsMetadata

instance Prelude.NFData OpsMetadata