{-# 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.LookoutVision.DeleteModel
(
DeleteModel (..),
newDeleteModel,
deleteModel_clientToken,
deleteModel_projectName,
deleteModel_modelVersion,
DeleteModelResponse (..),
newDeleteModelResponse,
deleteModelResponse_modelArn,
deleteModelResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.LookoutVision.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data DeleteModel = DeleteModel'
{
DeleteModel -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
DeleteModel -> Text
projectName :: Prelude.Text,
DeleteModel -> Text
modelVersion :: Prelude.Text
}
deriving (DeleteModel -> DeleteModel -> Bool
(DeleteModel -> DeleteModel -> Bool)
-> (DeleteModel -> DeleteModel -> Bool) -> Eq DeleteModel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteModel -> DeleteModel -> Bool
$c/= :: DeleteModel -> DeleteModel -> Bool
== :: DeleteModel -> DeleteModel -> Bool
$c== :: DeleteModel -> DeleteModel -> Bool
Prelude.Eq, ReadPrec [DeleteModel]
ReadPrec DeleteModel
Int -> ReadS DeleteModel
ReadS [DeleteModel]
(Int -> ReadS DeleteModel)
-> ReadS [DeleteModel]
-> ReadPrec DeleteModel
-> ReadPrec [DeleteModel]
-> Read DeleteModel
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteModel]
$creadListPrec :: ReadPrec [DeleteModel]
readPrec :: ReadPrec DeleteModel
$creadPrec :: ReadPrec DeleteModel
readList :: ReadS [DeleteModel]
$creadList :: ReadS [DeleteModel]
readsPrec :: Int -> ReadS DeleteModel
$creadsPrec :: Int -> ReadS DeleteModel
Prelude.Read, Int -> DeleteModel -> ShowS
[DeleteModel] -> ShowS
DeleteModel -> String
(Int -> DeleteModel -> ShowS)
-> (DeleteModel -> String)
-> ([DeleteModel] -> ShowS)
-> Show DeleteModel
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteModel] -> ShowS
$cshowList :: [DeleteModel] -> ShowS
show :: DeleteModel -> String
$cshow :: DeleteModel -> String
showsPrec :: Int -> DeleteModel -> ShowS
$cshowsPrec :: Int -> DeleteModel -> ShowS
Prelude.Show, (forall x. DeleteModel -> Rep DeleteModel x)
-> (forall x. Rep DeleteModel x -> DeleteModel)
-> Generic DeleteModel
forall x. Rep DeleteModel x -> DeleteModel
forall x. DeleteModel -> Rep DeleteModel x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteModel x -> DeleteModel
$cfrom :: forall x. DeleteModel -> Rep DeleteModel x
Prelude.Generic)
newDeleteModel ::
Prelude.Text ->
Prelude.Text ->
DeleteModel
newDeleteModel :: Text -> Text -> DeleteModel
newDeleteModel Text
pProjectName_ Text
pModelVersion_ =
DeleteModel' :: Maybe Text -> Text -> Text -> DeleteModel
DeleteModel'
{ $sel:clientToken:DeleteModel' :: Maybe Text
clientToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:projectName:DeleteModel' :: Text
projectName = Text
pProjectName_,
$sel:modelVersion:DeleteModel' :: Text
modelVersion = Text
pModelVersion_
}
deleteModel_clientToken :: Lens.Lens' DeleteModel (Prelude.Maybe Prelude.Text)
deleteModel_clientToken :: (Maybe Text -> f (Maybe Text)) -> DeleteModel -> f DeleteModel
deleteModel_clientToken = (DeleteModel -> Maybe Text)
-> (DeleteModel -> Maybe Text -> DeleteModel)
-> Lens DeleteModel DeleteModel (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteModel' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:DeleteModel' :: DeleteModel -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: DeleteModel
s@DeleteModel' {} Maybe Text
a -> DeleteModel
s {$sel:clientToken:DeleteModel' :: Maybe Text
clientToken = Maybe Text
a} :: DeleteModel)
deleteModel_projectName :: Lens.Lens' DeleteModel Prelude.Text
deleteModel_projectName :: (Text -> f Text) -> DeleteModel -> f DeleteModel
deleteModel_projectName = (DeleteModel -> Text)
-> (DeleteModel -> Text -> DeleteModel)
-> Lens DeleteModel DeleteModel Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteModel' {Text
projectName :: Text
$sel:projectName:DeleteModel' :: DeleteModel -> Text
projectName} -> Text
projectName) (\s :: DeleteModel
s@DeleteModel' {} Text
a -> DeleteModel
s {$sel:projectName:DeleteModel' :: Text
projectName = Text
a} :: DeleteModel)
deleteModel_modelVersion :: Lens.Lens' DeleteModel Prelude.Text
deleteModel_modelVersion :: (Text -> f Text) -> DeleteModel -> f DeleteModel
deleteModel_modelVersion = (DeleteModel -> Text)
-> (DeleteModel -> Text -> DeleteModel)
-> Lens DeleteModel DeleteModel Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteModel' {Text
modelVersion :: Text
$sel:modelVersion:DeleteModel' :: DeleteModel -> Text
modelVersion} -> Text
modelVersion) (\s :: DeleteModel
s@DeleteModel' {} Text
a -> DeleteModel
s {$sel:modelVersion:DeleteModel' :: Text
modelVersion = Text
a} :: DeleteModel)
instance Core.AWSRequest DeleteModel where
type AWSResponse DeleteModel = DeleteModelResponse
request :: DeleteModel -> Request DeleteModel
request = Service -> DeleteModel -> Request DeleteModel
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
response :: Logger
-> Service
-> Proxy DeleteModel
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteModel)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DeleteModel))
-> Logger
-> Service
-> Proxy DeleteModel
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteModel)))
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 -> DeleteModelResponse
DeleteModelResponse'
(Maybe Text -> Int -> DeleteModelResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DeleteModelResponse)
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
"ModelArn")
Either String (Int -> DeleteModelResponse)
-> Either String Int -> Either String DeleteModelResponse
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 DeleteModel
instance Prelude.NFData DeleteModel
instance Core.ToHeaders DeleteModel where
toHeaders :: DeleteModel -> ResponseHeaders
toHeaders DeleteModel' {Maybe Text
Text
modelVersion :: Text
projectName :: Text
clientToken :: Maybe Text
$sel:modelVersion:DeleteModel' :: DeleteModel -> Text
$sel:projectName:DeleteModel' :: DeleteModel -> Text
$sel:clientToken:DeleteModel' :: DeleteModel -> Maybe Text
..} =
[ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amzn-Client-Token" HeaderName -> Maybe Text -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# Maybe Text
clientToken,
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 DeleteModel where
toPath :: DeleteModel -> ByteString
toPath DeleteModel' {Maybe Text
Text
modelVersion :: Text
projectName :: Text
clientToken :: Maybe Text
$sel:modelVersion:DeleteModel' :: DeleteModel -> Text
$sel:projectName:DeleteModel' :: DeleteModel -> Text
$sel:clientToken:DeleteModel' :: DeleteModel -> Maybe Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/2020-11-20/projects/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
projectName,
ByteString
"/models/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
modelVersion
]
instance Core.ToQuery DeleteModel where
toQuery :: DeleteModel -> QueryString
toQuery = QueryString -> DeleteModel -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DeleteModelResponse = DeleteModelResponse'
{
DeleteModelResponse -> Maybe Text
modelArn :: Prelude.Maybe Prelude.Text,
DeleteModelResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DeleteModelResponse -> DeleteModelResponse -> Bool
(DeleteModelResponse -> DeleteModelResponse -> Bool)
-> (DeleteModelResponse -> DeleteModelResponse -> Bool)
-> Eq DeleteModelResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteModelResponse -> DeleteModelResponse -> Bool
$c/= :: DeleteModelResponse -> DeleteModelResponse -> Bool
== :: DeleteModelResponse -> DeleteModelResponse -> Bool
$c== :: DeleteModelResponse -> DeleteModelResponse -> Bool
Prelude.Eq, ReadPrec [DeleteModelResponse]
ReadPrec DeleteModelResponse
Int -> ReadS DeleteModelResponse
ReadS [DeleteModelResponse]
(Int -> ReadS DeleteModelResponse)
-> ReadS [DeleteModelResponse]
-> ReadPrec DeleteModelResponse
-> ReadPrec [DeleteModelResponse]
-> Read DeleteModelResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteModelResponse]
$creadListPrec :: ReadPrec [DeleteModelResponse]
readPrec :: ReadPrec DeleteModelResponse
$creadPrec :: ReadPrec DeleteModelResponse
readList :: ReadS [DeleteModelResponse]
$creadList :: ReadS [DeleteModelResponse]
readsPrec :: Int -> ReadS DeleteModelResponse
$creadsPrec :: Int -> ReadS DeleteModelResponse
Prelude.Read, Int -> DeleteModelResponse -> ShowS
[DeleteModelResponse] -> ShowS
DeleteModelResponse -> String
(Int -> DeleteModelResponse -> ShowS)
-> (DeleteModelResponse -> String)
-> ([DeleteModelResponse] -> ShowS)
-> Show DeleteModelResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteModelResponse] -> ShowS
$cshowList :: [DeleteModelResponse] -> ShowS
show :: DeleteModelResponse -> String
$cshow :: DeleteModelResponse -> String
showsPrec :: Int -> DeleteModelResponse -> ShowS
$cshowsPrec :: Int -> DeleteModelResponse -> ShowS
Prelude.Show, (forall x. DeleteModelResponse -> Rep DeleteModelResponse x)
-> (forall x. Rep DeleteModelResponse x -> DeleteModelResponse)
-> Generic DeleteModelResponse
forall x. Rep DeleteModelResponse x -> DeleteModelResponse
forall x. DeleteModelResponse -> Rep DeleteModelResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteModelResponse x -> DeleteModelResponse
$cfrom :: forall x. DeleteModelResponse -> Rep DeleteModelResponse x
Prelude.Generic)
newDeleteModelResponse ::
Prelude.Int ->
DeleteModelResponse
newDeleteModelResponse :: Int -> DeleteModelResponse
newDeleteModelResponse Int
pHttpStatus_ =
DeleteModelResponse' :: Maybe Text -> Int -> DeleteModelResponse
DeleteModelResponse'
{ $sel:modelArn:DeleteModelResponse' :: Maybe Text
modelArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DeleteModelResponse' :: Int
httpStatus = Int
pHttpStatus_
}
deleteModelResponse_modelArn :: Lens.Lens' DeleteModelResponse (Prelude.Maybe Prelude.Text)
deleteModelResponse_modelArn :: (Maybe Text -> f (Maybe Text))
-> DeleteModelResponse -> f DeleteModelResponse
deleteModelResponse_modelArn = (DeleteModelResponse -> Maybe Text)
-> (DeleteModelResponse -> Maybe Text -> DeleteModelResponse)
-> Lens
DeleteModelResponse DeleteModelResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteModelResponse' {Maybe Text
modelArn :: Maybe Text
$sel:modelArn:DeleteModelResponse' :: DeleteModelResponse -> Maybe Text
modelArn} -> Maybe Text
modelArn) (\s :: DeleteModelResponse
s@DeleteModelResponse' {} Maybe Text
a -> DeleteModelResponse
s {$sel:modelArn:DeleteModelResponse' :: Maybe Text
modelArn = Maybe Text
a} :: DeleteModelResponse)
deleteModelResponse_httpStatus :: Lens.Lens' DeleteModelResponse Prelude.Int
deleteModelResponse_httpStatus :: (Int -> f Int) -> DeleteModelResponse -> f DeleteModelResponse
deleteModelResponse_httpStatus = (DeleteModelResponse -> Int)
-> (DeleteModelResponse -> Int -> DeleteModelResponse)
-> Lens DeleteModelResponse DeleteModelResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteModelResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteModelResponse' :: DeleteModelResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DeleteModelResponse
s@DeleteModelResponse' {} Int
a -> DeleteModelResponse
s {$sel:httpStatus:DeleteModelResponse' :: Int
httpStatus = Int
a} :: DeleteModelResponse)
instance Prelude.NFData DeleteModelResponse