{-# 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.Route53Resolver.DeleteResolverEndpoint
-- 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)
--
-- Deletes a Resolver endpoint. The effect of deleting a Resolver endpoint
-- depends on whether it\'s an inbound or an outbound Resolver endpoint:
--
-- -   __Inbound__: DNS queries from your network are no longer routed to
--     the DNS service for the specified VPC.
--
-- -   __Outbound__: DNS queries from a VPC are no longer routed to your
--     network.
module Amazonka.Route53Resolver.DeleteResolverEndpoint
  ( -- * Creating a Request
    DeleteResolverEndpoint (..),
    newDeleteResolverEndpoint,

    -- * Request Lenses
    deleteResolverEndpoint_resolverEndpointId,

    -- * Destructuring the Response
    DeleteResolverEndpointResponse (..),
    newDeleteResolverEndpointResponse,

    -- * Response Lenses
    deleteResolverEndpointResponse_resolverEndpoint,
    deleteResolverEndpointResponse_httpStatus,
  )
where

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
import Amazonka.Route53Resolver.Types

-- | /See:/ 'newDeleteResolverEndpoint' smart constructor.
data DeleteResolverEndpoint = DeleteResolverEndpoint'
  { -- | The ID of the Resolver endpoint that you want to delete.
    DeleteResolverEndpoint -> Text
resolverEndpointId :: Prelude.Text
  }
  deriving (DeleteResolverEndpoint -> DeleteResolverEndpoint -> Bool
(DeleteResolverEndpoint -> DeleteResolverEndpoint -> Bool)
-> (DeleteResolverEndpoint -> DeleteResolverEndpoint -> Bool)
-> Eq DeleteResolverEndpoint
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteResolverEndpoint -> DeleteResolverEndpoint -> Bool
$c/= :: DeleteResolverEndpoint -> DeleteResolverEndpoint -> Bool
== :: DeleteResolverEndpoint -> DeleteResolverEndpoint -> Bool
$c== :: DeleteResolverEndpoint -> DeleteResolverEndpoint -> Bool
Prelude.Eq, ReadPrec [DeleteResolverEndpoint]
ReadPrec DeleteResolverEndpoint
Int -> ReadS DeleteResolverEndpoint
ReadS [DeleteResolverEndpoint]
(Int -> ReadS DeleteResolverEndpoint)
-> ReadS [DeleteResolverEndpoint]
-> ReadPrec DeleteResolverEndpoint
-> ReadPrec [DeleteResolverEndpoint]
-> Read DeleteResolverEndpoint
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteResolverEndpoint]
$creadListPrec :: ReadPrec [DeleteResolverEndpoint]
readPrec :: ReadPrec DeleteResolverEndpoint
$creadPrec :: ReadPrec DeleteResolverEndpoint
readList :: ReadS [DeleteResolverEndpoint]
$creadList :: ReadS [DeleteResolverEndpoint]
readsPrec :: Int -> ReadS DeleteResolverEndpoint
$creadsPrec :: Int -> ReadS DeleteResolverEndpoint
Prelude.Read, Int -> DeleteResolverEndpoint -> ShowS
[DeleteResolverEndpoint] -> ShowS
DeleteResolverEndpoint -> String
(Int -> DeleteResolverEndpoint -> ShowS)
-> (DeleteResolverEndpoint -> String)
-> ([DeleteResolverEndpoint] -> ShowS)
-> Show DeleteResolverEndpoint
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteResolverEndpoint] -> ShowS
$cshowList :: [DeleteResolverEndpoint] -> ShowS
show :: DeleteResolverEndpoint -> String
$cshow :: DeleteResolverEndpoint -> String
showsPrec :: Int -> DeleteResolverEndpoint -> ShowS
$cshowsPrec :: Int -> DeleteResolverEndpoint -> ShowS
Prelude.Show, (forall x. DeleteResolverEndpoint -> Rep DeleteResolverEndpoint x)
-> (forall x.
    Rep DeleteResolverEndpoint x -> DeleteResolverEndpoint)
-> Generic DeleteResolverEndpoint
forall x. Rep DeleteResolverEndpoint x -> DeleteResolverEndpoint
forall x. DeleteResolverEndpoint -> Rep DeleteResolverEndpoint x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteResolverEndpoint x -> DeleteResolverEndpoint
$cfrom :: forall x. DeleteResolverEndpoint -> Rep DeleteResolverEndpoint x
Prelude.Generic)

-- |
-- Create a value of 'DeleteResolverEndpoint' 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:
--
-- 'resolverEndpointId', 'deleteResolverEndpoint_resolverEndpointId' - The ID of the Resolver endpoint that you want to delete.
newDeleteResolverEndpoint ::
  -- | 'resolverEndpointId'
  Prelude.Text ->
  DeleteResolverEndpoint
newDeleteResolverEndpoint :: Text -> DeleteResolverEndpoint
newDeleteResolverEndpoint Text
pResolverEndpointId_ =
  DeleteResolverEndpoint' :: Text -> DeleteResolverEndpoint
DeleteResolverEndpoint'
    { $sel:resolverEndpointId:DeleteResolverEndpoint' :: Text
resolverEndpointId =
        Text
pResolverEndpointId_
    }

-- | The ID of the Resolver endpoint that you want to delete.
deleteResolverEndpoint_resolverEndpointId :: Lens.Lens' DeleteResolverEndpoint Prelude.Text
deleteResolverEndpoint_resolverEndpointId :: (Text -> f Text)
-> DeleteResolverEndpoint -> f DeleteResolverEndpoint
deleteResolverEndpoint_resolverEndpointId = (DeleteResolverEndpoint -> Text)
-> (DeleteResolverEndpoint -> Text -> DeleteResolverEndpoint)
-> Lens DeleteResolverEndpoint DeleteResolverEndpoint Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteResolverEndpoint' {Text
resolverEndpointId :: Text
$sel:resolverEndpointId:DeleteResolverEndpoint' :: DeleteResolverEndpoint -> Text
resolverEndpointId} -> Text
resolverEndpointId) (\s :: DeleteResolverEndpoint
s@DeleteResolverEndpoint' {} Text
a -> DeleteResolverEndpoint
s {$sel:resolverEndpointId:DeleteResolverEndpoint' :: Text
resolverEndpointId = Text
a} :: DeleteResolverEndpoint)

instance Core.AWSRequest DeleteResolverEndpoint where
  type
    AWSResponse DeleteResolverEndpoint =
      DeleteResolverEndpointResponse
  request :: DeleteResolverEndpoint -> Request DeleteResolverEndpoint
request = Service -> DeleteResolverEndpoint -> Request DeleteResolverEndpoint
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteResolverEndpoint
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteResolverEndpoint)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DeleteResolverEndpoint))
-> Logger
-> Service
-> Proxy DeleteResolverEndpoint
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteResolverEndpoint)))
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 ->
          Maybe ResolverEndpoint -> Int -> DeleteResolverEndpointResponse
DeleteResolverEndpointResponse'
            (Maybe ResolverEndpoint -> Int -> DeleteResolverEndpointResponse)
-> Either String (Maybe ResolverEndpoint)
-> Either String (Int -> DeleteResolverEndpointResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe ResolverEndpoint)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ResolverEndpoint")
            Either String (Int -> DeleteResolverEndpointResponse)
-> Either String Int
-> Either String DeleteResolverEndpointResponse
forall (f :: * -> *) a b. Applicative f => 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))
      )

instance Prelude.Hashable DeleteResolverEndpoint

instance Prelude.NFData DeleteResolverEndpoint

instance Core.ToHeaders DeleteResolverEndpoint where
  toHeaders :: DeleteResolverEndpoint -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteResolverEndpoint -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"Route53Resolver.DeleteResolverEndpoint" ::
                          Prelude.ByteString
                      ),
            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 DeleteResolverEndpoint where
  toJSON :: DeleteResolverEndpoint -> Value
toJSON DeleteResolverEndpoint' {Text
resolverEndpointId :: Text
$sel:resolverEndpointId:DeleteResolverEndpoint' :: DeleteResolverEndpoint -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"ResolverEndpointId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
resolverEndpointId)
          ]
      )

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

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

-- | /See:/ 'newDeleteResolverEndpointResponse' smart constructor.
data DeleteResolverEndpointResponse = DeleteResolverEndpointResponse'
  { -- | Information about the @DeleteResolverEndpoint@ request, including the
    -- status of the request.
    DeleteResolverEndpointResponse -> Maybe ResolverEndpoint
resolverEndpoint :: Prelude.Maybe ResolverEndpoint,
    -- | The response's http status code.
    DeleteResolverEndpointResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DeleteResolverEndpointResponse
-> DeleteResolverEndpointResponse -> Bool
(DeleteResolverEndpointResponse
 -> DeleteResolverEndpointResponse -> Bool)
-> (DeleteResolverEndpointResponse
    -> DeleteResolverEndpointResponse -> Bool)
-> Eq DeleteResolverEndpointResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteResolverEndpointResponse
-> DeleteResolverEndpointResponse -> Bool
$c/= :: DeleteResolverEndpointResponse
-> DeleteResolverEndpointResponse -> Bool
== :: DeleteResolverEndpointResponse
-> DeleteResolverEndpointResponse -> Bool
$c== :: DeleteResolverEndpointResponse
-> DeleteResolverEndpointResponse -> Bool
Prelude.Eq, ReadPrec [DeleteResolverEndpointResponse]
ReadPrec DeleteResolverEndpointResponse
Int -> ReadS DeleteResolverEndpointResponse
ReadS [DeleteResolverEndpointResponse]
(Int -> ReadS DeleteResolverEndpointResponse)
-> ReadS [DeleteResolverEndpointResponse]
-> ReadPrec DeleteResolverEndpointResponse
-> ReadPrec [DeleteResolverEndpointResponse]
-> Read DeleteResolverEndpointResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteResolverEndpointResponse]
$creadListPrec :: ReadPrec [DeleteResolverEndpointResponse]
readPrec :: ReadPrec DeleteResolverEndpointResponse
$creadPrec :: ReadPrec DeleteResolverEndpointResponse
readList :: ReadS [DeleteResolverEndpointResponse]
$creadList :: ReadS [DeleteResolverEndpointResponse]
readsPrec :: Int -> ReadS DeleteResolverEndpointResponse
$creadsPrec :: Int -> ReadS DeleteResolverEndpointResponse
Prelude.Read, Int -> DeleteResolverEndpointResponse -> ShowS
[DeleteResolverEndpointResponse] -> ShowS
DeleteResolverEndpointResponse -> String
(Int -> DeleteResolverEndpointResponse -> ShowS)
-> (DeleteResolverEndpointResponse -> String)
-> ([DeleteResolverEndpointResponse] -> ShowS)
-> Show DeleteResolverEndpointResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteResolverEndpointResponse] -> ShowS
$cshowList :: [DeleteResolverEndpointResponse] -> ShowS
show :: DeleteResolverEndpointResponse -> String
$cshow :: DeleteResolverEndpointResponse -> String
showsPrec :: Int -> DeleteResolverEndpointResponse -> ShowS
$cshowsPrec :: Int -> DeleteResolverEndpointResponse -> ShowS
Prelude.Show, (forall x.
 DeleteResolverEndpointResponse
 -> Rep DeleteResolverEndpointResponse x)
-> (forall x.
    Rep DeleteResolverEndpointResponse x
    -> DeleteResolverEndpointResponse)
-> Generic DeleteResolverEndpointResponse
forall x.
Rep DeleteResolverEndpointResponse x
-> DeleteResolverEndpointResponse
forall x.
DeleteResolverEndpointResponse
-> Rep DeleteResolverEndpointResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteResolverEndpointResponse x
-> DeleteResolverEndpointResponse
$cfrom :: forall x.
DeleteResolverEndpointResponse
-> Rep DeleteResolverEndpointResponse x
Prelude.Generic)

-- |
-- Create a value of 'DeleteResolverEndpointResponse' 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:
--
-- 'resolverEndpoint', 'deleteResolverEndpointResponse_resolverEndpoint' - Information about the @DeleteResolverEndpoint@ request, including the
-- status of the request.
--
-- 'httpStatus', 'deleteResolverEndpointResponse_httpStatus' - The response's http status code.
newDeleteResolverEndpointResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteResolverEndpointResponse
newDeleteResolverEndpointResponse :: Int -> DeleteResolverEndpointResponse
newDeleteResolverEndpointResponse Int
pHttpStatus_ =
  DeleteResolverEndpointResponse' :: Maybe ResolverEndpoint -> Int -> DeleteResolverEndpointResponse
DeleteResolverEndpointResponse'
    { $sel:resolverEndpoint:DeleteResolverEndpointResponse' :: Maybe ResolverEndpoint
resolverEndpoint =
        Maybe ResolverEndpoint
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DeleteResolverEndpointResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Information about the @DeleteResolverEndpoint@ request, including the
-- status of the request.
deleteResolverEndpointResponse_resolverEndpoint :: Lens.Lens' DeleteResolverEndpointResponse (Prelude.Maybe ResolverEndpoint)
deleteResolverEndpointResponse_resolverEndpoint :: (Maybe ResolverEndpoint -> f (Maybe ResolverEndpoint))
-> DeleteResolverEndpointResponse
-> f DeleteResolverEndpointResponse
deleteResolverEndpointResponse_resolverEndpoint = (DeleteResolverEndpointResponse -> Maybe ResolverEndpoint)
-> (DeleteResolverEndpointResponse
    -> Maybe ResolverEndpoint -> DeleteResolverEndpointResponse)
-> Lens
     DeleteResolverEndpointResponse
     DeleteResolverEndpointResponse
     (Maybe ResolverEndpoint)
     (Maybe ResolverEndpoint)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteResolverEndpointResponse' {Maybe ResolverEndpoint
resolverEndpoint :: Maybe ResolverEndpoint
$sel:resolverEndpoint:DeleteResolverEndpointResponse' :: DeleteResolverEndpointResponse -> Maybe ResolverEndpoint
resolverEndpoint} -> Maybe ResolverEndpoint
resolverEndpoint) (\s :: DeleteResolverEndpointResponse
s@DeleteResolverEndpointResponse' {} Maybe ResolverEndpoint
a -> DeleteResolverEndpointResponse
s {$sel:resolverEndpoint:DeleteResolverEndpointResponse' :: Maybe ResolverEndpoint
resolverEndpoint = Maybe ResolverEndpoint
a} :: DeleteResolverEndpointResponse)

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

instance
  Prelude.NFData
    DeleteResolverEndpointResponse