{-# 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.DeleteVirtualCluster
-- 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 virtual cluster. Virtual cluster is a managed entity on Amazon
-- EMR on EKS. You can create, describe, list and delete virtual clusters.
-- They do not consume any additional resource in your system. A single
-- virtual cluster maps to a single Kubernetes namespace. Given this
-- relationship, you can model virtual clusters the same way you model
-- Kubernetes namespaces to meet your requirements.
module Amazonka.EMRContainers.DeleteVirtualCluster
  ( -- * Creating a Request
    DeleteVirtualCluster (..),
    newDeleteVirtualCluster,

    -- * Request Lenses
    deleteVirtualCluster_id,

    -- * Destructuring the Response
    DeleteVirtualClusterResponse (..),
    newDeleteVirtualClusterResponse,

    -- * Response Lenses
    deleteVirtualClusterResponse_id,
    deleteVirtualClusterResponse_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:/ 'newDeleteVirtualCluster' smart constructor.
data DeleteVirtualCluster = DeleteVirtualCluster'
  { -- | The ID of the virtual cluster that will be deleted.
    DeleteVirtualCluster -> Text
id :: Prelude.Text
  }
  deriving (DeleteVirtualCluster -> DeleteVirtualCluster -> Bool
(DeleteVirtualCluster -> DeleteVirtualCluster -> Bool)
-> (DeleteVirtualCluster -> DeleteVirtualCluster -> Bool)
-> Eq DeleteVirtualCluster
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteVirtualCluster -> DeleteVirtualCluster -> Bool
$c/= :: DeleteVirtualCluster -> DeleteVirtualCluster -> Bool
== :: DeleteVirtualCluster -> DeleteVirtualCluster -> Bool
$c== :: DeleteVirtualCluster -> DeleteVirtualCluster -> Bool
Prelude.Eq, ReadPrec [DeleteVirtualCluster]
ReadPrec DeleteVirtualCluster
Int -> ReadS DeleteVirtualCluster
ReadS [DeleteVirtualCluster]
(Int -> ReadS DeleteVirtualCluster)
-> ReadS [DeleteVirtualCluster]
-> ReadPrec DeleteVirtualCluster
-> ReadPrec [DeleteVirtualCluster]
-> Read DeleteVirtualCluster
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteVirtualCluster]
$creadListPrec :: ReadPrec [DeleteVirtualCluster]
readPrec :: ReadPrec DeleteVirtualCluster
$creadPrec :: ReadPrec DeleteVirtualCluster
readList :: ReadS [DeleteVirtualCluster]
$creadList :: ReadS [DeleteVirtualCluster]
readsPrec :: Int -> ReadS DeleteVirtualCluster
$creadsPrec :: Int -> ReadS DeleteVirtualCluster
Prelude.Read, Int -> DeleteVirtualCluster -> ShowS
[DeleteVirtualCluster] -> ShowS
DeleteVirtualCluster -> String
(Int -> DeleteVirtualCluster -> ShowS)
-> (DeleteVirtualCluster -> String)
-> ([DeleteVirtualCluster] -> ShowS)
-> Show DeleteVirtualCluster
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteVirtualCluster] -> ShowS
$cshowList :: [DeleteVirtualCluster] -> ShowS
show :: DeleteVirtualCluster -> String
$cshow :: DeleteVirtualCluster -> String
showsPrec :: Int -> DeleteVirtualCluster -> ShowS
$cshowsPrec :: Int -> DeleteVirtualCluster -> ShowS
Prelude.Show, (forall x. DeleteVirtualCluster -> Rep DeleteVirtualCluster x)
-> (forall x. Rep DeleteVirtualCluster x -> DeleteVirtualCluster)
-> Generic DeleteVirtualCluster
forall x. Rep DeleteVirtualCluster x -> DeleteVirtualCluster
forall x. DeleteVirtualCluster -> Rep DeleteVirtualCluster x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteVirtualCluster x -> DeleteVirtualCluster
$cfrom :: forall x. DeleteVirtualCluster -> Rep DeleteVirtualCluster x
Prelude.Generic)

-- |
-- Create a value of 'DeleteVirtualCluster' 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', 'deleteVirtualCluster_id' - The ID of the virtual cluster that will be deleted.
newDeleteVirtualCluster ::
  -- | 'id'
  Prelude.Text ->
  DeleteVirtualCluster
newDeleteVirtualCluster :: Text -> DeleteVirtualCluster
newDeleteVirtualCluster Text
pId_ =
  DeleteVirtualCluster' :: Text -> DeleteVirtualCluster
DeleteVirtualCluster' {$sel:id:DeleteVirtualCluster' :: Text
id = Text
pId_}

-- | The ID of the virtual cluster that will be deleted.
deleteVirtualCluster_id :: Lens.Lens' DeleteVirtualCluster Prelude.Text
deleteVirtualCluster_id :: (Text -> f Text) -> DeleteVirtualCluster -> f DeleteVirtualCluster
deleteVirtualCluster_id = (DeleteVirtualCluster -> Text)
-> (DeleteVirtualCluster -> Text -> DeleteVirtualCluster)
-> Lens DeleteVirtualCluster DeleteVirtualCluster Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteVirtualCluster' {Text
id :: Text
$sel:id:DeleteVirtualCluster' :: DeleteVirtualCluster -> Text
id} -> Text
id) (\s :: DeleteVirtualCluster
s@DeleteVirtualCluster' {} Text
a -> DeleteVirtualCluster
s {$sel:id:DeleteVirtualCluster' :: Text
id = Text
a} :: DeleteVirtualCluster)

instance Core.AWSRequest DeleteVirtualCluster where
  type
    AWSResponse DeleteVirtualCluster =
      DeleteVirtualClusterResponse
  request :: DeleteVirtualCluster -> Request DeleteVirtualCluster
request = Service -> DeleteVirtualCluster -> Request DeleteVirtualCluster
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteVirtualCluster
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteVirtualCluster)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DeleteVirtualCluster))
-> Logger
-> Service
-> Proxy DeleteVirtualCluster
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteVirtualCluster)))
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 -> Int -> DeleteVirtualClusterResponse
DeleteVirtualClusterResponse'
            (Maybe Text -> Int -> DeleteVirtualClusterResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DeleteVirtualClusterResponse)
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 (Int -> DeleteVirtualClusterResponse)
-> Either String Int -> Either String DeleteVirtualClusterResponse
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 DeleteVirtualCluster

instance Prelude.NFData DeleteVirtualCluster

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

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

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

-- |
-- Create a value of 'DeleteVirtualClusterResponse' 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', 'deleteVirtualClusterResponse_id' - This output contains the ID of the virtual cluster that will be deleted.
--
-- 'httpStatus', 'deleteVirtualClusterResponse_httpStatus' - The response's http status code.
newDeleteVirtualClusterResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteVirtualClusterResponse
newDeleteVirtualClusterResponse :: Int -> DeleteVirtualClusterResponse
newDeleteVirtualClusterResponse Int
pHttpStatus_ =
  DeleteVirtualClusterResponse' :: Maybe Text -> Int -> DeleteVirtualClusterResponse
DeleteVirtualClusterResponse'
    { $sel:id:DeleteVirtualClusterResponse' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DeleteVirtualClusterResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | This output contains the ID of the virtual cluster that will be deleted.
deleteVirtualClusterResponse_id :: Lens.Lens' DeleteVirtualClusterResponse (Prelude.Maybe Prelude.Text)
deleteVirtualClusterResponse_id :: (Maybe Text -> f (Maybe Text))
-> DeleteVirtualClusterResponse -> f DeleteVirtualClusterResponse
deleteVirtualClusterResponse_id = (DeleteVirtualClusterResponse -> Maybe Text)
-> (DeleteVirtualClusterResponse
    -> Maybe Text -> DeleteVirtualClusterResponse)
-> Lens
     DeleteVirtualClusterResponse
     DeleteVirtualClusterResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteVirtualClusterResponse' {Maybe Text
id :: Maybe Text
$sel:id:DeleteVirtualClusterResponse' :: DeleteVirtualClusterResponse -> Maybe Text
id} -> Maybe Text
id) (\s :: DeleteVirtualClusterResponse
s@DeleteVirtualClusterResponse' {} Maybe Text
a -> DeleteVirtualClusterResponse
s {$sel:id:DeleteVirtualClusterResponse' :: Maybe Text
id = Maybe Text
a} :: DeleteVirtualClusterResponse)

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

instance Prelude.NFData DeleteVirtualClusterResponse