{-# 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.Lens as Lens
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
(UpdateResourceServer -> UpdateResourceServer -> Bool)
-> (UpdateResourceServer -> UpdateResourceServer -> Bool)
-> Eq UpdateResourceServer
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]
(Int -> ReadS UpdateResourceServer)
-> ReadS [UpdateResourceServer]
-> ReadPrec UpdateResourceServer
-> ReadPrec [UpdateResourceServer]
-> Read 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
(Int -> UpdateResourceServer -> ShowS)
-> (UpdateResourceServer -> String)
-> ([UpdateResourceServer] -> ShowS)
-> Show UpdateResourceServer
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. UpdateResourceServer -> Rep UpdateResourceServer x)
-> (forall x. Rep UpdateResourceServer x -> UpdateResourceServer)
-> Generic UpdateResourceServer
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' :: Maybe [ResourceServerScopeType]
-> Text -> Text -> Text -> UpdateResourceServer
UpdateResourceServer'
{ $sel:scopes:UpdateResourceServer' :: Maybe [ResourceServerScopeType]
scopes = Maybe [ResourceServerScopeType]
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 :: (Maybe [ResourceServerScopeType]
-> f (Maybe [ResourceServerScopeType]))
-> UpdateResourceServer -> f UpdateResourceServer
updateResourceServer_scopes = (UpdateResourceServer -> Maybe [ResourceServerScopeType])
-> (UpdateResourceServer
-> Maybe [ResourceServerScopeType] -> UpdateResourceServer)
-> Lens
UpdateResourceServer
UpdateResourceServer
(Maybe [ResourceServerScopeType])
(Maybe [ResourceServerScopeType])
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) ((Maybe [ResourceServerScopeType]
-> f (Maybe [ResourceServerScopeType]))
-> UpdateResourceServer -> f UpdateResourceServer)
-> ((Maybe [ResourceServerScopeType]
-> f (Maybe [ResourceServerScopeType]))
-> Maybe [ResourceServerScopeType]
-> f (Maybe [ResourceServerScopeType]))
-> (Maybe [ResourceServerScopeType]
-> f (Maybe [ResourceServerScopeType]))
-> UpdateResourceServer
-> f UpdateResourceServer
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[ResourceServerScopeType]
[ResourceServerScopeType]
[ResourceServerScopeType]
[ResourceServerScopeType]
-> Iso
(Maybe [ResourceServerScopeType])
(Maybe [ResourceServerScopeType])
(Maybe [ResourceServerScopeType])
(Maybe [ResourceServerScopeType])
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
[ResourceServerScopeType]
[ResourceServerScopeType]
[ResourceServerScopeType]
[ResourceServerScopeType]
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 :: (Text -> f Text) -> UpdateResourceServer -> f UpdateResourceServer
updateResourceServer_userPoolId = (UpdateResourceServer -> Text)
-> (UpdateResourceServer -> Text -> UpdateResourceServer)
-> Lens UpdateResourceServer UpdateResourceServer Text Text
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 :: (Text -> f Text) -> UpdateResourceServer -> f UpdateResourceServer
updateResourceServer_identifier = (UpdateResourceServer -> Text)
-> (UpdateResourceServer -> Text -> UpdateResourceServer)
-> Lens UpdateResourceServer UpdateResourceServer Text Text
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 :: (Text -> f Text) -> UpdateResourceServer -> f UpdateResourceServer
updateResourceServer_name = (UpdateResourceServer -> Text)
-> (UpdateResourceServer -> Text -> UpdateResourceServer)
-> Lens UpdateResourceServer UpdateResourceServer Text Text
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 :: UpdateResourceServer -> Request UpdateResourceServer
request = Service -> UpdateResourceServer -> Request UpdateResourceServer
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateResourceServer
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateResourceServer)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateResourceServer))
-> Logger
-> Service
-> Proxy UpdateResourceServer
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateResourceServer)))
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 ->
Int -> ResourceServerType -> UpdateResourceServerResponse
UpdateResourceServerResponse'
(Int -> ResourceServerType -> UpdateResourceServerResponse)
-> Either String Int
-> Either
String (ResourceServerType -> UpdateResourceServerResponse)
forall (f :: * -> *) a b. Functor 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 (ResourceServerType -> UpdateResourceServerResponse)
-> Either String ResourceServerType
-> Either String UpdateResourceServerResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String ResourceServerType
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"ResourceServer")
)
instance Prelude.Hashable UpdateResourceServer
instance Prelude.NFData UpdateResourceServer
instance Core.ToHeaders UpdateResourceServer where
toHeaders :: UpdateResourceServer -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateResourceServer -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AWSCognitoIdentityProviderService.UpdateResourceServer" ::
Prelude.ByteString
),
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 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
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Scopes" Text -> [ResourceServerScopeType] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([ResourceServerScopeType] -> Pair)
-> Maybe [ResourceServerScopeType] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [ResourceServerScopeType]
scopes,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"UserPoolId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
userPoolId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Identifier" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
identifier),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name)
]
)
instance Core.ToPath UpdateResourceServer where
toPath :: UpdateResourceServer -> ByteString
toPath = ByteString -> UpdateResourceServer -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery UpdateResourceServer where
toQuery :: UpdateResourceServer -> QueryString
toQuery = QueryString -> UpdateResourceServer -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateResourceServerResponse = UpdateResourceServerResponse'
{
UpdateResourceServerResponse -> Int
httpStatus :: Prelude.Int,
UpdateResourceServerResponse -> ResourceServerType
resourceServer :: ResourceServerType
}
deriving (UpdateResourceServerResponse
-> UpdateResourceServerResponse -> Bool
(UpdateResourceServerResponse
-> UpdateResourceServerResponse -> Bool)
-> (UpdateResourceServerResponse
-> UpdateResourceServerResponse -> Bool)
-> Eq UpdateResourceServerResponse
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]
(Int -> ReadS UpdateResourceServerResponse)
-> ReadS [UpdateResourceServerResponse]
-> ReadPrec UpdateResourceServerResponse
-> ReadPrec [UpdateResourceServerResponse]
-> Read 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
(Int -> UpdateResourceServerResponse -> ShowS)
-> (UpdateResourceServerResponse -> String)
-> ([UpdateResourceServerResponse] -> ShowS)
-> Show UpdateResourceServerResponse
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.
UpdateResourceServerResponse -> Rep UpdateResourceServerResponse x)
-> (forall x.
Rep UpdateResourceServerResponse x -> UpdateResourceServerResponse)
-> Generic UpdateResourceServerResponse
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' :: Int -> ResourceServerType -> UpdateResourceServerResponse
UpdateResourceServerResponse'
{ $sel:httpStatus:UpdateResourceServerResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:resourceServer:UpdateResourceServerResponse' :: ResourceServerType
resourceServer = ResourceServerType
pResourceServer_
}
updateResourceServerResponse_httpStatus :: Lens.Lens' UpdateResourceServerResponse Prelude.Int
updateResourceServerResponse_httpStatus :: (Int -> f Int)
-> UpdateResourceServerResponse -> f UpdateResourceServerResponse
updateResourceServerResponse_httpStatus = (UpdateResourceServerResponse -> Int)
-> (UpdateResourceServerResponse
-> Int -> UpdateResourceServerResponse)
-> Lens
UpdateResourceServerResponse UpdateResourceServerResponse Int Int
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 :: (ResourceServerType -> f ResourceServerType)
-> UpdateResourceServerResponse -> f UpdateResourceServerResponse
updateResourceServerResponse_resourceServer = (UpdateResourceServerResponse -> ResourceServerType)
-> (UpdateResourceServerResponse
-> ResourceServerType -> UpdateResourceServerResponse)
-> Lens
UpdateResourceServerResponse
UpdateResourceServerResponse
ResourceServerType
ResourceServerType
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