{-# 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.CreateVirtualNode
-- 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)
--
-- Creates a virtual node within a service mesh.
--
-- A virtual node acts as a logical pointer to a particular task group,
-- such as an Amazon ECS service or a Kubernetes deployment. When you
-- create a virtual node, you can specify the service discovery information
-- for your task group, and whether the proxy running in a task group will
-- communicate with other proxies using Transport Layer Security (TLS).
--
-- You define a @listener@ for any inbound traffic that your virtual node
-- expects. Any virtual service that your virtual node expects to
-- communicate to is specified as a @backend@.
--
-- The response metadata for your new virtual node contains the @arn@ that
-- is associated with the virtual node. Set this value to the full ARN; for
-- example,
-- @arn:aws:appmesh:us-west-2:123456789012:myMesh\/default\/virtualNode\/myApp@)
-- as the @APPMESH_RESOURCE_ARN@ environment variable for your task
-- group\'s Envoy proxy container in your task definition or pod spec. This
-- is then mapped to the @node.id@ and @node.cluster@ Envoy parameters.
--
-- By default, App Mesh uses the name of the resource you specified in
-- @APPMESH_RESOURCE_ARN@ when Envoy is referring to itself in metrics and
-- traces. You can override this behavior by setting the
-- @APPMESH_RESOURCE_CLUSTER@ environment variable with your own name.
--
-- For more information about virtual nodes, see
-- <https://docs.aws.amazon.com/app-mesh/latest/userguide/virtual_nodes.html Virtual nodes>.
-- You must be using @1.15.0@ or later of the Envoy image when setting
-- these variables. For more information aboutApp Mesh Envoy variables, see
-- <https://docs.aws.amazon.com/app-mesh/latest/userguide/envoy.html Envoy image>
-- in the AWS App Mesh User Guide.
module Amazonka.AppMesh.CreateVirtualNode
  ( -- * Creating a Request
    CreateVirtualNode (..),
    newCreateVirtualNode,

    -- * Request Lenses
    createVirtualNode_clientToken,
    createVirtualNode_meshOwner,
    createVirtualNode_tags,
    createVirtualNode_meshName,
    createVirtualNode_spec,
    createVirtualNode_virtualNodeName,

    -- * Destructuring the Response
    CreateVirtualNodeResponse (..),
    newCreateVirtualNodeResponse,

    -- * Response Lenses
    createVirtualNodeResponse_httpStatus,
    createVirtualNodeResponse_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:/ 'newCreateVirtualNode' smart constructor.
data CreateVirtualNode = CreateVirtualNode'
  { -- | Unique, case-sensitive identifier that you provide to ensure the
    -- idempotency of the request. Up to 36 letters, numbers, hyphens, and
    -- underscores are allowed.
    CreateVirtualNode -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
    -- | The AWS IAM account ID of the service mesh owner. If the account ID is
    -- not your own, then the account that you specify must share the mesh with
    -- your account before you can create the resource in the service mesh. For
    -- more information about mesh sharing, see
    -- <https://docs.aws.amazon.com/app-mesh/latest/userguide/sharing.html Working with shared meshes>.
    CreateVirtualNode -> Maybe Text
meshOwner :: Prelude.Maybe Prelude.Text,
    -- | Optional metadata that you can apply to the virtual node to assist with
    -- categorization and organization. Each tag consists of a key and an
    -- optional value, both of which you define. Tag keys can have a maximum
    -- character length of 128 characters, and tag values can have a maximum
    -- length of 256 characters.
    CreateVirtualNode -> Maybe [TagRef]
tags :: Prelude.Maybe [TagRef],
    -- | The name of the service mesh to create the virtual node in.
    CreateVirtualNode -> Text
meshName :: Prelude.Text,
    -- | The virtual node specification to apply.
    CreateVirtualNode -> VirtualNodeSpec
spec :: VirtualNodeSpec,
    -- | The name to use for the virtual node.
    CreateVirtualNode -> Text
virtualNodeName :: Prelude.Text
  }
  deriving (CreateVirtualNode -> CreateVirtualNode -> Bool
(CreateVirtualNode -> CreateVirtualNode -> Bool)
-> (CreateVirtualNode -> CreateVirtualNode -> Bool)
-> Eq CreateVirtualNode
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateVirtualNode -> CreateVirtualNode -> Bool
$c/= :: CreateVirtualNode -> CreateVirtualNode -> Bool
== :: CreateVirtualNode -> CreateVirtualNode -> Bool
$c== :: CreateVirtualNode -> CreateVirtualNode -> Bool
Prelude.Eq, ReadPrec [CreateVirtualNode]
ReadPrec CreateVirtualNode
Int -> ReadS CreateVirtualNode
ReadS [CreateVirtualNode]
(Int -> ReadS CreateVirtualNode)
-> ReadS [CreateVirtualNode]
-> ReadPrec CreateVirtualNode
-> ReadPrec [CreateVirtualNode]
-> Read CreateVirtualNode
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateVirtualNode]
$creadListPrec :: ReadPrec [CreateVirtualNode]
readPrec :: ReadPrec CreateVirtualNode
$creadPrec :: ReadPrec CreateVirtualNode
readList :: ReadS [CreateVirtualNode]
$creadList :: ReadS [CreateVirtualNode]
readsPrec :: Int -> ReadS CreateVirtualNode
$creadsPrec :: Int -> ReadS CreateVirtualNode
Prelude.Read, Int -> CreateVirtualNode -> ShowS
[CreateVirtualNode] -> ShowS
CreateVirtualNode -> String
(Int -> CreateVirtualNode -> ShowS)
-> (CreateVirtualNode -> String)
-> ([CreateVirtualNode] -> ShowS)
-> Show CreateVirtualNode
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateVirtualNode] -> ShowS
$cshowList :: [CreateVirtualNode] -> ShowS
show :: CreateVirtualNode -> String
$cshow :: CreateVirtualNode -> String
showsPrec :: Int -> CreateVirtualNode -> ShowS
$cshowsPrec :: Int -> CreateVirtualNode -> ShowS
Prelude.Show, (forall x. CreateVirtualNode -> Rep CreateVirtualNode x)
-> (forall x. Rep CreateVirtualNode x -> CreateVirtualNode)
-> Generic CreateVirtualNode
forall x. Rep CreateVirtualNode x -> CreateVirtualNode
forall x. CreateVirtualNode -> Rep CreateVirtualNode x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateVirtualNode x -> CreateVirtualNode
$cfrom :: forall x. CreateVirtualNode -> Rep CreateVirtualNode x
Prelude.Generic)

-- |
-- Create a value of 'CreateVirtualNode' 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:
--
-- 'clientToken', 'createVirtualNode_clientToken' - Unique, case-sensitive identifier that you provide to ensure the
-- idempotency of the request. Up to 36 letters, numbers, hyphens, and
-- underscores are allowed.
--
-- 'meshOwner', 'createVirtualNode_meshOwner' - The AWS IAM account ID of the service mesh owner. If the account ID is
-- not your own, then the account that you specify must share the mesh with
-- your account before you can create the resource in the service mesh. For
-- more information about mesh sharing, see
-- <https://docs.aws.amazon.com/app-mesh/latest/userguide/sharing.html Working with shared meshes>.
--
-- 'tags', 'createVirtualNode_tags' - Optional metadata that you can apply to the virtual node to assist with
-- categorization and organization. Each tag consists of a key and an
-- optional value, both of which you define. Tag keys can have a maximum
-- character length of 128 characters, and tag values can have a maximum
-- length of 256 characters.
--
-- 'meshName', 'createVirtualNode_meshName' - The name of the service mesh to create the virtual node in.
--
-- 'spec', 'createVirtualNode_spec' - The virtual node specification to apply.
--
-- 'virtualNodeName', 'createVirtualNode_virtualNodeName' - The name to use for the virtual node.
newCreateVirtualNode ::
  -- | 'meshName'
  Prelude.Text ->
  -- | 'spec'
  VirtualNodeSpec ->
  -- | 'virtualNodeName'
  Prelude.Text ->
  CreateVirtualNode
newCreateVirtualNode :: Text -> VirtualNodeSpec -> Text -> CreateVirtualNode
newCreateVirtualNode
  Text
pMeshName_
  VirtualNodeSpec
pSpec_
  Text
pVirtualNodeName_ =
    CreateVirtualNode' :: Maybe Text
-> Maybe Text
-> Maybe [TagRef]
-> Text
-> VirtualNodeSpec
-> Text
-> CreateVirtualNode
CreateVirtualNode'
      { $sel:clientToken:CreateVirtualNode' :: Maybe Text
clientToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:meshOwner:CreateVirtualNode' :: Maybe Text
meshOwner = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateVirtualNode' :: Maybe [TagRef]
tags = Maybe [TagRef]
forall a. Maybe a
Prelude.Nothing,
        $sel:meshName:CreateVirtualNode' :: Text
meshName = Text
pMeshName_,
        $sel:spec:CreateVirtualNode' :: VirtualNodeSpec
spec = VirtualNodeSpec
pSpec_,
        $sel:virtualNodeName:CreateVirtualNode' :: Text
virtualNodeName = Text
pVirtualNodeName_
      }

-- | Unique, case-sensitive identifier that you provide to ensure the
-- idempotency of the request. Up to 36 letters, numbers, hyphens, and
-- underscores are allowed.
createVirtualNode_clientToken :: Lens.Lens' CreateVirtualNode (Prelude.Maybe Prelude.Text)
createVirtualNode_clientToken :: (Maybe Text -> f (Maybe Text))
-> CreateVirtualNode -> f CreateVirtualNode
createVirtualNode_clientToken = (CreateVirtualNode -> Maybe Text)
-> (CreateVirtualNode -> Maybe Text -> CreateVirtualNode)
-> Lens
     CreateVirtualNode CreateVirtualNode (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateVirtualNode' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:CreateVirtualNode' :: CreateVirtualNode -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: CreateVirtualNode
s@CreateVirtualNode' {} Maybe Text
a -> CreateVirtualNode
s {$sel:clientToken:CreateVirtualNode' :: Maybe Text
clientToken = Maybe Text
a} :: CreateVirtualNode)

-- | The AWS IAM account ID of the service mesh owner. If the account ID is
-- not your own, then the account that you specify must share the mesh with
-- your account before you can create the resource in the service mesh. For
-- more information about mesh sharing, see
-- <https://docs.aws.amazon.com/app-mesh/latest/userguide/sharing.html Working with shared meshes>.
createVirtualNode_meshOwner :: Lens.Lens' CreateVirtualNode (Prelude.Maybe Prelude.Text)
createVirtualNode_meshOwner :: (Maybe Text -> f (Maybe Text))
-> CreateVirtualNode -> f CreateVirtualNode
createVirtualNode_meshOwner = (CreateVirtualNode -> Maybe Text)
-> (CreateVirtualNode -> Maybe Text -> CreateVirtualNode)
-> Lens
     CreateVirtualNode CreateVirtualNode (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateVirtualNode' {Maybe Text
meshOwner :: Maybe Text
$sel:meshOwner:CreateVirtualNode' :: CreateVirtualNode -> Maybe Text
meshOwner} -> Maybe Text
meshOwner) (\s :: CreateVirtualNode
s@CreateVirtualNode' {} Maybe Text
a -> CreateVirtualNode
s {$sel:meshOwner:CreateVirtualNode' :: Maybe Text
meshOwner = Maybe Text
a} :: CreateVirtualNode)

-- | Optional metadata that you can apply to the virtual node to assist with
-- categorization and organization. Each tag consists of a key and an
-- optional value, both of which you define. Tag keys can have a maximum
-- character length of 128 characters, and tag values can have a maximum
-- length of 256 characters.
createVirtualNode_tags :: Lens.Lens' CreateVirtualNode (Prelude.Maybe [TagRef])
createVirtualNode_tags :: (Maybe [TagRef] -> f (Maybe [TagRef]))
-> CreateVirtualNode -> f CreateVirtualNode
createVirtualNode_tags = (CreateVirtualNode -> Maybe [TagRef])
-> (CreateVirtualNode -> Maybe [TagRef] -> CreateVirtualNode)
-> Lens
     CreateVirtualNode
     CreateVirtualNode
     (Maybe [TagRef])
     (Maybe [TagRef])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateVirtualNode' {Maybe [TagRef]
tags :: Maybe [TagRef]
$sel:tags:CreateVirtualNode' :: CreateVirtualNode -> Maybe [TagRef]
tags} -> Maybe [TagRef]
tags) (\s :: CreateVirtualNode
s@CreateVirtualNode' {} Maybe [TagRef]
a -> CreateVirtualNode
s {$sel:tags:CreateVirtualNode' :: Maybe [TagRef]
tags = Maybe [TagRef]
a} :: CreateVirtualNode) ((Maybe [TagRef] -> f (Maybe [TagRef]))
 -> CreateVirtualNode -> f CreateVirtualNode)
-> ((Maybe [TagRef] -> f (Maybe [TagRef]))
    -> Maybe [TagRef] -> f (Maybe [TagRef]))
-> (Maybe [TagRef] -> f (Maybe [TagRef]))
-> CreateVirtualNode
-> f CreateVirtualNode
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [TagRef] [TagRef] [TagRef] [TagRef]
-> Iso
     (Maybe [TagRef]) (Maybe [TagRef]) (Maybe [TagRef]) (Maybe [TagRef])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [TagRef] [TagRef] [TagRef] [TagRef]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

-- | The virtual node specification to apply.
createVirtualNode_spec :: Lens.Lens' CreateVirtualNode VirtualNodeSpec
createVirtualNode_spec :: (VirtualNodeSpec -> f VirtualNodeSpec)
-> CreateVirtualNode -> f CreateVirtualNode
createVirtualNode_spec = (CreateVirtualNode -> VirtualNodeSpec)
-> (CreateVirtualNode -> VirtualNodeSpec -> CreateVirtualNode)
-> Lens
     CreateVirtualNode CreateVirtualNode VirtualNodeSpec VirtualNodeSpec
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateVirtualNode' {VirtualNodeSpec
spec :: VirtualNodeSpec
$sel:spec:CreateVirtualNode' :: CreateVirtualNode -> VirtualNodeSpec
spec} -> VirtualNodeSpec
spec) (\s :: CreateVirtualNode
s@CreateVirtualNode' {} VirtualNodeSpec
a -> CreateVirtualNode
s {$sel:spec:CreateVirtualNode' :: VirtualNodeSpec
spec = VirtualNodeSpec
a} :: CreateVirtualNode)

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

instance Core.AWSRequest CreateVirtualNode where
  type
    AWSResponse CreateVirtualNode =
      CreateVirtualNodeResponse
  request :: CreateVirtualNode -> Request CreateVirtualNode
request = Service -> CreateVirtualNode -> Request CreateVirtualNode
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateVirtualNode
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateVirtualNode)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateVirtualNode))
-> Logger
-> Service
-> Proxy CreateVirtualNode
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateVirtualNode)))
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 -> CreateVirtualNodeResponse
CreateVirtualNodeResponse'
            (Int -> VirtualNodeData -> CreateVirtualNodeResponse)
-> Either String Int
-> Either String (VirtualNodeData -> CreateVirtualNodeResponse)
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 -> CreateVirtualNodeResponse)
-> Either String VirtualNodeData
-> Either String CreateVirtualNodeResponse
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 CreateVirtualNode

instance Prelude.NFData CreateVirtualNode

instance Core.ToHeaders CreateVirtualNode where
  toHeaders :: CreateVirtualNode -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateVirtualNode -> 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.ToJSON CreateVirtualNode where
  toJSON :: CreateVirtualNode -> Value
toJSON CreateVirtualNode' {Maybe [TagRef]
Maybe Text
Text
VirtualNodeSpec
virtualNodeName :: Text
spec :: VirtualNodeSpec
meshName :: Text
tags :: Maybe [TagRef]
meshOwner :: Maybe Text
clientToken :: Maybe Text
$sel:virtualNodeName:CreateVirtualNode' :: CreateVirtualNode -> Text
$sel:spec:CreateVirtualNode' :: CreateVirtualNode -> VirtualNodeSpec
$sel:meshName:CreateVirtualNode' :: CreateVirtualNode -> Text
$sel:tags:CreateVirtualNode' :: CreateVirtualNode -> Maybe [TagRef]
$sel:meshOwner:CreateVirtualNode' :: CreateVirtualNode -> Maybe Text
$sel:clientToken:CreateVirtualNode' :: CreateVirtualNode -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"clientToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
clientToken,
            (Text
"tags" Text -> [TagRef] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([TagRef] -> Pair) -> Maybe [TagRef] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [TagRef]
tags,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"spec" Text -> VirtualNodeSpec -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= VirtualNodeSpec
spec),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"virtualNodeName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
virtualNodeName)
          ]
      )

instance Core.ToPath CreateVirtualNode where
  toPath :: CreateVirtualNode -> ByteString
toPath CreateVirtualNode' {Maybe [TagRef]
Maybe Text
Text
VirtualNodeSpec
virtualNodeName :: Text
spec :: VirtualNodeSpec
meshName :: Text
tags :: Maybe [TagRef]
meshOwner :: Maybe Text
clientToken :: Maybe Text
$sel:virtualNodeName:CreateVirtualNode' :: CreateVirtualNode -> Text
$sel:spec:CreateVirtualNode' :: CreateVirtualNode -> VirtualNodeSpec
$sel:meshName:CreateVirtualNode' :: CreateVirtualNode -> Text
$sel:tags:CreateVirtualNode' :: CreateVirtualNode -> Maybe [TagRef]
$sel:meshOwner:CreateVirtualNode' :: CreateVirtualNode -> Maybe Text
$sel:clientToken:CreateVirtualNode' :: CreateVirtualNode -> 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"
      ]

instance Core.ToQuery CreateVirtualNode where
  toQuery :: CreateVirtualNode -> QueryString
toQuery CreateVirtualNode' {Maybe [TagRef]
Maybe Text
Text
VirtualNodeSpec
virtualNodeName :: Text
spec :: VirtualNodeSpec
meshName :: Text
tags :: Maybe [TagRef]
meshOwner :: Maybe Text
clientToken :: Maybe Text
$sel:virtualNodeName:CreateVirtualNode' :: CreateVirtualNode -> Text
$sel:spec:CreateVirtualNode' :: CreateVirtualNode -> VirtualNodeSpec
$sel:meshName:CreateVirtualNode' :: CreateVirtualNode -> Text
$sel:tags:CreateVirtualNode' :: CreateVirtualNode -> Maybe [TagRef]
$sel:meshOwner:CreateVirtualNode' :: CreateVirtualNode -> Maybe Text
$sel:clientToken:CreateVirtualNode' :: CreateVirtualNode -> 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:/ 'newCreateVirtualNodeResponse' smart constructor.
data CreateVirtualNodeResponse = CreateVirtualNodeResponse'
  { -- | The response's http status code.
    CreateVirtualNodeResponse -> Int
httpStatus :: Prelude.Int,
    -- | The full description of your virtual node following the create call.
    CreateVirtualNodeResponse -> VirtualNodeData
virtualNode :: VirtualNodeData
  }
  deriving (CreateVirtualNodeResponse -> CreateVirtualNodeResponse -> Bool
(CreateVirtualNodeResponse -> CreateVirtualNodeResponse -> Bool)
-> (CreateVirtualNodeResponse -> CreateVirtualNodeResponse -> Bool)
-> Eq CreateVirtualNodeResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateVirtualNodeResponse -> CreateVirtualNodeResponse -> Bool
$c/= :: CreateVirtualNodeResponse -> CreateVirtualNodeResponse -> Bool
== :: CreateVirtualNodeResponse -> CreateVirtualNodeResponse -> Bool
$c== :: CreateVirtualNodeResponse -> CreateVirtualNodeResponse -> Bool
Prelude.Eq, ReadPrec [CreateVirtualNodeResponse]
ReadPrec CreateVirtualNodeResponse
Int -> ReadS CreateVirtualNodeResponse
ReadS [CreateVirtualNodeResponse]
(Int -> ReadS CreateVirtualNodeResponse)
-> ReadS [CreateVirtualNodeResponse]
-> ReadPrec CreateVirtualNodeResponse
-> ReadPrec [CreateVirtualNodeResponse]
-> Read CreateVirtualNodeResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateVirtualNodeResponse]
$creadListPrec :: ReadPrec [CreateVirtualNodeResponse]
readPrec :: ReadPrec CreateVirtualNodeResponse
$creadPrec :: ReadPrec CreateVirtualNodeResponse
readList :: ReadS [CreateVirtualNodeResponse]
$creadList :: ReadS [CreateVirtualNodeResponse]
readsPrec :: Int -> ReadS CreateVirtualNodeResponse
$creadsPrec :: Int -> ReadS CreateVirtualNodeResponse
Prelude.Read, Int -> CreateVirtualNodeResponse -> ShowS
[CreateVirtualNodeResponse] -> ShowS
CreateVirtualNodeResponse -> String
(Int -> CreateVirtualNodeResponse -> ShowS)
-> (CreateVirtualNodeResponse -> String)
-> ([CreateVirtualNodeResponse] -> ShowS)
-> Show CreateVirtualNodeResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateVirtualNodeResponse] -> ShowS
$cshowList :: [CreateVirtualNodeResponse] -> ShowS
show :: CreateVirtualNodeResponse -> String
$cshow :: CreateVirtualNodeResponse -> String
showsPrec :: Int -> CreateVirtualNodeResponse -> ShowS
$cshowsPrec :: Int -> CreateVirtualNodeResponse -> ShowS
Prelude.Show, (forall x.
 CreateVirtualNodeResponse -> Rep CreateVirtualNodeResponse x)
-> (forall x.
    Rep CreateVirtualNodeResponse x -> CreateVirtualNodeResponse)
-> Generic CreateVirtualNodeResponse
forall x.
Rep CreateVirtualNodeResponse x -> CreateVirtualNodeResponse
forall x.
CreateVirtualNodeResponse -> Rep CreateVirtualNodeResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateVirtualNodeResponse x -> CreateVirtualNodeResponse
$cfrom :: forall x.
CreateVirtualNodeResponse -> Rep CreateVirtualNodeResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateVirtualNodeResponse' 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', 'createVirtualNodeResponse_httpStatus' - The response's http status code.
--
-- 'virtualNode', 'createVirtualNodeResponse_virtualNode' - The full description of your virtual node following the create call.
newCreateVirtualNodeResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'virtualNode'
  VirtualNodeData ->
  CreateVirtualNodeResponse
newCreateVirtualNodeResponse :: Int -> VirtualNodeData -> CreateVirtualNodeResponse
newCreateVirtualNodeResponse
  Int
pHttpStatus_
  VirtualNodeData
pVirtualNode_ =
    CreateVirtualNodeResponse' :: Int -> VirtualNodeData -> CreateVirtualNodeResponse
CreateVirtualNodeResponse'
      { $sel:httpStatus:CreateVirtualNodeResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:virtualNode:CreateVirtualNodeResponse' :: VirtualNodeData
virtualNode = VirtualNodeData
pVirtualNode_
      }

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

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

instance Prelude.NFData CreateVirtualNodeResponse