{-# 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.DeleteVirtualGateway
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Deletes an existing virtual gateway. You cannot delete a virtual gateway
-- if any gateway routes are associated to it.
module Amazonka.AppMesh.DeleteVirtualGateway
  ( -- * Creating a Request
    DeleteVirtualGateway (..),
    newDeleteVirtualGateway,

    -- * Request Lenses
    deleteVirtualGateway_meshOwner,
    deleteVirtualGateway_meshName,
    deleteVirtualGateway_virtualGatewayName,

    -- * Destructuring the Response
    DeleteVirtualGatewayResponse (..),
    newDeleteVirtualGatewayResponse,

    -- * Response Lenses
    deleteVirtualGatewayResponse_httpStatus,
    deleteVirtualGatewayResponse_virtualGateway,
  )
where

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

-- | /See:/ 'newDeleteVirtualGateway' smart constructor.
data DeleteVirtualGateway = DeleteVirtualGateway'
  { -- | The Amazon Web Services IAM account ID of the service mesh owner. If the
    -- account ID is not your own, then it\'s the ID of the account that shared
    -- the mesh with your account. For more information about mesh sharing, see
    -- <https://docs.aws.amazon.com/app-mesh/latest/userguide/sharing.html Working with shared meshes>.
    DeleteVirtualGateway -> Maybe Text
meshOwner :: Prelude.Maybe Prelude.Text,
    -- | The name of the service mesh to delete the virtual gateway from.
    DeleteVirtualGateway -> Text
meshName :: Prelude.Text,
    -- | The name of the virtual gateway to delete.
    DeleteVirtualGateway -> Text
virtualGatewayName :: Prelude.Text
  }
  deriving (DeleteVirtualGateway -> DeleteVirtualGateway -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteVirtualGateway -> DeleteVirtualGateway -> Bool
$c/= :: DeleteVirtualGateway -> DeleteVirtualGateway -> Bool
== :: DeleteVirtualGateway -> DeleteVirtualGateway -> Bool
$c== :: DeleteVirtualGateway -> DeleteVirtualGateway -> Bool
Prelude.Eq, ReadPrec [DeleteVirtualGateway]
ReadPrec DeleteVirtualGateway
Int -> ReadS DeleteVirtualGateway
ReadS [DeleteVirtualGateway]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteVirtualGateway]
$creadListPrec :: ReadPrec [DeleteVirtualGateway]
readPrec :: ReadPrec DeleteVirtualGateway
$creadPrec :: ReadPrec DeleteVirtualGateway
readList :: ReadS [DeleteVirtualGateway]
$creadList :: ReadS [DeleteVirtualGateway]
readsPrec :: Int -> ReadS DeleteVirtualGateway
$creadsPrec :: Int -> ReadS DeleteVirtualGateway
Prelude.Read, Int -> DeleteVirtualGateway -> ShowS
[DeleteVirtualGateway] -> ShowS
DeleteVirtualGateway -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteVirtualGateway] -> ShowS
$cshowList :: [DeleteVirtualGateway] -> ShowS
show :: DeleteVirtualGateway -> String
$cshow :: DeleteVirtualGateway -> String
showsPrec :: Int -> DeleteVirtualGateway -> ShowS
$cshowsPrec :: Int -> DeleteVirtualGateway -> ShowS
Prelude.Show, forall x. Rep DeleteVirtualGateway x -> DeleteVirtualGateway
forall x. DeleteVirtualGateway -> Rep DeleteVirtualGateway x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteVirtualGateway x -> DeleteVirtualGateway
$cfrom :: forall x. DeleteVirtualGateway -> Rep DeleteVirtualGateway x
Prelude.Generic)

-- |
-- Create a value of 'DeleteVirtualGateway' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'meshOwner', 'deleteVirtualGateway_meshOwner' - The Amazon Web Services IAM account ID of the service mesh owner. If the
-- account ID is not your own, then it\'s the ID of the account that shared
-- the mesh with your account. For more information about mesh sharing, see
-- <https://docs.aws.amazon.com/app-mesh/latest/userguide/sharing.html Working with shared meshes>.
--
-- 'meshName', 'deleteVirtualGateway_meshName' - The name of the service mesh to delete the virtual gateway from.
--
-- 'virtualGatewayName', 'deleteVirtualGateway_virtualGatewayName' - The name of the virtual gateway to delete.
newDeleteVirtualGateway ::
  -- | 'meshName'
  Prelude.Text ->
  -- | 'virtualGatewayName'
  Prelude.Text ->
  DeleteVirtualGateway
newDeleteVirtualGateway :: Text -> Text -> DeleteVirtualGateway
newDeleteVirtualGateway
  Text
pMeshName_
  Text
pVirtualGatewayName_ =
    DeleteVirtualGateway'
      { $sel:meshOwner:DeleteVirtualGateway' :: Maybe Text
meshOwner = forall a. Maybe a
Prelude.Nothing,
        $sel:meshName:DeleteVirtualGateway' :: Text
meshName = Text
pMeshName_,
        $sel:virtualGatewayName:DeleteVirtualGateway' :: Text
virtualGatewayName = Text
pVirtualGatewayName_
      }

-- | The Amazon Web Services IAM account ID of the service mesh owner. If the
-- account ID is not your own, then it\'s the ID of the account that shared
-- the mesh with your account. For more information about mesh sharing, see
-- <https://docs.aws.amazon.com/app-mesh/latest/userguide/sharing.html Working with shared meshes>.
deleteVirtualGateway_meshOwner :: Lens.Lens' DeleteVirtualGateway (Prelude.Maybe Prelude.Text)
deleteVirtualGateway_meshOwner :: Lens' DeleteVirtualGateway (Maybe Text)
deleteVirtualGateway_meshOwner = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteVirtualGateway' {Maybe Text
meshOwner :: Maybe Text
$sel:meshOwner:DeleteVirtualGateway' :: DeleteVirtualGateway -> Maybe Text
meshOwner} -> Maybe Text
meshOwner) (\s :: DeleteVirtualGateway
s@DeleteVirtualGateway' {} Maybe Text
a -> DeleteVirtualGateway
s {$sel:meshOwner:DeleteVirtualGateway' :: Maybe Text
meshOwner = Maybe Text
a} :: DeleteVirtualGateway)

-- | The name of the service mesh to delete the virtual gateway from.
deleteVirtualGateway_meshName :: Lens.Lens' DeleteVirtualGateway Prelude.Text
deleteVirtualGateway_meshName :: Lens' DeleteVirtualGateway Text
deleteVirtualGateway_meshName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteVirtualGateway' {Text
meshName :: Text
$sel:meshName:DeleteVirtualGateway' :: DeleteVirtualGateway -> Text
meshName} -> Text
meshName) (\s :: DeleteVirtualGateway
s@DeleteVirtualGateway' {} Text
a -> DeleteVirtualGateway
s {$sel:meshName:DeleteVirtualGateway' :: Text
meshName = Text
a} :: DeleteVirtualGateway)

-- | The name of the virtual gateway to delete.
deleteVirtualGateway_virtualGatewayName :: Lens.Lens' DeleteVirtualGateway Prelude.Text
deleteVirtualGateway_virtualGatewayName :: Lens' DeleteVirtualGateway Text
deleteVirtualGateway_virtualGatewayName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteVirtualGateway' {Text
virtualGatewayName :: Text
$sel:virtualGatewayName:DeleteVirtualGateway' :: DeleteVirtualGateway -> Text
virtualGatewayName} -> Text
virtualGatewayName) (\s :: DeleteVirtualGateway
s@DeleteVirtualGateway' {} Text
a -> DeleteVirtualGateway
s {$sel:virtualGatewayName:DeleteVirtualGateway' :: Text
virtualGatewayName = Text
a} :: DeleteVirtualGateway)

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

instance Prelude.Hashable DeleteVirtualGateway where
  hashWithSalt :: Int -> DeleteVirtualGateway -> Int
hashWithSalt Int
_salt DeleteVirtualGateway' {Maybe Text
Text
virtualGatewayName :: Text
meshName :: Text
meshOwner :: Maybe Text
$sel:virtualGatewayName:DeleteVirtualGateway' :: DeleteVirtualGateway -> Text
$sel:meshName:DeleteVirtualGateway' :: DeleteVirtualGateway -> Text
$sel:meshOwner:DeleteVirtualGateway' :: DeleteVirtualGateway -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
meshOwner
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
meshName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
virtualGatewayName

instance Prelude.NFData DeleteVirtualGateway where
  rnf :: DeleteVirtualGateway -> ()
rnf DeleteVirtualGateway' {Maybe Text
Text
virtualGatewayName :: Text
meshName :: Text
meshOwner :: Maybe Text
$sel:virtualGatewayName:DeleteVirtualGateway' :: DeleteVirtualGateway -> Text
$sel:meshName:DeleteVirtualGateway' :: DeleteVirtualGateway -> Text
$sel:meshOwner:DeleteVirtualGateway' :: DeleteVirtualGateway -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
meshOwner
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
meshName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
virtualGatewayName

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

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

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

-- | /See:/ 'newDeleteVirtualGatewayResponse' smart constructor.
data DeleteVirtualGatewayResponse = DeleteVirtualGatewayResponse'
  { -- | The response's http status code.
    DeleteVirtualGatewayResponse -> Int
httpStatus :: Prelude.Int,
    -- | The virtual gateway that was deleted.
    DeleteVirtualGatewayResponse -> VirtualGatewayData
virtualGateway :: VirtualGatewayData
  }
  deriving (DeleteVirtualGatewayResponse
-> DeleteVirtualGatewayResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteVirtualGatewayResponse
-> DeleteVirtualGatewayResponse -> Bool
$c/= :: DeleteVirtualGatewayResponse
-> DeleteVirtualGatewayResponse -> Bool
== :: DeleteVirtualGatewayResponse
-> DeleteVirtualGatewayResponse -> Bool
$c== :: DeleteVirtualGatewayResponse
-> DeleteVirtualGatewayResponse -> Bool
Prelude.Eq, ReadPrec [DeleteVirtualGatewayResponse]
ReadPrec DeleteVirtualGatewayResponse
Int -> ReadS DeleteVirtualGatewayResponse
ReadS [DeleteVirtualGatewayResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteVirtualGatewayResponse]
$creadListPrec :: ReadPrec [DeleteVirtualGatewayResponse]
readPrec :: ReadPrec DeleteVirtualGatewayResponse
$creadPrec :: ReadPrec DeleteVirtualGatewayResponse
readList :: ReadS [DeleteVirtualGatewayResponse]
$creadList :: ReadS [DeleteVirtualGatewayResponse]
readsPrec :: Int -> ReadS DeleteVirtualGatewayResponse
$creadsPrec :: Int -> ReadS DeleteVirtualGatewayResponse
Prelude.Read, Int -> DeleteVirtualGatewayResponse -> ShowS
[DeleteVirtualGatewayResponse] -> ShowS
DeleteVirtualGatewayResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteVirtualGatewayResponse] -> ShowS
$cshowList :: [DeleteVirtualGatewayResponse] -> ShowS
show :: DeleteVirtualGatewayResponse -> String
$cshow :: DeleteVirtualGatewayResponse -> String
showsPrec :: Int -> DeleteVirtualGatewayResponse -> ShowS
$cshowsPrec :: Int -> DeleteVirtualGatewayResponse -> ShowS
Prelude.Show, forall x.
Rep DeleteVirtualGatewayResponse x -> DeleteVirtualGatewayResponse
forall x.
DeleteVirtualGatewayResponse -> Rep DeleteVirtualGatewayResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteVirtualGatewayResponse x -> DeleteVirtualGatewayResponse
$cfrom :: forall x.
DeleteVirtualGatewayResponse -> Rep DeleteVirtualGatewayResponse x
Prelude.Generic)

-- |
-- Create a value of 'DeleteVirtualGatewayResponse' 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', 'deleteVirtualGatewayResponse_httpStatus' - The response's http status code.
--
-- 'virtualGateway', 'deleteVirtualGatewayResponse_virtualGateway' - The virtual gateway that was deleted.
newDeleteVirtualGatewayResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'virtualGateway'
  VirtualGatewayData ->
  DeleteVirtualGatewayResponse
newDeleteVirtualGatewayResponse :: Int -> VirtualGatewayData -> DeleteVirtualGatewayResponse
newDeleteVirtualGatewayResponse
  Int
pHttpStatus_
  VirtualGatewayData
pVirtualGateway_ =
    DeleteVirtualGatewayResponse'
      { $sel:httpStatus:DeleteVirtualGatewayResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:virtualGateway:DeleteVirtualGatewayResponse' :: VirtualGatewayData
virtualGateway = VirtualGatewayData
pVirtualGateway_
      }

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

-- | The virtual gateway that was deleted.
deleteVirtualGatewayResponse_virtualGateway :: Lens.Lens' DeleteVirtualGatewayResponse VirtualGatewayData
deleteVirtualGatewayResponse_virtualGateway :: Lens' DeleteVirtualGatewayResponse VirtualGatewayData
deleteVirtualGatewayResponse_virtualGateway = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteVirtualGatewayResponse' {VirtualGatewayData
virtualGateway :: VirtualGatewayData
$sel:virtualGateway:DeleteVirtualGatewayResponse' :: DeleteVirtualGatewayResponse -> VirtualGatewayData
virtualGateway} -> VirtualGatewayData
virtualGateway) (\s :: DeleteVirtualGatewayResponse
s@DeleteVirtualGatewayResponse' {} VirtualGatewayData
a -> DeleteVirtualGatewayResponse
s {$sel:virtualGateway:DeleteVirtualGatewayResponse' :: VirtualGatewayData
virtualGateway = VirtualGatewayData
a} :: DeleteVirtualGatewayResponse)

instance Prelude.NFData DeleteVirtualGatewayResponse where
  rnf :: DeleteVirtualGatewayResponse -> ()
rnf DeleteVirtualGatewayResponse' {Int
VirtualGatewayData
virtualGateway :: VirtualGatewayData
httpStatus :: Int
$sel:virtualGateway:DeleteVirtualGatewayResponse' :: DeleteVirtualGatewayResponse -> VirtualGatewayData
$sel:httpStatus:DeleteVirtualGatewayResponse' :: DeleteVirtualGatewayResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf VirtualGatewayData
virtualGateway