{-# 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.SecretsManager.GetRandomPassword
(
getRandomPassword
, GetRandomPassword
, grpIncludeSpace
, grpExcludeNumbers
, grpExcludeLowercase
, grpExcludeCharacters
, grpExcludePunctuation
, grpRequireEachIncludedType
, grpExcludeUppercase
, grpPasswordLength
, getRandomPasswordResponse
, GetRandomPasswordResponse
, grprsRandomPassword
, grprsResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
import Network.AWS.SecretsManager.Types
import Network.AWS.SecretsManager.Types.Product
data GetRandomPassword = GetRandomPassword'
{ _grpIncludeSpace :: !(Maybe Bool)
, _grpExcludeNumbers :: !(Maybe Bool)
, _grpExcludeLowercase :: !(Maybe Bool)
, _grpExcludeCharacters :: !(Maybe Text)
, _grpExcludePunctuation :: !(Maybe Bool)
, _grpRequireEachIncludedType :: !(Maybe Bool)
, _grpExcludeUppercase :: !(Maybe Bool)
, _grpPasswordLength :: !(Maybe Nat)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getRandomPassword
:: GetRandomPassword
getRandomPassword =
GetRandomPassword'
{ _grpIncludeSpace = Nothing
, _grpExcludeNumbers = Nothing
, _grpExcludeLowercase = Nothing
, _grpExcludeCharacters = Nothing
, _grpExcludePunctuation = Nothing
, _grpRequireEachIncludedType = Nothing
, _grpExcludeUppercase = Nothing
, _grpPasswordLength = Nothing
}
grpIncludeSpace :: Lens' GetRandomPassword (Maybe Bool)
grpIncludeSpace = lens _grpIncludeSpace (\ s a -> s{_grpIncludeSpace = a})
grpExcludeNumbers :: Lens' GetRandomPassword (Maybe Bool)
grpExcludeNumbers = lens _grpExcludeNumbers (\ s a -> s{_grpExcludeNumbers = a})
grpExcludeLowercase :: Lens' GetRandomPassword (Maybe Bool)
grpExcludeLowercase = lens _grpExcludeLowercase (\ s a -> s{_grpExcludeLowercase = a})
grpExcludeCharacters :: Lens' GetRandomPassword (Maybe Text)
grpExcludeCharacters = lens _grpExcludeCharacters (\ s a -> s{_grpExcludeCharacters = a})
grpExcludePunctuation :: Lens' GetRandomPassword (Maybe Bool)
grpExcludePunctuation = lens _grpExcludePunctuation (\ s a -> s{_grpExcludePunctuation = a})
grpRequireEachIncludedType :: Lens' GetRandomPassword (Maybe Bool)
grpRequireEachIncludedType = lens _grpRequireEachIncludedType (\ s a -> s{_grpRequireEachIncludedType = a})
grpExcludeUppercase :: Lens' GetRandomPassword (Maybe Bool)
grpExcludeUppercase = lens _grpExcludeUppercase (\ s a -> s{_grpExcludeUppercase = a})
grpPasswordLength :: Lens' GetRandomPassword (Maybe Natural)
grpPasswordLength = lens _grpPasswordLength (\ s a -> s{_grpPasswordLength = a}) . mapping _Nat
instance AWSRequest GetRandomPassword where
type Rs GetRandomPassword = GetRandomPasswordResponse
request = postJSON secretsManager
response
= receiveJSON
(\ s h x ->
GetRandomPasswordResponse' <$>
(x .?> "RandomPassword") <*> (pure (fromEnum s)))
instance Hashable GetRandomPassword where
instance NFData GetRandomPassword where
instance ToHeaders GetRandomPassword where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("secretsmanager.GetRandomPassword" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON GetRandomPassword where
toJSON GetRandomPassword'{..}
= object
(catMaybes
[("IncludeSpace" .=) <$> _grpIncludeSpace,
("ExcludeNumbers" .=) <$> _grpExcludeNumbers,
("ExcludeLowercase" .=) <$> _grpExcludeLowercase,
("ExcludeCharacters" .=) <$> _grpExcludeCharacters,
("ExcludePunctuation" .=) <$> _grpExcludePunctuation,
("RequireEachIncludedType" .=) <$>
_grpRequireEachIncludedType,
("ExcludeUppercase" .=) <$> _grpExcludeUppercase,
("PasswordLength" .=) <$> _grpPasswordLength])
instance ToPath GetRandomPassword where
toPath = const "/"
instance ToQuery GetRandomPassword where
toQuery = const mempty
data GetRandomPasswordResponse = GetRandomPasswordResponse'
{ _grprsRandomPassword :: !(Maybe Text)
, _grprsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getRandomPasswordResponse
:: Int
-> GetRandomPasswordResponse
getRandomPasswordResponse pResponseStatus_ =
GetRandomPasswordResponse'
{_grprsRandomPassword = Nothing, _grprsResponseStatus = pResponseStatus_}
grprsRandomPassword :: Lens' GetRandomPasswordResponse (Maybe Text)
grprsRandomPassword = lens _grprsRandomPassword (\ s a -> s{_grprsRandomPassword = a})
grprsResponseStatus :: Lens' GetRandomPasswordResponse Int
grprsResponseStatus = lens _grprsResponseStatus (\ s a -> s{_grprsResponseStatus = a})
instance NFData GetRandomPasswordResponse where