{-# 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.DataBrew.StartProjectSession
(
StartProjectSession (..),
newStartProjectSession,
startProjectSession_assumeControl,
startProjectSession_name,
StartProjectSessionResponse (..),
newStartProjectSessionResponse,
startProjectSessionResponse_clientSessionId,
startProjectSessionResponse_httpStatus,
startProjectSessionResponse_name,
)
where
import qualified Amazonka.Core as Core
import Amazonka.DataBrew.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 StartProjectSession = StartProjectSession'
{
StartProjectSession -> Maybe Bool
assumeControl :: Prelude.Maybe Prelude.Bool,
StartProjectSession -> Text
name :: Prelude.Text
}
deriving (StartProjectSession -> StartProjectSession -> Bool
(StartProjectSession -> StartProjectSession -> Bool)
-> (StartProjectSession -> StartProjectSession -> Bool)
-> Eq StartProjectSession
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartProjectSession -> StartProjectSession -> Bool
$c/= :: StartProjectSession -> StartProjectSession -> Bool
== :: StartProjectSession -> StartProjectSession -> Bool
$c== :: StartProjectSession -> StartProjectSession -> Bool
Prelude.Eq, ReadPrec [StartProjectSession]
ReadPrec StartProjectSession
Int -> ReadS StartProjectSession
ReadS [StartProjectSession]
(Int -> ReadS StartProjectSession)
-> ReadS [StartProjectSession]
-> ReadPrec StartProjectSession
-> ReadPrec [StartProjectSession]
-> Read StartProjectSession
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartProjectSession]
$creadListPrec :: ReadPrec [StartProjectSession]
readPrec :: ReadPrec StartProjectSession
$creadPrec :: ReadPrec StartProjectSession
readList :: ReadS [StartProjectSession]
$creadList :: ReadS [StartProjectSession]
readsPrec :: Int -> ReadS StartProjectSession
$creadsPrec :: Int -> ReadS StartProjectSession
Prelude.Read, Int -> StartProjectSession -> ShowS
[StartProjectSession] -> ShowS
StartProjectSession -> String
(Int -> StartProjectSession -> ShowS)
-> (StartProjectSession -> String)
-> ([StartProjectSession] -> ShowS)
-> Show StartProjectSession
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartProjectSession] -> ShowS
$cshowList :: [StartProjectSession] -> ShowS
show :: StartProjectSession -> String
$cshow :: StartProjectSession -> String
showsPrec :: Int -> StartProjectSession -> ShowS
$cshowsPrec :: Int -> StartProjectSession -> ShowS
Prelude.Show, (forall x. StartProjectSession -> Rep StartProjectSession x)
-> (forall x. Rep StartProjectSession x -> StartProjectSession)
-> Generic StartProjectSession
forall x. Rep StartProjectSession x -> StartProjectSession
forall x. StartProjectSession -> Rep StartProjectSession x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartProjectSession x -> StartProjectSession
$cfrom :: forall x. StartProjectSession -> Rep StartProjectSession x
Prelude.Generic)
newStartProjectSession ::
Prelude.Text ->
StartProjectSession
newStartProjectSession :: Text -> StartProjectSession
newStartProjectSession Text
pName_ =
StartProjectSession' :: Maybe Bool -> Text -> StartProjectSession
StartProjectSession'
{ $sel:assumeControl:StartProjectSession' :: Maybe Bool
assumeControl =
Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:name:StartProjectSession' :: Text
name = Text
pName_
}
startProjectSession_assumeControl :: Lens.Lens' StartProjectSession (Prelude.Maybe Prelude.Bool)
startProjectSession_assumeControl :: (Maybe Bool -> f (Maybe Bool))
-> StartProjectSession -> f StartProjectSession
startProjectSession_assumeControl = (StartProjectSession -> Maybe Bool)
-> (StartProjectSession -> Maybe Bool -> StartProjectSession)
-> Lens
StartProjectSession StartProjectSession (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartProjectSession' {Maybe Bool
assumeControl :: Maybe Bool
$sel:assumeControl:StartProjectSession' :: StartProjectSession -> Maybe Bool
assumeControl} -> Maybe Bool
assumeControl) (\s :: StartProjectSession
s@StartProjectSession' {} Maybe Bool
a -> StartProjectSession
s {$sel:assumeControl:StartProjectSession' :: Maybe Bool
assumeControl = Maybe Bool
a} :: StartProjectSession)
startProjectSession_name :: Lens.Lens' StartProjectSession Prelude.Text
startProjectSession_name :: (Text -> f Text) -> StartProjectSession -> f StartProjectSession
startProjectSession_name = (StartProjectSession -> Text)
-> (StartProjectSession -> Text -> StartProjectSession)
-> Lens StartProjectSession StartProjectSession Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartProjectSession' {Text
name :: Text
$sel:name:StartProjectSession' :: StartProjectSession -> Text
name} -> Text
name) (\s :: StartProjectSession
s@StartProjectSession' {} Text
a -> StartProjectSession
s {$sel:name:StartProjectSession' :: Text
name = Text
a} :: StartProjectSession)
instance Core.AWSRequest StartProjectSession where
type
AWSResponse StartProjectSession =
StartProjectSessionResponse
request :: StartProjectSession -> Request StartProjectSession
request = Service -> StartProjectSession -> Request StartProjectSession
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy StartProjectSession
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse StartProjectSession)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse StartProjectSession))
-> Logger
-> Service
-> Proxy StartProjectSession
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse StartProjectSession)))
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 -> Text -> StartProjectSessionResponse
StartProjectSessionResponse'
(Maybe Text -> Int -> Text -> StartProjectSessionResponse)
-> Either String (Maybe Text)
-> Either String (Int -> Text -> StartProjectSessionResponse)
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
"ClientSessionId")
Either String (Int -> Text -> StartProjectSessionResponse)
-> Either String Int
-> Either String (Text -> StartProjectSessionResponse)
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))
Either String (Text -> StartProjectSessionResponse)
-> Either String Text -> Either String StartProjectSessionResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Text
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"Name")
)
instance Prelude.Hashable StartProjectSession
instance Prelude.NFData StartProjectSession
instance Core.ToHeaders StartProjectSession where
toHeaders :: StartProjectSession -> ResponseHeaders
toHeaders =
ResponseHeaders -> StartProjectSession -> 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 StartProjectSession where
toJSON :: StartProjectSession -> Value
toJSON StartProjectSession' {Maybe Bool
Text
name :: Text
assumeControl :: Maybe Bool
$sel:name:StartProjectSession' :: StartProjectSession -> Text
$sel:assumeControl:StartProjectSession' :: StartProjectSession -> Maybe Bool
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"AssumeControl" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
assumeControl
]
)
instance Core.ToPath StartProjectSession where
toPath :: StartProjectSession -> ByteString
toPath StartProjectSession' {Maybe Bool
Text
name :: Text
assumeControl :: Maybe Bool
$sel:name:StartProjectSession' :: StartProjectSession -> Text
$sel:assumeControl:StartProjectSession' :: StartProjectSession -> Maybe Bool
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/projects/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
name,
ByteString
"/startProjectSession"
]
instance Core.ToQuery StartProjectSession where
toQuery :: StartProjectSession -> QueryString
toQuery = QueryString -> StartProjectSession -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data StartProjectSessionResponse = StartProjectSessionResponse'
{
StartProjectSessionResponse -> Maybe Text
clientSessionId :: Prelude.Maybe Prelude.Text,
StartProjectSessionResponse -> Int
httpStatus :: Prelude.Int,
StartProjectSessionResponse -> Text
name :: Prelude.Text
}
deriving (StartProjectSessionResponse -> StartProjectSessionResponse -> Bool
(StartProjectSessionResponse
-> StartProjectSessionResponse -> Bool)
-> (StartProjectSessionResponse
-> StartProjectSessionResponse -> Bool)
-> Eq StartProjectSessionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartProjectSessionResponse -> StartProjectSessionResponse -> Bool
$c/= :: StartProjectSessionResponse -> StartProjectSessionResponse -> Bool
== :: StartProjectSessionResponse -> StartProjectSessionResponse -> Bool
$c== :: StartProjectSessionResponse -> StartProjectSessionResponse -> Bool
Prelude.Eq, ReadPrec [StartProjectSessionResponse]
ReadPrec StartProjectSessionResponse
Int -> ReadS StartProjectSessionResponse
ReadS [StartProjectSessionResponse]
(Int -> ReadS StartProjectSessionResponse)
-> ReadS [StartProjectSessionResponse]
-> ReadPrec StartProjectSessionResponse
-> ReadPrec [StartProjectSessionResponse]
-> Read StartProjectSessionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartProjectSessionResponse]
$creadListPrec :: ReadPrec [StartProjectSessionResponse]
readPrec :: ReadPrec StartProjectSessionResponse
$creadPrec :: ReadPrec StartProjectSessionResponse
readList :: ReadS [StartProjectSessionResponse]
$creadList :: ReadS [StartProjectSessionResponse]
readsPrec :: Int -> ReadS StartProjectSessionResponse
$creadsPrec :: Int -> ReadS StartProjectSessionResponse
Prelude.Read, Int -> StartProjectSessionResponse -> ShowS
[StartProjectSessionResponse] -> ShowS
StartProjectSessionResponse -> String
(Int -> StartProjectSessionResponse -> ShowS)
-> (StartProjectSessionResponse -> String)
-> ([StartProjectSessionResponse] -> ShowS)
-> Show StartProjectSessionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartProjectSessionResponse] -> ShowS
$cshowList :: [StartProjectSessionResponse] -> ShowS
show :: StartProjectSessionResponse -> String
$cshow :: StartProjectSessionResponse -> String
showsPrec :: Int -> StartProjectSessionResponse -> ShowS
$cshowsPrec :: Int -> StartProjectSessionResponse -> ShowS
Prelude.Show, (forall x.
StartProjectSessionResponse -> Rep StartProjectSessionResponse x)
-> (forall x.
Rep StartProjectSessionResponse x -> StartProjectSessionResponse)
-> Generic StartProjectSessionResponse
forall x.
Rep StartProjectSessionResponse x -> StartProjectSessionResponse
forall x.
StartProjectSessionResponse -> Rep StartProjectSessionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StartProjectSessionResponse x -> StartProjectSessionResponse
$cfrom :: forall x.
StartProjectSessionResponse -> Rep StartProjectSessionResponse x
Prelude.Generic)
newStartProjectSessionResponse ::
Prelude.Int ->
Prelude.Text ->
StartProjectSessionResponse
newStartProjectSessionResponse :: Int -> Text -> StartProjectSessionResponse
newStartProjectSessionResponse Int
pHttpStatus_ Text
pName_ =
StartProjectSessionResponse' :: Maybe Text -> Int -> Text -> StartProjectSessionResponse
StartProjectSessionResponse'
{ $sel:clientSessionId:StartProjectSessionResponse' :: Maybe Text
clientSessionId =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:StartProjectSessionResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:name:StartProjectSessionResponse' :: Text
name = Text
pName_
}
startProjectSessionResponse_clientSessionId :: Lens.Lens' StartProjectSessionResponse (Prelude.Maybe Prelude.Text)
startProjectSessionResponse_clientSessionId :: (Maybe Text -> f (Maybe Text))
-> StartProjectSessionResponse -> f StartProjectSessionResponse
startProjectSessionResponse_clientSessionId = (StartProjectSessionResponse -> Maybe Text)
-> (StartProjectSessionResponse
-> Maybe Text -> StartProjectSessionResponse)
-> Lens
StartProjectSessionResponse
StartProjectSessionResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartProjectSessionResponse' {Maybe Text
clientSessionId :: Maybe Text
$sel:clientSessionId:StartProjectSessionResponse' :: StartProjectSessionResponse -> Maybe Text
clientSessionId} -> Maybe Text
clientSessionId) (\s :: StartProjectSessionResponse
s@StartProjectSessionResponse' {} Maybe Text
a -> StartProjectSessionResponse
s {$sel:clientSessionId:StartProjectSessionResponse' :: Maybe Text
clientSessionId = Maybe Text
a} :: StartProjectSessionResponse)
startProjectSessionResponse_httpStatus :: Lens.Lens' StartProjectSessionResponse Prelude.Int
startProjectSessionResponse_httpStatus :: (Int -> f Int)
-> StartProjectSessionResponse -> f StartProjectSessionResponse
startProjectSessionResponse_httpStatus = (StartProjectSessionResponse -> Int)
-> (StartProjectSessionResponse
-> Int -> StartProjectSessionResponse)
-> Lens
StartProjectSessionResponse StartProjectSessionResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartProjectSessionResponse' {Int
httpStatus :: Int
$sel:httpStatus:StartProjectSessionResponse' :: StartProjectSessionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: StartProjectSessionResponse
s@StartProjectSessionResponse' {} Int
a -> StartProjectSessionResponse
s {$sel:httpStatus:StartProjectSessionResponse' :: Int
httpStatus = Int
a} :: StartProjectSessionResponse)
startProjectSessionResponse_name :: Lens.Lens' StartProjectSessionResponse Prelude.Text
startProjectSessionResponse_name :: (Text -> f Text)
-> StartProjectSessionResponse -> f StartProjectSessionResponse
startProjectSessionResponse_name = (StartProjectSessionResponse -> Text)
-> (StartProjectSessionResponse
-> Text -> StartProjectSessionResponse)
-> Lens
StartProjectSessionResponse StartProjectSessionResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartProjectSessionResponse' {Text
name :: Text
$sel:name:StartProjectSessionResponse' :: StartProjectSessionResponse -> Text
name} -> Text
name) (\s :: StartProjectSessionResponse
s@StartProjectSessionResponse' {} Text
a -> StartProjectSessionResponse
s {$sel:name:StartProjectSessionResponse' :: Text
name = Text
a} :: StartProjectSessionResponse)
instance Prelude.NFData StartProjectSessionResponse