{-# 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.StopModel
(
StopModel (..),
newStopModel,
stopModel_clientToken,
stopModel_projectName,
stopModel_modelVersion,
StopModelResponse (..),
newStopModelResponse,
stopModelResponse_status,
stopModelResponse_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 StopModel = StopModel'
{
StopModel -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
StopModel -> Text
projectName :: Prelude.Text,
StopModel -> Text
modelVersion :: Prelude.Text
}
deriving (StopModel -> StopModel -> Bool
(StopModel -> StopModel -> Bool)
-> (StopModel -> StopModel -> Bool) -> Eq StopModel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StopModel -> StopModel -> Bool
$c/= :: StopModel -> StopModel -> Bool
== :: StopModel -> StopModel -> Bool
$c== :: StopModel -> StopModel -> Bool
Prelude.Eq, ReadPrec [StopModel]
ReadPrec StopModel
Int -> ReadS StopModel
ReadS [StopModel]
(Int -> ReadS StopModel)
-> ReadS [StopModel]
-> ReadPrec StopModel
-> ReadPrec [StopModel]
-> Read StopModel
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StopModel]
$creadListPrec :: ReadPrec [StopModel]
readPrec :: ReadPrec StopModel
$creadPrec :: ReadPrec StopModel
readList :: ReadS [StopModel]
$creadList :: ReadS [StopModel]
readsPrec :: Int -> ReadS StopModel
$creadsPrec :: Int -> ReadS StopModel
Prelude.Read, Int -> StopModel -> ShowS
[StopModel] -> ShowS
StopModel -> String
(Int -> StopModel -> ShowS)
-> (StopModel -> String)
-> ([StopModel] -> ShowS)
-> Show StopModel
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StopModel] -> ShowS
$cshowList :: [StopModel] -> ShowS
show :: StopModel -> String
$cshow :: StopModel -> String
showsPrec :: Int -> StopModel -> ShowS
$cshowsPrec :: Int -> StopModel -> ShowS
Prelude.Show, (forall x. StopModel -> Rep StopModel x)
-> (forall x. Rep StopModel x -> StopModel) -> Generic StopModel
forall x. Rep StopModel x -> StopModel
forall x. StopModel -> Rep StopModel x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StopModel x -> StopModel
$cfrom :: forall x. StopModel -> Rep StopModel x
Prelude.Generic)
newStopModel ::
Prelude.Text ->
Prelude.Text ->
StopModel
newStopModel :: Text -> Text -> StopModel
newStopModel Text
pProjectName_ Text
pModelVersion_ =
StopModel' :: Maybe Text -> Text -> Text -> StopModel
StopModel'
{ $sel:clientToken:StopModel' :: Maybe Text
clientToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:projectName:StopModel' :: Text
projectName = Text
pProjectName_,
$sel:modelVersion:StopModel' :: Text
modelVersion = Text
pModelVersion_
}
stopModel_clientToken :: Lens.Lens' StopModel (Prelude.Maybe Prelude.Text)
stopModel_clientToken :: (Maybe Text -> f (Maybe Text)) -> StopModel -> f StopModel
stopModel_clientToken = (StopModel -> Maybe Text)
-> (StopModel -> Maybe Text -> StopModel)
-> Lens StopModel StopModel (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopModel' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:StopModel' :: StopModel -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: StopModel
s@StopModel' {} Maybe Text
a -> StopModel
s {$sel:clientToken:StopModel' :: Maybe Text
clientToken = Maybe Text
a} :: StopModel)
stopModel_projectName :: Lens.Lens' StopModel Prelude.Text
stopModel_projectName :: (Text -> f Text) -> StopModel -> f StopModel
stopModel_projectName = (StopModel -> Text)
-> (StopModel -> Text -> StopModel)
-> Lens StopModel StopModel Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopModel' {Text
projectName :: Text
$sel:projectName:StopModel' :: StopModel -> Text
projectName} -> Text
projectName) (\s :: StopModel
s@StopModel' {} Text
a -> StopModel
s {$sel:projectName:StopModel' :: Text
projectName = Text
a} :: StopModel)
stopModel_modelVersion :: Lens.Lens' StopModel Prelude.Text
stopModel_modelVersion :: (Text -> f Text) -> StopModel -> f StopModel
stopModel_modelVersion = (StopModel -> Text)
-> (StopModel -> Text -> StopModel)
-> Lens StopModel StopModel Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopModel' {Text
modelVersion :: Text
$sel:modelVersion:StopModel' :: StopModel -> Text
modelVersion} -> Text
modelVersion) (\s :: StopModel
s@StopModel' {} Text
a -> StopModel
s {$sel:modelVersion:StopModel' :: Text
modelVersion = Text
a} :: StopModel)
instance Core.AWSRequest StopModel where
type AWSResponse StopModel = StopModelResponse
request :: StopModel -> Request StopModel
request = Service -> StopModel -> Request StopModel
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy StopModel
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StopModel)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse StopModel))
-> Logger
-> Service
-> Proxy StopModel
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StopModel)))
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 ModelHostingStatus -> Int -> StopModelResponse
StopModelResponse'
(Maybe ModelHostingStatus -> Int -> StopModelResponse)
-> Either String (Maybe ModelHostingStatus)
-> Either String (Int -> StopModelResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe ModelHostingStatus)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Status")
Either String (Int -> StopModelResponse)
-> Either String Int -> Either String StopModelResponse
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 StopModel
instance Prelude.NFData StopModel
instance Core.ToHeaders StopModel where
toHeaders :: StopModel -> ResponseHeaders
toHeaders StopModel' {Maybe Text
Text
modelVersion :: Text
projectName :: Text
clientToken :: Maybe Text
$sel:modelVersion:StopModel' :: StopModel -> Text
$sel:projectName:StopModel' :: StopModel -> Text
$sel:clientToken:StopModel' :: StopModel -> 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.ToJSON StopModel where
toJSON :: StopModel -> Value
toJSON = Value -> StopModel -> Value
forall a b. a -> b -> a
Prelude.const (Object -> Value
Core.Object Object
forall a. Monoid a => a
Prelude.mempty)
instance Core.ToPath StopModel where
toPath :: StopModel -> ByteString
toPath StopModel' {Maybe Text
Text
modelVersion :: Text
projectName :: Text
clientToken :: Maybe Text
$sel:modelVersion:StopModel' :: StopModel -> Text
$sel:projectName:StopModel' :: StopModel -> Text
$sel:clientToken:StopModel' :: StopModel -> 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,
ByteString
"/stop"
]
instance Core.ToQuery StopModel where
toQuery :: StopModel -> QueryString
toQuery = QueryString -> StopModel -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data StopModelResponse = StopModelResponse'
{
StopModelResponse -> Maybe ModelHostingStatus
status :: Prelude.Maybe ModelHostingStatus,
StopModelResponse -> Int
httpStatus :: Prelude.Int
}
deriving (StopModelResponse -> StopModelResponse -> Bool
(StopModelResponse -> StopModelResponse -> Bool)
-> (StopModelResponse -> StopModelResponse -> Bool)
-> Eq StopModelResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StopModelResponse -> StopModelResponse -> Bool
$c/= :: StopModelResponse -> StopModelResponse -> Bool
== :: StopModelResponse -> StopModelResponse -> Bool
$c== :: StopModelResponse -> StopModelResponse -> Bool
Prelude.Eq, ReadPrec [StopModelResponse]
ReadPrec StopModelResponse
Int -> ReadS StopModelResponse
ReadS [StopModelResponse]
(Int -> ReadS StopModelResponse)
-> ReadS [StopModelResponse]
-> ReadPrec StopModelResponse
-> ReadPrec [StopModelResponse]
-> Read StopModelResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StopModelResponse]
$creadListPrec :: ReadPrec [StopModelResponse]
readPrec :: ReadPrec StopModelResponse
$creadPrec :: ReadPrec StopModelResponse
readList :: ReadS [StopModelResponse]
$creadList :: ReadS [StopModelResponse]
readsPrec :: Int -> ReadS StopModelResponse
$creadsPrec :: Int -> ReadS StopModelResponse
Prelude.Read, Int -> StopModelResponse -> ShowS
[StopModelResponse] -> ShowS
StopModelResponse -> String
(Int -> StopModelResponse -> ShowS)
-> (StopModelResponse -> String)
-> ([StopModelResponse] -> ShowS)
-> Show StopModelResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StopModelResponse] -> ShowS
$cshowList :: [StopModelResponse] -> ShowS
show :: StopModelResponse -> String
$cshow :: StopModelResponse -> String
showsPrec :: Int -> StopModelResponse -> ShowS
$cshowsPrec :: Int -> StopModelResponse -> ShowS
Prelude.Show, (forall x. StopModelResponse -> Rep StopModelResponse x)
-> (forall x. Rep StopModelResponse x -> StopModelResponse)
-> Generic StopModelResponse
forall x. Rep StopModelResponse x -> StopModelResponse
forall x. StopModelResponse -> Rep StopModelResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StopModelResponse x -> StopModelResponse
$cfrom :: forall x. StopModelResponse -> Rep StopModelResponse x
Prelude.Generic)
newStopModelResponse ::
Prelude.Int ->
StopModelResponse
newStopModelResponse :: Int -> StopModelResponse
newStopModelResponse Int
pHttpStatus_ =
StopModelResponse' :: Maybe ModelHostingStatus -> Int -> StopModelResponse
StopModelResponse'
{ $sel:status:StopModelResponse' :: Maybe ModelHostingStatus
status = Maybe ModelHostingStatus
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:StopModelResponse' :: Int
httpStatus = Int
pHttpStatus_
}
stopModelResponse_status :: Lens.Lens' StopModelResponse (Prelude.Maybe ModelHostingStatus)
stopModelResponse_status :: (Maybe ModelHostingStatus -> f (Maybe ModelHostingStatus))
-> StopModelResponse -> f StopModelResponse
stopModelResponse_status = (StopModelResponse -> Maybe ModelHostingStatus)
-> (StopModelResponse
-> Maybe ModelHostingStatus -> StopModelResponse)
-> Lens
StopModelResponse
StopModelResponse
(Maybe ModelHostingStatus)
(Maybe ModelHostingStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopModelResponse' {Maybe ModelHostingStatus
status :: Maybe ModelHostingStatus
$sel:status:StopModelResponse' :: StopModelResponse -> Maybe ModelHostingStatus
status} -> Maybe ModelHostingStatus
status) (\s :: StopModelResponse
s@StopModelResponse' {} Maybe ModelHostingStatus
a -> StopModelResponse
s {$sel:status:StopModelResponse' :: Maybe ModelHostingStatus
status = Maybe ModelHostingStatus
a} :: StopModelResponse)
stopModelResponse_httpStatus :: Lens.Lens' StopModelResponse Prelude.Int
stopModelResponse_httpStatus :: (Int -> f Int) -> StopModelResponse -> f StopModelResponse
stopModelResponse_httpStatus = (StopModelResponse -> Int)
-> (StopModelResponse -> Int -> StopModelResponse)
-> Lens StopModelResponse StopModelResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopModelResponse' {Int
httpStatus :: Int
$sel:httpStatus:StopModelResponse' :: StopModelResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: StopModelResponse
s@StopModelResponse' {} Int
a -> StopModelResponse
s {$sel:httpStatus:StopModelResponse' :: Int
httpStatus = Int
a} :: StopModelResponse)
instance Prelude.NFData StopModelResponse