{-# 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.CognitoIdentityProvider.UpdateResourceServer
(
UpdateResourceServer (..),
newUpdateResourceServer,
updateResourceServer_scopes,
updateResourceServer_userPoolId,
updateResourceServer_identifier,
updateResourceServer_name,
UpdateResourceServerResponse (..),
newUpdateResourceServerResponse,
updateResourceServerResponse_httpStatus,
updateResourceServerResponse_resourceServer,
)
where
import Amazonka.CognitoIdentityProvider.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data UpdateResourceServer = UpdateResourceServer'
{
UpdateResourceServer -> Maybe [ResourceServerScopeType]
scopes :: Prelude.Maybe [ResourceServerScopeType],
UpdateResourceServer -> Text
userPoolId :: Prelude.Text,
UpdateResourceServer -> Text
identifier :: Prelude.Text,
UpdateResourceServer -> Text
name :: Prelude.Text
}
deriving (UpdateResourceServer -> UpdateResourceServer -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateResourceServer -> UpdateResourceServer -> Bool
$c/= :: UpdateResourceServer -> UpdateResourceServer -> Bool
== :: UpdateResourceServer -> UpdateResourceServer -> Bool
$c== :: UpdateResourceServer -> UpdateResourceServer -> Bool
Prelude.Eq, ReadPrec [UpdateResourceServer]
ReadPrec UpdateResourceServer
Int -> ReadS UpdateResourceServer
ReadS [UpdateResourceServer]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateResourceServer]
$creadListPrec :: ReadPrec [UpdateResourceServer]
readPrec :: ReadPrec UpdateResourceServer
$creadPrec :: ReadPrec UpdateResourceServer
readList :: ReadS [UpdateResourceServer]
$creadList :: ReadS [UpdateResourceServer]
readsPrec :: Int -> ReadS UpdateResourceServer
$creadsPrec :: Int -> ReadS UpdateResourceServer
Prelude.Read, Int -> UpdateResourceServer -> ShowS
[UpdateResourceServer] -> ShowS
UpdateResourceServer -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateResourceServer] -> ShowS
$cshowList :: [UpdateResourceServer] -> ShowS
show :: UpdateResourceServer -> String
$cshow :: UpdateResourceServer -> String
showsPrec :: Int -> UpdateResourceServer -> ShowS
$cshowsPrec :: Int -> UpdateResourceServer -> ShowS
Prelude.Show, forall x. Rep UpdateResourceServer x -> UpdateResourceServer
forall x. UpdateResourceServer -> Rep UpdateResourceServer x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateResourceServer x -> UpdateResourceServer
$cfrom :: forall x. UpdateResourceServer -> Rep UpdateResourceServer x
Prelude.Generic)
newUpdateResourceServer ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
UpdateResourceServer
newUpdateResourceServer :: Text -> Text -> Text -> UpdateResourceServer
newUpdateResourceServer
Text
pUserPoolId_
Text
pIdentifier_
Text
pName_ =
UpdateResourceServer'
{ $sel:scopes:UpdateResourceServer' :: Maybe [ResourceServerScopeType]
scopes = forall a. Maybe a
Prelude.Nothing,
$sel:userPoolId:UpdateResourceServer' :: Text
userPoolId = Text
pUserPoolId_,
$sel:identifier:UpdateResourceServer' :: Text
identifier = Text
pIdentifier_,
$sel:name:UpdateResourceServer' :: Text
name = Text
pName_
}
updateResourceServer_scopes :: Lens.Lens' UpdateResourceServer (Prelude.Maybe [ResourceServerScopeType])
updateResourceServer_scopes :: Lens' UpdateResourceServer (Maybe [ResourceServerScopeType])
updateResourceServer_scopes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateResourceServer' {Maybe [ResourceServerScopeType]
scopes :: Maybe [ResourceServerScopeType]
$sel:scopes:UpdateResourceServer' :: UpdateResourceServer -> Maybe [ResourceServerScopeType]
scopes} -> Maybe [ResourceServerScopeType]
scopes) (\s :: UpdateResourceServer
s@UpdateResourceServer' {} Maybe [ResourceServerScopeType]
a -> UpdateResourceServer
s {$sel:scopes:UpdateResourceServer' :: Maybe [ResourceServerScopeType]
scopes = Maybe [ResourceServerScopeType]
a} :: UpdateResourceServer) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
updateResourceServer_userPoolId :: Lens.Lens' UpdateResourceServer Prelude.Text
updateResourceServer_userPoolId :: Lens' UpdateResourceServer Text
updateResourceServer_userPoolId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateResourceServer' {Text
userPoolId :: Text
$sel:userPoolId:UpdateResourceServer' :: UpdateResourceServer -> Text
userPoolId} -> Text
userPoolId) (\s :: UpdateResourceServer
s@UpdateResourceServer' {} Text
a -> UpdateResourceServer
s {$sel:userPoolId:UpdateResourceServer' :: Text
userPoolId = Text
a} :: UpdateResourceServer)
updateResourceServer_identifier :: Lens.Lens' UpdateResourceServer Prelude.Text
updateResourceServer_identifier :: Lens' UpdateResourceServer Text
updateResourceServer_identifier = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateResourceServer' {Text
identifier :: Text
$sel:identifier:UpdateResourceServer' :: UpdateResourceServer -> Text
identifier} -> Text
identifier) (\s :: UpdateResourceServer
s@UpdateResourceServer' {} Text
a -> UpdateResourceServer
s {$sel:identifier:UpdateResourceServer' :: Text
identifier = Text
a} :: UpdateResourceServer)
updateResourceServer_name :: Lens.Lens' UpdateResourceServer Prelude.Text
updateResourceServer_name :: Lens' UpdateResourceServer Text
updateResourceServer_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateResourceServer' {Text
name :: Text
$sel:name:UpdateResourceServer' :: UpdateResourceServer -> Text
name} -> Text
name) (\s :: UpdateResourceServer
s@UpdateResourceServer' {} Text
a -> UpdateResourceServer
s {$sel:name:UpdateResourceServer' :: Text
name = Text
a} :: UpdateResourceServer)
instance Core.AWSRequest UpdateResourceServer where
type
AWSResponse UpdateResourceServer =
UpdateResourceServerResponse
request :: (Service -> Service)
-> UpdateResourceServer -> Request UpdateResourceServer
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy UpdateResourceServer
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateResourceServer)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Int -> ResourceServerType -> UpdateResourceServerResponse
UpdateResourceServerResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"ResourceServer")
)
instance Prelude.Hashable UpdateResourceServer where
hashWithSalt :: Int -> UpdateResourceServer -> Int
hashWithSalt Int
_salt UpdateResourceServer' {Maybe [ResourceServerScopeType]
Text
name :: Text
identifier :: Text
userPoolId :: Text
scopes :: Maybe [ResourceServerScopeType]
$sel:name:UpdateResourceServer' :: UpdateResourceServer -> Text
$sel:identifier:UpdateResourceServer' :: UpdateResourceServer -> Text
$sel:userPoolId:UpdateResourceServer' :: UpdateResourceServer -> Text
$sel:scopes:UpdateResourceServer' :: UpdateResourceServer -> Maybe [ResourceServerScopeType]
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [ResourceServerScopeType]
scopes
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
userPoolId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
identifier
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
instance Prelude.NFData UpdateResourceServer where
rnf :: UpdateResourceServer -> ()
rnf UpdateResourceServer' {Maybe [ResourceServerScopeType]
Text
name :: Text
identifier :: Text
userPoolId :: Text
scopes :: Maybe [ResourceServerScopeType]
$sel:name:UpdateResourceServer' :: UpdateResourceServer -> Text
$sel:identifier:UpdateResourceServer' :: UpdateResourceServer -> Text
$sel:userPoolId:UpdateResourceServer' :: UpdateResourceServer -> Text
$sel:scopes:UpdateResourceServer' :: UpdateResourceServer -> Maybe [ResourceServerScopeType]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [ResourceServerScopeType]
scopes
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
userPoolId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
identifier
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
instance Data.ToHeaders UpdateResourceServer where
toHeaders :: UpdateResourceServer -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"AWSCognitoIdentityProviderService.UpdateResourceServer" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON UpdateResourceServer where
toJSON :: UpdateResourceServer -> Value
toJSON UpdateResourceServer' {Maybe [ResourceServerScopeType]
Text
name :: Text
identifier :: Text
userPoolId :: Text
scopes :: Maybe [ResourceServerScopeType]
$sel:name:UpdateResourceServer' :: UpdateResourceServer -> Text
$sel:identifier:UpdateResourceServer' :: UpdateResourceServer -> Text
$sel:userPoolId:UpdateResourceServer' :: UpdateResourceServer -> Text
$sel:scopes:UpdateResourceServer' :: UpdateResourceServer -> Maybe [ResourceServerScopeType]
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"Scopes" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [ResourceServerScopeType]
scopes,
forall a. a -> Maybe a
Prelude.Just (Key
"UserPoolId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
userPoolId),
forall a. a -> Maybe a
Prelude.Just (Key
"Identifier" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
identifier),
forall a. a -> Maybe a
Prelude.Just (Key
"Name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name)
]
)
instance Data.ToPath UpdateResourceServer where
toPath :: UpdateResourceServer -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery UpdateResourceServer where
toQuery :: UpdateResourceServer -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data UpdateResourceServerResponse = UpdateResourceServerResponse'
{
UpdateResourceServerResponse -> Int
httpStatus :: Prelude.Int,
UpdateResourceServerResponse -> ResourceServerType
resourceServer :: ResourceServerType
}
deriving (UpdateResourceServerResponse
-> UpdateResourceServerResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateResourceServerResponse
-> UpdateResourceServerResponse -> Bool
$c/= :: UpdateResourceServerResponse
-> UpdateResourceServerResponse -> Bool
== :: UpdateResourceServerResponse
-> UpdateResourceServerResponse -> Bool
$c== :: UpdateResourceServerResponse
-> UpdateResourceServerResponse -> Bool
Prelude.Eq, ReadPrec [UpdateResourceServerResponse]
ReadPrec UpdateResourceServerResponse
Int -> ReadS UpdateResourceServerResponse
ReadS [UpdateResourceServerResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateResourceServerResponse]
$creadListPrec :: ReadPrec [UpdateResourceServerResponse]
readPrec :: ReadPrec UpdateResourceServerResponse
$creadPrec :: ReadPrec UpdateResourceServerResponse
readList :: ReadS [UpdateResourceServerResponse]
$creadList :: ReadS [UpdateResourceServerResponse]
readsPrec :: Int -> ReadS UpdateResourceServerResponse
$creadsPrec :: Int -> ReadS UpdateResourceServerResponse
Prelude.Read, Int -> UpdateResourceServerResponse -> ShowS
[UpdateResourceServerResponse] -> ShowS
UpdateResourceServerResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateResourceServerResponse] -> ShowS
$cshowList :: [UpdateResourceServerResponse] -> ShowS
show :: UpdateResourceServerResponse -> String
$cshow :: UpdateResourceServerResponse -> String
showsPrec :: Int -> UpdateResourceServerResponse -> ShowS
$cshowsPrec :: Int -> UpdateResourceServerResponse -> ShowS
Prelude.Show, forall x.
Rep UpdateResourceServerResponse x -> UpdateResourceServerResponse
forall x.
UpdateResourceServerResponse -> Rep UpdateResourceServerResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateResourceServerResponse x -> UpdateResourceServerResponse
$cfrom :: forall x.
UpdateResourceServerResponse -> Rep UpdateResourceServerResponse x
Prelude.Generic)
newUpdateResourceServerResponse ::
Prelude.Int ->
ResourceServerType ->
UpdateResourceServerResponse
newUpdateResourceServerResponse :: Int -> ResourceServerType -> UpdateResourceServerResponse
newUpdateResourceServerResponse
Int
pHttpStatus_
ResourceServerType
pResourceServer_ =
UpdateResourceServerResponse'
{ $sel:httpStatus:UpdateResourceServerResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:resourceServer:UpdateResourceServerResponse' :: ResourceServerType
resourceServer = ResourceServerType
pResourceServer_
}
updateResourceServerResponse_httpStatus :: Lens.Lens' UpdateResourceServerResponse Prelude.Int
updateResourceServerResponse_httpStatus :: Lens' UpdateResourceServerResponse Int
updateResourceServerResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateResourceServerResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateResourceServerResponse' :: UpdateResourceServerResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateResourceServerResponse
s@UpdateResourceServerResponse' {} Int
a -> UpdateResourceServerResponse
s {$sel:httpStatus:UpdateResourceServerResponse' :: Int
httpStatus = Int
a} :: UpdateResourceServerResponse)
updateResourceServerResponse_resourceServer :: Lens.Lens' UpdateResourceServerResponse ResourceServerType
updateResourceServerResponse_resourceServer :: Lens' UpdateResourceServerResponse ResourceServerType
updateResourceServerResponse_resourceServer = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateResourceServerResponse' {ResourceServerType
resourceServer :: ResourceServerType
$sel:resourceServer:UpdateResourceServerResponse' :: UpdateResourceServerResponse -> ResourceServerType
resourceServer} -> ResourceServerType
resourceServer) (\s :: UpdateResourceServerResponse
s@UpdateResourceServerResponse' {} ResourceServerType
a -> UpdateResourceServerResponse
s {$sel:resourceServer:UpdateResourceServerResponse' :: ResourceServerType
resourceServer = ResourceServerType
a} :: UpdateResourceServerResponse)
instance Prelude.NFData UpdateResourceServerResponse where
rnf :: UpdateResourceServerResponse -> ()
rnf UpdateResourceServerResponse' {Int
ResourceServerType
resourceServer :: ResourceServerType
httpStatus :: Int
$sel:resourceServer:UpdateResourceServerResponse' :: UpdateResourceServerResponse -> ResourceServerType
$sel:httpStatus:UpdateResourceServerResponse' :: UpdateResourceServerResponse -> Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ResourceServerType
resourceServer