{-# 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.MacieV2.ListMembers -- Copyright : (c) 2013-2023 Brendan Hay -- License : Mozilla Public License, v. 2.0. -- Maintainer : Brendan Hay -- Stability : auto-generated -- Portability : non-portable (GHC extensions) -- -- Retrieves information about the accounts that are associated with an -- Amazon Macie administrator account. -- -- This operation returns paginated results. module Amazonka.MacieV2.ListMembers ( -- * Creating a Request ListMembers (..), newListMembers, -- * Request Lenses listMembers_maxResults, listMembers_nextToken, listMembers_onlyAssociated, -- * Destructuring the Response ListMembersResponse (..), newListMembersResponse, -- * Response Lenses listMembersResponse_members, listMembersResponse_nextToken, listMembersResponse_httpStatus, ) where import qualified Amazonka.Core as Core import qualified Amazonka.Core.Lens.Internal as Lens import qualified Amazonka.Data as Data import Amazonka.MacieV2.Types import qualified Amazonka.Prelude as Prelude import qualified Amazonka.Request as Request import qualified Amazonka.Response as Response -- | /See:/ 'newListMembers' smart constructor. data ListMembers = ListMembers' { -- | The maximum number of items to include in each page of a paginated -- response. maxResults :: Prelude.Maybe Prelude.Natural, -- | The nextToken string that specifies which page of results to return in a -- paginated response. nextToken :: Prelude.Maybe Prelude.Text, -- | Specifies which accounts to include in the response, based on the status -- of an account\'s relationship with the administrator account. By -- default, the response includes only current member accounts. To include -- all accounts, set this value to false. onlyAssociated :: Prelude.Maybe Prelude.Text } deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'ListMembers' 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: -- -- 'maxResults', 'listMembers_maxResults' - The maximum number of items to include in each page of a paginated -- response. -- -- 'nextToken', 'listMembers_nextToken' - The nextToken string that specifies which page of results to return in a -- paginated response. -- -- 'onlyAssociated', 'listMembers_onlyAssociated' - Specifies which accounts to include in the response, based on the status -- of an account\'s relationship with the administrator account. By -- default, the response includes only current member accounts. To include -- all accounts, set this value to false. newListMembers :: ListMembers newListMembers = ListMembers' { maxResults = Prelude.Nothing, nextToken = Prelude.Nothing, onlyAssociated = Prelude.Nothing } -- | The maximum number of items to include in each page of a paginated -- response. listMembers_maxResults :: Lens.Lens' ListMembers (Prelude.Maybe Prelude.Natural) listMembers_maxResults = Lens.lens (\ListMembers' {maxResults} -> maxResults) (\s@ListMembers' {} a -> s {maxResults = a} :: ListMembers) -- | The nextToken string that specifies which page of results to return in a -- paginated response. listMembers_nextToken :: Lens.Lens' ListMembers (Prelude.Maybe Prelude.Text) listMembers_nextToken = Lens.lens (\ListMembers' {nextToken} -> nextToken) (\s@ListMembers' {} a -> s {nextToken = a} :: ListMembers) -- | Specifies which accounts to include in the response, based on the status -- of an account\'s relationship with the administrator account. By -- default, the response includes only current member accounts. To include -- all accounts, set this value to false. listMembers_onlyAssociated :: Lens.Lens' ListMembers (Prelude.Maybe Prelude.Text) listMembers_onlyAssociated = Lens.lens (\ListMembers' {onlyAssociated} -> onlyAssociated) (\s@ListMembers' {} a -> s {onlyAssociated = a} :: ListMembers) instance Core.AWSPager ListMembers where page rq rs | Core.stop ( rs Lens.^? listMembersResponse_nextToken Prelude.. Lens._Just ) = Prelude.Nothing | Core.stop ( rs Lens.^? listMembersResponse_members Prelude.. Lens._Just ) = Prelude.Nothing | Prelude.otherwise = Prelude.Just Prelude.$ rq Prelude.& listMembers_nextToken Lens..~ rs Lens.^? listMembersResponse_nextToken Prelude.. Lens._Just instance Core.AWSRequest ListMembers where type AWSResponse ListMembers = ListMembersResponse request overrides = Request.get (overrides defaultService) response = Response.receiveJSON ( \s h x -> ListMembersResponse' Prelude.<$> (x Data..?> "members" Core..!@ Prelude.mempty) Prelude.<*> (x Data..?> "nextToken") Prelude.<*> (Prelude.pure (Prelude.fromEnum s)) ) instance Prelude.Hashable ListMembers where hashWithSalt _salt ListMembers' {..} = _salt `Prelude.hashWithSalt` maxResults `Prelude.hashWithSalt` nextToken `Prelude.hashWithSalt` onlyAssociated instance Prelude.NFData ListMembers where rnf ListMembers' {..} = Prelude.rnf maxResults `Prelude.seq` Prelude.rnf nextToken `Prelude.seq` Prelude.rnf onlyAssociated instance Data.ToHeaders ListMembers where toHeaders = Prelude.const ( Prelude.mconcat [ "Content-Type" Data.=# ( "application/x-amz-json-1.1" :: Prelude.ByteString ) ] ) instance Data.ToPath ListMembers where toPath = Prelude.const "/members" instance Data.ToQuery ListMembers where toQuery ListMembers' {..} = Prelude.mconcat [ "maxResults" Data.=: maxResults, "nextToken" Data.=: nextToken, "onlyAssociated" Data.=: onlyAssociated ] -- | /See:/ 'newListMembersResponse' smart constructor. data ListMembersResponse = ListMembersResponse' { -- | An array of objects, one for each account that\'s associated with the -- administrator account and matches the criteria specified in the request. members :: Prelude.Maybe [Member], -- | The string to use in a subsequent request to get the next page of -- results in a paginated response. This value is null if there are no -- additional pages. nextToken :: Prelude.Maybe Prelude.Text, -- | The response's http status code. httpStatus :: Prelude.Int } deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'ListMembersResponse' 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: -- -- 'members', 'listMembersResponse_members' - An array of objects, one for each account that\'s associated with the -- administrator account and matches the criteria specified in the request. -- -- 'nextToken', 'listMembersResponse_nextToken' - The string to use in a subsequent request to get the next page of -- results in a paginated response. This value is null if there are no -- additional pages. -- -- 'httpStatus', 'listMembersResponse_httpStatus' - The response's http status code. newListMembersResponse :: -- | 'httpStatus' Prelude.Int -> ListMembersResponse newListMembersResponse pHttpStatus_ = ListMembersResponse' { members = Prelude.Nothing, nextToken = Prelude.Nothing, httpStatus = pHttpStatus_ } -- | An array of objects, one for each account that\'s associated with the -- administrator account and matches the criteria specified in the request. listMembersResponse_members :: Lens.Lens' ListMembersResponse (Prelude.Maybe [Member]) listMembersResponse_members = Lens.lens (\ListMembersResponse' {members} -> members) (\s@ListMembersResponse' {} a -> s {members = a} :: ListMembersResponse) Prelude.. Lens.mapping Lens.coerced -- | The string to use in a subsequent request to get the next page of -- results in a paginated response. This value is null if there are no -- additional pages. listMembersResponse_nextToken :: Lens.Lens' ListMembersResponse (Prelude.Maybe Prelude.Text) listMembersResponse_nextToken = Lens.lens (\ListMembersResponse' {nextToken} -> nextToken) (\s@ListMembersResponse' {} a -> s {nextToken = a} :: ListMembersResponse) -- | The response's http status code. listMembersResponse_httpStatus :: Lens.Lens' ListMembersResponse Prelude.Int listMembersResponse_httpStatus = Lens.lens (\ListMembersResponse' {httpStatus} -> httpStatus) (\s@ListMembersResponse' {} a -> s {httpStatus = a} :: ListMembersResponse) instance Prelude.NFData ListMembersResponse where rnf ListMembersResponse' {..} = Prelude.rnf members `Prelude.seq` Prelude.rnf nextToken `Prelude.seq` Prelude.rnf httpStatus