{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.AppMesh.Types.ResourceMetadata 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

-- | 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 :: Data.POSIX,
    -- | The Unix epoch timestamp in seconds for when the resource was last
    -- updated.
    ResourceMetadata -> POSIX
lastUpdatedAt :: Data.POSIX,
    -- | The Amazon Web Services 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 Amazon Web Services 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
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]
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
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. 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 Amazon Web Services 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 Amazon Web Services 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'
      { $sel:arn:ResourceMetadata' :: Text
arn = Text
pArn_,
        $sel:createdAt:ResourceMetadata' :: POSIX
createdAt = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pCreatedAt_,
        $sel:lastUpdatedAt:ResourceMetadata' :: POSIX
lastUpdatedAt = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time 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 :: Lens' ResourceMetadata Text
resourceMetadata_arn = 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 :: Lens' ResourceMetadata UTCTime
resourceMetadata_createdAt = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The Unix epoch timestamp in seconds for when the resource was last
-- updated.
resourceMetadata_lastUpdatedAt :: Lens.Lens' ResourceMetadata Prelude.UTCTime
resourceMetadata_lastUpdatedAt :: Lens' ResourceMetadata UTCTime
resourceMetadata_lastUpdatedAt = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The Amazon Web Services 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 :: Lens' ResourceMetadata Text
resourceMetadata_meshOwner = 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 Amazon Web Services 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 :: Lens' ResourceMetadata Text
resourceMetadata_resourceOwner = 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 :: Lens' ResourceMetadata Text
resourceMetadata_uid = 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 :: Lens' ResourceMetadata Integer
resourceMetadata_version = 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 Data.FromJSON ResourceMetadata where
  parseJSON :: Value -> Parser ResourceMetadata
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ResourceMetadata"
      ( \Object
x ->
          Text
-> POSIX
-> POSIX
-> Text
-> Text
-> Text
-> Integer
-> ResourceMetadata
ResourceMetadata'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"arn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"createdAt")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"lastUpdatedAt")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"meshOwner")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"resourceOwner")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"uid")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"version")
      )

instance Prelude.Hashable ResourceMetadata where
  hashWithSalt :: Int -> ResourceMetadata -> Int
hashWithSalt Int
_salt ResourceMetadata' {Integer
Text
POSIX
version :: Integer
uid :: Text
resourceOwner :: Text
meshOwner :: Text
lastUpdatedAt :: POSIX
createdAt :: POSIX
arn :: Text
$sel:version:ResourceMetadata' :: ResourceMetadata -> Integer
$sel:uid:ResourceMetadata' :: ResourceMetadata -> Text
$sel:resourceOwner:ResourceMetadata' :: ResourceMetadata -> Text
$sel:meshOwner:ResourceMetadata' :: ResourceMetadata -> Text
$sel:lastUpdatedAt:ResourceMetadata' :: ResourceMetadata -> POSIX
$sel:createdAt:ResourceMetadata' :: ResourceMetadata -> POSIX
$sel:arn:ResourceMetadata' :: ResourceMetadata -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
arn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` POSIX
createdAt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` POSIX
lastUpdatedAt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
meshOwner
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
resourceOwner
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
uid
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Integer
version

instance Prelude.NFData ResourceMetadata where
  rnf :: ResourceMetadata -> ()
rnf ResourceMetadata' {Integer
Text
POSIX
version :: Integer
uid :: Text
resourceOwner :: Text
meshOwner :: Text
lastUpdatedAt :: POSIX
createdAt :: POSIX
arn :: Text
$sel:version:ResourceMetadata' :: ResourceMetadata -> Integer
$sel:uid:ResourceMetadata' :: ResourceMetadata -> Text
$sel:resourceOwner:ResourceMetadata' :: ResourceMetadata -> Text
$sel:meshOwner:ResourceMetadata' :: ResourceMetadata -> Text
$sel:lastUpdatedAt:ResourceMetadata' :: ResourceMetadata -> POSIX
$sel:createdAt:ResourceMetadata' :: ResourceMetadata -> POSIX
$sel:arn:ResourceMetadata' :: ResourceMetadata -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf POSIX
createdAt
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf POSIX
lastUpdatedAt
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
meshOwner
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
resourceOwner
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
uid
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Integer
version