{-# 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.Schemas.DeleteSchema
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Delete a schema definition.
module Amazonka.Schemas.DeleteSchema
  ( -- * Creating a Request
    DeleteSchema (..),
    newDeleteSchema,

    -- * Request Lenses
    deleteSchema_registryName,
    deleteSchema_schemaName,

    -- * Destructuring the Response
    DeleteSchemaResponse (..),
    newDeleteSchemaResponse,
  )
where

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

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

-- |
-- Create a value of 'DeleteSchema' 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:
--
-- 'registryName', 'deleteSchema_registryName' - The name of the registry.
--
-- 'schemaName', 'deleteSchema_schemaName' - The name of the schema.
newDeleteSchema ::
  -- | 'registryName'
  Prelude.Text ->
  -- | 'schemaName'
  Prelude.Text ->
  DeleteSchema
newDeleteSchema :: Text -> Text -> DeleteSchema
newDeleteSchema Text
pRegistryName_ Text
pSchemaName_ =
  DeleteSchema'
    { $sel:registryName:DeleteSchema' :: Text
registryName = Text
pRegistryName_,
      $sel:schemaName:DeleteSchema' :: Text
schemaName = Text
pSchemaName_
    }

-- | The name of the registry.
deleteSchema_registryName :: Lens.Lens' DeleteSchema Prelude.Text
deleteSchema_registryName :: Lens' DeleteSchema Text
deleteSchema_registryName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteSchema' {Text
registryName :: Text
$sel:registryName:DeleteSchema' :: DeleteSchema -> Text
registryName} -> Text
registryName) (\s :: DeleteSchema
s@DeleteSchema' {} Text
a -> DeleteSchema
s {$sel:registryName:DeleteSchema' :: Text
registryName = Text
a} :: DeleteSchema)

-- | The name of the schema.
deleteSchema_schemaName :: Lens.Lens' DeleteSchema Prelude.Text
deleteSchema_schemaName :: Lens' DeleteSchema Text
deleteSchema_schemaName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteSchema' {Text
schemaName :: Text
$sel:schemaName:DeleteSchema' :: DeleteSchema -> Text
schemaName} -> Text
schemaName) (\s :: DeleteSchema
s@DeleteSchema' {} Text
a -> DeleteSchema
s {$sel:schemaName:DeleteSchema' :: Text
schemaName = Text
a} :: DeleteSchema)

instance Core.AWSRequest DeleteSchema where
  type AWSResponse DeleteSchema = DeleteSchemaResponse
  request :: (Service -> Service) -> DeleteSchema -> Request DeleteSchema
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 DeleteSchema
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteSchema)))
response = forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull DeleteSchemaResponse
DeleteSchemaResponse'

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

instance Prelude.NFData DeleteSchema where
  rnf :: DeleteSchema -> ()
rnf DeleteSchema' {Text
schemaName :: Text
registryName :: Text
$sel:schemaName:DeleteSchema' :: DeleteSchema -> Text
$sel:registryName:DeleteSchema' :: DeleteSchema -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
registryName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
schemaName

instance Data.ToHeaders DeleteSchema where
  toHeaders :: DeleteSchema -> [Header]
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> [Header]
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToPath DeleteSchema where
  toPath :: DeleteSchema -> ByteString
toPath DeleteSchema' {Text
schemaName :: Text
registryName :: Text
$sel:schemaName:DeleteSchema' :: DeleteSchema -> Text
$sel:registryName:DeleteSchema' :: DeleteSchema -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/v1/registries/name/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
registryName,
        ByteString
"/schemas/name/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
schemaName
      ]

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

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

-- |
-- Create a value of 'DeleteSchemaResponse' 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.
newDeleteSchemaResponse ::
  DeleteSchemaResponse
newDeleteSchemaResponse :: DeleteSchemaResponse
newDeleteSchemaResponse = DeleteSchemaResponse
DeleteSchemaResponse'

instance Prelude.NFData DeleteSchemaResponse where
  rnf :: DeleteSchemaResponse -> ()
rnf DeleteSchemaResponse
_ = ()