{-# 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.Schemas.StartDiscoverer
(
StartDiscoverer (..),
newStartDiscoverer,
startDiscoverer_discovererId,
StartDiscovererResponse (..),
newStartDiscovererResponse,
startDiscovererResponse_state,
startDiscovererResponse_discovererId,
startDiscovererResponse_httpStatus,
)
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
data StartDiscoverer = StartDiscoverer'
{
StartDiscoverer -> Text
discovererId :: Prelude.Text
}
deriving (StartDiscoverer -> StartDiscoverer -> Bool
(StartDiscoverer -> StartDiscoverer -> Bool)
-> (StartDiscoverer -> StartDiscoverer -> Bool)
-> Eq StartDiscoverer
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartDiscoverer -> StartDiscoverer -> Bool
$c/= :: StartDiscoverer -> StartDiscoverer -> Bool
== :: StartDiscoverer -> StartDiscoverer -> Bool
$c== :: StartDiscoverer -> StartDiscoverer -> Bool
Prelude.Eq, ReadPrec [StartDiscoverer]
ReadPrec StartDiscoverer
Int -> ReadS StartDiscoverer
ReadS [StartDiscoverer]
(Int -> ReadS StartDiscoverer)
-> ReadS [StartDiscoverer]
-> ReadPrec StartDiscoverer
-> ReadPrec [StartDiscoverer]
-> Read StartDiscoverer
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartDiscoverer]
$creadListPrec :: ReadPrec [StartDiscoverer]
readPrec :: ReadPrec StartDiscoverer
$creadPrec :: ReadPrec StartDiscoverer
readList :: ReadS [StartDiscoverer]
$creadList :: ReadS [StartDiscoverer]
readsPrec :: Int -> ReadS StartDiscoverer
$creadsPrec :: Int -> ReadS StartDiscoverer
Prelude.Read, Int -> StartDiscoverer -> ShowS
[StartDiscoverer] -> ShowS
StartDiscoverer -> String
(Int -> StartDiscoverer -> ShowS)
-> (StartDiscoverer -> String)
-> ([StartDiscoverer] -> ShowS)
-> Show StartDiscoverer
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartDiscoverer] -> ShowS
$cshowList :: [StartDiscoverer] -> ShowS
show :: StartDiscoverer -> String
$cshow :: StartDiscoverer -> String
showsPrec :: Int -> StartDiscoverer -> ShowS
$cshowsPrec :: Int -> StartDiscoverer -> ShowS
Prelude.Show, (forall x. StartDiscoverer -> Rep StartDiscoverer x)
-> (forall x. Rep StartDiscoverer x -> StartDiscoverer)
-> Generic StartDiscoverer
forall x. Rep StartDiscoverer x -> StartDiscoverer
forall x. StartDiscoverer -> Rep StartDiscoverer x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartDiscoverer x -> StartDiscoverer
$cfrom :: forall x. StartDiscoverer -> Rep StartDiscoverer x
Prelude.Generic)
newStartDiscoverer ::
Prelude.Text ->
StartDiscoverer
newStartDiscoverer :: Text -> StartDiscoverer
newStartDiscoverer Text
pDiscovererId_ =
StartDiscoverer' :: Text -> StartDiscoverer
StartDiscoverer' {$sel:discovererId:StartDiscoverer' :: Text
discovererId = Text
pDiscovererId_}
startDiscoverer_discovererId :: Lens.Lens' StartDiscoverer Prelude.Text
startDiscoverer_discovererId :: (Text -> f Text) -> StartDiscoverer -> f StartDiscoverer
startDiscoverer_discovererId = (StartDiscoverer -> Text)
-> (StartDiscoverer -> Text -> StartDiscoverer)
-> Lens StartDiscoverer StartDiscoverer Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartDiscoverer' {Text
discovererId :: Text
$sel:discovererId:StartDiscoverer' :: StartDiscoverer -> Text
discovererId} -> Text
discovererId) (\s :: StartDiscoverer
s@StartDiscoverer' {} Text
a -> StartDiscoverer
s {$sel:discovererId:StartDiscoverer' :: Text
discovererId = Text
a} :: StartDiscoverer)
instance Core.AWSRequest StartDiscoverer where
type
AWSResponse StartDiscoverer =
StartDiscovererResponse
request :: StartDiscoverer -> Request StartDiscoverer
request = Service -> StartDiscoverer -> Request StartDiscoverer
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy StartDiscoverer
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StartDiscoverer)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse StartDiscoverer))
-> Logger
-> Service
-> Proxy StartDiscoverer
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StartDiscoverer)))
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 DiscovererState
-> Maybe Text -> Int -> StartDiscovererResponse
StartDiscovererResponse'
(Maybe DiscovererState
-> Maybe Text -> Int -> StartDiscovererResponse)
-> Either String (Maybe DiscovererState)
-> Either String (Maybe Text -> Int -> StartDiscovererResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe DiscovererState)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"State")
Either String (Maybe Text -> Int -> StartDiscovererResponse)
-> Either String (Maybe Text)
-> Either String (Int -> StartDiscovererResponse)
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
"DiscovererId")
Either String (Int -> StartDiscovererResponse)
-> Either String Int -> Either String StartDiscovererResponse
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 StartDiscoverer
instance Prelude.NFData StartDiscoverer
instance Core.ToHeaders StartDiscoverer where
toHeaders :: StartDiscoverer -> ResponseHeaders
toHeaders =
ResponseHeaders -> StartDiscoverer -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ 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 StartDiscoverer where
toJSON :: StartDiscoverer -> Value
toJSON = Value -> StartDiscoverer -> Value
forall a b. a -> b -> a
Prelude.const (Object -> Value
Core.Object Object
forall a. Monoid a => a
Prelude.mempty)
instance Core.ToPath StartDiscoverer where
toPath :: StartDiscoverer -> ByteString
toPath StartDiscoverer' {Text
discovererId :: Text
$sel:discovererId:StartDiscoverer' :: StartDiscoverer -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/v1/discoverers/id/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
discovererId,
ByteString
"/start"
]
instance Core.ToQuery StartDiscoverer where
toQuery :: StartDiscoverer -> QueryString
toQuery = QueryString -> StartDiscoverer -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data StartDiscovererResponse = StartDiscovererResponse'
{
StartDiscovererResponse -> Maybe DiscovererState
state :: Prelude.Maybe DiscovererState,
StartDiscovererResponse -> Maybe Text
discovererId :: Prelude.Maybe Prelude.Text,
StartDiscovererResponse -> Int
httpStatus :: Prelude.Int
}
deriving (StartDiscovererResponse -> StartDiscovererResponse -> Bool
(StartDiscovererResponse -> StartDiscovererResponse -> Bool)
-> (StartDiscovererResponse -> StartDiscovererResponse -> Bool)
-> Eq StartDiscovererResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartDiscovererResponse -> StartDiscovererResponse -> Bool
$c/= :: StartDiscovererResponse -> StartDiscovererResponse -> Bool
== :: StartDiscovererResponse -> StartDiscovererResponse -> Bool
$c== :: StartDiscovererResponse -> StartDiscovererResponse -> Bool
Prelude.Eq, ReadPrec [StartDiscovererResponse]
ReadPrec StartDiscovererResponse
Int -> ReadS StartDiscovererResponse
ReadS [StartDiscovererResponse]
(Int -> ReadS StartDiscovererResponse)
-> ReadS [StartDiscovererResponse]
-> ReadPrec StartDiscovererResponse
-> ReadPrec [StartDiscovererResponse]
-> Read StartDiscovererResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartDiscovererResponse]
$creadListPrec :: ReadPrec [StartDiscovererResponse]
readPrec :: ReadPrec StartDiscovererResponse
$creadPrec :: ReadPrec StartDiscovererResponse
readList :: ReadS [StartDiscovererResponse]
$creadList :: ReadS [StartDiscovererResponse]
readsPrec :: Int -> ReadS StartDiscovererResponse
$creadsPrec :: Int -> ReadS StartDiscovererResponse
Prelude.Read, Int -> StartDiscovererResponse -> ShowS
[StartDiscovererResponse] -> ShowS
StartDiscovererResponse -> String
(Int -> StartDiscovererResponse -> ShowS)
-> (StartDiscovererResponse -> String)
-> ([StartDiscovererResponse] -> ShowS)
-> Show StartDiscovererResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartDiscovererResponse] -> ShowS
$cshowList :: [StartDiscovererResponse] -> ShowS
show :: StartDiscovererResponse -> String
$cshow :: StartDiscovererResponse -> String
showsPrec :: Int -> StartDiscovererResponse -> ShowS
$cshowsPrec :: Int -> StartDiscovererResponse -> ShowS
Prelude.Show, (forall x.
StartDiscovererResponse -> Rep StartDiscovererResponse x)
-> (forall x.
Rep StartDiscovererResponse x -> StartDiscovererResponse)
-> Generic StartDiscovererResponse
forall x. Rep StartDiscovererResponse x -> StartDiscovererResponse
forall x. StartDiscovererResponse -> Rep StartDiscovererResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartDiscovererResponse x -> StartDiscovererResponse
$cfrom :: forall x. StartDiscovererResponse -> Rep StartDiscovererResponse x
Prelude.Generic)
newStartDiscovererResponse ::
Prelude.Int ->
StartDiscovererResponse
newStartDiscovererResponse :: Int -> StartDiscovererResponse
newStartDiscovererResponse Int
pHttpStatus_ =
StartDiscovererResponse' :: Maybe DiscovererState
-> Maybe Text -> Int -> StartDiscovererResponse
StartDiscovererResponse'
{ $sel:state:StartDiscovererResponse' :: Maybe DiscovererState
state = Maybe DiscovererState
forall a. Maybe a
Prelude.Nothing,
$sel:discovererId:StartDiscovererResponse' :: Maybe Text
discovererId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:StartDiscovererResponse' :: Int
httpStatus = Int
pHttpStatus_
}
startDiscovererResponse_state :: Lens.Lens' StartDiscovererResponse (Prelude.Maybe DiscovererState)
startDiscovererResponse_state :: (Maybe DiscovererState -> f (Maybe DiscovererState))
-> StartDiscovererResponse -> f StartDiscovererResponse
startDiscovererResponse_state = (StartDiscovererResponse -> Maybe DiscovererState)
-> (StartDiscovererResponse
-> Maybe DiscovererState -> StartDiscovererResponse)
-> Lens
StartDiscovererResponse
StartDiscovererResponse
(Maybe DiscovererState)
(Maybe DiscovererState)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartDiscovererResponse' {Maybe DiscovererState
state :: Maybe DiscovererState
$sel:state:StartDiscovererResponse' :: StartDiscovererResponse -> Maybe DiscovererState
state} -> Maybe DiscovererState
state) (\s :: StartDiscovererResponse
s@StartDiscovererResponse' {} Maybe DiscovererState
a -> StartDiscovererResponse
s {$sel:state:StartDiscovererResponse' :: Maybe DiscovererState
state = Maybe DiscovererState
a} :: StartDiscovererResponse)
startDiscovererResponse_discovererId :: Lens.Lens' StartDiscovererResponse (Prelude.Maybe Prelude.Text)
startDiscovererResponse_discovererId :: (Maybe Text -> f (Maybe Text))
-> StartDiscovererResponse -> f StartDiscovererResponse
startDiscovererResponse_discovererId = (StartDiscovererResponse -> Maybe Text)
-> (StartDiscovererResponse
-> Maybe Text -> StartDiscovererResponse)
-> Lens
StartDiscovererResponse
StartDiscovererResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartDiscovererResponse' {Maybe Text
discovererId :: Maybe Text
$sel:discovererId:StartDiscovererResponse' :: StartDiscovererResponse -> Maybe Text
discovererId} -> Maybe Text
discovererId) (\s :: StartDiscovererResponse
s@StartDiscovererResponse' {} Maybe Text
a -> StartDiscovererResponse
s {$sel:discovererId:StartDiscovererResponse' :: Maybe Text
discovererId = Maybe Text
a} :: StartDiscovererResponse)
startDiscovererResponse_httpStatus :: Lens.Lens' StartDiscovererResponse Prelude.Int
startDiscovererResponse_httpStatus :: (Int -> f Int)
-> StartDiscovererResponse -> f StartDiscovererResponse
startDiscovererResponse_httpStatus = (StartDiscovererResponse -> Int)
-> (StartDiscovererResponse -> Int -> StartDiscovererResponse)
-> Lens StartDiscovererResponse StartDiscovererResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartDiscovererResponse' {Int
httpStatus :: Int
$sel:httpStatus:StartDiscovererResponse' :: StartDiscovererResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: StartDiscovererResponse
s@StartDiscovererResponse' {} Int
a -> StartDiscovererResponse
s {$sel:httpStatus:StartDiscovererResponse' :: Int
httpStatus = Int
a} :: StartDiscovererResponse)
instance Prelude.NFData StartDiscovererResponse