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

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

-- | An object that represents a virtual node returned by a list operation.
--
-- /See:/ 'newVirtualNodeRef' smart constructor.
data VirtualNodeRef = VirtualNodeRef'
  { -- | The full Amazon Resource Name (ARN) for the virtual node.
    VirtualNodeRef -> Text
arn :: Prelude.Text,
    -- | The Unix epoch timestamp in seconds for when the resource was created.
    VirtualNodeRef -> POSIX
createdAt :: Core.POSIX,
    -- | The Unix epoch timestamp in seconds for when the resource was last
    -- updated.
    VirtualNodeRef -> POSIX
lastUpdatedAt :: Core.POSIX,
    -- | The name of the service mesh that the virtual node resides in.
    VirtualNodeRef -> Text
meshName :: Prelude.Text,
    -- | 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>.
    VirtualNodeRef -> 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>.
    VirtualNodeRef -> 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.
    VirtualNodeRef -> Integer
version :: Prelude.Integer,
    -- | The name of the virtual node.
    VirtualNodeRef -> Text
virtualNodeName :: Prelude.Text
  }
  deriving (VirtualNodeRef -> VirtualNodeRef -> Bool
(VirtualNodeRef -> VirtualNodeRef -> Bool)
-> (VirtualNodeRef -> VirtualNodeRef -> Bool) -> Eq VirtualNodeRef
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VirtualNodeRef -> VirtualNodeRef -> Bool
$c/= :: VirtualNodeRef -> VirtualNodeRef -> Bool
== :: VirtualNodeRef -> VirtualNodeRef -> Bool
$c== :: VirtualNodeRef -> VirtualNodeRef -> Bool
Prelude.Eq, ReadPrec [VirtualNodeRef]
ReadPrec VirtualNodeRef
Int -> ReadS VirtualNodeRef
ReadS [VirtualNodeRef]
(Int -> ReadS VirtualNodeRef)
-> ReadS [VirtualNodeRef]
-> ReadPrec VirtualNodeRef
-> ReadPrec [VirtualNodeRef]
-> Read VirtualNodeRef
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VirtualNodeRef]
$creadListPrec :: ReadPrec [VirtualNodeRef]
readPrec :: ReadPrec VirtualNodeRef
$creadPrec :: ReadPrec VirtualNodeRef
readList :: ReadS [VirtualNodeRef]
$creadList :: ReadS [VirtualNodeRef]
readsPrec :: Int -> ReadS VirtualNodeRef
$creadsPrec :: Int -> ReadS VirtualNodeRef
Prelude.Read, Int -> VirtualNodeRef -> ShowS
[VirtualNodeRef] -> ShowS
VirtualNodeRef -> String
(Int -> VirtualNodeRef -> ShowS)
-> (VirtualNodeRef -> String)
-> ([VirtualNodeRef] -> ShowS)
-> Show VirtualNodeRef
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VirtualNodeRef] -> ShowS
$cshowList :: [VirtualNodeRef] -> ShowS
show :: VirtualNodeRef -> String
$cshow :: VirtualNodeRef -> String
showsPrec :: Int -> VirtualNodeRef -> ShowS
$cshowsPrec :: Int -> VirtualNodeRef -> ShowS
Prelude.Show, (forall x. VirtualNodeRef -> Rep VirtualNodeRef x)
-> (forall x. Rep VirtualNodeRef x -> VirtualNodeRef)
-> Generic VirtualNodeRef
forall x. Rep VirtualNodeRef x -> VirtualNodeRef
forall x. VirtualNodeRef -> Rep VirtualNodeRef x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep VirtualNodeRef x -> VirtualNodeRef
$cfrom :: forall x. VirtualNodeRef -> Rep VirtualNodeRef x
Prelude.Generic)

-- |
-- Create a value of 'VirtualNodeRef' 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', 'virtualNodeRef_arn' - The full Amazon Resource Name (ARN) for the virtual node.
--
-- 'createdAt', 'virtualNodeRef_createdAt' - The Unix epoch timestamp in seconds for when the resource was created.
--
-- 'lastUpdatedAt', 'virtualNodeRef_lastUpdatedAt' - The Unix epoch timestamp in seconds for when the resource was last
-- updated.
--
-- 'meshName', 'virtualNodeRef_meshName' - The name of the service mesh that the virtual node resides in.
--
-- 'meshOwner', 'virtualNodeRef_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', 'virtualNodeRef_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>.
--
-- 'version', 'virtualNodeRef_version' - The version of the resource. Resources are created at version 1, and
-- this version is incremented each time that they\'re updated.
--
-- 'virtualNodeName', 'virtualNodeRef_virtualNodeName' - The name of the virtual node.
newVirtualNodeRef ::
  -- | 'arn'
  Prelude.Text ->
  -- | 'createdAt'
  Prelude.UTCTime ->
  -- | 'lastUpdatedAt'
  Prelude.UTCTime ->
  -- | 'meshName'
  Prelude.Text ->
  -- | 'meshOwner'
  Prelude.Text ->
  -- | 'resourceOwner'
  Prelude.Text ->
  -- | 'version'
  Prelude.Integer ->
  -- | 'virtualNodeName'
  Prelude.Text ->
  VirtualNodeRef
newVirtualNodeRef :: Text
-> UTCTime
-> UTCTime
-> Text
-> Text
-> Text
-> Integer
-> Text
-> VirtualNodeRef
newVirtualNodeRef
  Text
pArn_
  UTCTime
pCreatedAt_
  UTCTime
pLastUpdatedAt_
  Text
pMeshName_
  Text
pMeshOwner_
  Text
pResourceOwner_
  Integer
pVersion_
  Text
pVirtualNodeName_ =
    VirtualNodeRef' :: Text
-> POSIX
-> POSIX
-> Text
-> Text
-> Text
-> Integer
-> Text
-> VirtualNodeRef
VirtualNodeRef'
      { $sel:arn:VirtualNodeRef' :: Text
arn = Text
pArn_,
        $sel:createdAt:VirtualNodeRef' :: 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:VirtualNodeRef' :: 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:meshName:VirtualNodeRef' :: Text
meshName = Text
pMeshName_,
        $sel:meshOwner:VirtualNodeRef' :: Text
meshOwner = Text
pMeshOwner_,
        $sel:resourceOwner:VirtualNodeRef' :: Text
resourceOwner = Text
pResourceOwner_,
        $sel:version:VirtualNodeRef' :: Integer
version = Integer
pVersion_,
        $sel:virtualNodeName:VirtualNodeRef' :: Text
virtualNodeName = Text
pVirtualNodeName_
      }

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

-- | The Unix epoch timestamp in seconds for when the resource was created.
virtualNodeRef_createdAt :: Lens.Lens' VirtualNodeRef Prelude.UTCTime
virtualNodeRef_createdAt :: (UTCTime -> f UTCTime) -> VirtualNodeRef -> f VirtualNodeRef
virtualNodeRef_createdAt = (VirtualNodeRef -> POSIX)
-> (VirtualNodeRef -> POSIX -> VirtualNodeRef)
-> Lens VirtualNodeRef VirtualNodeRef POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VirtualNodeRef' {POSIX
createdAt :: POSIX
$sel:createdAt:VirtualNodeRef' :: VirtualNodeRef -> POSIX
createdAt} -> POSIX
createdAt) (\s :: VirtualNodeRef
s@VirtualNodeRef' {} POSIX
a -> VirtualNodeRef
s {$sel:createdAt:VirtualNodeRef' :: POSIX
createdAt = POSIX
a} :: VirtualNodeRef) ((POSIX -> f POSIX) -> VirtualNodeRef -> f VirtualNodeRef)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> VirtualNodeRef
-> f VirtualNodeRef
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.
virtualNodeRef_lastUpdatedAt :: Lens.Lens' VirtualNodeRef Prelude.UTCTime
virtualNodeRef_lastUpdatedAt :: (UTCTime -> f UTCTime) -> VirtualNodeRef -> f VirtualNodeRef
virtualNodeRef_lastUpdatedAt = (VirtualNodeRef -> POSIX)
-> (VirtualNodeRef -> POSIX -> VirtualNodeRef)
-> Lens VirtualNodeRef VirtualNodeRef POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VirtualNodeRef' {POSIX
lastUpdatedAt :: POSIX
$sel:lastUpdatedAt:VirtualNodeRef' :: VirtualNodeRef -> POSIX
lastUpdatedAt} -> POSIX
lastUpdatedAt) (\s :: VirtualNodeRef
s@VirtualNodeRef' {} POSIX
a -> VirtualNodeRef
s {$sel:lastUpdatedAt:VirtualNodeRef' :: POSIX
lastUpdatedAt = POSIX
a} :: VirtualNodeRef) ((POSIX -> f POSIX) -> VirtualNodeRef -> f VirtualNodeRef)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> VirtualNodeRef
-> f VirtualNodeRef
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 name of the service mesh that the virtual node resides in.
virtualNodeRef_meshName :: Lens.Lens' VirtualNodeRef Prelude.Text
virtualNodeRef_meshName :: (Text -> f Text) -> VirtualNodeRef -> f VirtualNodeRef
virtualNodeRef_meshName = (VirtualNodeRef -> Text)
-> (VirtualNodeRef -> Text -> VirtualNodeRef)
-> Lens VirtualNodeRef VirtualNodeRef Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VirtualNodeRef' {Text
meshName :: Text
$sel:meshName:VirtualNodeRef' :: VirtualNodeRef -> Text
meshName} -> Text
meshName) (\s :: VirtualNodeRef
s@VirtualNodeRef' {} Text
a -> VirtualNodeRef
s {$sel:meshName:VirtualNodeRef' :: Text
meshName = Text
a} :: VirtualNodeRef)

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

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

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

-- | The name of the virtual node.
virtualNodeRef_virtualNodeName :: Lens.Lens' VirtualNodeRef Prelude.Text
virtualNodeRef_virtualNodeName :: (Text -> f Text) -> VirtualNodeRef -> f VirtualNodeRef
virtualNodeRef_virtualNodeName = (VirtualNodeRef -> Text)
-> (VirtualNodeRef -> Text -> VirtualNodeRef)
-> Lens VirtualNodeRef VirtualNodeRef Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VirtualNodeRef' {Text
virtualNodeName :: Text
$sel:virtualNodeName:VirtualNodeRef' :: VirtualNodeRef -> Text
virtualNodeName} -> Text
virtualNodeName) (\s :: VirtualNodeRef
s@VirtualNodeRef' {} Text
a -> VirtualNodeRef
s {$sel:virtualNodeName:VirtualNodeRef' :: Text
virtualNodeName = Text
a} :: VirtualNodeRef)

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

instance Prelude.Hashable VirtualNodeRef

instance Prelude.NFData VirtualNodeRef