{-# 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.AuditManager.ListNotifications -- Copyright : (c) 2013-2023 Brendan Hay -- License : Mozilla Public License, v. 2.0. -- Maintainer : Brendan Hay -- Stability : auto-generated -- Portability : non-portable (GHC extensions) -- -- Returns a list of all Audit Manager notifications. module Amazonka.AuditManager.ListNotifications ( -- * Creating a Request ListNotifications (..), newListNotifications, -- * Request Lenses listNotifications_maxResults, listNotifications_nextToken, -- * Destructuring the Response ListNotificationsResponse (..), newListNotificationsResponse, -- * Response Lenses listNotificationsResponse_nextToken, listNotificationsResponse_notifications, listNotificationsResponse_httpStatus, ) where import Amazonka.AuditManager.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:/ 'newListNotifications' smart constructor. data ListNotifications = ListNotifications' { -- | Represents the maximum number of results on a page or for an API request -- call. maxResults :: Prelude.Maybe Prelude.Natural, -- | The pagination token that\'s used to fetch the next set of results. nextToken :: Prelude.Maybe Prelude.Text } deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'ListNotifications' 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', 'listNotifications_maxResults' - Represents the maximum number of results on a page or for an API request -- call. -- -- 'nextToken', 'listNotifications_nextToken' - The pagination token that\'s used to fetch the next set of results. newListNotifications :: ListNotifications newListNotifications = ListNotifications' { maxResults = Prelude.Nothing, nextToken = Prelude.Nothing } -- | Represents the maximum number of results on a page or for an API request -- call. listNotifications_maxResults :: Lens.Lens' ListNotifications (Prelude.Maybe Prelude.Natural) listNotifications_maxResults = Lens.lens (\ListNotifications' {maxResults} -> maxResults) (\s@ListNotifications' {} a -> s {maxResults = a} :: ListNotifications) -- | The pagination token that\'s used to fetch the next set of results. listNotifications_nextToken :: Lens.Lens' ListNotifications (Prelude.Maybe Prelude.Text) listNotifications_nextToken = Lens.lens (\ListNotifications' {nextToken} -> nextToken) (\s@ListNotifications' {} a -> s {nextToken = a} :: ListNotifications) instance Core.AWSRequest ListNotifications where type AWSResponse ListNotifications = ListNotificationsResponse request overrides = Request.get (overrides defaultService) response = Response.receiveJSON ( \s h x -> ListNotificationsResponse' Prelude.<$> (x Data..?> "nextToken") Prelude.<*> (x Data..?> "notifications" Core..!@ Prelude.mempty) Prelude.<*> (Prelude.pure (Prelude.fromEnum s)) ) instance Prelude.Hashable ListNotifications where hashWithSalt _salt ListNotifications' {..} = _salt `Prelude.hashWithSalt` maxResults `Prelude.hashWithSalt` nextToken instance Prelude.NFData ListNotifications where rnf ListNotifications' {..} = Prelude.rnf maxResults `Prelude.seq` Prelude.rnf nextToken instance Data.ToHeaders ListNotifications where toHeaders = Prelude.const ( Prelude.mconcat [ "Content-Type" Data.=# ( "application/x-amz-json-1.1" :: Prelude.ByteString ) ] ) instance Data.ToPath ListNotifications where toPath = Prelude.const "/notifications" instance Data.ToQuery ListNotifications where toQuery ListNotifications' {..} = Prelude.mconcat [ "maxResults" Data.=: maxResults, "nextToken" Data.=: nextToken ] -- | /See:/ 'newListNotificationsResponse' smart constructor. data ListNotificationsResponse = ListNotificationsResponse' { -- | The pagination token that\'s used to fetch the next set of results. nextToken :: Prelude.Maybe Prelude.Text, -- | The returned list of notifications. notifications :: Prelude.Maybe [Notification], -- | The response's http status code. httpStatus :: Prelude.Int } deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'ListNotificationsResponse' 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: -- -- 'nextToken', 'listNotificationsResponse_nextToken' - The pagination token that\'s used to fetch the next set of results. -- -- 'notifications', 'listNotificationsResponse_notifications' - The returned list of notifications. -- -- 'httpStatus', 'listNotificationsResponse_httpStatus' - The response's http status code. newListNotificationsResponse :: -- | 'httpStatus' Prelude.Int -> ListNotificationsResponse newListNotificationsResponse pHttpStatus_ = ListNotificationsResponse' { nextToken = Prelude.Nothing, notifications = Prelude.Nothing, httpStatus = pHttpStatus_ } -- | The pagination token that\'s used to fetch the next set of results. listNotificationsResponse_nextToken :: Lens.Lens' ListNotificationsResponse (Prelude.Maybe Prelude.Text) listNotificationsResponse_nextToken = Lens.lens (\ListNotificationsResponse' {nextToken} -> nextToken) (\s@ListNotificationsResponse' {} a -> s {nextToken = a} :: ListNotificationsResponse) -- | The returned list of notifications. listNotificationsResponse_notifications :: Lens.Lens' ListNotificationsResponse (Prelude.Maybe [Notification]) listNotificationsResponse_notifications = Lens.lens (\ListNotificationsResponse' {notifications} -> notifications) (\s@ListNotificationsResponse' {} a -> s {notifications = a} :: ListNotificationsResponse) Prelude.. Lens.mapping Lens.coerced -- | The response's http status code. listNotificationsResponse_httpStatus :: Lens.Lens' ListNotificationsResponse Prelude.Int listNotificationsResponse_httpStatus = Lens.lens (\ListNotificationsResponse' {httpStatus} -> httpStatus) (\s@ListNotificationsResponse' {} a -> s {httpStatus = a} :: ListNotificationsResponse) instance Prelude.NFData ListNotificationsResponse where rnf ListNotificationsResponse' {..} = Prelude.rnf nextToken `Prelude.seq` Prelude.rnf notifications `Prelude.seq` Prelude.rnf httpStatus