{-# 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.Glue.DeleteRegistry
-- 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)
--
-- Delete the entire registry including schema and all of its versions. To
-- get the status of the delete operation, you can call the @GetRegistry@
-- API after the asynchronous call. Deleting a registry will deactivate all
-- online operations for the registry such as the @UpdateRegistry@,
-- @CreateSchema@, @UpdateSchema@, and @RegisterSchemaVersion@ APIs.
module Amazonka.Glue.DeleteRegistry
  ( -- * Creating a Request
    DeleteRegistry (..),
    newDeleteRegistry,

    -- * Request Lenses
    deleteRegistry_registryId,

    -- * Destructuring the Response
    DeleteRegistryResponse (..),
    newDeleteRegistryResponse,

    -- * Response Lenses
    deleteRegistryResponse_status,
    deleteRegistryResponse_registryName,
    deleteRegistryResponse_registryArn,
    deleteRegistryResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.Glue.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:/ 'newDeleteRegistry' smart constructor.
data DeleteRegistry = DeleteRegistry'
  { -- | This is a wrapper structure that may contain the registry name and
    -- Amazon Resource Name (ARN).
    DeleteRegistry -> RegistryId
registryId :: RegistryId
  }
  deriving (DeleteRegistry -> DeleteRegistry -> Bool
(DeleteRegistry -> DeleteRegistry -> Bool)
-> (DeleteRegistry -> DeleteRegistry -> Bool) -> Eq DeleteRegistry
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteRegistry -> DeleteRegistry -> Bool
$c/= :: DeleteRegistry -> DeleteRegistry -> Bool
== :: DeleteRegistry -> DeleteRegistry -> Bool
$c== :: DeleteRegistry -> DeleteRegistry -> Bool
Prelude.Eq, ReadPrec [DeleteRegistry]
ReadPrec DeleteRegistry
Int -> ReadS DeleteRegistry
ReadS [DeleteRegistry]
(Int -> ReadS DeleteRegistry)
-> ReadS [DeleteRegistry]
-> ReadPrec DeleteRegistry
-> ReadPrec [DeleteRegistry]
-> Read DeleteRegistry
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteRegistry]
$creadListPrec :: ReadPrec [DeleteRegistry]
readPrec :: ReadPrec DeleteRegistry
$creadPrec :: ReadPrec DeleteRegistry
readList :: ReadS [DeleteRegistry]
$creadList :: ReadS [DeleteRegistry]
readsPrec :: Int -> ReadS DeleteRegistry
$creadsPrec :: Int -> ReadS DeleteRegistry
Prelude.Read, Int -> DeleteRegistry -> ShowS
[DeleteRegistry] -> ShowS
DeleteRegistry -> String
(Int -> DeleteRegistry -> ShowS)
-> (DeleteRegistry -> String)
-> ([DeleteRegistry] -> ShowS)
-> Show DeleteRegistry
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteRegistry] -> ShowS
$cshowList :: [DeleteRegistry] -> ShowS
show :: DeleteRegistry -> String
$cshow :: DeleteRegistry -> String
showsPrec :: Int -> DeleteRegistry -> ShowS
$cshowsPrec :: Int -> DeleteRegistry -> ShowS
Prelude.Show, (forall x. DeleteRegistry -> Rep DeleteRegistry x)
-> (forall x. Rep DeleteRegistry x -> DeleteRegistry)
-> Generic DeleteRegistry
forall x. Rep DeleteRegistry x -> DeleteRegistry
forall x. DeleteRegistry -> Rep DeleteRegistry x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteRegistry x -> DeleteRegistry
$cfrom :: forall x. DeleteRegistry -> Rep DeleteRegistry x
Prelude.Generic)

-- |
-- Create a value of 'DeleteRegistry' 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:
--
-- 'registryId', 'deleteRegistry_registryId' - This is a wrapper structure that may contain the registry name and
-- Amazon Resource Name (ARN).
newDeleteRegistry ::
  -- | 'registryId'
  RegistryId ->
  DeleteRegistry
newDeleteRegistry :: RegistryId -> DeleteRegistry
newDeleteRegistry RegistryId
pRegistryId_ =
  DeleteRegistry' :: RegistryId -> DeleteRegistry
DeleteRegistry' {$sel:registryId:DeleteRegistry' :: RegistryId
registryId = RegistryId
pRegistryId_}

-- | This is a wrapper structure that may contain the registry name and
-- Amazon Resource Name (ARN).
deleteRegistry_registryId :: Lens.Lens' DeleteRegistry RegistryId
deleteRegistry_registryId :: (RegistryId -> f RegistryId) -> DeleteRegistry -> f DeleteRegistry
deleteRegistry_registryId = (DeleteRegistry -> RegistryId)
-> (DeleteRegistry -> RegistryId -> DeleteRegistry)
-> Lens DeleteRegistry DeleteRegistry RegistryId RegistryId
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteRegistry' {RegistryId
registryId :: RegistryId
$sel:registryId:DeleteRegistry' :: DeleteRegistry -> RegistryId
registryId} -> RegistryId
registryId) (\s :: DeleteRegistry
s@DeleteRegistry' {} RegistryId
a -> DeleteRegistry
s {$sel:registryId:DeleteRegistry' :: RegistryId
registryId = RegistryId
a} :: DeleteRegistry)

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

instance Prelude.NFData DeleteRegistry

instance Core.ToHeaders DeleteRegistry where
  toHeaders :: DeleteRegistry -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteRegistry -> 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
"AWSGlue.DeleteRegistry" :: 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 DeleteRegistry where
  toJSON :: DeleteRegistry -> Value
toJSON DeleteRegistry' {RegistryId
registryId :: RegistryId
$sel:registryId:DeleteRegistry' :: DeleteRegistry -> RegistryId
..} =
    [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
"RegistryId" Text -> RegistryId -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= RegistryId
registryId)]
      )

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

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

-- | /See:/ 'newDeleteRegistryResponse' smart constructor.
data DeleteRegistryResponse = DeleteRegistryResponse'
  { -- | The status of the registry. A successful operation will return the
    -- @Deleting@ status.
    DeleteRegistryResponse -> Maybe RegistryStatus
status :: Prelude.Maybe RegistryStatus,
    -- | The name of the registry being deleted.
    DeleteRegistryResponse -> Maybe Text
registryName :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the registry being deleted.
    DeleteRegistryResponse -> Maybe Text
registryArn :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DeleteRegistryResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DeleteRegistryResponse -> DeleteRegistryResponse -> Bool
(DeleteRegistryResponse -> DeleteRegistryResponse -> Bool)
-> (DeleteRegistryResponse -> DeleteRegistryResponse -> Bool)
-> Eq DeleteRegistryResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteRegistryResponse -> DeleteRegistryResponse -> Bool
$c/= :: DeleteRegistryResponse -> DeleteRegistryResponse -> Bool
== :: DeleteRegistryResponse -> DeleteRegistryResponse -> Bool
$c== :: DeleteRegistryResponse -> DeleteRegistryResponse -> Bool
Prelude.Eq, ReadPrec [DeleteRegistryResponse]
ReadPrec DeleteRegistryResponse
Int -> ReadS DeleteRegistryResponse
ReadS [DeleteRegistryResponse]
(Int -> ReadS DeleteRegistryResponse)
-> ReadS [DeleteRegistryResponse]
-> ReadPrec DeleteRegistryResponse
-> ReadPrec [DeleteRegistryResponse]
-> Read DeleteRegistryResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteRegistryResponse]
$creadListPrec :: ReadPrec [DeleteRegistryResponse]
readPrec :: ReadPrec DeleteRegistryResponse
$creadPrec :: ReadPrec DeleteRegistryResponse
readList :: ReadS [DeleteRegistryResponse]
$creadList :: ReadS [DeleteRegistryResponse]
readsPrec :: Int -> ReadS DeleteRegistryResponse
$creadsPrec :: Int -> ReadS DeleteRegistryResponse
Prelude.Read, Int -> DeleteRegistryResponse -> ShowS
[DeleteRegistryResponse] -> ShowS
DeleteRegistryResponse -> String
(Int -> DeleteRegistryResponse -> ShowS)
-> (DeleteRegistryResponse -> String)
-> ([DeleteRegistryResponse] -> ShowS)
-> Show DeleteRegistryResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteRegistryResponse] -> ShowS
$cshowList :: [DeleteRegistryResponse] -> ShowS
show :: DeleteRegistryResponse -> String
$cshow :: DeleteRegistryResponse -> String
showsPrec :: Int -> DeleteRegistryResponse -> ShowS
$cshowsPrec :: Int -> DeleteRegistryResponse -> ShowS
Prelude.Show, (forall x. DeleteRegistryResponse -> Rep DeleteRegistryResponse x)
-> (forall x.
    Rep DeleteRegistryResponse x -> DeleteRegistryResponse)
-> Generic DeleteRegistryResponse
forall x. Rep DeleteRegistryResponse x -> DeleteRegistryResponse
forall x. DeleteRegistryResponse -> Rep DeleteRegistryResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteRegistryResponse x -> DeleteRegistryResponse
$cfrom :: forall x. DeleteRegistryResponse -> Rep DeleteRegistryResponse x
Prelude.Generic)

-- |
-- Create a value of 'DeleteRegistryResponse' 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:
--
-- 'status', 'deleteRegistryResponse_status' - The status of the registry. A successful operation will return the
-- @Deleting@ status.
--
-- 'registryName', 'deleteRegistryResponse_registryName' - The name of the registry being deleted.
--
-- 'registryArn', 'deleteRegistryResponse_registryArn' - The Amazon Resource Name (ARN) of the registry being deleted.
--
-- 'httpStatus', 'deleteRegistryResponse_httpStatus' - The response's http status code.
newDeleteRegistryResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteRegistryResponse
newDeleteRegistryResponse :: Int -> DeleteRegistryResponse
newDeleteRegistryResponse Int
pHttpStatus_ =
  DeleteRegistryResponse' :: Maybe RegistryStatus
-> Maybe Text -> Maybe Text -> Int -> DeleteRegistryResponse
DeleteRegistryResponse'
    { $sel:status:DeleteRegistryResponse' :: Maybe RegistryStatus
status = Maybe RegistryStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:registryName:DeleteRegistryResponse' :: Maybe Text
registryName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:registryArn:DeleteRegistryResponse' :: Maybe Text
registryArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DeleteRegistryResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The status of the registry. A successful operation will return the
-- @Deleting@ status.
deleteRegistryResponse_status :: Lens.Lens' DeleteRegistryResponse (Prelude.Maybe RegistryStatus)
deleteRegistryResponse_status :: (Maybe RegistryStatus -> f (Maybe RegistryStatus))
-> DeleteRegistryResponse -> f DeleteRegistryResponse
deleteRegistryResponse_status = (DeleteRegistryResponse -> Maybe RegistryStatus)
-> (DeleteRegistryResponse
    -> Maybe RegistryStatus -> DeleteRegistryResponse)
-> Lens
     DeleteRegistryResponse
     DeleteRegistryResponse
     (Maybe RegistryStatus)
     (Maybe RegistryStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteRegistryResponse' {Maybe RegistryStatus
status :: Maybe RegistryStatus
$sel:status:DeleteRegistryResponse' :: DeleteRegistryResponse -> Maybe RegistryStatus
status} -> Maybe RegistryStatus
status) (\s :: DeleteRegistryResponse
s@DeleteRegistryResponse' {} Maybe RegistryStatus
a -> DeleteRegistryResponse
s {$sel:status:DeleteRegistryResponse' :: Maybe RegistryStatus
status = Maybe RegistryStatus
a} :: DeleteRegistryResponse)

-- | The name of the registry being deleted.
deleteRegistryResponse_registryName :: Lens.Lens' DeleteRegistryResponse (Prelude.Maybe Prelude.Text)
deleteRegistryResponse_registryName :: (Maybe Text -> f (Maybe Text))
-> DeleteRegistryResponse -> f DeleteRegistryResponse
deleteRegistryResponse_registryName = (DeleteRegistryResponse -> Maybe Text)
-> (DeleteRegistryResponse -> Maybe Text -> DeleteRegistryResponse)
-> Lens
     DeleteRegistryResponse
     DeleteRegistryResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteRegistryResponse' {Maybe Text
registryName :: Maybe Text
$sel:registryName:DeleteRegistryResponse' :: DeleteRegistryResponse -> Maybe Text
registryName} -> Maybe Text
registryName) (\s :: DeleteRegistryResponse
s@DeleteRegistryResponse' {} Maybe Text
a -> DeleteRegistryResponse
s {$sel:registryName:DeleteRegistryResponse' :: Maybe Text
registryName = Maybe Text
a} :: DeleteRegistryResponse)

-- | The Amazon Resource Name (ARN) of the registry being deleted.
deleteRegistryResponse_registryArn :: Lens.Lens' DeleteRegistryResponse (Prelude.Maybe Prelude.Text)
deleteRegistryResponse_registryArn :: (Maybe Text -> f (Maybe Text))
-> DeleteRegistryResponse -> f DeleteRegistryResponse
deleteRegistryResponse_registryArn = (DeleteRegistryResponse -> Maybe Text)
-> (DeleteRegistryResponse -> Maybe Text -> DeleteRegistryResponse)
-> Lens
     DeleteRegistryResponse
     DeleteRegistryResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteRegistryResponse' {Maybe Text
registryArn :: Maybe Text
$sel:registryArn:DeleteRegistryResponse' :: DeleteRegistryResponse -> Maybe Text
registryArn} -> Maybe Text
registryArn) (\s :: DeleteRegistryResponse
s@DeleteRegistryResponse' {} Maybe Text
a -> DeleteRegistryResponse
s {$sel:registryArn:DeleteRegistryResponse' :: Maybe Text
registryArn = Maybe Text
a} :: DeleteRegistryResponse)

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

instance Prelude.NFData DeleteRegistryResponse