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

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

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

-- |
-- Create a value of 'RouteRef' 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', 'routeRef_arn' - The full Amazon Resource Name (ARN) for the route.
--
-- 'createdAt', 'routeRef_createdAt' - The Unix epoch timestamp in seconds for when the resource was created.
--
-- 'lastUpdatedAt', 'routeRef_lastUpdatedAt' - The Unix epoch timestamp in seconds for when the resource was last
-- updated.
--
-- 'meshName', 'routeRef_meshName' - The name of the service mesh that the route resides in.
--
-- 'meshOwner', 'routeRef_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', 'routeRef_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>.
--
-- 'routeName', 'routeRef_routeName' - The name of the route.
--
-- 'version', 'routeRef_version' - The version of the resource. Resources are created at version 1, and
-- this version is incremented each time that they\'re updated.
--
-- 'virtualRouterName', 'routeRef_virtualRouterName' - The virtual router that the route is associated with.
newRouteRef ::
  -- | 'arn'
  Prelude.Text ->
  -- | 'createdAt'
  Prelude.UTCTime ->
  -- | 'lastUpdatedAt'
  Prelude.UTCTime ->
  -- | 'meshName'
  Prelude.Text ->
  -- | 'meshOwner'
  Prelude.Text ->
  -- | 'resourceOwner'
  Prelude.Text ->
  -- | 'routeName'
  Prelude.Text ->
  -- | 'version'
  Prelude.Integer ->
  -- | 'virtualRouterName'
  Prelude.Text ->
  RouteRef
newRouteRef :: Text
-> UTCTime
-> UTCTime
-> Text
-> Text
-> Text
-> Text
-> Integer
-> Text
-> RouteRef
newRouteRef
  Text
pArn_
  UTCTime
pCreatedAt_
  UTCTime
pLastUpdatedAt_
  Text
pMeshName_
  Text
pMeshOwner_
  Text
pResourceOwner_
  Text
pRouteName_
  Integer
pVersion_
  Text
pVirtualRouterName_ =
    RouteRef' :: Text
-> POSIX
-> POSIX
-> Text
-> Text
-> Text
-> Text
-> Integer
-> Text
-> RouteRef
RouteRef'
      { $sel:arn:RouteRef' :: Text
arn = Text
pArn_,
        $sel:createdAt:RouteRef' :: 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:RouteRef' :: 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:RouteRef' :: Text
meshName = Text
pMeshName_,
        $sel:meshOwner:RouteRef' :: Text
meshOwner = Text
pMeshOwner_,
        $sel:resourceOwner:RouteRef' :: Text
resourceOwner = Text
pResourceOwner_,
        $sel:routeName:RouteRef' :: Text
routeName = Text
pRouteName_,
        $sel:version:RouteRef' :: Integer
version = Integer
pVersion_,
        $sel:virtualRouterName:RouteRef' :: Text
virtualRouterName = Text
pVirtualRouterName_
      }

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

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

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

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

-- | The name of the route.
routeRef_routeName :: Lens.Lens' RouteRef Prelude.Text
routeRef_routeName :: (Text -> f Text) -> RouteRef -> f RouteRef
routeRef_routeName = (RouteRef -> Text)
-> (RouteRef -> Text -> RouteRef)
-> Lens RouteRef RouteRef Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RouteRef' {Text
routeName :: Text
$sel:routeName:RouteRef' :: RouteRef -> Text
routeName} -> Text
routeName) (\s :: RouteRef
s@RouteRef' {} Text
a -> RouteRef
s {$sel:routeName:RouteRef' :: Text
routeName = Text
a} :: RouteRef)

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

-- | The virtual router that the route is associated with.
routeRef_virtualRouterName :: Lens.Lens' RouteRef Prelude.Text
routeRef_virtualRouterName :: (Text -> f Text) -> RouteRef -> f RouteRef
routeRef_virtualRouterName = (RouteRef -> Text)
-> (RouteRef -> Text -> RouteRef)
-> Lens RouteRef RouteRef Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RouteRef' {Text
virtualRouterName :: Text
$sel:virtualRouterName:RouteRef' :: RouteRef -> Text
virtualRouterName} -> Text
virtualRouterName) (\s :: RouteRef
s@RouteRef' {} Text
a -> RouteRef
s {$sel:virtualRouterName:RouteRef' :: Text
virtualRouterName = Text
a} :: RouteRef)

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

instance Prelude.NFData RouteRef