{-# 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.AppRunner.DeleteVpcConnector
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Delete an App Runner VPC connector resource. You can\'t delete a
-- connector that\'s used by one or more App Runner services.
module Amazonka.AppRunner.DeleteVpcConnector
  ( -- * Creating a Request
    DeleteVpcConnector (..),
    newDeleteVpcConnector,

    -- * Request Lenses
    deleteVpcConnector_vpcConnectorArn,

    -- * Destructuring the Response
    DeleteVpcConnectorResponse (..),
    newDeleteVpcConnectorResponse,

    -- * Response Lenses
    deleteVpcConnectorResponse_httpStatus,
    deleteVpcConnectorResponse_vpcConnector,
  )
where

import Amazonka.AppRunner.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:/ 'newDeleteVpcConnector' smart constructor.
data DeleteVpcConnector = DeleteVpcConnector'
  { -- | The Amazon Resource Name (ARN) of the App Runner VPC connector that you
    -- want to delete.
    --
    -- The ARN must be a full VPC connector ARN.
    DeleteVpcConnector -> Text
vpcConnectorArn :: Prelude.Text
  }
  deriving (DeleteVpcConnector -> DeleteVpcConnector -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteVpcConnector -> DeleteVpcConnector -> Bool
$c/= :: DeleteVpcConnector -> DeleteVpcConnector -> Bool
== :: DeleteVpcConnector -> DeleteVpcConnector -> Bool
$c== :: DeleteVpcConnector -> DeleteVpcConnector -> Bool
Prelude.Eq, ReadPrec [DeleteVpcConnector]
ReadPrec DeleteVpcConnector
Int -> ReadS DeleteVpcConnector
ReadS [DeleteVpcConnector]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteVpcConnector]
$creadListPrec :: ReadPrec [DeleteVpcConnector]
readPrec :: ReadPrec DeleteVpcConnector
$creadPrec :: ReadPrec DeleteVpcConnector
readList :: ReadS [DeleteVpcConnector]
$creadList :: ReadS [DeleteVpcConnector]
readsPrec :: Int -> ReadS DeleteVpcConnector
$creadsPrec :: Int -> ReadS DeleteVpcConnector
Prelude.Read, Int -> DeleteVpcConnector -> ShowS
[DeleteVpcConnector] -> ShowS
DeleteVpcConnector -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteVpcConnector] -> ShowS
$cshowList :: [DeleteVpcConnector] -> ShowS
show :: DeleteVpcConnector -> String
$cshow :: DeleteVpcConnector -> String
showsPrec :: Int -> DeleteVpcConnector -> ShowS
$cshowsPrec :: Int -> DeleteVpcConnector -> ShowS
Prelude.Show, forall x. Rep DeleteVpcConnector x -> DeleteVpcConnector
forall x. DeleteVpcConnector -> Rep DeleteVpcConnector x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteVpcConnector x -> DeleteVpcConnector
$cfrom :: forall x. DeleteVpcConnector -> Rep DeleteVpcConnector x
Prelude.Generic)

-- |
-- Create a value of 'DeleteVpcConnector' 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:
--
-- 'vpcConnectorArn', 'deleteVpcConnector_vpcConnectorArn' - The Amazon Resource Name (ARN) of the App Runner VPC connector that you
-- want to delete.
--
-- The ARN must be a full VPC connector ARN.
newDeleteVpcConnector ::
  -- | 'vpcConnectorArn'
  Prelude.Text ->
  DeleteVpcConnector
newDeleteVpcConnector :: Text -> DeleteVpcConnector
newDeleteVpcConnector Text
pVpcConnectorArn_ =
  DeleteVpcConnector'
    { $sel:vpcConnectorArn:DeleteVpcConnector' :: Text
vpcConnectorArn =
        Text
pVpcConnectorArn_
    }

-- | The Amazon Resource Name (ARN) of the App Runner VPC connector that you
-- want to delete.
--
-- The ARN must be a full VPC connector ARN.
deleteVpcConnector_vpcConnectorArn :: Lens.Lens' DeleteVpcConnector Prelude.Text
deleteVpcConnector_vpcConnectorArn :: Lens' DeleteVpcConnector Text
deleteVpcConnector_vpcConnectorArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteVpcConnector' {Text
vpcConnectorArn :: Text
$sel:vpcConnectorArn:DeleteVpcConnector' :: DeleteVpcConnector -> Text
vpcConnectorArn} -> Text
vpcConnectorArn) (\s :: DeleteVpcConnector
s@DeleteVpcConnector' {} Text
a -> DeleteVpcConnector
s {$sel:vpcConnectorArn:DeleteVpcConnector' :: Text
vpcConnectorArn = Text
a} :: DeleteVpcConnector)

instance Core.AWSRequest DeleteVpcConnector where
  type
    AWSResponse DeleteVpcConnector =
      DeleteVpcConnectorResponse
  request :: (Service -> Service)
-> DeleteVpcConnector -> Request DeleteVpcConnector
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DeleteVpcConnector
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteVpcConnector)))
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 -> VpcConnector -> DeleteVpcConnectorResponse
DeleteVpcConnectorResponse'
            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.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"VpcConnector")
      )

instance Prelude.Hashable DeleteVpcConnector where
  hashWithSalt :: Int -> DeleteVpcConnector -> Int
hashWithSalt Int
_salt DeleteVpcConnector' {Text
vpcConnectorArn :: Text
$sel:vpcConnectorArn:DeleteVpcConnector' :: DeleteVpcConnector -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
vpcConnectorArn

instance Prelude.NFData DeleteVpcConnector where
  rnf :: DeleteVpcConnector -> ()
rnf DeleteVpcConnector' {Text
vpcConnectorArn :: Text
$sel:vpcConnectorArn:DeleteVpcConnector' :: DeleteVpcConnector -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
vpcConnectorArn

instance Data.ToHeaders DeleteVpcConnector where
  toHeaders :: DeleteVpcConnector -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"AppRunner.DeleteVpcConnector" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.0" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON DeleteVpcConnector where
  toJSON :: DeleteVpcConnector -> Value
toJSON DeleteVpcConnector' {Text
vpcConnectorArn :: Text
$sel:vpcConnectorArn:DeleteVpcConnector' :: DeleteVpcConnector -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"VpcConnectorArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
vpcConnectorArn)
          ]
      )

instance Data.ToPath DeleteVpcConnector where
  toPath :: DeleteVpcConnector -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Data.ToQuery DeleteVpcConnector where
  toQuery :: DeleteVpcConnector -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newDeleteVpcConnectorResponse' smart constructor.
data DeleteVpcConnectorResponse = DeleteVpcConnectorResponse'
  { -- | The response's http status code.
    DeleteVpcConnectorResponse -> Int
httpStatus :: Prelude.Int,
    -- | A description of the App Runner VPC connector that this request just
    -- deleted.
    DeleteVpcConnectorResponse -> VpcConnector
vpcConnector :: VpcConnector
  }
  deriving (DeleteVpcConnectorResponse -> DeleteVpcConnectorResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteVpcConnectorResponse -> DeleteVpcConnectorResponse -> Bool
$c/= :: DeleteVpcConnectorResponse -> DeleteVpcConnectorResponse -> Bool
== :: DeleteVpcConnectorResponse -> DeleteVpcConnectorResponse -> Bool
$c== :: DeleteVpcConnectorResponse -> DeleteVpcConnectorResponse -> Bool
Prelude.Eq, ReadPrec [DeleteVpcConnectorResponse]
ReadPrec DeleteVpcConnectorResponse
Int -> ReadS DeleteVpcConnectorResponse
ReadS [DeleteVpcConnectorResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteVpcConnectorResponse]
$creadListPrec :: ReadPrec [DeleteVpcConnectorResponse]
readPrec :: ReadPrec DeleteVpcConnectorResponse
$creadPrec :: ReadPrec DeleteVpcConnectorResponse
readList :: ReadS [DeleteVpcConnectorResponse]
$creadList :: ReadS [DeleteVpcConnectorResponse]
readsPrec :: Int -> ReadS DeleteVpcConnectorResponse
$creadsPrec :: Int -> ReadS DeleteVpcConnectorResponse
Prelude.Read, Int -> DeleteVpcConnectorResponse -> ShowS
[DeleteVpcConnectorResponse] -> ShowS
DeleteVpcConnectorResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteVpcConnectorResponse] -> ShowS
$cshowList :: [DeleteVpcConnectorResponse] -> ShowS
show :: DeleteVpcConnectorResponse -> String
$cshow :: DeleteVpcConnectorResponse -> String
showsPrec :: Int -> DeleteVpcConnectorResponse -> ShowS
$cshowsPrec :: Int -> DeleteVpcConnectorResponse -> ShowS
Prelude.Show, forall x.
Rep DeleteVpcConnectorResponse x -> DeleteVpcConnectorResponse
forall x.
DeleteVpcConnectorResponse -> Rep DeleteVpcConnectorResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteVpcConnectorResponse x -> DeleteVpcConnectorResponse
$cfrom :: forall x.
DeleteVpcConnectorResponse -> Rep DeleteVpcConnectorResponse x
Prelude.Generic)

-- |
-- Create a value of 'DeleteVpcConnectorResponse' 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', 'deleteVpcConnectorResponse_httpStatus' - The response's http status code.
--
-- 'vpcConnector', 'deleteVpcConnectorResponse_vpcConnector' - A description of the App Runner VPC connector that this request just
-- deleted.
newDeleteVpcConnectorResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'vpcConnector'
  VpcConnector ->
  DeleteVpcConnectorResponse
newDeleteVpcConnectorResponse :: Int -> VpcConnector -> DeleteVpcConnectorResponse
newDeleteVpcConnectorResponse
  Int
pHttpStatus_
  VpcConnector
pVpcConnector_ =
    DeleteVpcConnectorResponse'
      { $sel:httpStatus:DeleteVpcConnectorResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:vpcConnector:DeleteVpcConnectorResponse' :: VpcConnector
vpcConnector = VpcConnector
pVpcConnector_
      }

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

-- | A description of the App Runner VPC connector that this request just
-- deleted.
deleteVpcConnectorResponse_vpcConnector :: Lens.Lens' DeleteVpcConnectorResponse VpcConnector
deleteVpcConnectorResponse_vpcConnector :: Lens' DeleteVpcConnectorResponse VpcConnector
deleteVpcConnectorResponse_vpcConnector = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteVpcConnectorResponse' {VpcConnector
vpcConnector :: VpcConnector
$sel:vpcConnector:DeleteVpcConnectorResponse' :: DeleteVpcConnectorResponse -> VpcConnector
vpcConnector} -> VpcConnector
vpcConnector) (\s :: DeleteVpcConnectorResponse
s@DeleteVpcConnectorResponse' {} VpcConnector
a -> DeleteVpcConnectorResponse
s {$sel:vpcConnector:DeleteVpcConnectorResponse' :: VpcConnector
vpcConnector = VpcConnector
a} :: DeleteVpcConnectorResponse)

instance Prelude.NFData DeleteVpcConnectorResponse where
  rnf :: DeleteVpcConnectorResponse -> ()
rnf DeleteVpcConnectorResponse' {Int
VpcConnector
vpcConnector :: VpcConnector
httpStatus :: Int
$sel:vpcConnector:DeleteVpcConnectorResponse' :: DeleteVpcConnectorResponse -> VpcConnector
$sel:httpStatus:DeleteVpcConnectorResponse' :: DeleteVpcConnectorResponse -> 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 VpcConnector
vpcConnector