{-# 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.CreateVirtualGateway
-- 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 gateway.
--
-- A virtual gateway allows resources outside your mesh to communicate to
-- resources that are inside your mesh. The virtual gateway represents an
-- Envoy proxy running in an Amazon ECS task, in a Kubernetes service, or
-- on an Amazon EC2 instance. Unlike a virtual node, which represents an
-- Envoy running with an application, a virtual gateway represents Envoy
-- deployed by itself.
--
-- For more information about virtual gateways, see
-- <https://docs.aws.amazon.com/app-mesh/latest/userguide/virtual_gateways.html Virtual gateways>.
module Amazonka.AppMesh.CreateVirtualGateway
  ( -- * Creating a Request
    CreateVirtualGateway (..),
    newCreateVirtualGateway,

    -- * Request Lenses
    createVirtualGateway_clientToken,
    createVirtualGateway_meshOwner,
    createVirtualGateway_tags,
    createVirtualGateway_meshName,
    createVirtualGateway_spec,
    createVirtualGateway_virtualGatewayName,

    -- * Destructuring the Response
    CreateVirtualGatewayResponse (..),
    newCreateVirtualGatewayResponse,

    -- * Response Lenses
    createVirtualGatewayResponse_httpStatus,
    createVirtualGatewayResponse_virtualGateway,
  )
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:/ 'newCreateVirtualGateway' smart constructor.
data CreateVirtualGateway = CreateVirtualGateway'
  { -- | Unique, case-sensitive identifier that you provide to ensure the
    -- idempotency of the request. Up to 36 letters, numbers, hyphens, and
    -- underscores are allowed.
    CreateVirtualGateway -> 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>.
    CreateVirtualGateway -> Maybe Text
meshOwner :: Prelude.Maybe Prelude.Text,
    -- | Optional metadata that you can apply to the virtual gateway 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.
    CreateVirtualGateway -> Maybe [TagRef]
tags :: Prelude.Maybe [TagRef],
    -- | The name of the service mesh to create the virtual gateway in.
    CreateVirtualGateway -> Text
meshName :: Prelude.Text,
    -- | The virtual gateway specification to apply.
    CreateVirtualGateway -> VirtualGatewaySpec
spec :: VirtualGatewaySpec,
    -- | The name to use for the virtual gateway.
    CreateVirtualGateway -> Text
virtualGatewayName :: Prelude.Text
  }
  deriving (CreateVirtualGateway -> CreateVirtualGateway -> Bool
(CreateVirtualGateway -> CreateVirtualGateway -> Bool)
-> (CreateVirtualGateway -> CreateVirtualGateway -> Bool)
-> Eq CreateVirtualGateway
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateVirtualGateway -> CreateVirtualGateway -> Bool
$c/= :: CreateVirtualGateway -> CreateVirtualGateway -> Bool
== :: CreateVirtualGateway -> CreateVirtualGateway -> Bool
$c== :: CreateVirtualGateway -> CreateVirtualGateway -> Bool
Prelude.Eq, ReadPrec [CreateVirtualGateway]
ReadPrec CreateVirtualGateway
Int -> ReadS CreateVirtualGateway
ReadS [CreateVirtualGateway]
(Int -> ReadS CreateVirtualGateway)
-> ReadS [CreateVirtualGateway]
-> ReadPrec CreateVirtualGateway
-> ReadPrec [CreateVirtualGateway]
-> Read CreateVirtualGateway
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateVirtualGateway]
$creadListPrec :: ReadPrec [CreateVirtualGateway]
readPrec :: ReadPrec CreateVirtualGateway
$creadPrec :: ReadPrec CreateVirtualGateway
readList :: ReadS [CreateVirtualGateway]
$creadList :: ReadS [CreateVirtualGateway]
readsPrec :: Int -> ReadS CreateVirtualGateway
$creadsPrec :: Int -> ReadS CreateVirtualGateway
Prelude.Read, Int -> CreateVirtualGateway -> ShowS
[CreateVirtualGateway] -> ShowS
CreateVirtualGateway -> String
(Int -> CreateVirtualGateway -> ShowS)
-> (CreateVirtualGateway -> String)
-> ([CreateVirtualGateway] -> ShowS)
-> Show CreateVirtualGateway
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateVirtualGateway] -> ShowS
$cshowList :: [CreateVirtualGateway] -> ShowS
show :: CreateVirtualGateway -> String
$cshow :: CreateVirtualGateway -> String
showsPrec :: Int -> CreateVirtualGateway -> ShowS
$cshowsPrec :: Int -> CreateVirtualGateway -> ShowS
Prelude.Show, (forall x. CreateVirtualGateway -> Rep CreateVirtualGateway x)
-> (forall x. Rep CreateVirtualGateway x -> CreateVirtualGateway)
-> Generic CreateVirtualGateway
forall x. Rep CreateVirtualGateway x -> CreateVirtualGateway
forall x. CreateVirtualGateway -> Rep CreateVirtualGateway x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateVirtualGateway x -> CreateVirtualGateway
$cfrom :: forall x. CreateVirtualGateway -> Rep CreateVirtualGateway x
Prelude.Generic)

-- |
-- Create a value of 'CreateVirtualGateway' 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', 'createVirtualGateway_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', 'createVirtualGateway_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', 'createVirtualGateway_tags' - Optional metadata that you can apply to the virtual gateway 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', 'createVirtualGateway_meshName' - The name of the service mesh to create the virtual gateway in.
--
-- 'spec', 'createVirtualGateway_spec' - The virtual gateway specification to apply.
--
-- 'virtualGatewayName', 'createVirtualGateway_virtualGatewayName' - The name to use for the virtual gateway.
newCreateVirtualGateway ::
  -- | 'meshName'
  Prelude.Text ->
  -- | 'spec'
  VirtualGatewaySpec ->
  -- | 'virtualGatewayName'
  Prelude.Text ->
  CreateVirtualGateway
newCreateVirtualGateway :: Text -> VirtualGatewaySpec -> Text -> CreateVirtualGateway
newCreateVirtualGateway
  Text
pMeshName_
  VirtualGatewaySpec
pSpec_
  Text
pVirtualGatewayName_ =
    CreateVirtualGateway' :: Maybe Text
-> Maybe Text
-> Maybe [TagRef]
-> Text
-> VirtualGatewaySpec
-> Text
-> CreateVirtualGateway
CreateVirtualGateway'
      { $sel:clientToken:CreateVirtualGateway' :: Maybe Text
clientToken =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:meshOwner:CreateVirtualGateway' :: Maybe Text
meshOwner = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateVirtualGateway' :: Maybe [TagRef]
tags = Maybe [TagRef]
forall a. Maybe a
Prelude.Nothing,
        $sel:meshName:CreateVirtualGateway' :: Text
meshName = Text
pMeshName_,
        $sel:spec:CreateVirtualGateway' :: VirtualGatewaySpec
spec = VirtualGatewaySpec
pSpec_,
        $sel:virtualGatewayName:CreateVirtualGateway' :: Text
virtualGatewayName = Text
pVirtualGatewayName_
      }

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

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

-- | Optional metadata that you can apply to the virtual gateway 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.
createVirtualGateway_tags :: Lens.Lens' CreateVirtualGateway (Prelude.Maybe [TagRef])
createVirtualGateway_tags :: (Maybe [TagRef] -> f (Maybe [TagRef]))
-> CreateVirtualGateway -> f CreateVirtualGateway
createVirtualGateway_tags = (CreateVirtualGateway -> Maybe [TagRef])
-> (CreateVirtualGateway -> Maybe [TagRef] -> CreateVirtualGateway)
-> Lens
     CreateVirtualGateway
     CreateVirtualGateway
     (Maybe [TagRef])
     (Maybe [TagRef])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateVirtualGateway' {Maybe [TagRef]
tags :: Maybe [TagRef]
$sel:tags:CreateVirtualGateway' :: CreateVirtualGateway -> Maybe [TagRef]
tags} -> Maybe [TagRef]
tags) (\s :: CreateVirtualGateway
s@CreateVirtualGateway' {} Maybe [TagRef]
a -> CreateVirtualGateway
s {$sel:tags:CreateVirtualGateway' :: Maybe [TagRef]
tags = Maybe [TagRef]
a} :: CreateVirtualGateway) ((Maybe [TagRef] -> f (Maybe [TagRef]))
 -> CreateVirtualGateway -> f CreateVirtualGateway)
-> ((Maybe [TagRef] -> f (Maybe [TagRef]))
    -> Maybe [TagRef] -> f (Maybe [TagRef]))
-> (Maybe [TagRef] -> f (Maybe [TagRef]))
-> CreateVirtualGateway
-> f CreateVirtualGateway
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 gateway in.
createVirtualGateway_meshName :: Lens.Lens' CreateVirtualGateway Prelude.Text
createVirtualGateway_meshName :: (Text -> f Text) -> CreateVirtualGateway -> f CreateVirtualGateway
createVirtualGateway_meshName = (CreateVirtualGateway -> Text)
-> (CreateVirtualGateway -> Text -> CreateVirtualGateway)
-> Lens CreateVirtualGateway CreateVirtualGateway Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateVirtualGateway' {Text
meshName :: Text
$sel:meshName:CreateVirtualGateway' :: CreateVirtualGateway -> Text
meshName} -> Text
meshName) (\s :: CreateVirtualGateway
s@CreateVirtualGateway' {} Text
a -> CreateVirtualGateway
s {$sel:meshName:CreateVirtualGateway' :: Text
meshName = Text
a} :: CreateVirtualGateway)

-- | The virtual gateway specification to apply.
createVirtualGateway_spec :: Lens.Lens' CreateVirtualGateway VirtualGatewaySpec
createVirtualGateway_spec :: (VirtualGatewaySpec -> f VirtualGatewaySpec)
-> CreateVirtualGateway -> f CreateVirtualGateway
createVirtualGateway_spec = (CreateVirtualGateway -> VirtualGatewaySpec)
-> (CreateVirtualGateway
    -> VirtualGatewaySpec -> CreateVirtualGateway)
-> Lens
     CreateVirtualGateway
     CreateVirtualGateway
     VirtualGatewaySpec
     VirtualGatewaySpec
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateVirtualGateway' {VirtualGatewaySpec
spec :: VirtualGatewaySpec
$sel:spec:CreateVirtualGateway' :: CreateVirtualGateway -> VirtualGatewaySpec
spec} -> VirtualGatewaySpec
spec) (\s :: CreateVirtualGateway
s@CreateVirtualGateway' {} VirtualGatewaySpec
a -> CreateVirtualGateway
s {$sel:spec:CreateVirtualGateway' :: VirtualGatewaySpec
spec = VirtualGatewaySpec
a} :: CreateVirtualGateway)

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

instance Core.AWSRequest CreateVirtualGateway where
  type
    AWSResponse CreateVirtualGateway =
      CreateVirtualGatewayResponse
  request :: CreateVirtualGateway -> Request CreateVirtualGateway
request = Service -> CreateVirtualGateway -> Request CreateVirtualGateway
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateVirtualGateway
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateVirtualGateway)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateVirtualGateway))
-> Logger
-> Service
-> Proxy CreateVirtualGateway
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateVirtualGateway)))
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 -> VirtualGatewayData -> CreateVirtualGatewayResponse
CreateVirtualGatewayResponse'
            (Int -> VirtualGatewayData -> CreateVirtualGatewayResponse)
-> Either String Int
-> Either
     String (VirtualGatewayData -> CreateVirtualGatewayResponse)
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 (VirtualGatewayData -> CreateVirtualGatewayResponse)
-> Either String VirtualGatewayData
-> Either String CreateVirtualGatewayResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object -> Either String VirtualGatewayData
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
      )

instance Prelude.Hashable CreateVirtualGateway

instance Prelude.NFData CreateVirtualGateway

instance Core.ToHeaders CreateVirtualGateway where
  toHeaders :: CreateVirtualGateway -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateVirtualGateway -> 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 CreateVirtualGateway where
  toJSON :: CreateVirtualGateway -> Value
toJSON CreateVirtualGateway' {Maybe [TagRef]
Maybe Text
Text
VirtualGatewaySpec
virtualGatewayName :: Text
spec :: VirtualGatewaySpec
meshName :: Text
tags :: Maybe [TagRef]
meshOwner :: Maybe Text
clientToken :: Maybe Text
$sel:virtualGatewayName:CreateVirtualGateway' :: CreateVirtualGateway -> Text
$sel:spec:CreateVirtualGateway' :: CreateVirtualGateway -> VirtualGatewaySpec
$sel:meshName:CreateVirtualGateway' :: CreateVirtualGateway -> Text
$sel:tags:CreateVirtualGateway' :: CreateVirtualGateway -> Maybe [TagRef]
$sel:meshOwner:CreateVirtualGateway' :: CreateVirtualGateway -> Maybe Text
$sel:clientToken:CreateVirtualGateway' :: CreateVirtualGateway -> 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 -> VirtualGatewaySpec -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= VirtualGatewaySpec
spec),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"virtualGatewayName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
virtualGatewayName)
          ]
      )

instance Core.ToPath CreateVirtualGateway where
  toPath :: CreateVirtualGateway -> ByteString
toPath CreateVirtualGateway' {Maybe [TagRef]
Maybe Text
Text
VirtualGatewaySpec
virtualGatewayName :: Text
spec :: VirtualGatewaySpec
meshName :: Text
tags :: Maybe [TagRef]
meshOwner :: Maybe Text
clientToken :: Maybe Text
$sel:virtualGatewayName:CreateVirtualGateway' :: CreateVirtualGateway -> Text
$sel:spec:CreateVirtualGateway' :: CreateVirtualGateway -> VirtualGatewaySpec
$sel:meshName:CreateVirtualGateway' :: CreateVirtualGateway -> Text
$sel:tags:CreateVirtualGateway' :: CreateVirtualGateway -> Maybe [TagRef]
$sel:meshOwner:CreateVirtualGateway' :: CreateVirtualGateway -> Maybe Text
$sel:clientToken:CreateVirtualGateway' :: CreateVirtualGateway -> 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
"/virtualGateways"
      ]

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

-- |
-- Create a value of 'CreateVirtualGatewayResponse' 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', 'createVirtualGatewayResponse_httpStatus' - The response's http status code.
--
-- 'virtualGateway', 'createVirtualGatewayResponse_virtualGateway' - The full description of your virtual gateway following the create call.
newCreateVirtualGatewayResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'virtualGateway'
  VirtualGatewayData ->
  CreateVirtualGatewayResponse
newCreateVirtualGatewayResponse :: Int -> VirtualGatewayData -> CreateVirtualGatewayResponse
newCreateVirtualGatewayResponse
  Int
pHttpStatus_
  VirtualGatewayData
pVirtualGateway_ =
    CreateVirtualGatewayResponse' :: Int -> VirtualGatewayData -> CreateVirtualGatewayResponse
CreateVirtualGatewayResponse'
      { $sel:httpStatus:CreateVirtualGatewayResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:virtualGateway:CreateVirtualGatewayResponse' :: VirtualGatewayData
virtualGateway = VirtualGatewayData
pVirtualGateway_
      }

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

-- | The full description of your virtual gateway following the create call.
createVirtualGatewayResponse_virtualGateway :: Lens.Lens' CreateVirtualGatewayResponse VirtualGatewayData
createVirtualGatewayResponse_virtualGateway :: (VirtualGatewayData -> f VirtualGatewayData)
-> CreateVirtualGatewayResponse -> f CreateVirtualGatewayResponse
createVirtualGatewayResponse_virtualGateway = (CreateVirtualGatewayResponse -> VirtualGatewayData)
-> (CreateVirtualGatewayResponse
    -> VirtualGatewayData -> CreateVirtualGatewayResponse)
-> Lens
     CreateVirtualGatewayResponse
     CreateVirtualGatewayResponse
     VirtualGatewayData
     VirtualGatewayData
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateVirtualGatewayResponse' {VirtualGatewayData
virtualGateway :: VirtualGatewayData
$sel:virtualGateway:CreateVirtualGatewayResponse' :: CreateVirtualGatewayResponse -> VirtualGatewayData
virtualGateway} -> VirtualGatewayData
virtualGateway) (\s :: CreateVirtualGatewayResponse
s@CreateVirtualGatewayResponse' {} VirtualGatewayData
a -> CreateVirtualGatewayResponse
s {$sel:virtualGateway:CreateVirtualGatewayResponse' :: VirtualGatewayData
virtualGateway = VirtualGatewayData
a} :: CreateVirtualGatewayResponse)

instance Prelude.NFData CreateVirtualGatewayResponse