{-# 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.OpenSearch.DeleteVpcEndpoint
-- 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 Amazon OpenSearch Service-managed interface VPC endpoint.
module Amazonka.OpenSearch.DeleteVpcEndpoint
  ( -- * Creating a Request
    DeleteVpcEndpoint (..),
    newDeleteVpcEndpoint,

    -- * Request Lenses
    deleteVpcEndpoint_vpcEndpointId,

    -- * Destructuring the Response
    DeleteVpcEndpointResponse (..),
    newDeleteVpcEndpointResponse,

    -- * Response Lenses
    deleteVpcEndpointResponse_httpStatus,
    deleteVpcEndpointResponse_vpcEndpointSummary,
  )
where

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

-- | /See:/ 'newDeleteVpcEndpoint' smart constructor.
data DeleteVpcEndpoint = DeleteVpcEndpoint'
  { -- | The unique identifier of the endpoint.
    DeleteVpcEndpoint -> Text
vpcEndpointId :: Prelude.Text
  }
  deriving (DeleteVpcEndpoint -> DeleteVpcEndpoint -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteVpcEndpoint -> DeleteVpcEndpoint -> Bool
$c/= :: DeleteVpcEndpoint -> DeleteVpcEndpoint -> Bool
== :: DeleteVpcEndpoint -> DeleteVpcEndpoint -> Bool
$c== :: DeleteVpcEndpoint -> DeleteVpcEndpoint -> Bool
Prelude.Eq, ReadPrec [DeleteVpcEndpoint]
ReadPrec DeleteVpcEndpoint
Int -> ReadS DeleteVpcEndpoint
ReadS [DeleteVpcEndpoint]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteVpcEndpoint]
$creadListPrec :: ReadPrec [DeleteVpcEndpoint]
readPrec :: ReadPrec DeleteVpcEndpoint
$creadPrec :: ReadPrec DeleteVpcEndpoint
readList :: ReadS [DeleteVpcEndpoint]
$creadList :: ReadS [DeleteVpcEndpoint]
readsPrec :: Int -> ReadS DeleteVpcEndpoint
$creadsPrec :: Int -> ReadS DeleteVpcEndpoint
Prelude.Read, Int -> DeleteVpcEndpoint -> ShowS
[DeleteVpcEndpoint] -> ShowS
DeleteVpcEndpoint -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteVpcEndpoint] -> ShowS
$cshowList :: [DeleteVpcEndpoint] -> ShowS
show :: DeleteVpcEndpoint -> String
$cshow :: DeleteVpcEndpoint -> String
showsPrec :: Int -> DeleteVpcEndpoint -> ShowS
$cshowsPrec :: Int -> DeleteVpcEndpoint -> ShowS
Prelude.Show, forall x. Rep DeleteVpcEndpoint x -> DeleteVpcEndpoint
forall x. DeleteVpcEndpoint -> Rep DeleteVpcEndpoint x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteVpcEndpoint x -> DeleteVpcEndpoint
$cfrom :: forall x. DeleteVpcEndpoint -> Rep DeleteVpcEndpoint x
Prelude.Generic)

-- |
-- Create a value of 'DeleteVpcEndpoint' 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:
--
-- 'vpcEndpointId', 'deleteVpcEndpoint_vpcEndpointId' - The unique identifier of the endpoint.
newDeleteVpcEndpoint ::
  -- | 'vpcEndpointId'
  Prelude.Text ->
  DeleteVpcEndpoint
newDeleteVpcEndpoint :: Text -> DeleteVpcEndpoint
newDeleteVpcEndpoint Text
pVpcEndpointId_ =
  DeleteVpcEndpoint' {$sel:vpcEndpointId:DeleteVpcEndpoint' :: Text
vpcEndpointId = Text
pVpcEndpointId_}

-- | The unique identifier of the endpoint.
deleteVpcEndpoint_vpcEndpointId :: Lens.Lens' DeleteVpcEndpoint Prelude.Text
deleteVpcEndpoint_vpcEndpointId :: Lens' DeleteVpcEndpoint Text
deleteVpcEndpoint_vpcEndpointId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteVpcEndpoint' {Text
vpcEndpointId :: Text
$sel:vpcEndpointId:DeleteVpcEndpoint' :: DeleteVpcEndpoint -> Text
vpcEndpointId} -> Text
vpcEndpointId) (\s :: DeleteVpcEndpoint
s@DeleteVpcEndpoint' {} Text
a -> DeleteVpcEndpoint
s {$sel:vpcEndpointId:DeleteVpcEndpoint' :: Text
vpcEndpointId = Text
a} :: DeleteVpcEndpoint)

instance Core.AWSRequest DeleteVpcEndpoint where
  type
    AWSResponse DeleteVpcEndpoint =
      DeleteVpcEndpointResponse
  request :: (Service -> Service)
-> DeleteVpcEndpoint -> Request DeleteVpcEndpoint
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 DeleteVpcEndpoint
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteVpcEndpoint)))
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 -> VpcEndpointSummary -> DeleteVpcEndpointResponse
DeleteVpcEndpointResponse'
            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
"VpcEndpointSummary")
      )

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

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

instance Data.ToHeaders DeleteVpcEndpoint where
  toHeaders :: DeleteVpcEndpoint -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

instance Data.ToPath DeleteVpcEndpoint where
  toPath :: DeleteVpcEndpoint -> ByteString
toPath DeleteVpcEndpoint' {Text
vpcEndpointId :: Text
$sel:vpcEndpointId:DeleteVpcEndpoint' :: DeleteVpcEndpoint -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/2021-01-01/opensearch/vpcEndpoints/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
vpcEndpointId
      ]

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

-- | /See:/ 'newDeleteVpcEndpointResponse' smart constructor.
data DeleteVpcEndpointResponse = DeleteVpcEndpointResponse'
  { -- | The response's http status code.
    DeleteVpcEndpointResponse -> Int
httpStatus :: Prelude.Int,
    -- | Information about the deleted endpoint, including its current status
    -- (@DELETING@ or @DELETE_FAILED@).
    DeleteVpcEndpointResponse -> VpcEndpointSummary
vpcEndpointSummary :: VpcEndpointSummary
  }
  deriving (DeleteVpcEndpointResponse -> DeleteVpcEndpointResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteVpcEndpointResponse -> DeleteVpcEndpointResponse -> Bool
$c/= :: DeleteVpcEndpointResponse -> DeleteVpcEndpointResponse -> Bool
== :: DeleteVpcEndpointResponse -> DeleteVpcEndpointResponse -> Bool
$c== :: DeleteVpcEndpointResponse -> DeleteVpcEndpointResponse -> Bool
Prelude.Eq, ReadPrec [DeleteVpcEndpointResponse]
ReadPrec DeleteVpcEndpointResponse
Int -> ReadS DeleteVpcEndpointResponse
ReadS [DeleteVpcEndpointResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteVpcEndpointResponse]
$creadListPrec :: ReadPrec [DeleteVpcEndpointResponse]
readPrec :: ReadPrec DeleteVpcEndpointResponse
$creadPrec :: ReadPrec DeleteVpcEndpointResponse
readList :: ReadS [DeleteVpcEndpointResponse]
$creadList :: ReadS [DeleteVpcEndpointResponse]
readsPrec :: Int -> ReadS DeleteVpcEndpointResponse
$creadsPrec :: Int -> ReadS DeleteVpcEndpointResponse
Prelude.Read, Int -> DeleteVpcEndpointResponse -> ShowS
[DeleteVpcEndpointResponse] -> ShowS
DeleteVpcEndpointResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteVpcEndpointResponse] -> ShowS
$cshowList :: [DeleteVpcEndpointResponse] -> ShowS
show :: DeleteVpcEndpointResponse -> String
$cshow :: DeleteVpcEndpointResponse -> String
showsPrec :: Int -> DeleteVpcEndpointResponse -> ShowS
$cshowsPrec :: Int -> DeleteVpcEndpointResponse -> ShowS
Prelude.Show, forall x.
Rep DeleteVpcEndpointResponse x -> DeleteVpcEndpointResponse
forall x.
DeleteVpcEndpointResponse -> Rep DeleteVpcEndpointResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteVpcEndpointResponse x -> DeleteVpcEndpointResponse
$cfrom :: forall x.
DeleteVpcEndpointResponse -> Rep DeleteVpcEndpointResponse x
Prelude.Generic)

-- |
-- Create a value of 'DeleteVpcEndpointResponse' 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', 'deleteVpcEndpointResponse_httpStatus' - The response's http status code.
--
-- 'vpcEndpointSummary', 'deleteVpcEndpointResponse_vpcEndpointSummary' - Information about the deleted endpoint, including its current status
-- (@DELETING@ or @DELETE_FAILED@).
newDeleteVpcEndpointResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'vpcEndpointSummary'
  VpcEndpointSummary ->
  DeleteVpcEndpointResponse
newDeleteVpcEndpointResponse :: Int -> VpcEndpointSummary -> DeleteVpcEndpointResponse
newDeleteVpcEndpointResponse
  Int
pHttpStatus_
  VpcEndpointSummary
pVpcEndpointSummary_ =
    DeleteVpcEndpointResponse'
      { $sel:httpStatus:DeleteVpcEndpointResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:vpcEndpointSummary:DeleteVpcEndpointResponse' :: VpcEndpointSummary
vpcEndpointSummary = VpcEndpointSummary
pVpcEndpointSummary_
      }

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

-- | Information about the deleted endpoint, including its current status
-- (@DELETING@ or @DELETE_FAILED@).
deleteVpcEndpointResponse_vpcEndpointSummary :: Lens.Lens' DeleteVpcEndpointResponse VpcEndpointSummary
deleteVpcEndpointResponse_vpcEndpointSummary :: Lens' DeleteVpcEndpointResponse VpcEndpointSummary
deleteVpcEndpointResponse_vpcEndpointSummary = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteVpcEndpointResponse' {VpcEndpointSummary
vpcEndpointSummary :: VpcEndpointSummary
$sel:vpcEndpointSummary:DeleteVpcEndpointResponse' :: DeleteVpcEndpointResponse -> VpcEndpointSummary
vpcEndpointSummary} -> VpcEndpointSummary
vpcEndpointSummary) (\s :: DeleteVpcEndpointResponse
s@DeleteVpcEndpointResponse' {} VpcEndpointSummary
a -> DeleteVpcEndpointResponse
s {$sel:vpcEndpointSummary:DeleteVpcEndpointResponse' :: VpcEndpointSummary
vpcEndpointSummary = VpcEndpointSummary
a} :: DeleteVpcEndpointResponse)

instance Prelude.NFData DeleteVpcEndpointResponse where
  rnf :: DeleteVpcEndpointResponse -> ()
rnf DeleteVpcEndpointResponse' {Int
VpcEndpointSummary
vpcEndpointSummary :: VpcEndpointSummary
httpStatus :: Int
$sel:vpcEndpointSummary:DeleteVpcEndpointResponse' :: DeleteVpcEndpointResponse -> VpcEndpointSummary
$sel:httpStatus:DeleteVpcEndpointResponse' :: DeleteVpcEndpointResponse -> 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 VpcEndpointSummary
vpcEndpointSummary