{-# 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.MeshRef
-- 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.MeshRef 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 a service mesh returned by a list operation.
--
-- /See:/ 'newMeshRef' smart constructor.
data MeshRef = MeshRef'
  { -- | The full Amazon Resource Name (ARN) of the service mesh.
    MeshRef -> Text
arn :: Prelude.Text,
    -- | The Unix epoch timestamp in seconds for when the resource was created.
    MeshRef -> POSIX
createdAt :: Data.POSIX,
    -- | The Unix epoch timestamp in seconds for when the resource was last
    -- updated.
    MeshRef -> POSIX
lastUpdatedAt :: Data.POSIX,
    -- | The name of the service mesh.
    MeshRef -> Text
meshName :: Prelude.Text,
    -- | 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>.
    MeshRef -> 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>.
    MeshRef -> Text
resourceOwner :: Prelude.Text,
    -- | The version of the resource. Resources are created at version 1, and
    -- this version is incremented each time that they\'re updated.
    MeshRef -> Integer
version :: Prelude.Integer
  }
  deriving (MeshRef -> MeshRef -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MeshRef -> MeshRef -> Bool
$c/= :: MeshRef -> MeshRef -> Bool
== :: MeshRef -> MeshRef -> Bool
$c== :: MeshRef -> MeshRef -> Bool
Prelude.Eq, ReadPrec [MeshRef]
ReadPrec MeshRef
Int -> ReadS MeshRef
ReadS [MeshRef]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MeshRef]
$creadListPrec :: ReadPrec [MeshRef]
readPrec :: ReadPrec MeshRef
$creadPrec :: ReadPrec MeshRef
readList :: ReadS [MeshRef]
$creadList :: ReadS [MeshRef]
readsPrec :: Int -> ReadS MeshRef
$creadsPrec :: Int -> ReadS MeshRef
Prelude.Read, Int -> MeshRef -> ShowS
[MeshRef] -> ShowS
MeshRef -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MeshRef] -> ShowS
$cshowList :: [MeshRef] -> ShowS
show :: MeshRef -> String
$cshow :: MeshRef -> String
showsPrec :: Int -> MeshRef -> ShowS
$cshowsPrec :: Int -> MeshRef -> ShowS
Prelude.Show, forall x. Rep MeshRef x -> MeshRef
forall x. MeshRef -> Rep MeshRef x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MeshRef x -> MeshRef
$cfrom :: forall x. MeshRef -> Rep MeshRef x
Prelude.Generic)

-- |
-- Create a value of 'MeshRef' 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', 'meshRef_arn' - The full Amazon Resource Name (ARN) of the service mesh.
--
-- 'createdAt', 'meshRef_createdAt' - The Unix epoch timestamp in seconds for when the resource was created.
--
-- 'lastUpdatedAt', 'meshRef_lastUpdatedAt' - The Unix epoch timestamp in seconds for when the resource was last
-- updated.
--
-- 'meshName', 'meshRef_meshName' - The name of the service mesh.
--
-- 'meshOwner', 'meshRef_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', 'meshRef_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>.
--
-- 'version', 'meshRef_version' - The version of the resource. Resources are created at version 1, and
-- this version is incremented each time that they\'re updated.
newMeshRef ::
  -- | 'arn'
  Prelude.Text ->
  -- | 'createdAt'
  Prelude.UTCTime ->
  -- | 'lastUpdatedAt'
  Prelude.UTCTime ->
  -- | 'meshName'
  Prelude.Text ->
  -- | 'meshOwner'
  Prelude.Text ->
  -- | 'resourceOwner'
  Prelude.Text ->
  -- | 'version'
  Prelude.Integer ->
  MeshRef
newMeshRef :: Text
-> UTCTime -> UTCTime -> Text -> Text -> Text -> Integer -> MeshRef
newMeshRef
  Text
pArn_
  UTCTime
pCreatedAt_
  UTCTime
pLastUpdatedAt_
  Text
pMeshName_
  Text
pMeshOwner_
  Text
pResourceOwner_
  Integer
pVersion_ =
    MeshRef'
      { $sel:arn:MeshRef' :: Text
arn = Text
pArn_,
        $sel:createdAt:MeshRef' :: POSIX
createdAt = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pCreatedAt_,
        $sel:lastUpdatedAt:MeshRef' :: POSIX
lastUpdatedAt = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pLastUpdatedAt_,
        $sel:meshName:MeshRef' :: Text
meshName = Text
pMeshName_,
        $sel:meshOwner:MeshRef' :: Text
meshOwner = Text
pMeshOwner_,
        $sel:resourceOwner:MeshRef' :: Text
resourceOwner = Text
pResourceOwner_,
        $sel:version:MeshRef' :: Integer
version = Integer
pVersion_
      }

-- | The full Amazon Resource Name (ARN) of the service mesh.
meshRef_arn :: Lens.Lens' MeshRef Prelude.Text
meshRef_arn :: Lens' MeshRef Text
meshRef_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MeshRef' {Text
arn :: Text
$sel:arn:MeshRef' :: MeshRef -> Text
arn} -> Text
arn) (\s :: MeshRef
s@MeshRef' {} Text
a -> MeshRef
s {$sel:arn:MeshRef' :: Text
arn = Text
a} :: MeshRef)

-- | The Unix epoch timestamp in seconds for when the resource was created.
meshRef_createdAt :: Lens.Lens' MeshRef Prelude.UTCTime
meshRef_createdAt :: Lens' MeshRef UTCTime
meshRef_createdAt = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MeshRef' {POSIX
createdAt :: POSIX
$sel:createdAt:MeshRef' :: MeshRef -> POSIX
createdAt} -> POSIX
createdAt) (\s :: MeshRef
s@MeshRef' {} POSIX
a -> MeshRef
s {$sel:createdAt:MeshRef' :: POSIX
createdAt = POSIX
a} :: MeshRef) 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.
meshRef_lastUpdatedAt :: Lens.Lens' MeshRef Prelude.UTCTime
meshRef_lastUpdatedAt :: Lens' MeshRef UTCTime
meshRef_lastUpdatedAt = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MeshRef' {POSIX
lastUpdatedAt :: POSIX
$sel:lastUpdatedAt:MeshRef' :: MeshRef -> POSIX
lastUpdatedAt} -> POSIX
lastUpdatedAt) (\s :: MeshRef
s@MeshRef' {} POSIX
a -> MeshRef
s {$sel:lastUpdatedAt:MeshRef' :: POSIX
lastUpdatedAt = POSIX
a} :: MeshRef) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The name of the service mesh.
meshRef_meshName :: Lens.Lens' MeshRef Prelude.Text
meshRef_meshName :: Lens' MeshRef Text
meshRef_meshName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MeshRef' {Text
meshName :: Text
$sel:meshName:MeshRef' :: MeshRef -> Text
meshName} -> Text
meshName) (\s :: MeshRef
s@MeshRef' {} Text
a -> MeshRef
s {$sel:meshName:MeshRef' :: Text
meshName = Text
a} :: MeshRef)

-- | 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>.
meshRef_meshOwner :: Lens.Lens' MeshRef Prelude.Text
meshRef_meshOwner :: Lens' MeshRef Text
meshRef_meshOwner = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MeshRef' {Text
meshOwner :: Text
$sel:meshOwner:MeshRef' :: MeshRef -> Text
meshOwner} -> Text
meshOwner) (\s :: MeshRef
s@MeshRef' {} Text
a -> MeshRef
s {$sel:meshOwner:MeshRef' :: Text
meshOwner = Text
a} :: MeshRef)

-- | 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>.
meshRef_resourceOwner :: Lens.Lens' MeshRef Prelude.Text
meshRef_resourceOwner :: Lens' MeshRef Text
meshRef_resourceOwner = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MeshRef' {Text
resourceOwner :: Text
$sel:resourceOwner:MeshRef' :: MeshRef -> Text
resourceOwner} -> Text
resourceOwner) (\s :: MeshRef
s@MeshRef' {} Text
a -> MeshRef
s {$sel:resourceOwner:MeshRef' :: Text
resourceOwner = Text
a} :: MeshRef)

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

instance Data.FromJSON MeshRef where
  parseJSON :: Value -> Parser MeshRef
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"MeshRef"
      ( \Object
x ->
          Text
-> POSIX -> POSIX -> Text -> Text -> Text -> Integer -> MeshRef
MeshRef'
            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
"meshName")
            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
"version")
      )

instance Prelude.Hashable MeshRef where
  hashWithSalt :: Int -> MeshRef -> Int
hashWithSalt Int
_salt MeshRef' {Integer
Text
POSIX
version :: Integer
resourceOwner :: Text
meshOwner :: Text
meshName :: Text
lastUpdatedAt :: POSIX
createdAt :: POSIX
arn :: Text
$sel:version:MeshRef' :: MeshRef -> Integer
$sel:resourceOwner:MeshRef' :: MeshRef -> Text
$sel:meshOwner:MeshRef' :: MeshRef -> Text
$sel:meshName:MeshRef' :: MeshRef -> Text
$sel:lastUpdatedAt:MeshRef' :: MeshRef -> POSIX
$sel:createdAt:MeshRef' :: MeshRef -> POSIX
$sel:arn:MeshRef' :: MeshRef -> 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
meshName
      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` Integer
version

instance Prelude.NFData MeshRef where
  rnf :: MeshRef -> ()
rnf MeshRef' {Integer
Text
POSIX
version :: Integer
resourceOwner :: Text
meshOwner :: Text
meshName :: Text
lastUpdatedAt :: POSIX
createdAt :: POSIX
arn :: Text
$sel:version:MeshRef' :: MeshRef -> Integer
$sel:resourceOwner:MeshRef' :: MeshRef -> Text
$sel:meshOwner:MeshRef' :: MeshRef -> Text
$sel:meshName:MeshRef' :: MeshRef -> Text
$sel:lastUpdatedAt:MeshRef' :: MeshRef -> POSIX
$sel:createdAt:MeshRef' :: MeshRef -> POSIX
$sel:arn:MeshRef' :: MeshRef -> 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
meshName
      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 Integer
version