{-# 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 #-} -- Derived from AWS service descriptions, licensed under Apache 2.0. -- | -- Module : Amazonka.CognitoIdentityProvider.GetGroup -- Copyright : (c) 2013-2023 Brendan Hay -- License : Mozilla Public License, v. 2.0. -- Maintainer : Brendan Hay -- Stability : auto-generated -- Portability : non-portable (GHC extensions) -- -- Gets a group. -- -- Calling this action requires developer credentials. module Amazonka.CognitoIdentityProvider.GetGroup ( -- * Creating a Request GetGroup (..), newGetGroup, -- * Request Lenses getGroup_groupName, getGroup_userPoolId, -- * Destructuring the Response GetGroupResponse (..), newGetGroupResponse, -- * Response Lenses getGroupResponse_group, getGroupResponse_httpStatus, ) where import Amazonka.CognitoIdentityProvider.Types import qualified Amazonka.Core as Core import qualified Amazonka.Core.Lens.Internal as Lens import qualified Amazonka.Data as Data import qualified Amazonka.Prelude as Prelude import qualified Amazonka.Request as Request import qualified Amazonka.Response as Response -- | /See:/ 'newGetGroup' smart constructor. data GetGroup = GetGroup' { -- | The name of the group. groupName :: Prelude.Text, -- | The user pool ID for the user pool. userPoolId :: Prelude.Text } deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'GetGroup' with all optional fields omitted. -- -- Use or to modify other optional fields. -- -- The following record fields are available, with the corresponding lenses provided -- for backwards compatibility: -- -- 'groupName', 'getGroup_groupName' - The name of the group. -- -- 'userPoolId', 'getGroup_userPoolId' - The user pool ID for the user pool. newGetGroup :: -- | 'groupName' Prelude.Text -> -- | 'userPoolId' Prelude.Text -> GetGroup newGetGroup pGroupName_ pUserPoolId_ = GetGroup' { groupName = pGroupName_, userPoolId = pUserPoolId_ } -- | The name of the group. getGroup_groupName :: Lens.Lens' GetGroup Prelude.Text getGroup_groupName = Lens.lens (\GetGroup' {groupName} -> groupName) (\s@GetGroup' {} a -> s {groupName = a} :: GetGroup) -- | The user pool ID for the user pool. getGroup_userPoolId :: Lens.Lens' GetGroup Prelude.Text getGroup_userPoolId = Lens.lens (\GetGroup' {userPoolId} -> userPoolId) (\s@GetGroup' {} a -> s {userPoolId = a} :: GetGroup) instance Core.AWSRequest GetGroup where type AWSResponse GetGroup = GetGroupResponse request overrides = Request.postJSON (overrides defaultService) response = Response.receiveJSON ( \s h x -> GetGroupResponse' Prelude.<$> (x Data..?> "Group") Prelude.<*> (Prelude.pure (Prelude.fromEnum s)) ) instance Prelude.Hashable GetGroup where hashWithSalt _salt GetGroup' {..} = _salt `Prelude.hashWithSalt` groupName `Prelude.hashWithSalt` userPoolId instance Prelude.NFData GetGroup where rnf GetGroup' {..} = Prelude.rnf groupName `Prelude.seq` Prelude.rnf userPoolId instance Data.ToHeaders GetGroup where toHeaders = Prelude.const ( Prelude.mconcat [ "X-Amz-Target" Data.=# ( "AWSCognitoIdentityProviderService.GetGroup" :: Prelude.ByteString ), "Content-Type" Data.=# ( "application/x-amz-json-1.1" :: Prelude.ByteString ) ] ) instance Data.ToJSON GetGroup where toJSON GetGroup' {..} = Data.object ( Prelude.catMaybes [ Prelude.Just ("GroupName" Data..= groupName), Prelude.Just ("UserPoolId" Data..= userPoolId) ] ) instance Data.ToPath GetGroup where toPath = Prelude.const "/" instance Data.ToQuery GetGroup where toQuery = Prelude.const Prelude.mempty -- | /See:/ 'newGetGroupResponse' smart constructor. data GetGroupResponse = GetGroupResponse' { -- | The group object for the group. group' :: Prelude.Maybe GroupType, -- | The response's http status code. httpStatus :: Prelude.Int } deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'GetGroupResponse' with all optional fields omitted. -- -- Use or to modify other optional fields. -- -- The following record fields are available, with the corresponding lenses provided -- for backwards compatibility: -- -- 'group'', 'getGroupResponse_group' - The group object for the group. -- -- 'httpStatus', 'getGroupResponse_httpStatus' - The response's http status code. newGetGroupResponse :: -- | 'httpStatus' Prelude.Int -> GetGroupResponse newGetGroupResponse pHttpStatus_ = GetGroupResponse' { group' = Prelude.Nothing, httpStatus = pHttpStatus_ } -- | The group object for the group. getGroupResponse_group :: Lens.Lens' GetGroupResponse (Prelude.Maybe GroupType) getGroupResponse_group = Lens.lens (\GetGroupResponse' {group'} -> group') (\s@GetGroupResponse' {} a -> s {group' = a} :: GetGroupResponse) -- | The response's http status code. getGroupResponse_httpStatus :: Lens.Lens' GetGroupResponse Prelude.Int getGroupResponse_httpStatus = Lens.lens (\GetGroupResponse' {httpStatus} -> httpStatus) (\s@GetGroupResponse' {} a -> s {httpStatus = a} :: GetGroupResponse) instance Prelude.NFData GetGroupResponse where rnf GetGroupResponse' {..} = Prelude.rnf group' `Prelude.seq` Prelude.rnf httpStatus