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

-- |
-- Create a value of 'VirtualRouterRef' 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', 'virtualRouterRef_arn' - The full Amazon Resource Name (ARN) for the virtual router.
--
-- 'createdAt', 'virtualRouterRef_createdAt' - The Unix epoch timestamp in seconds for when the resource was created.
--
-- 'lastUpdatedAt', 'virtualRouterRef_lastUpdatedAt' - The Unix epoch timestamp in seconds for when the resource was last
-- updated.
--
-- 'meshName', 'virtualRouterRef_meshName' - The name of the service mesh that the virtual router resides in.
--
-- 'meshOwner', 'virtualRouterRef_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', 'virtualRouterRef_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', 'virtualRouterRef_version' - The version of the resource. Resources are created at version 1, and
-- this version is incremented each time that they\'re updated.
--
-- 'virtualRouterName', 'virtualRouterRef_virtualRouterName' - The name of the virtual router.
newVirtualRouterRef ::
  -- | 'arn'
  Prelude.Text ->
  -- | 'createdAt'
  Prelude.UTCTime ->
  -- | 'lastUpdatedAt'
  Prelude.UTCTime ->
  -- | 'meshName'
  Prelude.Text ->
  -- | 'meshOwner'
  Prelude.Text ->
  -- | 'resourceOwner'
  Prelude.Text ->
  -- | 'version'
  Prelude.Integer ->
  -- | 'virtualRouterName'
  Prelude.Text ->
  VirtualRouterRef
newVirtualRouterRef :: Text
-> UTCTime
-> UTCTime
-> Text
-> Text
-> Text
-> Integer
-> Text
-> VirtualRouterRef
newVirtualRouterRef
  Text
pArn_
  UTCTime
pCreatedAt_
  UTCTime
pLastUpdatedAt_
  Text
pMeshName_
  Text
pMeshOwner_
  Text
pResourceOwner_
  Integer
pVersion_
  Text
pVirtualRouterName_ =
    VirtualRouterRef' :: Text
-> POSIX
-> POSIX
-> Text
-> Text
-> Text
-> Integer
-> Text
-> VirtualRouterRef
VirtualRouterRef'
      { $sel:arn:VirtualRouterRef' :: Text
arn = Text
pArn_,
        $sel:createdAt:VirtualRouterRef' :: 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:VirtualRouterRef' :: 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:VirtualRouterRef' :: Text
meshName = Text
pMeshName_,
        $sel:meshOwner:VirtualRouterRef' :: Text
meshOwner = Text
pMeshOwner_,
        $sel:resourceOwner:VirtualRouterRef' :: Text
resourceOwner = Text
pResourceOwner_,
        $sel:version:VirtualRouterRef' :: Integer
version = Integer
pVersion_,
        $sel:virtualRouterName:VirtualRouterRef' :: Text
virtualRouterName = Text
pVirtualRouterName_
      }

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

-- | The Unix epoch timestamp in seconds for when the resource was created.
virtualRouterRef_createdAt :: Lens.Lens' VirtualRouterRef Prelude.UTCTime
virtualRouterRef_createdAt :: (UTCTime -> f UTCTime) -> VirtualRouterRef -> f VirtualRouterRef
virtualRouterRef_createdAt = (VirtualRouterRef -> POSIX)
-> (VirtualRouterRef -> POSIX -> VirtualRouterRef)
-> Lens VirtualRouterRef VirtualRouterRef POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VirtualRouterRef' {POSIX
createdAt :: POSIX
$sel:createdAt:VirtualRouterRef' :: VirtualRouterRef -> POSIX
createdAt} -> POSIX
createdAt) (\s :: VirtualRouterRef
s@VirtualRouterRef' {} POSIX
a -> VirtualRouterRef
s {$sel:createdAt:VirtualRouterRef' :: POSIX
createdAt = POSIX
a} :: VirtualRouterRef) ((POSIX -> f POSIX) -> VirtualRouterRef -> f VirtualRouterRef)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> VirtualRouterRef
-> f VirtualRouterRef
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.
virtualRouterRef_lastUpdatedAt :: Lens.Lens' VirtualRouterRef Prelude.UTCTime
virtualRouterRef_lastUpdatedAt :: (UTCTime -> f UTCTime) -> VirtualRouterRef -> f VirtualRouterRef
virtualRouterRef_lastUpdatedAt = (VirtualRouterRef -> POSIX)
-> (VirtualRouterRef -> POSIX -> VirtualRouterRef)
-> Lens VirtualRouterRef VirtualRouterRef POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VirtualRouterRef' {POSIX
lastUpdatedAt :: POSIX
$sel:lastUpdatedAt:VirtualRouterRef' :: VirtualRouterRef -> POSIX
lastUpdatedAt} -> POSIX
lastUpdatedAt) (\s :: VirtualRouterRef
s@VirtualRouterRef' {} POSIX
a -> VirtualRouterRef
s {$sel:lastUpdatedAt:VirtualRouterRef' :: POSIX
lastUpdatedAt = POSIX
a} :: VirtualRouterRef) ((POSIX -> f POSIX) -> VirtualRouterRef -> f VirtualRouterRef)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> VirtualRouterRef
-> f VirtualRouterRef
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 router resides in.
virtualRouterRef_meshName :: Lens.Lens' VirtualRouterRef Prelude.Text
virtualRouterRef_meshName :: (Text -> f Text) -> VirtualRouterRef -> f VirtualRouterRef
virtualRouterRef_meshName = (VirtualRouterRef -> Text)
-> (VirtualRouterRef -> Text -> VirtualRouterRef)
-> Lens VirtualRouterRef VirtualRouterRef Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VirtualRouterRef' {Text
meshName :: Text
$sel:meshName:VirtualRouterRef' :: VirtualRouterRef -> Text
meshName} -> Text
meshName) (\s :: VirtualRouterRef
s@VirtualRouterRef' {} Text
a -> VirtualRouterRef
s {$sel:meshName:VirtualRouterRef' :: Text
meshName = Text
a} :: VirtualRouterRef)

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

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

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

-- | The name of the virtual router.
virtualRouterRef_virtualRouterName :: Lens.Lens' VirtualRouterRef Prelude.Text
virtualRouterRef_virtualRouterName :: (Text -> f Text) -> VirtualRouterRef -> f VirtualRouterRef
virtualRouterRef_virtualRouterName = (VirtualRouterRef -> Text)
-> (VirtualRouterRef -> Text -> VirtualRouterRef)
-> Lens VirtualRouterRef VirtualRouterRef Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VirtualRouterRef' {Text
virtualRouterName :: Text
$sel:virtualRouterName:VirtualRouterRef' :: VirtualRouterRef -> Text
virtualRouterName} -> Text
virtualRouterName) (\s :: VirtualRouterRef
s@VirtualRouterRef' {} Text
a -> VirtualRouterRef
s {$sel:virtualRouterName:VirtualRouterRef' :: Text
virtualRouterName = Text
a} :: VirtualRouterRef)

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

instance Prelude.Hashable VirtualRouterRef

instance Prelude.NFData VirtualRouterRef