{-# 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.SSMContacts.ListEngagements
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Lists all engagements that have happened in an incident.
--
-- This operation returns paginated results.
module Amazonka.SSMContacts.ListEngagements
  ( -- * Creating a Request
    ListEngagements (..),
    newListEngagements,

    -- * Request Lenses
    listEngagements_timeRangeValue,
    listEngagements_nextToken,
    listEngagements_incidentId,
    listEngagements_maxResults,

    -- * Destructuring the Response
    ListEngagementsResponse (..),
    newListEngagementsResponse,

    -- * Response Lenses
    listEngagementsResponse_nextToken,
    listEngagementsResponse_httpStatus,
    listEngagementsResponse_engagements,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.SSMContacts.Types

-- | /See:/ 'newListEngagements' smart constructor.
data ListEngagements = ListEngagements'
  { -- | The time range to lists engagements for an incident.
    ListEngagements -> Maybe TimeRange
timeRangeValue :: Prelude.Maybe TimeRange,
    -- | The pagination token to continue to the next page of results.
    ListEngagements -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the incident you\'re listing
    -- engagements for.
    ListEngagements -> Maybe Text
incidentId :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of engagements per page of results.
    ListEngagements -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
  }
  deriving (ListEngagements -> ListEngagements -> Bool
(ListEngagements -> ListEngagements -> Bool)
-> (ListEngagements -> ListEngagements -> Bool)
-> Eq ListEngagements
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListEngagements -> ListEngagements -> Bool
$c/= :: ListEngagements -> ListEngagements -> Bool
== :: ListEngagements -> ListEngagements -> Bool
$c== :: ListEngagements -> ListEngagements -> Bool
Prelude.Eq, ReadPrec [ListEngagements]
ReadPrec ListEngagements
Int -> ReadS ListEngagements
ReadS [ListEngagements]
(Int -> ReadS ListEngagements)
-> ReadS [ListEngagements]
-> ReadPrec ListEngagements
-> ReadPrec [ListEngagements]
-> Read ListEngagements
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListEngagements]
$creadListPrec :: ReadPrec [ListEngagements]
readPrec :: ReadPrec ListEngagements
$creadPrec :: ReadPrec ListEngagements
readList :: ReadS [ListEngagements]
$creadList :: ReadS [ListEngagements]
readsPrec :: Int -> ReadS ListEngagements
$creadsPrec :: Int -> ReadS ListEngagements
Prelude.Read, Int -> ListEngagements -> ShowS
[ListEngagements] -> ShowS
ListEngagements -> String
(Int -> ListEngagements -> ShowS)
-> (ListEngagements -> String)
-> ([ListEngagements] -> ShowS)
-> Show ListEngagements
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListEngagements] -> ShowS
$cshowList :: [ListEngagements] -> ShowS
show :: ListEngagements -> String
$cshow :: ListEngagements -> String
showsPrec :: Int -> ListEngagements -> ShowS
$cshowsPrec :: Int -> ListEngagements -> ShowS
Prelude.Show, (forall x. ListEngagements -> Rep ListEngagements x)
-> (forall x. Rep ListEngagements x -> ListEngagements)
-> Generic ListEngagements
forall x. Rep ListEngagements x -> ListEngagements
forall x. ListEngagements -> Rep ListEngagements x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListEngagements x -> ListEngagements
$cfrom :: forall x. ListEngagements -> Rep ListEngagements x
Prelude.Generic)

-- |
-- Create a value of 'ListEngagements' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'timeRangeValue', 'listEngagements_timeRangeValue' - The time range to lists engagements for an incident.
--
-- 'nextToken', 'listEngagements_nextToken' - The pagination token to continue to the next page of results.
--
-- 'incidentId', 'listEngagements_incidentId' - The Amazon Resource Name (ARN) of the incident you\'re listing
-- engagements for.
--
-- 'maxResults', 'listEngagements_maxResults' - The maximum number of engagements per page of results.
newListEngagements ::
  ListEngagements
newListEngagements :: ListEngagements
newListEngagements =
  ListEngagements' :: Maybe TimeRange
-> Maybe Text -> Maybe Text -> Maybe Natural -> ListEngagements
ListEngagements'
    { $sel:timeRangeValue:ListEngagements' :: Maybe TimeRange
timeRangeValue = Maybe TimeRange
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListEngagements' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:incidentId:ListEngagements' :: Maybe Text
incidentId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListEngagements' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | The time range to lists engagements for an incident.
listEngagements_timeRangeValue :: Lens.Lens' ListEngagements (Prelude.Maybe TimeRange)
listEngagements_timeRangeValue :: (Maybe TimeRange -> f (Maybe TimeRange))
-> ListEngagements -> f ListEngagements
listEngagements_timeRangeValue = (ListEngagements -> Maybe TimeRange)
-> (ListEngagements -> Maybe TimeRange -> ListEngagements)
-> Lens
     ListEngagements ListEngagements (Maybe TimeRange) (Maybe TimeRange)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEngagements' {Maybe TimeRange
timeRangeValue :: Maybe TimeRange
$sel:timeRangeValue:ListEngagements' :: ListEngagements -> Maybe TimeRange
timeRangeValue} -> Maybe TimeRange
timeRangeValue) (\s :: ListEngagements
s@ListEngagements' {} Maybe TimeRange
a -> ListEngagements
s {$sel:timeRangeValue:ListEngagements' :: Maybe TimeRange
timeRangeValue = Maybe TimeRange
a} :: ListEngagements)

-- | The pagination token to continue to the next page of results.
listEngagements_nextToken :: Lens.Lens' ListEngagements (Prelude.Maybe Prelude.Text)
listEngagements_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListEngagements -> f ListEngagements
listEngagements_nextToken = (ListEngagements -> Maybe Text)
-> (ListEngagements -> Maybe Text -> ListEngagements)
-> Lens ListEngagements ListEngagements (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEngagements' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListEngagements' :: ListEngagements -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListEngagements
s@ListEngagements' {} Maybe Text
a -> ListEngagements
s {$sel:nextToken:ListEngagements' :: Maybe Text
nextToken = Maybe Text
a} :: ListEngagements)

-- | The Amazon Resource Name (ARN) of the incident you\'re listing
-- engagements for.
listEngagements_incidentId :: Lens.Lens' ListEngagements (Prelude.Maybe Prelude.Text)
listEngagements_incidentId :: (Maybe Text -> f (Maybe Text))
-> ListEngagements -> f ListEngagements
listEngagements_incidentId = (ListEngagements -> Maybe Text)
-> (ListEngagements -> Maybe Text -> ListEngagements)
-> Lens ListEngagements ListEngagements (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEngagements' {Maybe Text
incidentId :: Maybe Text
$sel:incidentId:ListEngagements' :: ListEngagements -> Maybe Text
incidentId} -> Maybe Text
incidentId) (\s :: ListEngagements
s@ListEngagements' {} Maybe Text
a -> ListEngagements
s {$sel:incidentId:ListEngagements' :: Maybe Text
incidentId = Maybe Text
a} :: ListEngagements)

-- | The maximum number of engagements per page of results.
listEngagements_maxResults :: Lens.Lens' ListEngagements (Prelude.Maybe Prelude.Natural)
listEngagements_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListEngagements -> f ListEngagements
listEngagements_maxResults = (ListEngagements -> Maybe Natural)
-> (ListEngagements -> Maybe Natural -> ListEngagements)
-> Lens
     ListEngagements ListEngagements (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEngagements' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListEngagements' :: ListEngagements -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListEngagements
s@ListEngagements' {} Maybe Natural
a -> ListEngagements
s {$sel:maxResults:ListEngagements' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListEngagements)

instance Core.AWSPager ListEngagements where
  page :: ListEngagements
-> AWSResponse ListEngagements -> Maybe ListEngagements
page ListEngagements
rq AWSResponse ListEngagements
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListEngagements
ListEngagementsResponse
rs
            ListEngagementsResponse
-> Getting (First Text) ListEngagementsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListEngagementsResponse
-> Const (First Text) ListEngagementsResponse
Lens' ListEngagementsResponse (Maybe Text)
listEngagementsResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListEngagementsResponse
 -> Const (First Text) ListEngagementsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListEngagementsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListEngagements
forall a. Maybe a
Prelude.Nothing
    | [Engagement] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        (AWSResponse ListEngagements
ListEngagementsResponse
rs ListEngagementsResponse
-> Getting [Engagement] ListEngagementsResponse [Engagement]
-> [Engagement]
forall s a. s -> Getting a s a -> a
Lens.^. Getting [Engagement] ListEngagementsResponse [Engagement]
Lens' ListEngagementsResponse [Engagement]
listEngagementsResponse_engagements) =
      Maybe ListEngagements
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListEngagements -> Maybe ListEngagements
forall a. a -> Maybe a
Prelude.Just (ListEngagements -> Maybe ListEngagements)
-> ListEngagements -> Maybe ListEngagements
forall a b. (a -> b) -> a -> b
Prelude.$
        ListEngagements
rq
          ListEngagements
-> (ListEngagements -> ListEngagements) -> ListEngagements
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListEngagements -> Identity ListEngagements
Lens ListEngagements ListEngagements (Maybe Text) (Maybe Text)
listEngagements_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListEngagements -> Identity ListEngagements)
-> Maybe Text -> ListEngagements -> ListEngagements
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListEngagements
ListEngagementsResponse
rs
          ListEngagementsResponse
-> Getting (First Text) ListEngagementsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListEngagementsResponse
-> Const (First Text) ListEngagementsResponse
Lens' ListEngagementsResponse (Maybe Text)
listEngagementsResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListEngagementsResponse
 -> Const (First Text) ListEngagementsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListEngagementsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest ListEngagements where
  type
    AWSResponse ListEngagements =
      ListEngagementsResponse
  request :: ListEngagements -> Request ListEngagements
request = Service -> ListEngagements -> Request ListEngagements
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ListEngagements
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListEngagements)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListEngagements))
-> Logger
-> Service
-> Proxy ListEngagements
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListEngagements)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text -> Int -> [Engagement] -> ListEngagementsResponse
ListEngagementsResponse'
            (Maybe Text -> Int -> [Engagement] -> ListEngagementsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> [Engagement] -> ListEngagementsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"NextToken")
            Either String (Int -> [Engagement] -> ListEngagementsResponse)
-> Either String Int
-> Either String ([Engagement] -> ListEngagementsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
            Either String ([Engagement] -> ListEngagementsResponse)
-> Either String [Engagement]
-> Either String ListEngagementsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe [Engagement])
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Engagements" Either String (Maybe [Engagement])
-> [Engagement] -> Either String [Engagement]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Engagement]
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable ListEngagements

instance Prelude.NFData ListEngagements

instance Core.ToHeaders ListEngagements where
  toHeaders :: ListEngagements -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListEngagements -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"SSMContacts.ListEngagements" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON ListEngagements where
  toJSON :: ListEngagements -> Value
toJSON ListEngagements' {Maybe Natural
Maybe Text
Maybe TimeRange
maxResults :: Maybe Natural
incidentId :: Maybe Text
nextToken :: Maybe Text
timeRangeValue :: Maybe TimeRange
$sel:maxResults:ListEngagements' :: ListEngagements -> Maybe Natural
$sel:incidentId:ListEngagements' :: ListEngagements -> Maybe Text
$sel:nextToken:ListEngagements' :: ListEngagements -> Maybe Text
$sel:timeRangeValue:ListEngagements' :: ListEngagements -> Maybe TimeRange
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"TimeRangeValue" Text -> TimeRange -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (TimeRange -> Pair) -> Maybe TimeRange -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe TimeRange
timeRangeValue,
            (Text
"NextToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
            (Text
"IncidentId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
incidentId,
            (Text
"MaxResults" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults
          ]
      )

instance Core.ToPath ListEngagements where
  toPath :: ListEngagements -> ByteString
toPath = ByteString -> ListEngagements -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery ListEngagements where
  toQuery :: ListEngagements -> QueryString
toQuery = QueryString -> ListEngagements -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newListEngagementsResponse' smart constructor.
data ListEngagementsResponse = ListEngagementsResponse'
  { -- | The pagination token to continue to the next page of results.
    ListEngagementsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListEngagementsResponse -> Int
httpStatus :: Prelude.Int,
    -- | A list of each engagement that occurred during the specified time range
    -- of an incident.
    ListEngagementsResponse -> [Engagement]
engagements :: [Engagement]
  }
  deriving (ListEngagementsResponse -> ListEngagementsResponse -> Bool
(ListEngagementsResponse -> ListEngagementsResponse -> Bool)
-> (ListEngagementsResponse -> ListEngagementsResponse -> Bool)
-> Eq ListEngagementsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListEngagementsResponse -> ListEngagementsResponse -> Bool
$c/= :: ListEngagementsResponse -> ListEngagementsResponse -> Bool
== :: ListEngagementsResponse -> ListEngagementsResponse -> Bool
$c== :: ListEngagementsResponse -> ListEngagementsResponse -> Bool
Prelude.Eq, ReadPrec [ListEngagementsResponse]
ReadPrec ListEngagementsResponse
Int -> ReadS ListEngagementsResponse
ReadS [ListEngagementsResponse]
(Int -> ReadS ListEngagementsResponse)
-> ReadS [ListEngagementsResponse]
-> ReadPrec ListEngagementsResponse
-> ReadPrec [ListEngagementsResponse]
-> Read ListEngagementsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListEngagementsResponse]
$creadListPrec :: ReadPrec [ListEngagementsResponse]
readPrec :: ReadPrec ListEngagementsResponse
$creadPrec :: ReadPrec ListEngagementsResponse
readList :: ReadS [ListEngagementsResponse]
$creadList :: ReadS [ListEngagementsResponse]
readsPrec :: Int -> ReadS ListEngagementsResponse
$creadsPrec :: Int -> ReadS ListEngagementsResponse
Prelude.Read, Int -> ListEngagementsResponse -> ShowS
[ListEngagementsResponse] -> ShowS
ListEngagementsResponse -> String
(Int -> ListEngagementsResponse -> ShowS)
-> (ListEngagementsResponse -> String)
-> ([ListEngagementsResponse] -> ShowS)
-> Show ListEngagementsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListEngagementsResponse] -> ShowS
$cshowList :: [ListEngagementsResponse] -> ShowS
show :: ListEngagementsResponse -> String
$cshow :: ListEngagementsResponse -> String
showsPrec :: Int -> ListEngagementsResponse -> ShowS
$cshowsPrec :: Int -> ListEngagementsResponse -> ShowS
Prelude.Show, (forall x.
 ListEngagementsResponse -> Rep ListEngagementsResponse x)
-> (forall x.
    Rep ListEngagementsResponse x -> ListEngagementsResponse)
-> Generic ListEngagementsResponse
forall x. Rep ListEngagementsResponse x -> ListEngagementsResponse
forall x. ListEngagementsResponse -> Rep ListEngagementsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListEngagementsResponse x -> ListEngagementsResponse
$cfrom :: forall x. ListEngagementsResponse -> Rep ListEngagementsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListEngagementsResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'nextToken', 'listEngagementsResponse_nextToken' - The pagination token to continue to the next page of results.
--
-- 'httpStatus', 'listEngagementsResponse_httpStatus' - The response's http status code.
--
-- 'engagements', 'listEngagementsResponse_engagements' - A list of each engagement that occurred during the specified time range
-- of an incident.
newListEngagementsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListEngagementsResponse
newListEngagementsResponse :: Int -> ListEngagementsResponse
newListEngagementsResponse Int
pHttpStatus_ =
  ListEngagementsResponse' :: Maybe Text -> Int -> [Engagement] -> ListEngagementsResponse
ListEngagementsResponse'
    { $sel:nextToken:ListEngagementsResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListEngagementsResponse' :: Int
httpStatus = Int
pHttpStatus_,
      $sel:engagements:ListEngagementsResponse' :: [Engagement]
engagements = [Engagement]
forall a. Monoid a => a
Prelude.mempty
    }

-- | The pagination token to continue to the next page of results.
listEngagementsResponse_nextToken :: Lens.Lens' ListEngagementsResponse (Prelude.Maybe Prelude.Text)
listEngagementsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListEngagementsResponse -> f ListEngagementsResponse
listEngagementsResponse_nextToken = (ListEngagementsResponse -> Maybe Text)
-> (ListEngagementsResponse
    -> Maybe Text -> ListEngagementsResponse)
-> Lens' ListEngagementsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEngagementsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListEngagementsResponse' :: ListEngagementsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListEngagementsResponse
s@ListEngagementsResponse' {} Maybe Text
a -> ListEngagementsResponse
s {$sel:nextToken:ListEngagementsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListEngagementsResponse)

-- | The response's http status code.
listEngagementsResponse_httpStatus :: Lens.Lens' ListEngagementsResponse Prelude.Int
listEngagementsResponse_httpStatus :: (Int -> f Int)
-> ListEngagementsResponse -> f ListEngagementsResponse
listEngagementsResponse_httpStatus = (ListEngagementsResponse -> Int)
-> (ListEngagementsResponse -> Int -> ListEngagementsResponse)
-> Lens ListEngagementsResponse ListEngagementsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEngagementsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListEngagementsResponse' :: ListEngagementsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListEngagementsResponse
s@ListEngagementsResponse' {} Int
a -> ListEngagementsResponse
s {$sel:httpStatus:ListEngagementsResponse' :: Int
httpStatus = Int
a} :: ListEngagementsResponse)

-- | A list of each engagement that occurred during the specified time range
-- of an incident.
listEngagementsResponse_engagements :: Lens.Lens' ListEngagementsResponse [Engagement]
listEngagementsResponse_engagements :: ([Engagement] -> f [Engagement])
-> ListEngagementsResponse -> f ListEngagementsResponse
listEngagementsResponse_engagements = (ListEngagementsResponse -> [Engagement])
-> (ListEngagementsResponse
    -> [Engagement] -> ListEngagementsResponse)
-> Lens' ListEngagementsResponse [Engagement]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEngagementsResponse' {[Engagement]
engagements :: [Engagement]
$sel:engagements:ListEngagementsResponse' :: ListEngagementsResponse -> [Engagement]
engagements} -> [Engagement]
engagements) (\s :: ListEngagementsResponse
s@ListEngagementsResponse' {} [Engagement]
a -> ListEngagementsResponse
s {$sel:engagements:ListEngagementsResponse' :: [Engagement]
engagements = [Engagement]
a} :: ListEngagementsResponse) (([Engagement] -> f [Engagement])
 -> ListEngagementsResponse -> f ListEngagementsResponse)
-> (([Engagement] -> f [Engagement])
    -> [Engagement] -> f [Engagement])
-> ([Engagement] -> f [Engagement])
-> ListEngagementsResponse
-> f ListEngagementsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Engagement] -> f [Engagement]) -> [Engagement] -> f [Engagement]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Prelude.NFData ListEngagementsResponse