{-# 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.AppMesh.Types.ResourceMetadata
-- 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.AppMesh.Types.ResourceMetadata where

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

-- | An object that represents metadata for a resource.
--
-- /See:/ 'newResourceMetadata' smart constructor.
data ResourceMetadata = ResourceMetadata'
  { -- | The full Amazon Resource Name (ARN) for the resource.
    ResourceMetadata -> Text
arn :: Prelude.Text,
    -- | The Unix epoch timestamp in seconds for when the resource was created.
    ResourceMetadata -> POSIX
createdAt :: Core.POSIX,
    -- | The Unix epoch timestamp in seconds for when the resource was last
    -- updated.
    ResourceMetadata -> POSIX
lastUpdatedAt :: Core.POSIX,
    -- | The AWS IAM account ID of the service mesh owner. If the account ID is
    -- not your own, then it\'s the ID of the account that shared the mesh with
    -- your account. For more information about mesh sharing, see
    -- <https://docs.aws.amazon.com/app-mesh/latest/userguide/sharing.html Working with shared meshes>.
    ResourceMetadata -> Text
meshOwner :: Prelude.Text,
    -- | The AWS IAM account ID of the resource owner. If the account ID is not
    -- your own, then it\'s the ID of the mesh owner or of another account that
    -- the mesh is shared with. For more information about mesh sharing, see
    -- <https://docs.aws.amazon.com/app-mesh/latest/userguide/sharing.html Working with shared meshes>.
    ResourceMetadata -> Text
resourceOwner :: Prelude.Text,
    -- | The unique identifier for the resource.
    ResourceMetadata -> Text
uid :: Prelude.Text,
    -- | The version of the resource. Resources are created at version 1, and
    -- this version is incremented each time that they\'re updated.
    ResourceMetadata -> Integer
version :: Prelude.Integer
  }
  deriving (ResourceMetadata -> ResourceMetadata -> Bool
(ResourceMetadata -> ResourceMetadata -> Bool)
-> (ResourceMetadata -> ResourceMetadata -> Bool)
-> Eq ResourceMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResourceMetadata -> ResourceMetadata -> Bool
$c/= :: ResourceMetadata -> ResourceMetadata -> Bool
== :: ResourceMetadata -> ResourceMetadata -> Bool
$c== :: ResourceMetadata -> ResourceMetadata -> Bool
Prelude.Eq, ReadPrec [ResourceMetadata]
ReadPrec ResourceMetadata
Int -> ReadS ResourceMetadata
ReadS [ResourceMetadata]
(Int -> ReadS ResourceMetadata)
-> ReadS [ResourceMetadata]
-> ReadPrec ResourceMetadata
-> ReadPrec [ResourceMetadata]
-> Read ResourceMetadata
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ResourceMetadata]
$creadListPrec :: ReadPrec [ResourceMetadata]
readPrec :: ReadPrec ResourceMetadata
$creadPrec :: ReadPrec ResourceMetadata
readList :: ReadS [ResourceMetadata]
$creadList :: ReadS [ResourceMetadata]
readsPrec :: Int -> ReadS ResourceMetadata
$creadsPrec :: Int -> ReadS ResourceMetadata
Prelude.Read, Int -> ResourceMetadata -> ShowS
[ResourceMetadata] -> ShowS
ResourceMetadata -> String
(Int -> ResourceMetadata -> ShowS)
-> (ResourceMetadata -> String)
-> ([ResourceMetadata] -> ShowS)
-> Show ResourceMetadata
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResourceMetadata] -> ShowS
$cshowList :: [ResourceMetadata] -> ShowS
show :: ResourceMetadata -> String
$cshow :: ResourceMetadata -> String
showsPrec :: Int -> ResourceMetadata -> ShowS
$cshowsPrec :: Int -> ResourceMetadata -> ShowS
Prelude.Show, (forall x. ResourceMetadata -> Rep ResourceMetadata x)
-> (forall x. Rep ResourceMetadata x -> ResourceMetadata)
-> Generic ResourceMetadata
forall x. Rep ResourceMetadata x -> ResourceMetadata
forall x. ResourceMetadata -> Rep ResourceMetadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ResourceMetadata x -> ResourceMetadata
$cfrom :: forall x. ResourceMetadata -> Rep ResourceMetadata x
Prelude.Generic)

-- |
-- Create a value of 'ResourceMetadata' 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', 'resourceMetadata_arn' - The full Amazon Resource Name (ARN) for the resource.
--
-- 'createdAt', 'resourceMetadata_createdAt' - The Unix epoch timestamp in seconds for when the resource was created.
--
-- 'lastUpdatedAt', 'resourceMetadata_lastUpdatedAt' - The Unix epoch timestamp in seconds for when the resource was last
-- updated.
--
-- 'meshOwner', 'resourceMetadata_meshOwner' - The AWS IAM account ID of the service mesh owner. If the account ID is
-- not your own, then it\'s the ID of the account that shared the mesh with
-- your account. For more information about mesh sharing, see
-- <https://docs.aws.amazon.com/app-mesh/latest/userguide/sharing.html Working with shared meshes>.
--
-- 'resourceOwner', 'resourceMetadata_resourceOwner' - The AWS IAM account ID of the resource owner. If the account ID is not
-- your own, then it\'s the ID of the mesh owner or of another account that
-- the mesh is shared with. For more information about mesh sharing, see
-- <https://docs.aws.amazon.com/app-mesh/latest/userguide/sharing.html Working with shared meshes>.
--
-- 'uid', 'resourceMetadata_uid' - The unique identifier for the resource.
--
-- 'version', 'resourceMetadata_version' - The version of the resource. Resources are created at version 1, and
-- this version is incremented each time that they\'re updated.
newResourceMetadata ::
  -- | 'arn'
  Prelude.Text ->
  -- | 'createdAt'
  Prelude.UTCTime ->
  -- | 'lastUpdatedAt'
  Prelude.UTCTime ->
  -- | 'meshOwner'
  Prelude.Text ->
  -- | 'resourceOwner'
  Prelude.Text ->
  -- | 'uid'
  Prelude.Text ->
  -- | 'version'
  Prelude.Integer ->
  ResourceMetadata
newResourceMetadata :: Text
-> UTCTime
-> UTCTime
-> Text
-> Text
-> Text
-> Integer
-> ResourceMetadata
newResourceMetadata
  Text
pArn_
  UTCTime
pCreatedAt_
  UTCTime
pLastUpdatedAt_
  Text
pMeshOwner_
  Text
pResourceOwner_
  Text
pUid_
  Integer
pVersion_ =
    ResourceMetadata' :: Text
-> POSIX
-> POSIX
-> Text
-> Text
-> Text
-> Integer
-> ResourceMetadata
ResourceMetadata'
      { $sel:arn:ResourceMetadata' :: Text
arn = Text
pArn_,
        $sel:createdAt:ResourceMetadata' :: POSIX
createdAt = Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pCreatedAt_,
        $sel:lastUpdatedAt:ResourceMetadata' :: POSIX
lastUpdatedAt = Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pLastUpdatedAt_,
        $sel:meshOwner:ResourceMetadata' :: Text
meshOwner = Text
pMeshOwner_,
        $sel:resourceOwner:ResourceMetadata' :: Text
resourceOwner = Text
pResourceOwner_,
        $sel:uid:ResourceMetadata' :: Text
uid = Text
pUid_,
        $sel:version:ResourceMetadata' :: Integer
version = Integer
pVersion_
      }

-- | The full Amazon Resource Name (ARN) for the resource.
resourceMetadata_arn :: Lens.Lens' ResourceMetadata Prelude.Text
resourceMetadata_arn :: (Text -> f Text) -> ResourceMetadata -> f ResourceMetadata
resourceMetadata_arn = (ResourceMetadata -> Text)
-> (ResourceMetadata -> Text -> ResourceMetadata)
-> Lens ResourceMetadata ResourceMetadata Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceMetadata' {Text
arn :: Text
$sel:arn:ResourceMetadata' :: ResourceMetadata -> Text
arn} -> Text
arn) (\s :: ResourceMetadata
s@ResourceMetadata' {} Text
a -> ResourceMetadata
s {$sel:arn:ResourceMetadata' :: Text
arn = Text
a} :: ResourceMetadata)

-- | The Unix epoch timestamp in seconds for when the resource was created.
resourceMetadata_createdAt :: Lens.Lens' ResourceMetadata Prelude.UTCTime
resourceMetadata_createdAt :: (UTCTime -> f UTCTime) -> ResourceMetadata -> f ResourceMetadata
resourceMetadata_createdAt = (ResourceMetadata -> POSIX)
-> (ResourceMetadata -> POSIX -> ResourceMetadata)
-> Lens ResourceMetadata ResourceMetadata POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceMetadata' {POSIX
createdAt :: POSIX
$sel:createdAt:ResourceMetadata' :: ResourceMetadata -> POSIX
createdAt} -> POSIX
createdAt) (\s :: ResourceMetadata
s@ResourceMetadata' {} POSIX
a -> ResourceMetadata
s {$sel:createdAt:ResourceMetadata' :: POSIX
createdAt = POSIX
a} :: ResourceMetadata) ((POSIX -> f POSIX) -> ResourceMetadata -> f ResourceMetadata)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> ResourceMetadata
-> f ResourceMetadata
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The Unix epoch timestamp in seconds for when the resource was last
-- updated.
resourceMetadata_lastUpdatedAt :: Lens.Lens' ResourceMetadata Prelude.UTCTime
resourceMetadata_lastUpdatedAt :: (UTCTime -> f UTCTime) -> ResourceMetadata -> f ResourceMetadata
resourceMetadata_lastUpdatedAt = (ResourceMetadata -> POSIX)
-> (ResourceMetadata -> POSIX -> ResourceMetadata)
-> Lens ResourceMetadata ResourceMetadata POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceMetadata' {POSIX
lastUpdatedAt :: POSIX
$sel:lastUpdatedAt:ResourceMetadata' :: ResourceMetadata -> POSIX
lastUpdatedAt} -> POSIX
lastUpdatedAt) (\s :: ResourceMetadata
s@ResourceMetadata' {} POSIX
a -> ResourceMetadata
s {$sel:lastUpdatedAt:ResourceMetadata' :: POSIX
lastUpdatedAt = POSIX
a} :: ResourceMetadata) ((POSIX -> f POSIX) -> ResourceMetadata -> f ResourceMetadata)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> ResourceMetadata
-> f ResourceMetadata
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The AWS IAM account ID of the service mesh owner. If the account ID is
-- not your own, then it\'s the ID of the account that shared the mesh with
-- your account. For more information about mesh sharing, see
-- <https://docs.aws.amazon.com/app-mesh/latest/userguide/sharing.html Working with shared meshes>.
resourceMetadata_meshOwner :: Lens.Lens' ResourceMetadata Prelude.Text
resourceMetadata_meshOwner :: (Text -> f Text) -> ResourceMetadata -> f ResourceMetadata
resourceMetadata_meshOwner = (ResourceMetadata -> Text)
-> (ResourceMetadata -> Text -> ResourceMetadata)
-> Lens ResourceMetadata ResourceMetadata Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceMetadata' {Text
meshOwner :: Text
$sel:meshOwner:ResourceMetadata' :: ResourceMetadata -> Text
meshOwner} -> Text
meshOwner) (\s :: ResourceMetadata
s@ResourceMetadata' {} Text
a -> ResourceMetadata
s {$sel:meshOwner:ResourceMetadata' :: Text
meshOwner = Text
a} :: ResourceMetadata)

-- | The AWS IAM account ID of the resource owner. If the account ID is not
-- your own, then it\'s the ID of the mesh owner or of another account that
-- the mesh is shared with. For more information about mesh sharing, see
-- <https://docs.aws.amazon.com/app-mesh/latest/userguide/sharing.html Working with shared meshes>.
resourceMetadata_resourceOwner :: Lens.Lens' ResourceMetadata Prelude.Text
resourceMetadata_resourceOwner :: (Text -> f Text) -> ResourceMetadata -> f ResourceMetadata
resourceMetadata_resourceOwner = (ResourceMetadata -> Text)
-> (ResourceMetadata -> Text -> ResourceMetadata)
-> Lens ResourceMetadata ResourceMetadata Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceMetadata' {Text
resourceOwner :: Text
$sel:resourceOwner:ResourceMetadata' :: ResourceMetadata -> Text
resourceOwner} -> Text
resourceOwner) (\s :: ResourceMetadata
s@ResourceMetadata' {} Text
a -> ResourceMetadata
s {$sel:resourceOwner:ResourceMetadata' :: Text
resourceOwner = Text
a} :: ResourceMetadata)

-- | The unique identifier for the resource.
resourceMetadata_uid :: Lens.Lens' ResourceMetadata Prelude.Text
resourceMetadata_uid :: (Text -> f Text) -> ResourceMetadata -> f ResourceMetadata
resourceMetadata_uid = (ResourceMetadata -> Text)
-> (ResourceMetadata -> Text -> ResourceMetadata)
-> Lens ResourceMetadata ResourceMetadata Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceMetadata' {Text
uid :: Text
$sel:uid:ResourceMetadata' :: ResourceMetadata -> Text
uid} -> Text
uid) (\s :: ResourceMetadata
s@ResourceMetadata' {} Text
a -> ResourceMetadata
s {$sel:uid:ResourceMetadata' :: Text
uid = Text
a} :: ResourceMetadata)

-- | The version of the resource. Resources are created at version 1, and
-- this version is incremented each time that they\'re updated.
resourceMetadata_version :: Lens.Lens' ResourceMetadata Prelude.Integer
resourceMetadata_version :: (Integer -> f Integer) -> ResourceMetadata -> f ResourceMetadata
resourceMetadata_version = (ResourceMetadata -> Integer)
-> (ResourceMetadata -> Integer -> ResourceMetadata)
-> Lens ResourceMetadata ResourceMetadata Integer Integer
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceMetadata' {Integer
version :: Integer
$sel:version:ResourceMetadata' :: ResourceMetadata -> Integer
version} -> Integer
version) (\s :: ResourceMetadata
s@ResourceMetadata' {} Integer
a -> ResourceMetadata
s {$sel:version:ResourceMetadata' :: Integer
version = Integer
a} :: ResourceMetadata)

instance Core.FromJSON ResourceMetadata where
  parseJSON :: Value -> Parser ResourceMetadata
parseJSON =
    String
-> (Object -> Parser ResourceMetadata)
-> Value
-> Parser ResourceMetadata
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ResourceMetadata"
      ( \Object
x ->
          Text
-> POSIX
-> POSIX
-> Text
-> Text
-> Text
-> Integer
-> ResourceMetadata
ResourceMetadata'
            (Text
 -> POSIX
 -> POSIX
 -> Text
 -> Text
 -> Text
 -> Integer
 -> ResourceMetadata)
-> Parser Text
-> Parser
     (POSIX
      -> POSIX -> Text -> Text -> Text -> Integer -> ResourceMetadata)
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
"arn")
            Parser
  (POSIX
   -> POSIX -> Text -> Text -> Text -> Integer -> ResourceMetadata)
-> Parser POSIX
-> Parser
     (POSIX -> Text -> Text -> Text -> Integer -> ResourceMetadata)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser POSIX
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"createdAt")
            Parser
  (POSIX -> Text -> Text -> Text -> Integer -> ResourceMetadata)
-> Parser POSIX
-> Parser (Text -> Text -> Text -> Integer -> ResourceMetadata)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser POSIX
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"lastUpdatedAt")
            Parser (Text -> Text -> Text -> Integer -> ResourceMetadata)
-> Parser Text
-> Parser (Text -> Text -> Integer -> ResourceMetadata)
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
"meshOwner")
            Parser (Text -> Text -> Integer -> ResourceMetadata)
-> Parser Text -> Parser (Text -> Integer -> ResourceMetadata)
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
"resourceOwner")
            Parser (Text -> Integer -> ResourceMetadata)
-> Parser Text -> Parser (Integer -> ResourceMetadata)
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
"uid")
            Parser (Integer -> ResourceMetadata)
-> Parser Integer -> Parser ResourceMetadata
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Integer
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"version")
      )

instance Prelude.Hashable ResourceMetadata

instance Prelude.NFData ResourceMetadata