{-# 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 #-}
module Amazonka.Glue.DeleteSchema
(
DeleteSchema (..),
newDeleteSchema,
deleteSchema_schemaId,
DeleteSchemaResponse (..),
newDeleteSchemaResponse,
deleteSchemaResponse_status,
deleteSchemaResponse_schemaName,
deleteSchemaResponse_schemaArn,
deleteSchemaResponse_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
data DeleteSchema = DeleteSchema'
{
DeleteSchema -> SchemaId
schemaId :: SchemaId
}
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)
newDeleteSchema ::
SchemaId ->
DeleteSchema
newDeleteSchema :: SchemaId -> DeleteSchema
newDeleteSchema SchemaId
pSchemaId_ =
DeleteSchema' :: SchemaId -> DeleteSchema
DeleteSchema' {$sel:schemaId:DeleteSchema' :: SchemaId
schemaId = SchemaId
pSchemaId_}
deleteSchema_schemaId :: Lens.Lens' DeleteSchema SchemaId
deleteSchema_schemaId :: (SchemaId -> f SchemaId) -> DeleteSchema -> f DeleteSchema
deleteSchema_schemaId = (DeleteSchema -> SchemaId)
-> (DeleteSchema -> SchemaId -> DeleteSchema)
-> Lens DeleteSchema DeleteSchema SchemaId SchemaId
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteSchema' {SchemaId
schemaId :: SchemaId
$sel:schemaId:DeleteSchema' :: DeleteSchema -> SchemaId
schemaId} -> SchemaId
schemaId) (\s :: DeleteSchema
s@DeleteSchema' {} SchemaId
a -> DeleteSchema
s {$sel:schemaId:DeleteSchema' :: SchemaId
schemaId = SchemaId
a} :: DeleteSchema)
instance Core.AWSRequest DeleteSchema where
type AWSResponse DeleteSchema = DeleteSchemaResponse
request :: DeleteSchema -> Request DeleteSchema
request = Service -> DeleteSchema -> Request DeleteSchema
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DeleteSchema
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteSchema)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DeleteSchema))
-> Logger
-> Service
-> Proxy DeleteSchema
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteSchema)))
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 SchemaStatus
-> Maybe Text -> Maybe Text -> Int -> DeleteSchemaResponse
DeleteSchemaResponse'
(Maybe SchemaStatus
-> Maybe Text -> Maybe Text -> Int -> DeleteSchemaResponse)
-> Either String (Maybe SchemaStatus)
-> Either
String (Maybe Text -> Maybe Text -> Int -> DeleteSchemaResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe SchemaStatus)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Status")
Either
String (Maybe Text -> Maybe Text -> Int -> DeleteSchemaResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> DeleteSchemaResponse)
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
"SchemaName")
Either String (Maybe Text -> Int -> DeleteSchemaResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DeleteSchemaResponse)
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
"SchemaArn")
Either String (Int -> DeleteSchemaResponse)
-> Either String Int -> Either String DeleteSchemaResponse
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 DeleteSchema
instance Prelude.NFData DeleteSchema
instance Core.ToHeaders DeleteSchema where
toHeaders :: DeleteSchema -> ResponseHeaders
toHeaders =
ResponseHeaders -> DeleteSchema -> 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.DeleteSchema" :: 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 DeleteSchema where
toJSON :: DeleteSchema -> Value
toJSON DeleteSchema' {SchemaId
schemaId :: SchemaId
$sel:schemaId:DeleteSchema' :: DeleteSchema -> SchemaId
..} =
[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
"SchemaId" Text -> SchemaId -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= SchemaId
schemaId)]
)
instance Core.ToPath DeleteSchema where
toPath :: DeleteSchema -> ByteString
toPath = ByteString -> DeleteSchema -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
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
data DeleteSchemaResponse = DeleteSchemaResponse'
{
DeleteSchemaResponse -> Maybe SchemaStatus
status :: Prelude.Maybe SchemaStatus,
DeleteSchemaResponse -> Maybe Text
schemaName :: Prelude.Maybe Prelude.Text,
DeleteSchemaResponse -> Maybe Text
schemaArn :: Prelude.Maybe Prelude.Text,
DeleteSchemaResponse -> Int
httpStatus :: Prelude.Int
}
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)
newDeleteSchemaResponse ::
Prelude.Int ->
DeleteSchemaResponse
newDeleteSchemaResponse :: Int -> DeleteSchemaResponse
newDeleteSchemaResponse Int
pHttpStatus_ =
DeleteSchemaResponse' :: Maybe SchemaStatus
-> Maybe Text -> Maybe Text -> Int -> DeleteSchemaResponse
DeleteSchemaResponse'
{ $sel:status:DeleteSchemaResponse' :: Maybe SchemaStatus
status = Maybe SchemaStatus
forall a. Maybe a
Prelude.Nothing,
$sel:schemaName:DeleteSchemaResponse' :: Maybe Text
schemaName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:schemaArn:DeleteSchemaResponse' :: Maybe Text
schemaArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DeleteSchemaResponse' :: Int
httpStatus = Int
pHttpStatus_
}
deleteSchemaResponse_status :: Lens.Lens' DeleteSchemaResponse (Prelude.Maybe SchemaStatus)
deleteSchemaResponse_status :: (Maybe SchemaStatus -> f (Maybe SchemaStatus))
-> DeleteSchemaResponse -> f DeleteSchemaResponse
deleteSchemaResponse_status = (DeleteSchemaResponse -> Maybe SchemaStatus)
-> (DeleteSchemaResponse
-> Maybe SchemaStatus -> DeleteSchemaResponse)
-> Lens
DeleteSchemaResponse
DeleteSchemaResponse
(Maybe SchemaStatus)
(Maybe SchemaStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteSchemaResponse' {Maybe SchemaStatus
status :: Maybe SchemaStatus
$sel:status:DeleteSchemaResponse' :: DeleteSchemaResponse -> Maybe SchemaStatus
status} -> Maybe SchemaStatus
status) (\s :: DeleteSchemaResponse
s@DeleteSchemaResponse' {} Maybe SchemaStatus
a -> DeleteSchemaResponse
s {$sel:status:DeleteSchemaResponse' :: Maybe SchemaStatus
status = Maybe SchemaStatus
a} :: DeleteSchemaResponse)
deleteSchemaResponse_schemaName :: Lens.Lens' DeleteSchemaResponse (Prelude.Maybe Prelude.Text)
deleteSchemaResponse_schemaName :: (Maybe Text -> f (Maybe Text))
-> DeleteSchemaResponse -> f DeleteSchemaResponse
deleteSchemaResponse_schemaName = (DeleteSchemaResponse -> Maybe Text)
-> (DeleteSchemaResponse -> Maybe Text -> DeleteSchemaResponse)
-> Lens
DeleteSchemaResponse DeleteSchemaResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteSchemaResponse' {Maybe Text
schemaName :: Maybe Text
$sel:schemaName:DeleteSchemaResponse' :: DeleteSchemaResponse -> Maybe Text
schemaName} -> Maybe Text
schemaName) (\s :: DeleteSchemaResponse
s@DeleteSchemaResponse' {} Maybe Text
a -> DeleteSchemaResponse
s {$sel:schemaName:DeleteSchemaResponse' :: Maybe Text
schemaName = Maybe Text
a} :: DeleteSchemaResponse)
deleteSchemaResponse_schemaArn :: Lens.Lens' DeleteSchemaResponse (Prelude.Maybe Prelude.Text)
deleteSchemaResponse_schemaArn :: (Maybe Text -> f (Maybe Text))
-> DeleteSchemaResponse -> f DeleteSchemaResponse
deleteSchemaResponse_schemaArn = (DeleteSchemaResponse -> Maybe Text)
-> (DeleteSchemaResponse -> Maybe Text -> DeleteSchemaResponse)
-> Lens
DeleteSchemaResponse DeleteSchemaResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteSchemaResponse' {Maybe Text
schemaArn :: Maybe Text
$sel:schemaArn:DeleteSchemaResponse' :: DeleteSchemaResponse -> Maybe Text
schemaArn} -> Maybe Text
schemaArn) (\s :: DeleteSchemaResponse
s@DeleteSchemaResponse' {} Maybe Text
a -> DeleteSchemaResponse
s {$sel:schemaArn:DeleteSchemaResponse' :: Maybe Text
schemaArn = Maybe Text
a} :: DeleteSchemaResponse)
deleteSchemaResponse_httpStatus :: Lens.Lens' DeleteSchemaResponse Prelude.Int
deleteSchemaResponse_httpStatus :: (Int -> f Int) -> DeleteSchemaResponse -> f DeleteSchemaResponse
deleteSchemaResponse_httpStatus = (DeleteSchemaResponse -> Int)
-> (DeleteSchemaResponse -> Int -> DeleteSchemaResponse)
-> Lens DeleteSchemaResponse DeleteSchemaResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteSchemaResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteSchemaResponse' :: DeleteSchemaResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DeleteSchemaResponse
s@DeleteSchemaResponse' {} Int
a -> DeleteSchemaResponse
s {$sel:httpStatus:DeleteSchemaResponse' :: Int
httpStatus = Int
a} :: DeleteSchemaResponse)
instance Prelude.NFData DeleteSchemaResponse