{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Network.AWS.CognitoIdentityProvider.CreateUserPoolClient
(
createUserPoolClient
, CreateUserPoolClient
, cupcRefreshTokenValidity
, cupcExplicitAuthFlows
, cupcSupportedIdentityProviders
, cupcLogoutURLs
, cupcAllowedOAuthFlowsUserPoolClient
, cupcGenerateSecret
, cupcDefaultRedirectURI
, cupcWriteAttributes
, cupcReadAttributes
, cupcAllowedOAuthScopes
, cupcAllowedOAuthFlows
, cupcAnalyticsConfiguration
, cupcCallbackURLs
, cupcUserPoolId
, cupcClientName
, createUserPoolClientResponse
, CreateUserPoolClientResponse
, cupcrsUserPoolClient
, cupcrsResponseStatus
) where
import Network.AWS.CognitoIdentityProvider.Types
import Network.AWS.CognitoIdentityProvider.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data CreateUserPoolClient = CreateUserPoolClient'
{ _cupcRefreshTokenValidity :: !(Maybe Nat)
, _cupcExplicitAuthFlows :: !(Maybe [ExplicitAuthFlowsType])
, _cupcSupportedIdentityProviders :: !(Maybe [Text])
, _cupcLogoutURLs :: !(Maybe [Text])
, _cupcAllowedOAuthFlowsUserPoolClient :: !(Maybe Bool)
, _cupcGenerateSecret :: !(Maybe Bool)
, _cupcDefaultRedirectURI :: !(Maybe Text)
, _cupcWriteAttributes :: !(Maybe [Text])
, _cupcReadAttributes :: !(Maybe [Text])
, _cupcAllowedOAuthScopes :: !(Maybe [Text])
, _cupcAllowedOAuthFlows :: !(Maybe [OAuthFlowType])
, _cupcAnalyticsConfiguration :: !(Maybe AnalyticsConfigurationType)
, _cupcCallbackURLs :: !(Maybe [Text])
, _cupcUserPoolId :: !Text
, _cupcClientName :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createUserPoolClient
:: Text
-> Text
-> CreateUserPoolClient
createUserPoolClient pUserPoolId_ pClientName_ =
CreateUserPoolClient'
{ _cupcRefreshTokenValidity = Nothing
, _cupcExplicitAuthFlows = Nothing
, _cupcSupportedIdentityProviders = Nothing
, _cupcLogoutURLs = Nothing
, _cupcAllowedOAuthFlowsUserPoolClient = Nothing
, _cupcGenerateSecret = Nothing
, _cupcDefaultRedirectURI = Nothing
, _cupcWriteAttributes = Nothing
, _cupcReadAttributes = Nothing
, _cupcAllowedOAuthScopes = Nothing
, _cupcAllowedOAuthFlows = Nothing
, _cupcAnalyticsConfiguration = Nothing
, _cupcCallbackURLs = Nothing
, _cupcUserPoolId = pUserPoolId_
, _cupcClientName = pClientName_
}
cupcRefreshTokenValidity :: Lens' CreateUserPoolClient (Maybe Natural)
cupcRefreshTokenValidity = lens _cupcRefreshTokenValidity (\ s a -> s{_cupcRefreshTokenValidity = a}) . mapping _Nat
cupcExplicitAuthFlows :: Lens' CreateUserPoolClient [ExplicitAuthFlowsType]
cupcExplicitAuthFlows = lens _cupcExplicitAuthFlows (\ s a -> s{_cupcExplicitAuthFlows = a}) . _Default . _Coerce
cupcSupportedIdentityProviders :: Lens' CreateUserPoolClient [Text]
cupcSupportedIdentityProviders = lens _cupcSupportedIdentityProviders (\ s a -> s{_cupcSupportedIdentityProviders = a}) . _Default . _Coerce
cupcLogoutURLs :: Lens' CreateUserPoolClient [Text]
cupcLogoutURLs = lens _cupcLogoutURLs (\ s a -> s{_cupcLogoutURLs = a}) . _Default . _Coerce
cupcAllowedOAuthFlowsUserPoolClient :: Lens' CreateUserPoolClient (Maybe Bool)
cupcAllowedOAuthFlowsUserPoolClient = lens _cupcAllowedOAuthFlowsUserPoolClient (\ s a -> s{_cupcAllowedOAuthFlowsUserPoolClient = a})
cupcGenerateSecret :: Lens' CreateUserPoolClient (Maybe Bool)
cupcGenerateSecret = lens _cupcGenerateSecret (\ s a -> s{_cupcGenerateSecret = a})
cupcDefaultRedirectURI :: Lens' CreateUserPoolClient (Maybe Text)
cupcDefaultRedirectURI = lens _cupcDefaultRedirectURI (\ s a -> s{_cupcDefaultRedirectURI = a})
cupcWriteAttributes :: Lens' CreateUserPoolClient [Text]
cupcWriteAttributes = lens _cupcWriteAttributes (\ s a -> s{_cupcWriteAttributes = a}) . _Default . _Coerce
cupcReadAttributes :: Lens' CreateUserPoolClient [Text]
cupcReadAttributes = lens _cupcReadAttributes (\ s a -> s{_cupcReadAttributes = a}) . _Default . _Coerce
cupcAllowedOAuthScopes :: Lens' CreateUserPoolClient [Text]
cupcAllowedOAuthScopes = lens _cupcAllowedOAuthScopes (\ s a -> s{_cupcAllowedOAuthScopes = a}) . _Default . _Coerce
cupcAllowedOAuthFlows :: Lens' CreateUserPoolClient [OAuthFlowType]
cupcAllowedOAuthFlows = lens _cupcAllowedOAuthFlows (\ s a -> s{_cupcAllowedOAuthFlows = a}) . _Default . _Coerce
cupcAnalyticsConfiguration :: Lens' CreateUserPoolClient (Maybe AnalyticsConfigurationType)
cupcAnalyticsConfiguration = lens _cupcAnalyticsConfiguration (\ s a -> s{_cupcAnalyticsConfiguration = a})
cupcCallbackURLs :: Lens' CreateUserPoolClient [Text]
cupcCallbackURLs = lens _cupcCallbackURLs (\ s a -> s{_cupcCallbackURLs = a}) . _Default . _Coerce
cupcUserPoolId :: Lens' CreateUserPoolClient Text
cupcUserPoolId = lens _cupcUserPoolId (\ s a -> s{_cupcUserPoolId = a})
cupcClientName :: Lens' CreateUserPoolClient Text
cupcClientName = lens _cupcClientName (\ s a -> s{_cupcClientName = a})
instance AWSRequest CreateUserPoolClient where
type Rs CreateUserPoolClient =
CreateUserPoolClientResponse
request = postJSON cognitoIdentityProvider
response
= receiveJSON
(\ s h x ->
CreateUserPoolClientResponse' <$>
(x .?> "UserPoolClient") <*> (pure (fromEnum s)))
instance Hashable CreateUserPoolClient where
instance NFData CreateUserPoolClient where
instance ToHeaders CreateUserPoolClient where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AWSCognitoIdentityProviderService.CreateUserPoolClient"
:: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CreateUserPoolClient where
toJSON CreateUserPoolClient'{..}
= object
(catMaybes
[("RefreshTokenValidity" .=) <$>
_cupcRefreshTokenValidity,
("ExplicitAuthFlows" .=) <$> _cupcExplicitAuthFlows,
("SupportedIdentityProviders" .=) <$>
_cupcSupportedIdentityProviders,
("LogoutURLs" .=) <$> _cupcLogoutURLs,
("AllowedOAuthFlowsUserPoolClient" .=) <$>
_cupcAllowedOAuthFlowsUserPoolClient,
("GenerateSecret" .=) <$> _cupcGenerateSecret,
("DefaultRedirectURI" .=) <$>
_cupcDefaultRedirectURI,
("WriteAttributes" .=) <$> _cupcWriteAttributes,
("ReadAttributes" .=) <$> _cupcReadAttributes,
("AllowedOAuthScopes" .=) <$>
_cupcAllowedOAuthScopes,
("AllowedOAuthFlows" .=) <$> _cupcAllowedOAuthFlows,
("AnalyticsConfiguration" .=) <$>
_cupcAnalyticsConfiguration,
("CallbackURLs" .=) <$> _cupcCallbackURLs,
Just ("UserPoolId" .= _cupcUserPoolId),
Just ("ClientName" .= _cupcClientName)])
instance ToPath CreateUserPoolClient where
toPath = const "/"
instance ToQuery CreateUserPoolClient where
toQuery = const mempty
data CreateUserPoolClientResponse = CreateUserPoolClientResponse'
{ _cupcrsUserPoolClient :: !(Maybe UserPoolClientType)
, _cupcrsResponseStatus :: !Int
} deriving (Eq, Show, Data, Typeable, Generic)
createUserPoolClientResponse
:: Int
-> CreateUserPoolClientResponse
createUserPoolClientResponse pResponseStatus_ =
CreateUserPoolClientResponse'
{_cupcrsUserPoolClient = Nothing, _cupcrsResponseStatus = pResponseStatus_}
cupcrsUserPoolClient :: Lens' CreateUserPoolClientResponse (Maybe UserPoolClientType)
cupcrsUserPoolClient = lens _cupcrsUserPoolClient (\ s a -> s{_cupcrsUserPoolClient = a})
cupcrsResponseStatus :: Lens' CreateUserPoolClientResponse Int
cupcrsResponseStatus = lens _cupcrsResponseStatus (\ s a -> s{_cupcrsResponseStatus = a})
instance NFData CreateUserPoolClientResponse where