{-# 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.EMRContainers.DeleteManagedEndpoint
-- 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 managed endpoint. A managed endpoint is a gateway that
-- connects EMR Studio to Amazon EMR on EKS so that EMR Studio can
-- communicate with your virtual cluster.
module Amazonka.EMRContainers.DeleteManagedEndpoint
  ( -- * Creating a Request
    DeleteManagedEndpoint (..),
    newDeleteManagedEndpoint,

    -- * Request Lenses
    deleteManagedEndpoint_id,
    deleteManagedEndpoint_virtualClusterId,

    -- * Destructuring the Response
    DeleteManagedEndpointResponse (..),
    newDeleteManagedEndpointResponse,

    -- * Response Lenses
    deleteManagedEndpointResponse_id,
    deleteManagedEndpointResponse_virtualClusterId,
    deleteManagedEndpointResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.EMRContainers.Types
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:/ 'newDeleteManagedEndpoint' smart constructor.
data DeleteManagedEndpoint = DeleteManagedEndpoint'
  { -- | The ID of the managed endpoint.
    DeleteManagedEndpoint -> Text
id :: Prelude.Text,
    -- | The ID of the endpoint\'s virtual cluster.
    DeleteManagedEndpoint -> Text
virtualClusterId :: Prelude.Text
  }
  deriving (DeleteManagedEndpoint -> DeleteManagedEndpoint -> Bool
(DeleteManagedEndpoint -> DeleteManagedEndpoint -> Bool)
-> (DeleteManagedEndpoint -> DeleteManagedEndpoint -> Bool)
-> Eq DeleteManagedEndpoint
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteManagedEndpoint -> DeleteManagedEndpoint -> Bool
$c/= :: DeleteManagedEndpoint -> DeleteManagedEndpoint -> Bool
== :: DeleteManagedEndpoint -> DeleteManagedEndpoint -> Bool
$c== :: DeleteManagedEndpoint -> DeleteManagedEndpoint -> Bool
Prelude.Eq, ReadPrec [DeleteManagedEndpoint]
ReadPrec DeleteManagedEndpoint
Int -> ReadS DeleteManagedEndpoint
ReadS [DeleteManagedEndpoint]
(Int -> ReadS DeleteManagedEndpoint)
-> ReadS [DeleteManagedEndpoint]
-> ReadPrec DeleteManagedEndpoint
-> ReadPrec [DeleteManagedEndpoint]
-> Read DeleteManagedEndpoint
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteManagedEndpoint]
$creadListPrec :: ReadPrec [DeleteManagedEndpoint]
readPrec :: ReadPrec DeleteManagedEndpoint
$creadPrec :: ReadPrec DeleteManagedEndpoint
readList :: ReadS [DeleteManagedEndpoint]
$creadList :: ReadS [DeleteManagedEndpoint]
readsPrec :: Int -> ReadS DeleteManagedEndpoint
$creadsPrec :: Int -> ReadS DeleteManagedEndpoint
Prelude.Read, Int -> DeleteManagedEndpoint -> ShowS
[DeleteManagedEndpoint] -> ShowS
DeleteManagedEndpoint -> String
(Int -> DeleteManagedEndpoint -> ShowS)
-> (DeleteManagedEndpoint -> String)
-> ([DeleteManagedEndpoint] -> ShowS)
-> Show DeleteManagedEndpoint
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteManagedEndpoint] -> ShowS
$cshowList :: [DeleteManagedEndpoint] -> ShowS
show :: DeleteManagedEndpoint -> String
$cshow :: DeleteManagedEndpoint -> String
showsPrec :: Int -> DeleteManagedEndpoint -> ShowS
$cshowsPrec :: Int -> DeleteManagedEndpoint -> ShowS
Prelude.Show, (forall x. DeleteManagedEndpoint -> Rep DeleteManagedEndpoint x)
-> (forall x. Rep DeleteManagedEndpoint x -> DeleteManagedEndpoint)
-> Generic DeleteManagedEndpoint
forall x. Rep DeleteManagedEndpoint x -> DeleteManagedEndpoint
forall x. DeleteManagedEndpoint -> Rep DeleteManagedEndpoint x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteManagedEndpoint x -> DeleteManagedEndpoint
$cfrom :: forall x. DeleteManagedEndpoint -> Rep DeleteManagedEndpoint x
Prelude.Generic)

-- |
-- Create a value of 'DeleteManagedEndpoint' 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:
--
-- 'id', 'deleteManagedEndpoint_id' - The ID of the managed endpoint.
--
-- 'virtualClusterId', 'deleteManagedEndpoint_virtualClusterId' - The ID of the endpoint\'s virtual cluster.
newDeleteManagedEndpoint ::
  -- | 'id'
  Prelude.Text ->
  -- | 'virtualClusterId'
  Prelude.Text ->
  DeleteManagedEndpoint
newDeleteManagedEndpoint :: Text -> Text -> DeleteManagedEndpoint
newDeleteManagedEndpoint Text
pId_ Text
pVirtualClusterId_ =
  DeleteManagedEndpoint' :: Text -> Text -> DeleteManagedEndpoint
DeleteManagedEndpoint'
    { $sel:id:DeleteManagedEndpoint' :: Text
id = Text
pId_,
      $sel:virtualClusterId:DeleteManagedEndpoint' :: Text
virtualClusterId = Text
pVirtualClusterId_
    }

-- | The ID of the managed endpoint.
deleteManagedEndpoint_id :: Lens.Lens' DeleteManagedEndpoint Prelude.Text
deleteManagedEndpoint_id :: (Text -> f Text)
-> DeleteManagedEndpoint -> f DeleteManagedEndpoint
deleteManagedEndpoint_id = (DeleteManagedEndpoint -> Text)
-> (DeleteManagedEndpoint -> Text -> DeleteManagedEndpoint)
-> Lens DeleteManagedEndpoint DeleteManagedEndpoint Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteManagedEndpoint' {Text
id :: Text
$sel:id:DeleteManagedEndpoint' :: DeleteManagedEndpoint -> Text
id} -> Text
id) (\s :: DeleteManagedEndpoint
s@DeleteManagedEndpoint' {} Text
a -> DeleteManagedEndpoint
s {$sel:id:DeleteManagedEndpoint' :: Text
id = Text
a} :: DeleteManagedEndpoint)

-- | The ID of the endpoint\'s virtual cluster.
deleteManagedEndpoint_virtualClusterId :: Lens.Lens' DeleteManagedEndpoint Prelude.Text
deleteManagedEndpoint_virtualClusterId :: (Text -> f Text)
-> DeleteManagedEndpoint -> f DeleteManagedEndpoint
deleteManagedEndpoint_virtualClusterId = (DeleteManagedEndpoint -> Text)
-> (DeleteManagedEndpoint -> Text -> DeleteManagedEndpoint)
-> Lens DeleteManagedEndpoint DeleteManagedEndpoint Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteManagedEndpoint' {Text
virtualClusterId :: Text
$sel:virtualClusterId:DeleteManagedEndpoint' :: DeleteManagedEndpoint -> Text
virtualClusterId} -> Text
virtualClusterId) (\s :: DeleteManagedEndpoint
s@DeleteManagedEndpoint' {} Text
a -> DeleteManagedEndpoint
s {$sel:virtualClusterId:DeleteManagedEndpoint' :: Text
virtualClusterId = Text
a} :: DeleteManagedEndpoint)

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

instance Prelude.NFData DeleteManagedEndpoint

instance Core.ToHeaders DeleteManagedEndpoint where
  toHeaders :: DeleteManagedEndpoint -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteManagedEndpoint -> 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.ToPath DeleteManagedEndpoint where
  toPath :: DeleteManagedEndpoint -> ByteString
toPath DeleteManagedEndpoint' {Text
virtualClusterId :: Text
id :: Text
$sel:virtualClusterId:DeleteManagedEndpoint' :: DeleteManagedEndpoint -> Text
$sel:id:DeleteManagedEndpoint' :: DeleteManagedEndpoint -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/virtualclusters/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
virtualClusterId,
        ByteString
"/endpoints/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
id
      ]

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

-- | /See:/ 'newDeleteManagedEndpointResponse' smart constructor.
data DeleteManagedEndpointResponse = DeleteManagedEndpointResponse'
  { -- | The output displays the ID of the managed endpoint.
    DeleteManagedEndpointResponse -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | The output displays the ID of the endpoint\'s virtual cluster.
    DeleteManagedEndpointResponse -> Maybe Text
virtualClusterId :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DeleteManagedEndpointResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DeleteManagedEndpointResponse
-> DeleteManagedEndpointResponse -> Bool
(DeleteManagedEndpointResponse
 -> DeleteManagedEndpointResponse -> Bool)
-> (DeleteManagedEndpointResponse
    -> DeleteManagedEndpointResponse -> Bool)
-> Eq DeleteManagedEndpointResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteManagedEndpointResponse
-> DeleteManagedEndpointResponse -> Bool
$c/= :: DeleteManagedEndpointResponse
-> DeleteManagedEndpointResponse -> Bool
== :: DeleteManagedEndpointResponse
-> DeleteManagedEndpointResponse -> Bool
$c== :: DeleteManagedEndpointResponse
-> DeleteManagedEndpointResponse -> Bool
Prelude.Eq, ReadPrec [DeleteManagedEndpointResponse]
ReadPrec DeleteManagedEndpointResponse
Int -> ReadS DeleteManagedEndpointResponse
ReadS [DeleteManagedEndpointResponse]
(Int -> ReadS DeleteManagedEndpointResponse)
-> ReadS [DeleteManagedEndpointResponse]
-> ReadPrec DeleteManagedEndpointResponse
-> ReadPrec [DeleteManagedEndpointResponse]
-> Read DeleteManagedEndpointResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteManagedEndpointResponse]
$creadListPrec :: ReadPrec [DeleteManagedEndpointResponse]
readPrec :: ReadPrec DeleteManagedEndpointResponse
$creadPrec :: ReadPrec DeleteManagedEndpointResponse
readList :: ReadS [DeleteManagedEndpointResponse]
$creadList :: ReadS [DeleteManagedEndpointResponse]
readsPrec :: Int -> ReadS DeleteManagedEndpointResponse
$creadsPrec :: Int -> ReadS DeleteManagedEndpointResponse
Prelude.Read, Int -> DeleteManagedEndpointResponse -> ShowS
[DeleteManagedEndpointResponse] -> ShowS
DeleteManagedEndpointResponse -> String
(Int -> DeleteManagedEndpointResponse -> ShowS)
-> (DeleteManagedEndpointResponse -> String)
-> ([DeleteManagedEndpointResponse] -> ShowS)
-> Show DeleteManagedEndpointResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteManagedEndpointResponse] -> ShowS
$cshowList :: [DeleteManagedEndpointResponse] -> ShowS
show :: DeleteManagedEndpointResponse -> String
$cshow :: DeleteManagedEndpointResponse -> String
showsPrec :: Int -> DeleteManagedEndpointResponse -> ShowS
$cshowsPrec :: Int -> DeleteManagedEndpointResponse -> ShowS
Prelude.Show, (forall x.
 DeleteManagedEndpointResponse
 -> Rep DeleteManagedEndpointResponse x)
-> (forall x.
    Rep DeleteManagedEndpointResponse x
    -> DeleteManagedEndpointResponse)
-> Generic DeleteManagedEndpointResponse
forall x.
Rep DeleteManagedEndpointResponse x
-> DeleteManagedEndpointResponse
forall x.
DeleteManagedEndpointResponse
-> Rep DeleteManagedEndpointResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteManagedEndpointResponse x
-> DeleteManagedEndpointResponse
$cfrom :: forall x.
DeleteManagedEndpointResponse
-> Rep DeleteManagedEndpointResponse x
Prelude.Generic)

-- |
-- Create a value of 'DeleteManagedEndpointResponse' 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:
--
-- 'id', 'deleteManagedEndpointResponse_id' - The output displays the ID of the managed endpoint.
--
-- 'virtualClusterId', 'deleteManagedEndpointResponse_virtualClusterId' - The output displays the ID of the endpoint\'s virtual cluster.
--
-- 'httpStatus', 'deleteManagedEndpointResponse_httpStatus' - The response's http status code.
newDeleteManagedEndpointResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteManagedEndpointResponse
newDeleteManagedEndpointResponse :: Int -> DeleteManagedEndpointResponse
newDeleteManagedEndpointResponse Int
pHttpStatus_ =
  DeleteManagedEndpointResponse' :: Maybe Text -> Maybe Text -> Int -> DeleteManagedEndpointResponse
DeleteManagedEndpointResponse'
    { $sel:id:DeleteManagedEndpointResponse' :: Maybe Text
id =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:virtualClusterId:DeleteManagedEndpointResponse' :: Maybe Text
virtualClusterId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DeleteManagedEndpointResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The output displays the ID of the managed endpoint.
deleteManagedEndpointResponse_id :: Lens.Lens' DeleteManagedEndpointResponse (Prelude.Maybe Prelude.Text)
deleteManagedEndpointResponse_id :: (Maybe Text -> f (Maybe Text))
-> DeleteManagedEndpointResponse -> f DeleteManagedEndpointResponse
deleteManagedEndpointResponse_id = (DeleteManagedEndpointResponse -> Maybe Text)
-> (DeleteManagedEndpointResponse
    -> Maybe Text -> DeleteManagedEndpointResponse)
-> Lens
     DeleteManagedEndpointResponse
     DeleteManagedEndpointResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteManagedEndpointResponse' {Maybe Text
id :: Maybe Text
$sel:id:DeleteManagedEndpointResponse' :: DeleteManagedEndpointResponse -> Maybe Text
id} -> Maybe Text
id) (\s :: DeleteManagedEndpointResponse
s@DeleteManagedEndpointResponse' {} Maybe Text
a -> DeleteManagedEndpointResponse
s {$sel:id:DeleteManagedEndpointResponse' :: Maybe Text
id = Maybe Text
a} :: DeleteManagedEndpointResponse)

-- | The output displays the ID of the endpoint\'s virtual cluster.
deleteManagedEndpointResponse_virtualClusterId :: Lens.Lens' DeleteManagedEndpointResponse (Prelude.Maybe Prelude.Text)
deleteManagedEndpointResponse_virtualClusterId :: (Maybe Text -> f (Maybe Text))
-> DeleteManagedEndpointResponse -> f DeleteManagedEndpointResponse
deleteManagedEndpointResponse_virtualClusterId = (DeleteManagedEndpointResponse -> Maybe Text)
-> (DeleteManagedEndpointResponse
    -> Maybe Text -> DeleteManagedEndpointResponse)
-> Lens
     DeleteManagedEndpointResponse
     DeleteManagedEndpointResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteManagedEndpointResponse' {Maybe Text
virtualClusterId :: Maybe Text
$sel:virtualClusterId:DeleteManagedEndpointResponse' :: DeleteManagedEndpointResponse -> Maybe Text
virtualClusterId} -> Maybe Text
virtualClusterId) (\s :: DeleteManagedEndpointResponse
s@DeleteManagedEndpointResponse' {} Maybe Text
a -> DeleteManagedEndpointResponse
s {$sel:virtualClusterId:DeleteManagedEndpointResponse' :: Maybe Text
virtualClusterId = Maybe Text
a} :: DeleteManagedEndpointResponse)

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

instance Prelude.NFData DeleteManagedEndpointResponse