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

import Amazonka.AppMesh.Types.ResourceMetadata
import Amazonka.AppMesh.Types.RouteSpec
import Amazonka.AppMesh.Types.RouteStatus
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 describe operation.
--
-- /See:/ 'newRouteData' smart constructor.
data RouteData = RouteData'
  { -- | The name of the service mesh that the route resides in.
    RouteData -> Text
meshName :: Prelude.Text,
    -- | The associated metadata for the route.
    RouteData -> ResourceMetadata
metadata :: ResourceMetadata,
    -- | The name of the route.
    RouteData -> Text
routeName :: Prelude.Text,
    -- | The specifications of the route.
    RouteData -> RouteSpec
spec :: RouteSpec,
    -- | The status of the route.
    RouteData -> RouteStatus
status :: RouteStatus,
    -- | The virtual router that the route is associated with.
    RouteData -> Text
virtualRouterName :: Prelude.Text
  }
  deriving (RouteData -> RouteData -> Bool
(RouteData -> RouteData -> Bool)
-> (RouteData -> RouteData -> Bool) -> Eq RouteData
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RouteData -> RouteData -> Bool
$c/= :: RouteData -> RouteData -> Bool
== :: RouteData -> RouteData -> Bool
$c== :: RouteData -> RouteData -> Bool
Prelude.Eq, ReadPrec [RouteData]
ReadPrec RouteData
Int -> ReadS RouteData
ReadS [RouteData]
(Int -> ReadS RouteData)
-> ReadS [RouteData]
-> ReadPrec RouteData
-> ReadPrec [RouteData]
-> Read RouteData
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RouteData]
$creadListPrec :: ReadPrec [RouteData]
readPrec :: ReadPrec RouteData
$creadPrec :: ReadPrec RouteData
readList :: ReadS [RouteData]
$creadList :: ReadS [RouteData]
readsPrec :: Int -> ReadS RouteData
$creadsPrec :: Int -> ReadS RouteData
Prelude.Read, Int -> RouteData -> ShowS
[RouteData] -> ShowS
RouteData -> String
(Int -> RouteData -> ShowS)
-> (RouteData -> String)
-> ([RouteData] -> ShowS)
-> Show RouteData
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RouteData] -> ShowS
$cshowList :: [RouteData] -> ShowS
show :: RouteData -> String
$cshow :: RouteData -> String
showsPrec :: Int -> RouteData -> ShowS
$cshowsPrec :: Int -> RouteData -> ShowS
Prelude.Show, (forall x. RouteData -> Rep RouteData x)
-> (forall x. Rep RouteData x -> RouteData) -> Generic RouteData
forall x. Rep RouteData x -> RouteData
forall x. RouteData -> Rep RouteData x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RouteData x -> RouteData
$cfrom :: forall x. RouteData -> Rep RouteData x
Prelude.Generic)

-- |
-- Create a value of 'RouteData' 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:
--
-- 'meshName', 'routeData_meshName' - The name of the service mesh that the route resides in.
--
-- 'metadata', 'routeData_metadata' - The associated metadata for the route.
--
-- 'routeName', 'routeData_routeName' - The name of the route.
--
-- 'spec', 'routeData_spec' - The specifications of the route.
--
-- 'status', 'routeData_status' - The status of the route.
--
-- 'virtualRouterName', 'routeData_virtualRouterName' - The virtual router that the route is associated with.
newRouteData ::
  -- | 'meshName'
  Prelude.Text ->
  -- | 'metadata'
  ResourceMetadata ->
  -- | 'routeName'
  Prelude.Text ->
  -- | 'spec'
  RouteSpec ->
  -- | 'status'
  RouteStatus ->
  -- | 'virtualRouterName'
  Prelude.Text ->
  RouteData
newRouteData :: Text
-> ResourceMetadata
-> Text
-> RouteSpec
-> RouteStatus
-> Text
-> RouteData
newRouteData
  Text
pMeshName_
  ResourceMetadata
pMetadata_
  Text
pRouteName_
  RouteSpec
pSpec_
  RouteStatus
pStatus_
  Text
pVirtualRouterName_ =
    RouteData' :: Text
-> ResourceMetadata
-> Text
-> RouteSpec
-> RouteStatus
-> Text
-> RouteData
RouteData'
      { $sel:meshName:RouteData' :: Text
meshName = Text
pMeshName_,
        $sel:metadata:RouteData' :: ResourceMetadata
metadata = ResourceMetadata
pMetadata_,
        $sel:routeName:RouteData' :: Text
routeName = Text
pRouteName_,
        $sel:spec:RouteData' :: RouteSpec
spec = RouteSpec
pSpec_,
        $sel:status:RouteData' :: RouteStatus
status = RouteStatus
pStatus_,
        $sel:virtualRouterName:RouteData' :: Text
virtualRouterName = Text
pVirtualRouterName_
      }

-- | The name of the service mesh that the route resides in.
routeData_meshName :: Lens.Lens' RouteData Prelude.Text
routeData_meshName :: (Text -> f Text) -> RouteData -> f RouteData
routeData_meshName = (RouteData -> Text)
-> (RouteData -> Text -> RouteData)
-> Lens RouteData RouteData Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RouteData' {Text
meshName :: Text
$sel:meshName:RouteData' :: RouteData -> Text
meshName} -> Text
meshName) (\s :: RouteData
s@RouteData' {} Text
a -> RouteData
s {$sel:meshName:RouteData' :: Text
meshName = Text
a} :: RouteData)

-- | The associated metadata for the route.
routeData_metadata :: Lens.Lens' RouteData ResourceMetadata
routeData_metadata :: (ResourceMetadata -> f ResourceMetadata)
-> RouteData -> f RouteData
routeData_metadata = (RouteData -> ResourceMetadata)
-> (RouteData -> ResourceMetadata -> RouteData)
-> Lens RouteData RouteData ResourceMetadata ResourceMetadata
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RouteData' {ResourceMetadata
metadata :: ResourceMetadata
$sel:metadata:RouteData' :: RouteData -> ResourceMetadata
metadata} -> ResourceMetadata
metadata) (\s :: RouteData
s@RouteData' {} ResourceMetadata
a -> RouteData
s {$sel:metadata:RouteData' :: ResourceMetadata
metadata = ResourceMetadata
a} :: RouteData)

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

-- | The specifications of the route.
routeData_spec :: Lens.Lens' RouteData RouteSpec
routeData_spec :: (RouteSpec -> f RouteSpec) -> RouteData -> f RouteData
routeData_spec = (RouteData -> RouteSpec)
-> (RouteData -> RouteSpec -> RouteData)
-> Lens RouteData RouteData RouteSpec RouteSpec
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RouteData' {RouteSpec
spec :: RouteSpec
$sel:spec:RouteData' :: RouteData -> RouteSpec
spec} -> RouteSpec
spec) (\s :: RouteData
s@RouteData' {} RouteSpec
a -> RouteData
s {$sel:spec:RouteData' :: RouteSpec
spec = RouteSpec
a} :: RouteData)

-- | The status of the route.
routeData_status :: Lens.Lens' RouteData RouteStatus
routeData_status :: (RouteStatus -> f RouteStatus) -> RouteData -> f RouteData
routeData_status = (RouteData -> RouteStatus)
-> (RouteData -> RouteStatus -> RouteData)
-> Lens RouteData RouteData RouteStatus RouteStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RouteData' {RouteStatus
status :: RouteStatus
$sel:status:RouteData' :: RouteData -> RouteStatus
status} -> RouteStatus
status) (\s :: RouteData
s@RouteData' {} RouteStatus
a -> RouteData
s {$sel:status:RouteData' :: RouteStatus
status = RouteStatus
a} :: RouteData)

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

instance Core.FromJSON RouteData where
  parseJSON :: Value -> Parser RouteData
parseJSON =
    String -> (Object -> Parser RouteData) -> Value -> Parser RouteData
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"RouteData"
      ( \Object
x ->
          Text
-> ResourceMetadata
-> Text
-> RouteSpec
-> RouteStatus
-> Text
-> RouteData
RouteData'
            (Text
 -> ResourceMetadata
 -> Text
 -> RouteSpec
 -> RouteStatus
 -> Text
 -> RouteData)
-> Parser Text
-> Parser
     (ResourceMetadata
      -> Text -> RouteSpec -> RouteStatus -> Text -> RouteData)
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
"meshName")
            Parser
  (ResourceMetadata
   -> Text -> RouteSpec -> RouteStatus -> Text -> RouteData)
-> Parser ResourceMetadata
-> Parser (Text -> RouteSpec -> RouteStatus -> Text -> RouteData)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser ResourceMetadata
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"metadata")
            Parser (Text -> RouteSpec -> RouteStatus -> Text -> RouteData)
-> Parser Text
-> Parser (RouteSpec -> RouteStatus -> Text -> RouteData)
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 (RouteSpec -> RouteStatus -> Text -> RouteData)
-> Parser RouteSpec -> Parser (RouteStatus -> Text -> RouteData)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser RouteSpec
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"spec")
            Parser (RouteStatus -> Text -> RouteData)
-> Parser RouteStatus -> Parser (Text -> RouteData)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser RouteStatus
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"status")
            Parser (Text -> RouteData) -> Parser Text -> Parser RouteData
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 RouteData

instance Prelude.NFData RouteData