{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# 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.DescribeVirtualNode
-- 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)
--
-- Describes an existing virtual node.
module Amazonka.AppMesh.DescribeVirtualNode
  ( -- * Creating a Request
    DescribeVirtualNode (..),
    newDescribeVirtualNode,

    -- * Request Lenses
    describeVirtualNode_meshOwner,
    describeVirtualNode_meshName,
    describeVirtualNode_virtualNodeName,

    -- * Destructuring the Response
    DescribeVirtualNodeResponse (..),
    newDescribeVirtualNodeResponse,

    -- * Response Lenses
    describeVirtualNodeResponse_httpStatus,
    describeVirtualNodeResponse_virtualNode,
  )
where

import Amazonka.AppMesh.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- |
--
-- /See:/ 'newDescribeVirtualNode' smart constructor.
data DescribeVirtualNode = DescribeVirtualNode'
  { -- | 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>.
    DescribeVirtualNode -> Maybe Text
meshOwner :: Prelude.Maybe Prelude.Text,
    -- | The name of the service mesh that the virtual node resides in.
    DescribeVirtualNode -> Text
meshName :: Prelude.Text,
    -- | The name of the virtual node to describe.
    DescribeVirtualNode -> Text
virtualNodeName :: Prelude.Text
  }
  deriving (DescribeVirtualNode -> DescribeVirtualNode -> Bool
(DescribeVirtualNode -> DescribeVirtualNode -> Bool)
-> (DescribeVirtualNode -> DescribeVirtualNode -> Bool)
-> Eq DescribeVirtualNode
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeVirtualNode -> DescribeVirtualNode -> Bool
$c/= :: DescribeVirtualNode -> DescribeVirtualNode -> Bool
== :: DescribeVirtualNode -> DescribeVirtualNode -> Bool
$c== :: DescribeVirtualNode -> DescribeVirtualNode -> Bool
Prelude.Eq, ReadPrec [DescribeVirtualNode]
ReadPrec DescribeVirtualNode
Int -> ReadS DescribeVirtualNode
ReadS [DescribeVirtualNode]
(Int -> ReadS DescribeVirtualNode)
-> ReadS [DescribeVirtualNode]
-> ReadPrec DescribeVirtualNode
-> ReadPrec [DescribeVirtualNode]
-> Read DescribeVirtualNode
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeVirtualNode]
$creadListPrec :: ReadPrec [DescribeVirtualNode]
readPrec :: ReadPrec DescribeVirtualNode
$creadPrec :: ReadPrec DescribeVirtualNode
readList :: ReadS [DescribeVirtualNode]
$creadList :: ReadS [DescribeVirtualNode]
readsPrec :: Int -> ReadS DescribeVirtualNode
$creadsPrec :: Int -> ReadS DescribeVirtualNode
Prelude.Read, Int -> DescribeVirtualNode -> ShowS
[DescribeVirtualNode] -> ShowS
DescribeVirtualNode -> String
(Int -> DescribeVirtualNode -> ShowS)
-> (DescribeVirtualNode -> String)
-> ([DescribeVirtualNode] -> ShowS)
-> Show DescribeVirtualNode
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeVirtualNode] -> ShowS
$cshowList :: [DescribeVirtualNode] -> ShowS
show :: DescribeVirtualNode -> String
$cshow :: DescribeVirtualNode -> String
showsPrec :: Int -> DescribeVirtualNode -> ShowS
$cshowsPrec :: Int -> DescribeVirtualNode -> ShowS
Prelude.Show, (forall x. DescribeVirtualNode -> Rep DescribeVirtualNode x)
-> (forall x. Rep DescribeVirtualNode x -> DescribeVirtualNode)
-> Generic DescribeVirtualNode
forall x. Rep DescribeVirtualNode x -> DescribeVirtualNode
forall x. DescribeVirtualNode -> Rep DescribeVirtualNode x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeVirtualNode x -> DescribeVirtualNode
$cfrom :: forall x. DescribeVirtualNode -> Rep DescribeVirtualNode x
Prelude.Generic)

-- |
-- Create a value of 'DescribeVirtualNode' 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:
--
-- 'meshOwner', 'describeVirtualNode_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>.
--
-- 'meshName', 'describeVirtualNode_meshName' - The name of the service mesh that the virtual node resides in.
--
-- 'virtualNodeName', 'describeVirtualNode_virtualNodeName' - The name of the virtual node to describe.
newDescribeVirtualNode ::
  -- | 'meshName'
  Prelude.Text ->
  -- | 'virtualNodeName'
  Prelude.Text ->
  DescribeVirtualNode
newDescribeVirtualNode :: Text -> Text -> DescribeVirtualNode
newDescribeVirtualNode Text
pMeshName_ Text
pVirtualNodeName_ =
  DescribeVirtualNode' :: Maybe Text -> Text -> Text -> DescribeVirtualNode
DescribeVirtualNode'
    { $sel:meshOwner:DescribeVirtualNode' :: Maybe Text
meshOwner = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:meshName:DescribeVirtualNode' :: Text
meshName = Text
pMeshName_,
      $sel:virtualNodeName:DescribeVirtualNode' :: Text
virtualNodeName = Text
pVirtualNodeName_
    }

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

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

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

instance Core.AWSRequest DescribeVirtualNode where
  type
    AWSResponse DescribeVirtualNode =
      DescribeVirtualNodeResponse
  request :: DescribeVirtualNode -> Request DescribeVirtualNode
request = Service -> DescribeVirtualNode -> Request DescribeVirtualNode
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeVirtualNode
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeVirtualNode)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeVirtualNode))
-> Logger
-> Service
-> Proxy DescribeVirtualNode
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeVirtualNode)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Int -> VirtualNodeData -> DescribeVirtualNodeResponse
DescribeVirtualNodeResponse'
            (Int -> VirtualNodeData -> DescribeVirtualNodeResponse)
-> Either String Int
-> Either String (VirtualNodeData -> DescribeVirtualNodeResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
            Either String (VirtualNodeData -> DescribeVirtualNodeResponse)
-> Either String VirtualNodeData
-> Either String DescribeVirtualNodeResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object -> Either String VirtualNodeData
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
      )

instance Prelude.Hashable DescribeVirtualNode

instance Prelude.NFData DescribeVirtualNode

instance Core.ToHeaders DescribeVirtualNode where
  toHeaders :: DescribeVirtualNode -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeVirtualNode -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToPath DescribeVirtualNode where
  toPath :: DescribeVirtualNode -> ByteString
toPath DescribeVirtualNode' {Maybe Text
Text
virtualNodeName :: Text
meshName :: Text
meshOwner :: Maybe Text
$sel:virtualNodeName:DescribeVirtualNode' :: DescribeVirtualNode -> Text
$sel:meshName:DescribeVirtualNode' :: DescribeVirtualNode -> Text
$sel:meshOwner:DescribeVirtualNode' :: DescribeVirtualNode -> Maybe Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/v20190125/meshes/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
meshName,
        ByteString
"/virtualNodes/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
virtualNodeName
      ]

instance Core.ToQuery DescribeVirtualNode where
  toQuery :: DescribeVirtualNode -> QueryString
toQuery DescribeVirtualNode' {Maybe Text
Text
virtualNodeName :: Text
meshName :: Text
meshOwner :: Maybe Text
$sel:virtualNodeName:DescribeVirtualNode' :: DescribeVirtualNode -> Text
$sel:meshName:DescribeVirtualNode' :: DescribeVirtualNode -> Text
$sel:meshOwner:DescribeVirtualNode' :: DescribeVirtualNode -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"meshOwner" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
meshOwner]

-- |
--
-- /See:/ 'newDescribeVirtualNodeResponse' smart constructor.
data DescribeVirtualNodeResponse = DescribeVirtualNodeResponse'
  { -- | The response's http status code.
    DescribeVirtualNodeResponse -> Int
httpStatus :: Prelude.Int,
    -- | The full description of your virtual node.
    DescribeVirtualNodeResponse -> VirtualNodeData
virtualNode :: VirtualNodeData
  }
  deriving (DescribeVirtualNodeResponse -> DescribeVirtualNodeResponse -> Bool
(DescribeVirtualNodeResponse
 -> DescribeVirtualNodeResponse -> Bool)
-> (DescribeVirtualNodeResponse
    -> DescribeVirtualNodeResponse -> Bool)
-> Eq DescribeVirtualNodeResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeVirtualNodeResponse -> DescribeVirtualNodeResponse -> Bool
$c/= :: DescribeVirtualNodeResponse -> DescribeVirtualNodeResponse -> Bool
== :: DescribeVirtualNodeResponse -> DescribeVirtualNodeResponse -> Bool
$c== :: DescribeVirtualNodeResponse -> DescribeVirtualNodeResponse -> Bool
Prelude.Eq, ReadPrec [DescribeVirtualNodeResponse]
ReadPrec DescribeVirtualNodeResponse
Int -> ReadS DescribeVirtualNodeResponse
ReadS [DescribeVirtualNodeResponse]
(Int -> ReadS DescribeVirtualNodeResponse)
-> ReadS [DescribeVirtualNodeResponse]
-> ReadPrec DescribeVirtualNodeResponse
-> ReadPrec [DescribeVirtualNodeResponse]
-> Read DescribeVirtualNodeResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeVirtualNodeResponse]
$creadListPrec :: ReadPrec [DescribeVirtualNodeResponse]
readPrec :: ReadPrec DescribeVirtualNodeResponse
$creadPrec :: ReadPrec DescribeVirtualNodeResponse
readList :: ReadS [DescribeVirtualNodeResponse]
$creadList :: ReadS [DescribeVirtualNodeResponse]
readsPrec :: Int -> ReadS DescribeVirtualNodeResponse
$creadsPrec :: Int -> ReadS DescribeVirtualNodeResponse
Prelude.Read, Int -> DescribeVirtualNodeResponse -> ShowS
[DescribeVirtualNodeResponse] -> ShowS
DescribeVirtualNodeResponse -> String
(Int -> DescribeVirtualNodeResponse -> ShowS)
-> (DescribeVirtualNodeResponse -> String)
-> ([DescribeVirtualNodeResponse] -> ShowS)
-> Show DescribeVirtualNodeResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeVirtualNodeResponse] -> ShowS
$cshowList :: [DescribeVirtualNodeResponse] -> ShowS
show :: DescribeVirtualNodeResponse -> String
$cshow :: DescribeVirtualNodeResponse -> String
showsPrec :: Int -> DescribeVirtualNodeResponse -> ShowS
$cshowsPrec :: Int -> DescribeVirtualNodeResponse -> ShowS
Prelude.Show, (forall x.
 DescribeVirtualNodeResponse -> Rep DescribeVirtualNodeResponse x)
-> (forall x.
    Rep DescribeVirtualNodeResponse x -> DescribeVirtualNodeResponse)
-> Generic DescribeVirtualNodeResponse
forall x.
Rep DescribeVirtualNodeResponse x -> DescribeVirtualNodeResponse
forall x.
DescribeVirtualNodeResponse -> Rep DescribeVirtualNodeResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeVirtualNodeResponse x -> DescribeVirtualNodeResponse
$cfrom :: forall x.
DescribeVirtualNodeResponse -> Rep DescribeVirtualNodeResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeVirtualNodeResponse' 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:
--
-- 'httpStatus', 'describeVirtualNodeResponse_httpStatus' - The response's http status code.
--
-- 'virtualNode', 'describeVirtualNodeResponse_virtualNode' - The full description of your virtual node.
newDescribeVirtualNodeResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'virtualNode'
  VirtualNodeData ->
  DescribeVirtualNodeResponse
newDescribeVirtualNodeResponse :: Int -> VirtualNodeData -> DescribeVirtualNodeResponse
newDescribeVirtualNodeResponse
  Int
pHttpStatus_
  VirtualNodeData
pVirtualNode_ =
    DescribeVirtualNodeResponse' :: Int -> VirtualNodeData -> DescribeVirtualNodeResponse
DescribeVirtualNodeResponse'
      { $sel:httpStatus:DescribeVirtualNodeResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:virtualNode:DescribeVirtualNodeResponse' :: VirtualNodeData
virtualNode = VirtualNodeData
pVirtualNode_
      }

-- | The response's http status code.
describeVirtualNodeResponse_httpStatus :: Lens.Lens' DescribeVirtualNodeResponse Prelude.Int
describeVirtualNodeResponse_httpStatus :: (Int -> f Int)
-> DescribeVirtualNodeResponse -> f DescribeVirtualNodeResponse
describeVirtualNodeResponse_httpStatus = (DescribeVirtualNodeResponse -> Int)
-> (DescribeVirtualNodeResponse
    -> Int -> DescribeVirtualNodeResponse)
-> Lens
     DescribeVirtualNodeResponse DescribeVirtualNodeResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeVirtualNodeResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeVirtualNodeResponse' :: DescribeVirtualNodeResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeVirtualNodeResponse
s@DescribeVirtualNodeResponse' {} Int
a -> DescribeVirtualNodeResponse
s {$sel:httpStatus:DescribeVirtualNodeResponse' :: Int
httpStatus = Int
a} :: DescribeVirtualNodeResponse)

-- | The full description of your virtual node.
describeVirtualNodeResponse_virtualNode :: Lens.Lens' DescribeVirtualNodeResponse VirtualNodeData
describeVirtualNodeResponse_virtualNode :: (VirtualNodeData -> f VirtualNodeData)
-> DescribeVirtualNodeResponse -> f DescribeVirtualNodeResponse
describeVirtualNodeResponse_virtualNode = (DescribeVirtualNodeResponse -> VirtualNodeData)
-> (DescribeVirtualNodeResponse
    -> VirtualNodeData -> DescribeVirtualNodeResponse)
-> Lens
     DescribeVirtualNodeResponse
     DescribeVirtualNodeResponse
     VirtualNodeData
     VirtualNodeData
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeVirtualNodeResponse' {VirtualNodeData
virtualNode :: VirtualNodeData
$sel:virtualNode:DescribeVirtualNodeResponse' :: DescribeVirtualNodeResponse -> VirtualNodeData
virtualNode} -> VirtualNodeData
virtualNode) (\s :: DescribeVirtualNodeResponse
s@DescribeVirtualNodeResponse' {} VirtualNodeData
a -> DescribeVirtualNodeResponse
s {$sel:virtualNode:DescribeVirtualNodeResponse' :: VirtualNodeData
virtualNode = VirtualNodeData
a} :: DescribeVirtualNodeResponse)

instance Prelude.NFData DescribeVirtualNodeResponse