module Network.AWS.Greengrass.CreateGroup
(
createGroup
, CreateGroup
, cgAmznClientToken
, cgInitialVersion
, cgName
, createGroupResponse
, CreateGroupResponse
, cgrsLatestVersionARN
, cgrsARN
, cgrsName
, cgrsCreationTimestamp
, cgrsId
, cgrsLatestVersion
, cgrsLastUpdatedTimestamp
, cgrsResponseStatus
) where
import Network.AWS.Greengrass.Types
import Network.AWS.Greengrass.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data CreateGroup = CreateGroup'
{ _cgAmznClientToken :: !(Maybe Text)
, _cgInitialVersion :: !(Maybe GroupVersion)
, _cgName :: !(Maybe Text)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createGroup
:: CreateGroup
createGroup =
CreateGroup'
{_cgAmznClientToken = Nothing, _cgInitialVersion = Nothing, _cgName = Nothing}
cgAmznClientToken :: Lens' CreateGroup (Maybe Text)
cgAmznClientToken = lens _cgAmznClientToken (\ s a -> s{_cgAmznClientToken = a});
cgInitialVersion :: Lens' CreateGroup (Maybe GroupVersion)
cgInitialVersion = lens _cgInitialVersion (\ s a -> s{_cgInitialVersion = a});
cgName :: Lens' CreateGroup (Maybe Text)
cgName = lens _cgName (\ s a -> s{_cgName = a});
instance AWSRequest CreateGroup where
type Rs CreateGroup = CreateGroupResponse
request = postJSON greengrass
response
= receiveJSON
(\ s h x ->
CreateGroupResponse' <$>
(x .?> "LatestVersionArn") <*> (x .?> "Arn") <*>
(x .?> "Name")
<*> (x .?> "CreationTimestamp")
<*> (x .?> "Id")
<*> (x .?> "LatestVersion")
<*> (x .?> "LastUpdatedTimestamp")
<*> (pure (fromEnum s)))
instance Hashable CreateGroup where
instance NFData CreateGroup where
instance ToHeaders CreateGroup where
toHeaders CreateGroup'{..}
= mconcat
["X-Amzn-Client-Token" =# _cgAmznClientToken,
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)]
instance ToJSON CreateGroup where
toJSON CreateGroup'{..}
= object
(catMaybes
[("InitialVersion" .=) <$> _cgInitialVersion,
("Name" .=) <$> _cgName])
instance ToPath CreateGroup where
toPath = const "/greengrass/groups"
instance ToQuery CreateGroup where
toQuery = const mempty
data CreateGroupResponse = CreateGroupResponse'
{ _cgrsLatestVersionARN :: !(Maybe Text)
, _cgrsARN :: !(Maybe Text)
, _cgrsName :: !(Maybe Text)
, _cgrsCreationTimestamp :: !(Maybe Text)
, _cgrsId :: !(Maybe Text)
, _cgrsLatestVersion :: !(Maybe Text)
, _cgrsLastUpdatedTimestamp :: !(Maybe Text)
, _cgrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createGroupResponse
:: Int
-> CreateGroupResponse
createGroupResponse pResponseStatus_ =
CreateGroupResponse'
{ _cgrsLatestVersionARN = Nothing
, _cgrsARN = Nothing
, _cgrsName = Nothing
, _cgrsCreationTimestamp = Nothing
, _cgrsId = Nothing
, _cgrsLatestVersion = Nothing
, _cgrsLastUpdatedTimestamp = Nothing
, _cgrsResponseStatus = pResponseStatus_
}
cgrsLatestVersionARN :: Lens' CreateGroupResponse (Maybe Text)
cgrsLatestVersionARN = lens _cgrsLatestVersionARN (\ s a -> s{_cgrsLatestVersionARN = a});
cgrsARN :: Lens' CreateGroupResponse (Maybe Text)
cgrsARN = lens _cgrsARN (\ s a -> s{_cgrsARN = a});
cgrsName :: Lens' CreateGroupResponse (Maybe Text)
cgrsName = lens _cgrsName (\ s a -> s{_cgrsName = a});
cgrsCreationTimestamp :: Lens' CreateGroupResponse (Maybe Text)
cgrsCreationTimestamp = lens _cgrsCreationTimestamp (\ s a -> s{_cgrsCreationTimestamp = a});
cgrsId :: Lens' CreateGroupResponse (Maybe Text)
cgrsId = lens _cgrsId (\ s a -> s{_cgrsId = a});
cgrsLatestVersion :: Lens' CreateGroupResponse (Maybe Text)
cgrsLatestVersion = lens _cgrsLatestVersion (\ s a -> s{_cgrsLatestVersion = a});
cgrsLastUpdatedTimestamp :: Lens' CreateGroupResponse (Maybe Text)
cgrsLastUpdatedTimestamp = lens _cgrsLastUpdatedTimestamp (\ s a -> s{_cgrsLastUpdatedTimestamp = a});
cgrsResponseStatus :: Lens' CreateGroupResponse Int
cgrsResponseStatus = lens _cgrsResponseStatus (\ s a -> s{_cgrsResponseStatus = a});
instance NFData CreateGroupResponse where