{-# 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.SecurityHub.ListInvitations -- 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 all Security Hub membership invitations that were sent to the -- current Amazon Web Services account. -- -- This operation is only used by accounts that are managed by invitation. -- Accounts that are managed using the integration with Organizations do -- not receive invitations. -- -- This operation returns paginated results. module Amazonka.SecurityHub.ListInvitations ( -- * Creating a Request ListInvitations (..), newListInvitations, -- * Request Lenses listInvitations_maxResults, listInvitations_nextToken, -- * Destructuring the Response ListInvitationsResponse (..), newListInvitationsResponse, -- * Response Lenses listInvitationsResponse_invitations, listInvitationsResponse_nextToken, listInvitationsResponse_httpStatus, ) where 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 import Amazonka.SecurityHub.Types -- | /See:/ 'newListInvitations' smart constructor. data ListInvitations = ListInvitations' { -- | The maximum number of items to return in the response. maxResults :: Prelude.Maybe Prelude.Natural, -- | The token that is required for pagination. On your first call to the -- @ListInvitations@ operation, set the value of this parameter to @NULL@. -- -- For subsequent calls to the operation, to continue listing data, set the -- value of this parameter to the value returned from the previous -- response. nextToken :: Prelude.Maybe Prelude.Text } deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'ListInvitations' 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', 'listInvitations_maxResults' - The maximum number of items to return in the response. -- -- 'nextToken', 'listInvitations_nextToken' - The token that is required for pagination. On your first call to the -- @ListInvitations@ operation, set the value of this parameter to @NULL@. -- -- For subsequent calls to the operation, to continue listing data, set the -- value of this parameter to the value returned from the previous -- response. newListInvitations :: ListInvitations newListInvitations = ListInvitations' { maxResults = Prelude.Nothing, nextToken = Prelude.Nothing } -- | The maximum number of items to return in the response. listInvitations_maxResults :: Lens.Lens' ListInvitations (Prelude.Maybe Prelude.Natural) listInvitations_maxResults = Lens.lens (\ListInvitations' {maxResults} -> maxResults) (\s@ListInvitations' {} a -> s {maxResults = a} :: ListInvitations) -- | The token that is required for pagination. On your first call to the -- @ListInvitations@ operation, set the value of this parameter to @NULL@. -- -- For subsequent calls to the operation, to continue listing data, set the -- value of this parameter to the value returned from the previous -- response. listInvitations_nextToken :: Lens.Lens' ListInvitations (Prelude.Maybe Prelude.Text) listInvitations_nextToken = Lens.lens (\ListInvitations' {nextToken} -> nextToken) (\s@ListInvitations' {} a -> s {nextToken = a} :: ListInvitations) instance Core.AWSPager ListInvitations where page rq rs | Core.stop ( rs Lens.^? listInvitationsResponse_nextToken Prelude.. Lens._Just ) = Prelude.Nothing | Core.stop ( rs Lens.^? listInvitationsResponse_invitations Prelude.. Lens._Just ) = Prelude.Nothing | Prelude.otherwise = Prelude.Just Prelude.$ rq Prelude.& listInvitations_nextToken Lens..~ rs Lens.^? listInvitationsResponse_nextToken Prelude.. Lens._Just instance Core.AWSRequest ListInvitations where type AWSResponse ListInvitations = ListInvitationsResponse request overrides = Request.get (overrides defaultService) response = Response.receiveJSON ( \s h x -> ListInvitationsResponse' Prelude.<$> (x Data..?> "Invitations" Core..!@ Prelude.mempty) Prelude.<*> (x Data..?> "NextToken") Prelude.<*> (Prelude.pure (Prelude.fromEnum s)) ) instance Prelude.Hashable ListInvitations where hashWithSalt _salt ListInvitations' {..} = _salt `Prelude.hashWithSalt` maxResults `Prelude.hashWithSalt` nextToken instance Prelude.NFData ListInvitations where rnf ListInvitations' {..} = Prelude.rnf maxResults `Prelude.seq` Prelude.rnf nextToken instance Data.ToHeaders ListInvitations where toHeaders = Prelude.const ( Prelude.mconcat [ "Content-Type" Data.=# ( "application/x-amz-json-1.1" :: Prelude.ByteString ) ] ) instance Data.ToPath ListInvitations where toPath = Prelude.const "/invitations" instance Data.ToQuery ListInvitations where toQuery ListInvitations' {..} = Prelude.mconcat [ "MaxResults" Data.=: maxResults, "NextToken" Data.=: nextToken ] -- | /See:/ 'newListInvitationsResponse' smart constructor. data ListInvitationsResponse = ListInvitationsResponse' { -- | The details of the invitations returned by the operation. invitations :: Prelude.Maybe [Invitation], -- | The pagination token to use to request the next page of results. 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 'ListInvitationsResponse' 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: -- -- 'invitations', 'listInvitationsResponse_invitations' - The details of the invitations returned by the operation. -- -- 'nextToken', 'listInvitationsResponse_nextToken' - The pagination token to use to request the next page of results. -- -- 'httpStatus', 'listInvitationsResponse_httpStatus' - The response's http status code. newListInvitationsResponse :: -- | 'httpStatus' Prelude.Int -> ListInvitationsResponse newListInvitationsResponse pHttpStatus_ = ListInvitationsResponse' { invitations = Prelude.Nothing, nextToken = Prelude.Nothing, httpStatus = pHttpStatus_ } -- | The details of the invitations returned by the operation. listInvitationsResponse_invitations :: Lens.Lens' ListInvitationsResponse (Prelude.Maybe [Invitation]) listInvitationsResponse_invitations = Lens.lens (\ListInvitationsResponse' {invitations} -> invitations) (\s@ListInvitationsResponse' {} a -> s {invitations = a} :: ListInvitationsResponse) Prelude.. Lens.mapping Lens.coerced -- | The pagination token to use to request the next page of results. listInvitationsResponse_nextToken :: Lens.Lens' ListInvitationsResponse (Prelude.Maybe Prelude.Text) listInvitationsResponse_nextToken = Lens.lens (\ListInvitationsResponse' {nextToken} -> nextToken) (\s@ListInvitationsResponse' {} a -> s {nextToken = a} :: ListInvitationsResponse) -- | The response's http status code. listInvitationsResponse_httpStatus :: Lens.Lens' ListInvitationsResponse Prelude.Int listInvitationsResponse_httpStatus = Lens.lens (\ListInvitationsResponse' {httpStatus} -> httpStatus) (\s@ListInvitationsResponse' {} a -> s {httpStatus = a} :: ListInvitationsResponse) instance Prelude.NFData ListInvitationsResponse where rnf ListInvitationsResponse' {..} = Prelude.rnf invitations `Prelude.seq` Prelude.rnf nextToken `Prelude.seq` Prelude.rnf httpStatus