{-# 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-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 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.Lens as Lens
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
(DeleteSchema -> DeleteSchema -> Bool)
-> (DeleteSchema -> DeleteSchema -> Bool) -> Eq DeleteSchema
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]
(Int -> ReadS DeleteSchema)
-> ReadS [DeleteSchema]
-> ReadPrec DeleteSchema
-> ReadPrec [DeleteSchema]
-> Read 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
(Int -> DeleteSchema -> ShowS)
-> (DeleteSchema -> String)
-> ([DeleteSchema] -> ShowS)
-> Show DeleteSchema
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. DeleteSchema -> Rep DeleteSchema x)
-> (forall x. Rep DeleteSchema x -> DeleteSchema)
-> Generic DeleteSchema
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' :: Text -> Text -> DeleteSchema
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 :: (Text -> f Text) -> DeleteSchema -> f DeleteSchema
deleteSchema_registryName = (DeleteSchema -> Text)
-> (DeleteSchema -> Text -> DeleteSchema)
-> Lens DeleteSchema DeleteSchema Text Text
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 :: (Text -> f Text) -> DeleteSchema -> f DeleteSchema
deleteSchema_schemaName = (DeleteSchema -> Text)
-> (DeleteSchema -> Text -> DeleteSchema)
-> Lens DeleteSchema DeleteSchema Text Text
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 :: DeleteSchema -> Request DeleteSchema
request = Service -> DeleteSchema -> Request DeleteSchema
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteSchema
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteSchema)))
response = AWSResponse DeleteSchema
-> Logger
-> Service
-> Proxy DeleteSchema
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteSchema)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse DeleteSchema
DeleteSchemaResponse
DeleteSchemaResponse'

instance Prelude.Hashable DeleteSchema

instance Prelude.NFData DeleteSchema

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

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

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

-- | /See:/ 'newDeleteSchemaResponse' smart constructor.
data DeleteSchemaResponse = DeleteSchemaResponse'
  {
  }
  deriving (DeleteSchemaResponse -> DeleteSchemaResponse -> Bool
(DeleteSchemaResponse -> DeleteSchemaResponse -> Bool)
-> (DeleteSchemaResponse -> DeleteSchemaResponse -> Bool)
-> Eq DeleteSchemaResponse
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]
(Int -> ReadS DeleteSchemaResponse)
-> ReadS [DeleteSchemaResponse]
-> ReadPrec DeleteSchemaResponse
-> ReadPrec [DeleteSchemaResponse]
-> Read 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
(Int -> DeleteSchemaResponse -> ShowS)
-> (DeleteSchemaResponse -> String)
-> ([DeleteSchemaResponse] -> ShowS)
-> Show DeleteSchemaResponse
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. DeleteSchemaResponse -> Rep DeleteSchemaResponse x)
-> (forall x. Rep DeleteSchemaResponse x -> DeleteSchemaResponse)
-> Generic DeleteSchemaResponse
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