{-# 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 #-} -- Derived from AWS service descriptions, licensed under Apache 2.0. -- | -- Module : Network.AWS.Greengrass.CreateGroupCertificateAuthority -- Copyright : (c) 2013-2017 Brendan Hay -- License : Mozilla Public License, v. 2.0. -- Maintainer : Brendan Hay -- Stability : auto-generated -- Portability : non-portable (GHC extensions) -- -- Creates a CA for the group. If a CA already exists, it will rotate the existing CA. module Network.AWS.Greengrass.CreateGroupCertificateAuthority ( -- * Creating a Request createGroupCertificateAuthority , CreateGroupCertificateAuthority -- * Request Lenses , cgcaAmznClientToken , cgcaGroupId -- * Destructuring the Response , createGroupCertificateAuthorityResponse , CreateGroupCertificateAuthorityResponse -- * Response Lenses , cgcarsGroupCertificateAuthorityARN , cgcarsResponseStatus ) 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 -- | /See:/ 'createGroupCertificateAuthority' smart constructor. data CreateGroupCertificateAuthority = CreateGroupCertificateAuthority' { _cgcaAmznClientToken :: !(Maybe Text) , _cgcaGroupId :: !Text } deriving (Eq, Read, Show, Data, Typeable, Generic) -- | Creates a value of 'CreateGroupCertificateAuthority' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'cgcaAmznClientToken' - The client token used to request idempotent operations. -- -- * 'cgcaGroupId' - The unique Id of the AWS Greengrass Group createGroupCertificateAuthority :: Text -- ^ 'cgcaGroupId' -> CreateGroupCertificateAuthority createGroupCertificateAuthority pGroupId_ = CreateGroupCertificateAuthority' {_cgcaAmznClientToken = Nothing, _cgcaGroupId = pGroupId_} -- | The client token used to request idempotent operations. cgcaAmznClientToken :: Lens' CreateGroupCertificateAuthority (Maybe Text) cgcaAmznClientToken = lens _cgcaAmznClientToken (\ s a -> s{_cgcaAmznClientToken = a}); -- | The unique Id of the AWS Greengrass Group cgcaGroupId :: Lens' CreateGroupCertificateAuthority Text cgcaGroupId = lens _cgcaGroupId (\ s a -> s{_cgcaGroupId = a}); instance AWSRequest CreateGroupCertificateAuthority where type Rs CreateGroupCertificateAuthority = CreateGroupCertificateAuthorityResponse request = postJSON greengrass response = receiveJSON (\ s h x -> CreateGroupCertificateAuthorityResponse' <$> (x .?> "GroupCertificateAuthorityArn") <*> (pure (fromEnum s))) instance Hashable CreateGroupCertificateAuthority where instance NFData CreateGroupCertificateAuthority where instance ToHeaders CreateGroupCertificateAuthority where toHeaders CreateGroupCertificateAuthority'{..} = mconcat ["X-Amzn-Client-Token" =# _cgcaAmznClientToken, "Content-Type" =# ("application/x-amz-json-1.1" :: ByteString)] instance ToJSON CreateGroupCertificateAuthority where toJSON = const (Object mempty) instance ToPath CreateGroupCertificateAuthority where toPath CreateGroupCertificateAuthority'{..} = mconcat ["/greengrass/groups/", toBS _cgcaGroupId, "/certificateauthorities"] instance ToQuery CreateGroupCertificateAuthority where toQuery = const mempty -- | /See:/ 'createGroupCertificateAuthorityResponse' smart constructor. data CreateGroupCertificateAuthorityResponse = CreateGroupCertificateAuthorityResponse' { _cgcarsGroupCertificateAuthorityARN :: !(Maybe Text) , _cgcarsResponseStatus :: !Int } deriving (Eq, Read, Show, Data, Typeable, Generic) -- | Creates a value of 'CreateGroupCertificateAuthorityResponse' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'cgcarsGroupCertificateAuthorityARN' - Arn of the group certificate authority. -- -- * 'cgcarsResponseStatus' - -- | The response status code. createGroupCertificateAuthorityResponse :: Int -- ^ 'cgcarsResponseStatus' -> CreateGroupCertificateAuthorityResponse createGroupCertificateAuthorityResponse pResponseStatus_ = CreateGroupCertificateAuthorityResponse' { _cgcarsGroupCertificateAuthorityARN = Nothing , _cgcarsResponseStatus = pResponseStatus_ } -- | Arn of the group certificate authority. cgcarsGroupCertificateAuthorityARN :: Lens' CreateGroupCertificateAuthorityResponse (Maybe Text) cgcarsGroupCertificateAuthorityARN = lens _cgcarsGroupCertificateAuthorityARN (\ s a -> s{_cgcarsGroupCertificateAuthorityARN = a}); -- | -- | The response status code. cgcarsResponseStatus :: Lens' CreateGroupCertificateAuthorityResponse Int cgcarsResponseStatus = lens _cgcarsResponseStatus (\ s a -> s{_cgcarsResponseStatus = a}); instance NFData CreateGroupCertificateAuthorityResponse where