{-# 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.GuardDuty.ListOrganizationAdminAccounts -- Copyright : (c) 2013-2023 Brendan Hay -- License : Mozilla Public License, v. 2.0. -- Maintainer : Brendan Hay -- Stability : auto-generated -- Portability : non-portable (GHC extensions) -- -- Lists the accounts configured as GuardDuty delegated administrators. -- -- This operation returns paginated results. module Amazonka.GuardDuty.ListOrganizationAdminAccounts ( -- * Creating a Request ListOrganizationAdminAccounts (..), newListOrganizationAdminAccounts, -- * Request Lenses listOrganizationAdminAccounts_maxResults, listOrganizationAdminAccounts_nextToken, -- * Destructuring the Response ListOrganizationAdminAccountsResponse (..), newListOrganizationAdminAccountsResponse, -- * Response Lenses listOrganizationAdminAccountsResponse_adminAccounts, listOrganizationAdminAccountsResponse_nextToken, listOrganizationAdminAccountsResponse_httpStatus, ) where import qualified Amazonka.Core as Core import qualified Amazonka.Core.Lens.Internal as Lens import qualified Amazonka.Data as Data import Amazonka.GuardDuty.Types import qualified Amazonka.Prelude as Prelude import qualified Amazonka.Request as Request import qualified Amazonka.Response as Response -- | /See:/ 'newListOrganizationAdminAccounts' smart constructor. data ListOrganizationAdminAccounts = ListOrganizationAdminAccounts' { -- | The maximum number of results to return in the response. maxResults :: Prelude.Maybe Prelude.Natural, -- | A token to use for paginating results that are returned in the response. -- Set the value of this parameter to null for the first request to a list -- action. For subsequent calls, use the @NextToken@ value returned from -- the previous request to continue listing results after the first page. nextToken :: Prelude.Maybe Prelude.Text } deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'ListOrganizationAdminAccounts' 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', 'listOrganizationAdminAccounts_maxResults' - The maximum number of results to return in the response. -- -- 'nextToken', 'listOrganizationAdminAccounts_nextToken' - A token to use for paginating results that are returned in the response. -- Set the value of this parameter to null for the first request to a list -- action. For subsequent calls, use the @NextToken@ value returned from -- the previous request to continue listing results after the first page. newListOrganizationAdminAccounts :: ListOrganizationAdminAccounts newListOrganizationAdminAccounts = ListOrganizationAdminAccounts' { maxResults = Prelude.Nothing, nextToken = Prelude.Nothing } -- | The maximum number of results to return in the response. listOrganizationAdminAccounts_maxResults :: Lens.Lens' ListOrganizationAdminAccounts (Prelude.Maybe Prelude.Natural) listOrganizationAdminAccounts_maxResults = Lens.lens (\ListOrganizationAdminAccounts' {maxResults} -> maxResults) (\s@ListOrganizationAdminAccounts' {} a -> s {maxResults = a} :: ListOrganizationAdminAccounts) -- | A token to use for paginating results that are returned in the response. -- Set the value of this parameter to null for the first request to a list -- action. For subsequent calls, use the @NextToken@ value returned from -- the previous request to continue listing results after the first page. listOrganizationAdminAccounts_nextToken :: Lens.Lens' ListOrganizationAdminAccounts (Prelude.Maybe Prelude.Text) listOrganizationAdminAccounts_nextToken = Lens.lens (\ListOrganizationAdminAccounts' {nextToken} -> nextToken) (\s@ListOrganizationAdminAccounts' {} a -> s {nextToken = a} :: ListOrganizationAdminAccounts) instance Core.AWSPager ListOrganizationAdminAccounts where page rq rs | Core.stop ( rs Lens.^? listOrganizationAdminAccountsResponse_nextToken Prelude.. Lens._Just ) = Prelude.Nothing | Core.stop ( rs Lens.^? listOrganizationAdminAccountsResponse_adminAccounts Prelude.. Lens._Just ) = Prelude.Nothing | Prelude.otherwise = Prelude.Just Prelude.$ rq Prelude.& listOrganizationAdminAccounts_nextToken Lens..~ rs Lens.^? listOrganizationAdminAccountsResponse_nextToken Prelude.. Lens._Just instance Core.AWSRequest ListOrganizationAdminAccounts where type AWSResponse ListOrganizationAdminAccounts = ListOrganizationAdminAccountsResponse request overrides = Request.get (overrides defaultService) response = Response.receiveJSON ( \s h x -> ListOrganizationAdminAccountsResponse' Prelude.<$> (x Data..?> "adminAccounts" Core..!@ Prelude.mempty) Prelude.<*> (x Data..?> "nextToken") Prelude.<*> (Prelude.pure (Prelude.fromEnum s)) ) instance Prelude.Hashable ListOrganizationAdminAccounts where hashWithSalt _salt ListOrganizationAdminAccounts' {..} = _salt `Prelude.hashWithSalt` maxResults `Prelude.hashWithSalt` nextToken instance Prelude.NFData ListOrganizationAdminAccounts where rnf ListOrganizationAdminAccounts' {..} = Prelude.rnf maxResults `Prelude.seq` Prelude.rnf nextToken instance Data.ToHeaders ListOrganizationAdminAccounts where toHeaders = Prelude.const ( Prelude.mconcat [ "Content-Type" Data.=# ( "application/x-amz-json-1.1" :: Prelude.ByteString ) ] ) instance Data.ToPath ListOrganizationAdminAccounts where toPath = Prelude.const "/admin" instance Data.ToQuery ListOrganizationAdminAccounts where toQuery ListOrganizationAdminAccounts' {..} = Prelude.mconcat [ "maxResults" Data.=: maxResults, "nextToken" Data.=: nextToken ] -- | /See:/ 'newListOrganizationAdminAccountsResponse' smart constructor. data ListOrganizationAdminAccountsResponse = ListOrganizationAdminAccountsResponse' { -- | A list of accounts configured as GuardDuty delegated administrators. adminAccounts :: Prelude.Maybe [AdminAccount], -- | The pagination parameter to be used on the next list operation to -- retrieve more items. 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 'ListOrganizationAdminAccountsResponse' 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: -- -- 'adminAccounts', 'listOrganizationAdminAccountsResponse_adminAccounts' - A list of accounts configured as GuardDuty delegated administrators. -- -- 'nextToken', 'listOrganizationAdminAccountsResponse_nextToken' - The pagination parameter to be used on the next list operation to -- retrieve more items. -- -- 'httpStatus', 'listOrganizationAdminAccountsResponse_httpStatus' - The response's http status code. newListOrganizationAdminAccountsResponse :: -- | 'httpStatus' Prelude.Int -> ListOrganizationAdminAccountsResponse newListOrganizationAdminAccountsResponse pHttpStatus_ = ListOrganizationAdminAccountsResponse' { adminAccounts = Prelude.Nothing, nextToken = Prelude.Nothing, httpStatus = pHttpStatus_ } -- | A list of accounts configured as GuardDuty delegated administrators. listOrganizationAdminAccountsResponse_adminAccounts :: Lens.Lens' ListOrganizationAdminAccountsResponse (Prelude.Maybe [AdminAccount]) listOrganizationAdminAccountsResponse_adminAccounts = Lens.lens (\ListOrganizationAdminAccountsResponse' {adminAccounts} -> adminAccounts) (\s@ListOrganizationAdminAccountsResponse' {} a -> s {adminAccounts = a} :: ListOrganizationAdminAccountsResponse) Prelude.. Lens.mapping Lens.coerced -- | The pagination parameter to be used on the next list operation to -- retrieve more items. listOrganizationAdminAccountsResponse_nextToken :: Lens.Lens' ListOrganizationAdminAccountsResponse (Prelude.Maybe Prelude.Text) listOrganizationAdminAccountsResponse_nextToken = Lens.lens (\ListOrganizationAdminAccountsResponse' {nextToken} -> nextToken) (\s@ListOrganizationAdminAccountsResponse' {} a -> s {nextToken = a} :: ListOrganizationAdminAccountsResponse) -- | The response's http status code. listOrganizationAdminAccountsResponse_httpStatus :: Lens.Lens' ListOrganizationAdminAccountsResponse Prelude.Int listOrganizationAdminAccountsResponse_httpStatus = Lens.lens (\ListOrganizationAdminAccountsResponse' {httpStatus} -> httpStatus) (\s@ListOrganizationAdminAccountsResponse' {} a -> s {httpStatus = a} :: ListOrganizationAdminAccountsResponse) instance Prelude.NFData ListOrganizationAdminAccountsResponse where rnf ListOrganizationAdminAccountsResponse' {..} = Prelude.rnf adminAccounts `Prelude.seq` Prelude.rnf nextToken `Prelude.seq` Prelude.rnf httpStatus