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

import Amazonka.AppMesh.Types.ResourceMetadata
import Amazonka.AppMesh.Types.VirtualServiceSpec
import Amazonka.AppMesh.Types.VirtualServiceStatus
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | An object that represents a virtual service returned by a describe
-- operation.
--
-- /See:/ 'newVirtualServiceData' smart constructor.
data VirtualServiceData = VirtualServiceData'
  { -- | The name of the service mesh that the virtual service resides in.
    VirtualServiceData -> Text
meshName :: Prelude.Text,
    VirtualServiceData -> ResourceMetadata
metadata :: ResourceMetadata,
    -- | The specifications of the virtual service.
    VirtualServiceData -> VirtualServiceSpec
spec :: VirtualServiceSpec,
    -- | The current status of the virtual service.
    VirtualServiceData -> VirtualServiceStatus
status :: VirtualServiceStatus,
    -- | The name of the virtual service.
    VirtualServiceData -> Text
virtualServiceName :: Prelude.Text
  }
  deriving (VirtualServiceData -> VirtualServiceData -> Bool
(VirtualServiceData -> VirtualServiceData -> Bool)
-> (VirtualServiceData -> VirtualServiceData -> Bool)
-> Eq VirtualServiceData
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VirtualServiceData -> VirtualServiceData -> Bool
$c/= :: VirtualServiceData -> VirtualServiceData -> Bool
== :: VirtualServiceData -> VirtualServiceData -> Bool
$c== :: VirtualServiceData -> VirtualServiceData -> Bool
Prelude.Eq, ReadPrec [VirtualServiceData]
ReadPrec VirtualServiceData
Int -> ReadS VirtualServiceData
ReadS [VirtualServiceData]
(Int -> ReadS VirtualServiceData)
-> ReadS [VirtualServiceData]
-> ReadPrec VirtualServiceData
-> ReadPrec [VirtualServiceData]
-> Read VirtualServiceData
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VirtualServiceData]
$creadListPrec :: ReadPrec [VirtualServiceData]
readPrec :: ReadPrec VirtualServiceData
$creadPrec :: ReadPrec VirtualServiceData
readList :: ReadS [VirtualServiceData]
$creadList :: ReadS [VirtualServiceData]
readsPrec :: Int -> ReadS VirtualServiceData
$creadsPrec :: Int -> ReadS VirtualServiceData
Prelude.Read, Int -> VirtualServiceData -> ShowS
[VirtualServiceData] -> ShowS
VirtualServiceData -> String
(Int -> VirtualServiceData -> ShowS)
-> (VirtualServiceData -> String)
-> ([VirtualServiceData] -> ShowS)
-> Show VirtualServiceData
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VirtualServiceData] -> ShowS
$cshowList :: [VirtualServiceData] -> ShowS
show :: VirtualServiceData -> String
$cshow :: VirtualServiceData -> String
showsPrec :: Int -> VirtualServiceData -> ShowS
$cshowsPrec :: Int -> VirtualServiceData -> ShowS
Prelude.Show, (forall x. VirtualServiceData -> Rep VirtualServiceData x)
-> (forall x. Rep VirtualServiceData x -> VirtualServiceData)
-> Generic VirtualServiceData
forall x. Rep VirtualServiceData x -> VirtualServiceData
forall x. VirtualServiceData -> Rep VirtualServiceData x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep VirtualServiceData x -> VirtualServiceData
$cfrom :: forall x. VirtualServiceData -> Rep VirtualServiceData x
Prelude.Generic)

-- |
-- Create a value of 'VirtualServiceData' 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', 'virtualServiceData_meshName' - The name of the service mesh that the virtual service resides in.
--
-- 'metadata', 'virtualServiceData_metadata' - Undocumented member.
--
-- 'spec', 'virtualServiceData_spec' - The specifications of the virtual service.
--
-- 'status', 'virtualServiceData_status' - The current status of the virtual service.
--
-- 'virtualServiceName', 'virtualServiceData_virtualServiceName' - The name of the virtual service.
newVirtualServiceData ::
  -- | 'meshName'
  Prelude.Text ->
  -- | 'metadata'
  ResourceMetadata ->
  -- | 'spec'
  VirtualServiceSpec ->
  -- | 'status'
  VirtualServiceStatus ->
  -- | 'virtualServiceName'
  Prelude.Text ->
  VirtualServiceData
newVirtualServiceData :: Text
-> ResourceMetadata
-> VirtualServiceSpec
-> VirtualServiceStatus
-> Text
-> VirtualServiceData
newVirtualServiceData
  Text
pMeshName_
  ResourceMetadata
pMetadata_
  VirtualServiceSpec
pSpec_
  VirtualServiceStatus
pStatus_
  Text
pVirtualServiceName_ =
    VirtualServiceData' :: Text
-> ResourceMetadata
-> VirtualServiceSpec
-> VirtualServiceStatus
-> Text
-> VirtualServiceData
VirtualServiceData'
      { $sel:meshName:VirtualServiceData' :: Text
meshName = Text
pMeshName_,
        $sel:metadata:VirtualServiceData' :: ResourceMetadata
metadata = ResourceMetadata
pMetadata_,
        $sel:spec:VirtualServiceData' :: VirtualServiceSpec
spec = VirtualServiceSpec
pSpec_,
        $sel:status:VirtualServiceData' :: VirtualServiceStatus
status = VirtualServiceStatus
pStatus_,
        $sel:virtualServiceName:VirtualServiceData' :: Text
virtualServiceName = Text
pVirtualServiceName_
      }

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

-- | Undocumented member.
virtualServiceData_metadata :: Lens.Lens' VirtualServiceData ResourceMetadata
virtualServiceData_metadata :: (ResourceMetadata -> f ResourceMetadata)
-> VirtualServiceData -> f VirtualServiceData
virtualServiceData_metadata = (VirtualServiceData -> ResourceMetadata)
-> (VirtualServiceData -> ResourceMetadata -> VirtualServiceData)
-> Lens
     VirtualServiceData
     VirtualServiceData
     ResourceMetadata
     ResourceMetadata
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VirtualServiceData' {ResourceMetadata
metadata :: ResourceMetadata
$sel:metadata:VirtualServiceData' :: VirtualServiceData -> ResourceMetadata
metadata} -> ResourceMetadata
metadata) (\s :: VirtualServiceData
s@VirtualServiceData' {} ResourceMetadata
a -> VirtualServiceData
s {$sel:metadata:VirtualServiceData' :: ResourceMetadata
metadata = ResourceMetadata
a} :: VirtualServiceData)

-- | The specifications of the virtual service.
virtualServiceData_spec :: Lens.Lens' VirtualServiceData VirtualServiceSpec
virtualServiceData_spec :: (VirtualServiceSpec -> f VirtualServiceSpec)
-> VirtualServiceData -> f VirtualServiceData
virtualServiceData_spec = (VirtualServiceData -> VirtualServiceSpec)
-> (VirtualServiceData -> VirtualServiceSpec -> VirtualServiceData)
-> Lens
     VirtualServiceData
     VirtualServiceData
     VirtualServiceSpec
     VirtualServiceSpec
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VirtualServiceData' {VirtualServiceSpec
spec :: VirtualServiceSpec
$sel:spec:VirtualServiceData' :: VirtualServiceData -> VirtualServiceSpec
spec} -> VirtualServiceSpec
spec) (\s :: VirtualServiceData
s@VirtualServiceData' {} VirtualServiceSpec
a -> VirtualServiceData
s {$sel:spec:VirtualServiceData' :: VirtualServiceSpec
spec = VirtualServiceSpec
a} :: VirtualServiceData)

-- | The current status of the virtual service.
virtualServiceData_status :: Lens.Lens' VirtualServiceData VirtualServiceStatus
virtualServiceData_status :: (VirtualServiceStatus -> f VirtualServiceStatus)
-> VirtualServiceData -> f VirtualServiceData
virtualServiceData_status = (VirtualServiceData -> VirtualServiceStatus)
-> (VirtualServiceData
    -> VirtualServiceStatus -> VirtualServiceData)
-> Lens
     VirtualServiceData
     VirtualServiceData
     VirtualServiceStatus
     VirtualServiceStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VirtualServiceData' {VirtualServiceStatus
status :: VirtualServiceStatus
$sel:status:VirtualServiceData' :: VirtualServiceData -> VirtualServiceStatus
status} -> VirtualServiceStatus
status) (\s :: VirtualServiceData
s@VirtualServiceData' {} VirtualServiceStatus
a -> VirtualServiceData
s {$sel:status:VirtualServiceData' :: VirtualServiceStatus
status = VirtualServiceStatus
a} :: VirtualServiceData)

-- | The name of the virtual service.
virtualServiceData_virtualServiceName :: Lens.Lens' VirtualServiceData Prelude.Text
virtualServiceData_virtualServiceName :: (Text -> f Text) -> VirtualServiceData -> f VirtualServiceData
virtualServiceData_virtualServiceName = (VirtualServiceData -> Text)
-> (VirtualServiceData -> Text -> VirtualServiceData)
-> Lens VirtualServiceData VirtualServiceData Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VirtualServiceData' {Text
virtualServiceName :: Text
$sel:virtualServiceName:VirtualServiceData' :: VirtualServiceData -> Text
virtualServiceName} -> Text
virtualServiceName) (\s :: VirtualServiceData
s@VirtualServiceData' {} Text
a -> VirtualServiceData
s {$sel:virtualServiceName:VirtualServiceData' :: Text
virtualServiceName = Text
a} :: VirtualServiceData)

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

instance Prelude.Hashable VirtualServiceData

instance Prelude.NFData VirtualServiceData