{-# 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.CreateVirtualService
-- 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 service within a service mesh.
--
-- A virtual service is an abstraction of a real service that is provided
-- by a virtual node directly or indirectly by means of a virtual router.
-- Dependent services call your virtual service by its
-- @virtualServiceName@, and those requests are routed to the virtual node
-- or virtual router that is specified as the provider for the virtual
-- service.
--
-- For more information about virtual services, see
-- <https://docs.aws.amazon.com/app-mesh/latest/userguide/virtual_services.html Virtual services>.
module Amazonka.AppMesh.CreateVirtualService
  ( -- * Creating a Request
    CreateVirtualService (..),
    newCreateVirtualService,

    -- * Request Lenses
    createVirtualService_clientToken,
    createVirtualService_meshOwner,
    createVirtualService_tags,
    createVirtualService_meshName,
    createVirtualService_spec,
    createVirtualService_virtualServiceName,

    -- * Destructuring the Response
    CreateVirtualServiceResponse (..),
    newCreateVirtualServiceResponse,

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

-- |
-- Create a value of 'CreateVirtualService' 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', 'createVirtualService_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', 'createVirtualService_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', 'createVirtualService_tags' - Optional metadata that you can apply to the virtual service 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', 'createVirtualService_meshName' - The name of the service mesh to create the virtual service in.
--
-- 'spec', 'createVirtualService_spec' - The virtual service specification to apply.
--
-- 'virtualServiceName', 'createVirtualService_virtualServiceName' - The name to use for the virtual service.
newCreateVirtualService ::
  -- | 'meshName'
  Prelude.Text ->
  -- | 'spec'
  VirtualServiceSpec ->
  -- | 'virtualServiceName'
  Prelude.Text ->
  CreateVirtualService
newCreateVirtualService :: Text -> VirtualServiceSpec -> Text -> CreateVirtualService
newCreateVirtualService
  Text
pMeshName_
  VirtualServiceSpec
pSpec_
  Text
pVirtualServiceName_ =
    CreateVirtualService' :: Maybe Text
-> Maybe Text
-> Maybe [TagRef]
-> Text
-> VirtualServiceSpec
-> Text
-> CreateVirtualService
CreateVirtualService'
      { $sel:clientToken:CreateVirtualService' :: Maybe Text
clientToken =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:meshOwner:CreateVirtualService' :: Maybe Text
meshOwner = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateVirtualService' :: Maybe [TagRef]
tags = Maybe [TagRef]
forall a. Maybe a
Prelude.Nothing,
        $sel:meshName:CreateVirtualService' :: Text
meshName = Text
pMeshName_,
        $sel:spec:CreateVirtualService' :: VirtualServiceSpec
spec = VirtualServiceSpec
pSpec_,
        $sel:virtualServiceName:CreateVirtualService' :: Text
virtualServiceName = Text
pVirtualServiceName_
      }

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

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

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

-- | The virtual service specification to apply.
createVirtualService_spec :: Lens.Lens' CreateVirtualService VirtualServiceSpec
createVirtualService_spec :: (VirtualServiceSpec -> f VirtualServiceSpec)
-> CreateVirtualService -> f CreateVirtualService
createVirtualService_spec = (CreateVirtualService -> VirtualServiceSpec)
-> (CreateVirtualService
    -> VirtualServiceSpec -> CreateVirtualService)
-> Lens
     CreateVirtualService
     CreateVirtualService
     VirtualServiceSpec
     VirtualServiceSpec
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateVirtualService' {VirtualServiceSpec
spec :: VirtualServiceSpec
$sel:spec:CreateVirtualService' :: CreateVirtualService -> VirtualServiceSpec
spec} -> VirtualServiceSpec
spec) (\s :: CreateVirtualService
s@CreateVirtualService' {} VirtualServiceSpec
a -> CreateVirtualService
s {$sel:spec:CreateVirtualService' :: VirtualServiceSpec
spec = VirtualServiceSpec
a} :: CreateVirtualService)

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

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

instance Prelude.Hashable CreateVirtualService

instance Prelude.NFData CreateVirtualService

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

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

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

-- |
-- Create a value of 'CreateVirtualServiceResponse' 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', 'createVirtualServiceResponse_httpStatus' - The response's http status code.
--
-- 'virtualService', 'createVirtualServiceResponse_virtualService' - The full description of your virtual service following the create call.
newCreateVirtualServiceResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'virtualService'
  VirtualServiceData ->
  CreateVirtualServiceResponse
newCreateVirtualServiceResponse :: Int -> VirtualServiceData -> CreateVirtualServiceResponse
newCreateVirtualServiceResponse
  Int
pHttpStatus_
  VirtualServiceData
pVirtualService_ =
    CreateVirtualServiceResponse' :: Int -> VirtualServiceData -> CreateVirtualServiceResponse
CreateVirtualServiceResponse'
      { $sel:httpStatus:CreateVirtualServiceResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:virtualService:CreateVirtualServiceResponse' :: VirtualServiceData
virtualService = VirtualServiceData
pVirtualService_
      }

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

-- | The full description of your virtual service following the create call.
createVirtualServiceResponse_virtualService :: Lens.Lens' CreateVirtualServiceResponse VirtualServiceData
createVirtualServiceResponse_virtualService :: (VirtualServiceData -> f VirtualServiceData)
-> CreateVirtualServiceResponse -> f CreateVirtualServiceResponse
createVirtualServiceResponse_virtualService = (CreateVirtualServiceResponse -> VirtualServiceData)
-> (CreateVirtualServiceResponse
    -> VirtualServiceData -> CreateVirtualServiceResponse)
-> Lens
     CreateVirtualServiceResponse
     CreateVirtualServiceResponse
     VirtualServiceData
     VirtualServiceData
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateVirtualServiceResponse' {VirtualServiceData
virtualService :: VirtualServiceData
$sel:virtualService:CreateVirtualServiceResponse' :: CreateVirtualServiceResponse -> VirtualServiceData
virtualService} -> VirtualServiceData
virtualService) (\s :: CreateVirtualServiceResponse
s@CreateVirtualServiceResponse' {} VirtualServiceData
a -> CreateVirtualServiceResponse
s {$sel:virtualService:CreateVirtualServiceResponse' :: VirtualServiceData
virtualService = VirtualServiceData
a} :: CreateVirtualServiceResponse)

instance Prelude.NFData CreateVirtualServiceResponse