{-# 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.CreateVirtualRouter
-- 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 router within a service mesh.
--
-- Specify a @listener@ for any inbound traffic that your virtual router
-- receives. Create a virtual router for each protocol and port that you
-- need to route. Virtual routers handle traffic for one or more virtual
-- services within your mesh. After you create your virtual router, create
-- and associate routes for your virtual router that direct incoming
-- requests to different virtual nodes.
--
-- For more information about virtual routers, see
-- <https://docs.aws.amazon.com/app-mesh/latest/userguide/virtual_routers.html Virtual routers>.
module Amazonka.AppMesh.CreateVirtualRouter
  ( -- * Creating a Request
    CreateVirtualRouter (..),
    newCreateVirtualRouter,

    -- * Request Lenses
    createVirtualRouter_clientToken,
    createVirtualRouter_meshOwner,
    createVirtualRouter_tags,
    createVirtualRouter_meshName,
    createVirtualRouter_spec,
    createVirtualRouter_virtualRouterName,

    -- * Destructuring the Response
    CreateVirtualRouterResponse (..),
    newCreateVirtualRouterResponse,

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

-- |
-- Create a value of 'CreateVirtualRouter' 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', 'createVirtualRouter_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', 'createVirtualRouter_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', 'createVirtualRouter_tags' - Optional metadata that you can apply to the virtual router 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', 'createVirtualRouter_meshName' - The name of the service mesh to create the virtual router in.
--
-- 'spec', 'createVirtualRouter_spec' - The virtual router specification to apply.
--
-- 'virtualRouterName', 'createVirtualRouter_virtualRouterName' - The name to use for the virtual router.
newCreateVirtualRouter ::
  -- | 'meshName'
  Prelude.Text ->
  -- | 'spec'
  VirtualRouterSpec ->
  -- | 'virtualRouterName'
  Prelude.Text ->
  CreateVirtualRouter
newCreateVirtualRouter :: Text -> VirtualRouterSpec -> Text -> CreateVirtualRouter
newCreateVirtualRouter
  Text
pMeshName_
  VirtualRouterSpec
pSpec_
  Text
pVirtualRouterName_ =
    CreateVirtualRouter' :: Maybe Text
-> Maybe Text
-> Maybe [TagRef]
-> Text
-> VirtualRouterSpec
-> Text
-> CreateVirtualRouter
CreateVirtualRouter'
      { $sel:clientToken:CreateVirtualRouter' :: Maybe Text
clientToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:meshOwner:CreateVirtualRouter' :: Maybe Text
meshOwner = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateVirtualRouter' :: Maybe [TagRef]
tags = Maybe [TagRef]
forall a. Maybe a
Prelude.Nothing,
        $sel:meshName:CreateVirtualRouter' :: Text
meshName = Text
pMeshName_,
        $sel:spec:CreateVirtualRouter' :: VirtualRouterSpec
spec = VirtualRouterSpec
pSpec_,
        $sel:virtualRouterName:CreateVirtualRouter' :: Text
virtualRouterName = Text
pVirtualRouterName_
      }

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

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

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

-- | The virtual router specification to apply.
createVirtualRouter_spec :: Lens.Lens' CreateVirtualRouter VirtualRouterSpec
createVirtualRouter_spec :: (VirtualRouterSpec -> f VirtualRouterSpec)
-> CreateVirtualRouter -> f CreateVirtualRouter
createVirtualRouter_spec = (CreateVirtualRouter -> VirtualRouterSpec)
-> (CreateVirtualRouter
    -> VirtualRouterSpec -> CreateVirtualRouter)
-> Lens
     CreateVirtualRouter
     CreateVirtualRouter
     VirtualRouterSpec
     VirtualRouterSpec
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateVirtualRouter' {VirtualRouterSpec
spec :: VirtualRouterSpec
$sel:spec:CreateVirtualRouter' :: CreateVirtualRouter -> VirtualRouterSpec
spec} -> VirtualRouterSpec
spec) (\s :: CreateVirtualRouter
s@CreateVirtualRouter' {} VirtualRouterSpec
a -> CreateVirtualRouter
s {$sel:spec:CreateVirtualRouter' :: VirtualRouterSpec
spec = VirtualRouterSpec
a} :: CreateVirtualRouter)

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

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

instance Prelude.Hashable CreateVirtualRouter

instance Prelude.NFData CreateVirtualRouter

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

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

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

-- |
-- Create a value of 'CreateVirtualRouterResponse' 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', 'createVirtualRouterResponse_httpStatus' - The response's http status code.
--
-- 'virtualRouter', 'createVirtualRouterResponse_virtualRouter' - The full description of your virtual router following the create call.
newCreateVirtualRouterResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'virtualRouter'
  VirtualRouterData ->
  CreateVirtualRouterResponse
newCreateVirtualRouterResponse :: Int -> VirtualRouterData -> CreateVirtualRouterResponse
newCreateVirtualRouterResponse
  Int
pHttpStatus_
  VirtualRouterData
pVirtualRouter_ =
    CreateVirtualRouterResponse' :: Int -> VirtualRouterData -> CreateVirtualRouterResponse
CreateVirtualRouterResponse'
      { $sel:httpStatus:CreateVirtualRouterResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:virtualRouter:CreateVirtualRouterResponse' :: VirtualRouterData
virtualRouter = VirtualRouterData
pVirtualRouter_
      }

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

-- | The full description of your virtual router following the create call.
createVirtualRouterResponse_virtualRouter :: Lens.Lens' CreateVirtualRouterResponse VirtualRouterData
createVirtualRouterResponse_virtualRouter :: (VirtualRouterData -> f VirtualRouterData)
-> CreateVirtualRouterResponse -> f CreateVirtualRouterResponse
createVirtualRouterResponse_virtualRouter = (CreateVirtualRouterResponse -> VirtualRouterData)
-> (CreateVirtualRouterResponse
    -> VirtualRouterData -> CreateVirtualRouterResponse)
-> Lens
     CreateVirtualRouterResponse
     CreateVirtualRouterResponse
     VirtualRouterData
     VirtualRouterData
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateVirtualRouterResponse' {VirtualRouterData
virtualRouter :: VirtualRouterData
$sel:virtualRouter:CreateVirtualRouterResponse' :: CreateVirtualRouterResponse -> VirtualRouterData
virtualRouter} -> VirtualRouterData
virtualRouter) (\s :: CreateVirtualRouterResponse
s@CreateVirtualRouterResponse' {} VirtualRouterData
a -> CreateVirtualRouterResponse
s {$sel:virtualRouter:CreateVirtualRouterResponse' :: VirtualRouterData
virtualRouter = VirtualRouterData
a} :: CreateVirtualRouterResponse)

instance Prelude.NFData CreateVirtualRouterResponse