{-# 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.Nimble.AcceptEulas
(
AcceptEulas (..),
newAcceptEulas,
acceptEulas_clientToken,
acceptEulas_eulaIds,
acceptEulas_studioId,
AcceptEulasResponse (..),
newAcceptEulasResponse,
acceptEulasResponse_eulaAcceptances,
acceptEulasResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Nimble.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data AcceptEulas = AcceptEulas'
{
AcceptEulas -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
AcceptEulas -> Maybe [Text]
eulaIds :: Prelude.Maybe [Prelude.Text],
AcceptEulas -> Text
studioId :: Prelude.Text
}
deriving (AcceptEulas -> AcceptEulas -> Bool
(AcceptEulas -> AcceptEulas -> Bool)
-> (AcceptEulas -> AcceptEulas -> Bool) -> Eq AcceptEulas
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AcceptEulas -> AcceptEulas -> Bool
$c/= :: AcceptEulas -> AcceptEulas -> Bool
== :: AcceptEulas -> AcceptEulas -> Bool
$c== :: AcceptEulas -> AcceptEulas -> Bool
Prelude.Eq, ReadPrec [AcceptEulas]
ReadPrec AcceptEulas
Int -> ReadS AcceptEulas
ReadS [AcceptEulas]
(Int -> ReadS AcceptEulas)
-> ReadS [AcceptEulas]
-> ReadPrec AcceptEulas
-> ReadPrec [AcceptEulas]
-> Read AcceptEulas
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AcceptEulas]
$creadListPrec :: ReadPrec [AcceptEulas]
readPrec :: ReadPrec AcceptEulas
$creadPrec :: ReadPrec AcceptEulas
readList :: ReadS [AcceptEulas]
$creadList :: ReadS [AcceptEulas]
readsPrec :: Int -> ReadS AcceptEulas
$creadsPrec :: Int -> ReadS AcceptEulas
Prelude.Read, Int -> AcceptEulas -> ShowS
[AcceptEulas] -> ShowS
AcceptEulas -> String
(Int -> AcceptEulas -> ShowS)
-> (AcceptEulas -> String)
-> ([AcceptEulas] -> ShowS)
-> Show AcceptEulas
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AcceptEulas] -> ShowS
$cshowList :: [AcceptEulas] -> ShowS
show :: AcceptEulas -> String
$cshow :: AcceptEulas -> String
showsPrec :: Int -> AcceptEulas -> ShowS
$cshowsPrec :: Int -> AcceptEulas -> ShowS
Prelude.Show, (forall x. AcceptEulas -> Rep AcceptEulas x)
-> (forall x. Rep AcceptEulas x -> AcceptEulas)
-> Generic AcceptEulas
forall x. Rep AcceptEulas x -> AcceptEulas
forall x. AcceptEulas -> Rep AcceptEulas x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AcceptEulas x -> AcceptEulas
$cfrom :: forall x. AcceptEulas -> Rep AcceptEulas x
Prelude.Generic)
newAcceptEulas ::
Prelude.Text ->
AcceptEulas
newAcceptEulas :: Text -> AcceptEulas
newAcceptEulas Text
pStudioId_ =
AcceptEulas' :: Maybe Text -> Maybe [Text] -> Text -> AcceptEulas
AcceptEulas'
{ $sel:clientToken:AcceptEulas' :: Maybe Text
clientToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:eulaIds:AcceptEulas' :: Maybe [Text]
eulaIds = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
$sel:studioId:AcceptEulas' :: Text
studioId = Text
pStudioId_
}
acceptEulas_clientToken :: Lens.Lens' AcceptEulas (Prelude.Maybe Prelude.Text)
acceptEulas_clientToken :: (Maybe Text -> f (Maybe Text)) -> AcceptEulas -> f AcceptEulas
acceptEulas_clientToken = (AcceptEulas -> Maybe Text)
-> (AcceptEulas -> Maybe Text -> AcceptEulas)
-> Lens AcceptEulas AcceptEulas (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AcceptEulas' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:AcceptEulas' :: AcceptEulas -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: AcceptEulas
s@AcceptEulas' {} Maybe Text
a -> AcceptEulas
s {$sel:clientToken:AcceptEulas' :: Maybe Text
clientToken = Maybe Text
a} :: AcceptEulas)
acceptEulas_eulaIds :: Lens.Lens' AcceptEulas (Prelude.Maybe [Prelude.Text])
acceptEulas_eulaIds :: (Maybe [Text] -> f (Maybe [Text])) -> AcceptEulas -> f AcceptEulas
acceptEulas_eulaIds = (AcceptEulas -> Maybe [Text])
-> (AcceptEulas -> Maybe [Text] -> AcceptEulas)
-> Lens AcceptEulas AcceptEulas (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AcceptEulas' {Maybe [Text]
eulaIds :: Maybe [Text]
$sel:eulaIds:AcceptEulas' :: AcceptEulas -> Maybe [Text]
eulaIds} -> Maybe [Text]
eulaIds) (\s :: AcceptEulas
s@AcceptEulas' {} Maybe [Text]
a -> AcceptEulas
s {$sel:eulaIds:AcceptEulas' :: Maybe [Text]
eulaIds = Maybe [Text]
a} :: AcceptEulas) ((Maybe [Text] -> f (Maybe [Text]))
-> AcceptEulas -> f AcceptEulas)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> AcceptEulas
-> f AcceptEulas
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
acceptEulas_studioId :: Lens.Lens' AcceptEulas Prelude.Text
acceptEulas_studioId :: (Text -> f Text) -> AcceptEulas -> f AcceptEulas
acceptEulas_studioId = (AcceptEulas -> Text)
-> (AcceptEulas -> Text -> AcceptEulas)
-> Lens AcceptEulas AcceptEulas Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AcceptEulas' {Text
studioId :: Text
$sel:studioId:AcceptEulas' :: AcceptEulas -> Text
studioId} -> Text
studioId) (\s :: AcceptEulas
s@AcceptEulas' {} Text
a -> AcceptEulas
s {$sel:studioId:AcceptEulas' :: Text
studioId = Text
a} :: AcceptEulas)
instance Core.AWSRequest AcceptEulas where
type AWSResponse AcceptEulas = AcceptEulasResponse
request :: AcceptEulas -> Request AcceptEulas
request = Service -> AcceptEulas -> Request AcceptEulas
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy AcceptEulas
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse AcceptEulas)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse AcceptEulas))
-> Logger
-> Service
-> Proxy AcceptEulas
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse AcceptEulas)))
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 [EulaAcceptance] -> Int -> AcceptEulasResponse
AcceptEulasResponse'
(Maybe [EulaAcceptance] -> Int -> AcceptEulasResponse)
-> Either String (Maybe [EulaAcceptance])
-> Either String (Int -> AcceptEulasResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Either String (Maybe (Maybe [EulaAcceptance]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"eulaAcceptances"
Either String (Maybe (Maybe [EulaAcceptance]))
-> Maybe [EulaAcceptance] -> Either String (Maybe [EulaAcceptance])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [EulaAcceptance]
forall a. Monoid a => a
Prelude.mempty
)
Either String (Int -> AcceptEulasResponse)
-> Either String Int -> Either String AcceptEulasResponse
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 AcceptEulas
instance Prelude.NFData AcceptEulas
instance Core.ToHeaders AcceptEulas where
toHeaders :: AcceptEulas -> ResponseHeaders
toHeaders AcceptEulas' {Maybe [Text]
Maybe Text
Text
studioId :: Text
eulaIds :: Maybe [Text]
clientToken :: Maybe Text
$sel:studioId:AcceptEulas' :: AcceptEulas -> Text
$sel:eulaIds:AcceptEulas' :: AcceptEulas -> Maybe [Text]
$sel:clientToken:AcceptEulas' :: AcceptEulas -> Maybe Text
..} =
[ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-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 AcceptEulas where
toJSON :: AcceptEulas -> Value
toJSON AcceptEulas' {Maybe [Text]
Maybe Text
Text
studioId :: Text
eulaIds :: Maybe [Text]
clientToken :: Maybe Text
$sel:studioId:AcceptEulas' :: AcceptEulas -> Text
$sel:eulaIds:AcceptEulas' :: AcceptEulas -> Maybe [Text]
$sel:clientToken:AcceptEulas' :: AcceptEulas -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[(Text
"eulaIds" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Text] -> Pair) -> Maybe [Text] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
eulaIds]
)
instance Core.ToPath AcceptEulas where
toPath :: AcceptEulas -> ByteString
toPath AcceptEulas' {Maybe [Text]
Maybe Text
Text
studioId :: Text
eulaIds :: Maybe [Text]
clientToken :: Maybe Text
$sel:studioId:AcceptEulas' :: AcceptEulas -> Text
$sel:eulaIds:AcceptEulas' :: AcceptEulas -> Maybe [Text]
$sel:clientToken:AcceptEulas' :: AcceptEulas -> Maybe Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/2020-08-01/studios/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
studioId,
ByteString
"/eula-acceptances"
]
instance Core.ToQuery AcceptEulas where
toQuery :: AcceptEulas -> QueryString
toQuery = QueryString -> AcceptEulas -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data AcceptEulasResponse = AcceptEulasResponse'
{
AcceptEulasResponse -> Maybe [EulaAcceptance]
eulaAcceptances :: Prelude.Maybe [EulaAcceptance],
AcceptEulasResponse -> Int
httpStatus :: Prelude.Int
}
deriving (AcceptEulasResponse -> AcceptEulasResponse -> Bool
(AcceptEulasResponse -> AcceptEulasResponse -> Bool)
-> (AcceptEulasResponse -> AcceptEulasResponse -> Bool)
-> Eq AcceptEulasResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AcceptEulasResponse -> AcceptEulasResponse -> Bool
$c/= :: AcceptEulasResponse -> AcceptEulasResponse -> Bool
== :: AcceptEulasResponse -> AcceptEulasResponse -> Bool
$c== :: AcceptEulasResponse -> AcceptEulasResponse -> Bool
Prelude.Eq, ReadPrec [AcceptEulasResponse]
ReadPrec AcceptEulasResponse
Int -> ReadS AcceptEulasResponse
ReadS [AcceptEulasResponse]
(Int -> ReadS AcceptEulasResponse)
-> ReadS [AcceptEulasResponse]
-> ReadPrec AcceptEulasResponse
-> ReadPrec [AcceptEulasResponse]
-> Read AcceptEulasResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AcceptEulasResponse]
$creadListPrec :: ReadPrec [AcceptEulasResponse]
readPrec :: ReadPrec AcceptEulasResponse
$creadPrec :: ReadPrec AcceptEulasResponse
readList :: ReadS [AcceptEulasResponse]
$creadList :: ReadS [AcceptEulasResponse]
readsPrec :: Int -> ReadS AcceptEulasResponse
$creadsPrec :: Int -> ReadS AcceptEulasResponse
Prelude.Read, Int -> AcceptEulasResponse -> ShowS
[AcceptEulasResponse] -> ShowS
AcceptEulasResponse -> String
(Int -> AcceptEulasResponse -> ShowS)
-> (AcceptEulasResponse -> String)
-> ([AcceptEulasResponse] -> ShowS)
-> Show AcceptEulasResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AcceptEulasResponse] -> ShowS
$cshowList :: [AcceptEulasResponse] -> ShowS
show :: AcceptEulasResponse -> String
$cshow :: AcceptEulasResponse -> String
showsPrec :: Int -> AcceptEulasResponse -> ShowS
$cshowsPrec :: Int -> AcceptEulasResponse -> ShowS
Prelude.Show, (forall x. AcceptEulasResponse -> Rep AcceptEulasResponse x)
-> (forall x. Rep AcceptEulasResponse x -> AcceptEulasResponse)
-> Generic AcceptEulasResponse
forall x. Rep AcceptEulasResponse x -> AcceptEulasResponse
forall x. AcceptEulasResponse -> Rep AcceptEulasResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AcceptEulasResponse x -> AcceptEulasResponse
$cfrom :: forall x. AcceptEulasResponse -> Rep AcceptEulasResponse x
Prelude.Generic)
newAcceptEulasResponse ::
Prelude.Int ->
AcceptEulasResponse
newAcceptEulasResponse :: Int -> AcceptEulasResponse
newAcceptEulasResponse Int
pHttpStatus_ =
AcceptEulasResponse' :: Maybe [EulaAcceptance] -> Int -> AcceptEulasResponse
AcceptEulasResponse'
{ $sel:eulaAcceptances:AcceptEulasResponse' :: Maybe [EulaAcceptance]
eulaAcceptances =
Maybe [EulaAcceptance]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:AcceptEulasResponse' :: Int
httpStatus = Int
pHttpStatus_
}
acceptEulasResponse_eulaAcceptances :: Lens.Lens' AcceptEulasResponse (Prelude.Maybe [EulaAcceptance])
acceptEulasResponse_eulaAcceptances :: (Maybe [EulaAcceptance] -> f (Maybe [EulaAcceptance]))
-> AcceptEulasResponse -> f AcceptEulasResponse
acceptEulasResponse_eulaAcceptances = (AcceptEulasResponse -> Maybe [EulaAcceptance])
-> (AcceptEulasResponse
-> Maybe [EulaAcceptance] -> AcceptEulasResponse)
-> Lens
AcceptEulasResponse
AcceptEulasResponse
(Maybe [EulaAcceptance])
(Maybe [EulaAcceptance])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AcceptEulasResponse' {Maybe [EulaAcceptance]
eulaAcceptances :: Maybe [EulaAcceptance]
$sel:eulaAcceptances:AcceptEulasResponse' :: AcceptEulasResponse -> Maybe [EulaAcceptance]
eulaAcceptances} -> Maybe [EulaAcceptance]
eulaAcceptances) (\s :: AcceptEulasResponse
s@AcceptEulasResponse' {} Maybe [EulaAcceptance]
a -> AcceptEulasResponse
s {$sel:eulaAcceptances:AcceptEulasResponse' :: Maybe [EulaAcceptance]
eulaAcceptances = Maybe [EulaAcceptance]
a} :: AcceptEulasResponse) ((Maybe [EulaAcceptance] -> f (Maybe [EulaAcceptance]))
-> AcceptEulasResponse -> f AcceptEulasResponse)
-> ((Maybe [EulaAcceptance] -> f (Maybe [EulaAcceptance]))
-> Maybe [EulaAcceptance] -> f (Maybe [EulaAcceptance]))
-> (Maybe [EulaAcceptance] -> f (Maybe [EulaAcceptance]))
-> AcceptEulasResponse
-> f AcceptEulasResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[EulaAcceptance] [EulaAcceptance] [EulaAcceptance] [EulaAcceptance]
-> Iso
(Maybe [EulaAcceptance])
(Maybe [EulaAcceptance])
(Maybe [EulaAcceptance])
(Maybe [EulaAcceptance])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
[EulaAcceptance] [EulaAcceptance] [EulaAcceptance] [EulaAcceptance]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
acceptEulasResponse_httpStatus :: Lens.Lens' AcceptEulasResponse Prelude.Int
acceptEulasResponse_httpStatus :: (Int -> f Int) -> AcceptEulasResponse -> f AcceptEulasResponse
acceptEulasResponse_httpStatus = (AcceptEulasResponse -> Int)
-> (AcceptEulasResponse -> Int -> AcceptEulasResponse)
-> Lens AcceptEulasResponse AcceptEulasResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AcceptEulasResponse' {Int
httpStatus :: Int
$sel:httpStatus:AcceptEulasResponse' :: AcceptEulasResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AcceptEulasResponse
s@AcceptEulasResponse' {} Int
a -> AcceptEulasResponse
s {$sel:httpStatus:AcceptEulasResponse' :: Int
httpStatus = Int
a} :: AcceptEulasResponse)
instance Prelude.NFData AcceptEulasResponse