{-# 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.SSM.ListOpsItemEvents
-- 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)
--
-- Returns a list of all OpsItem events in the current Amazon Web Services
-- Region and Amazon Web Services account. You can limit the results to
-- events associated with specific OpsItems by specifying a filter.
--
-- This operation returns paginated results.
module Amazonka.SSM.ListOpsItemEvents
  ( -- * Creating a Request
    ListOpsItemEvents (..),
    newListOpsItemEvents,

    -- * Request Lenses
    listOpsItemEvents_filters,
    listOpsItemEvents_nextToken,
    listOpsItemEvents_maxResults,

    -- * Destructuring the Response
    ListOpsItemEventsResponse (..),
    newListOpsItemEventsResponse,

    -- * Response Lenses
    listOpsItemEventsResponse_nextToken,
    listOpsItemEventsResponse_summaries,
    listOpsItemEventsResponse_httpStatus,
  )
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.SSM.Types

-- | /See:/ 'newListOpsItemEvents' smart constructor.
data ListOpsItemEvents = ListOpsItemEvents'
  { -- | One or more OpsItem filters. Use a filter to return a more specific list
    -- of results.
    ListOpsItemEvents -> Maybe [OpsItemEventFilter]
filters :: Prelude.Maybe [OpsItemEventFilter],
    -- | A token to start the list. Use this token to get the next set of
    -- results.
    ListOpsItemEvents -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of items to return for this call. The call also
    -- returns a token that you can specify in a subsequent call to get the
    -- next set of results.
    ListOpsItemEvents -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
  }
  deriving (ListOpsItemEvents -> ListOpsItemEvents -> Bool
(ListOpsItemEvents -> ListOpsItemEvents -> Bool)
-> (ListOpsItemEvents -> ListOpsItemEvents -> Bool)
-> Eq ListOpsItemEvents
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListOpsItemEvents -> ListOpsItemEvents -> Bool
$c/= :: ListOpsItemEvents -> ListOpsItemEvents -> Bool
== :: ListOpsItemEvents -> ListOpsItemEvents -> Bool
$c== :: ListOpsItemEvents -> ListOpsItemEvents -> Bool
Prelude.Eq, ReadPrec [ListOpsItemEvents]
ReadPrec ListOpsItemEvents
Int -> ReadS ListOpsItemEvents
ReadS [ListOpsItemEvents]
(Int -> ReadS ListOpsItemEvents)
-> ReadS [ListOpsItemEvents]
-> ReadPrec ListOpsItemEvents
-> ReadPrec [ListOpsItemEvents]
-> Read ListOpsItemEvents
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListOpsItemEvents]
$creadListPrec :: ReadPrec [ListOpsItemEvents]
readPrec :: ReadPrec ListOpsItemEvents
$creadPrec :: ReadPrec ListOpsItemEvents
readList :: ReadS [ListOpsItemEvents]
$creadList :: ReadS [ListOpsItemEvents]
readsPrec :: Int -> ReadS ListOpsItemEvents
$creadsPrec :: Int -> ReadS ListOpsItemEvents
Prelude.Read, Int -> ListOpsItemEvents -> ShowS
[ListOpsItemEvents] -> ShowS
ListOpsItemEvents -> String
(Int -> ListOpsItemEvents -> ShowS)
-> (ListOpsItemEvents -> String)
-> ([ListOpsItemEvents] -> ShowS)
-> Show ListOpsItemEvents
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListOpsItemEvents] -> ShowS
$cshowList :: [ListOpsItemEvents] -> ShowS
show :: ListOpsItemEvents -> String
$cshow :: ListOpsItemEvents -> String
showsPrec :: Int -> ListOpsItemEvents -> ShowS
$cshowsPrec :: Int -> ListOpsItemEvents -> ShowS
Prelude.Show, (forall x. ListOpsItemEvents -> Rep ListOpsItemEvents x)
-> (forall x. Rep ListOpsItemEvents x -> ListOpsItemEvents)
-> Generic ListOpsItemEvents
forall x. Rep ListOpsItemEvents x -> ListOpsItemEvents
forall x. ListOpsItemEvents -> Rep ListOpsItemEvents x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListOpsItemEvents x -> ListOpsItemEvents
$cfrom :: forall x. ListOpsItemEvents -> Rep ListOpsItemEvents x
Prelude.Generic)

-- |
-- Create a value of 'ListOpsItemEvents' 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:
--
-- 'filters', 'listOpsItemEvents_filters' - One or more OpsItem filters. Use a filter to return a more specific list
-- of results.
--
-- 'nextToken', 'listOpsItemEvents_nextToken' - A token to start the list. Use this token to get the next set of
-- results.
--
-- 'maxResults', 'listOpsItemEvents_maxResults' - The maximum number of items to return for this call. The call also
-- returns a token that you can specify in a subsequent call to get the
-- next set of results.
newListOpsItemEvents ::
  ListOpsItemEvents
newListOpsItemEvents :: ListOpsItemEvents
newListOpsItemEvents =
  ListOpsItemEvents' :: Maybe [OpsItemEventFilter]
-> Maybe Text -> Maybe Natural -> ListOpsItemEvents
ListOpsItemEvents'
    { $sel:filters:ListOpsItemEvents' :: Maybe [OpsItemEventFilter]
filters = Maybe [OpsItemEventFilter]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListOpsItemEvents' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListOpsItemEvents' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | One or more OpsItem filters. Use a filter to return a more specific list
-- of results.
listOpsItemEvents_filters :: Lens.Lens' ListOpsItemEvents (Prelude.Maybe [OpsItemEventFilter])
listOpsItemEvents_filters :: (Maybe [OpsItemEventFilter] -> f (Maybe [OpsItemEventFilter]))
-> ListOpsItemEvents -> f ListOpsItemEvents
listOpsItemEvents_filters = (ListOpsItemEvents -> Maybe [OpsItemEventFilter])
-> (ListOpsItemEvents
    -> Maybe [OpsItemEventFilter] -> ListOpsItemEvents)
-> Lens
     ListOpsItemEvents
     ListOpsItemEvents
     (Maybe [OpsItemEventFilter])
     (Maybe [OpsItemEventFilter])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListOpsItemEvents' {Maybe [OpsItemEventFilter]
filters :: Maybe [OpsItemEventFilter]
$sel:filters:ListOpsItemEvents' :: ListOpsItemEvents -> Maybe [OpsItemEventFilter]
filters} -> Maybe [OpsItemEventFilter]
filters) (\s :: ListOpsItemEvents
s@ListOpsItemEvents' {} Maybe [OpsItemEventFilter]
a -> ListOpsItemEvents
s {$sel:filters:ListOpsItemEvents' :: Maybe [OpsItemEventFilter]
filters = Maybe [OpsItemEventFilter]
a} :: ListOpsItemEvents) ((Maybe [OpsItemEventFilter] -> f (Maybe [OpsItemEventFilter]))
 -> ListOpsItemEvents -> f ListOpsItemEvents)
-> ((Maybe [OpsItemEventFilter] -> f (Maybe [OpsItemEventFilter]))
    -> Maybe [OpsItemEventFilter] -> f (Maybe [OpsItemEventFilter]))
-> (Maybe [OpsItemEventFilter] -> f (Maybe [OpsItemEventFilter]))
-> ListOpsItemEvents
-> f ListOpsItemEvents
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [OpsItemEventFilter]
  [OpsItemEventFilter]
  [OpsItemEventFilter]
  [OpsItemEventFilter]
-> Iso
     (Maybe [OpsItemEventFilter])
     (Maybe [OpsItemEventFilter])
     (Maybe [OpsItemEventFilter])
     (Maybe [OpsItemEventFilter])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  [OpsItemEventFilter]
  [OpsItemEventFilter]
  [OpsItemEventFilter]
  [OpsItemEventFilter]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A token to start the list. Use this token to get the next set of
-- results.
listOpsItemEvents_nextToken :: Lens.Lens' ListOpsItemEvents (Prelude.Maybe Prelude.Text)
listOpsItemEvents_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListOpsItemEvents -> f ListOpsItemEvents
listOpsItemEvents_nextToken = (ListOpsItemEvents -> Maybe Text)
-> (ListOpsItemEvents -> Maybe Text -> ListOpsItemEvents)
-> Lens
     ListOpsItemEvents ListOpsItemEvents (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListOpsItemEvents' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListOpsItemEvents' :: ListOpsItemEvents -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListOpsItemEvents
s@ListOpsItemEvents' {} Maybe Text
a -> ListOpsItemEvents
s {$sel:nextToken:ListOpsItemEvents' :: Maybe Text
nextToken = Maybe Text
a} :: ListOpsItemEvents)

-- | The maximum number of items to return for this call. The call also
-- returns a token that you can specify in a subsequent call to get the
-- next set of results.
listOpsItemEvents_maxResults :: Lens.Lens' ListOpsItemEvents (Prelude.Maybe Prelude.Natural)
listOpsItemEvents_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListOpsItemEvents -> f ListOpsItemEvents
listOpsItemEvents_maxResults = (ListOpsItemEvents -> Maybe Natural)
-> (ListOpsItemEvents -> Maybe Natural -> ListOpsItemEvents)
-> Lens
     ListOpsItemEvents ListOpsItemEvents (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListOpsItemEvents' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListOpsItemEvents' :: ListOpsItemEvents -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListOpsItemEvents
s@ListOpsItemEvents' {} Maybe Natural
a -> ListOpsItemEvents
s {$sel:maxResults:ListOpsItemEvents' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListOpsItemEvents)

instance Core.AWSPager ListOpsItemEvents where
  page :: ListOpsItemEvents
-> AWSResponse ListOpsItemEvents -> Maybe ListOpsItemEvents
page ListOpsItemEvents
rq AWSResponse ListOpsItemEvents
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListOpsItemEvents
ListOpsItemEventsResponse
rs
            ListOpsItemEventsResponse
-> Getting (First Text) ListOpsItemEventsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListOpsItemEventsResponse
-> Const (First Text) ListOpsItemEventsResponse
Lens' ListOpsItemEventsResponse (Maybe Text)
listOpsItemEventsResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListOpsItemEventsResponse
 -> Const (First Text) ListOpsItemEventsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListOpsItemEventsResponse 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 ListOpsItemEvents
forall a. Maybe a
Prelude.Nothing
    | Maybe [OpsItemEventSummary] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListOpsItemEvents
ListOpsItemEventsResponse
rs
            ListOpsItemEventsResponse
-> Getting
     (First [OpsItemEventSummary])
     ListOpsItemEventsResponse
     [OpsItemEventSummary]
-> Maybe [OpsItemEventSummary]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [OpsItemEventSummary]
 -> Const
      (First [OpsItemEventSummary]) (Maybe [OpsItemEventSummary]))
-> ListOpsItemEventsResponse
-> Const (First [OpsItemEventSummary]) ListOpsItemEventsResponse
Lens' ListOpsItemEventsResponse (Maybe [OpsItemEventSummary])
listOpsItemEventsResponse_summaries
              ((Maybe [OpsItemEventSummary]
  -> Const
       (First [OpsItemEventSummary]) (Maybe [OpsItemEventSummary]))
 -> ListOpsItemEventsResponse
 -> Const (First [OpsItemEventSummary]) ListOpsItemEventsResponse)
-> (([OpsItemEventSummary]
     -> Const (First [OpsItemEventSummary]) [OpsItemEventSummary])
    -> Maybe [OpsItemEventSummary]
    -> Const
         (First [OpsItemEventSummary]) (Maybe [OpsItemEventSummary]))
-> Getting
     (First [OpsItemEventSummary])
     ListOpsItemEventsResponse
     [OpsItemEventSummary]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([OpsItemEventSummary]
 -> Const (First [OpsItemEventSummary]) [OpsItemEventSummary])
-> Maybe [OpsItemEventSummary]
-> Const
     (First [OpsItemEventSummary]) (Maybe [OpsItemEventSummary])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListOpsItemEvents
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListOpsItemEvents -> Maybe ListOpsItemEvents
forall a. a -> Maybe a
Prelude.Just (ListOpsItemEvents -> Maybe ListOpsItemEvents)
-> ListOpsItemEvents -> Maybe ListOpsItemEvents
forall a b. (a -> b) -> a -> b
Prelude.$
        ListOpsItemEvents
rq
          ListOpsItemEvents
-> (ListOpsItemEvents -> ListOpsItemEvents) -> ListOpsItemEvents
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListOpsItemEvents -> Identity ListOpsItemEvents
Lens ListOpsItemEvents ListOpsItemEvents (Maybe Text) (Maybe Text)
listOpsItemEvents_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListOpsItemEvents -> Identity ListOpsItemEvents)
-> Maybe Text -> ListOpsItemEvents -> ListOpsItemEvents
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListOpsItemEvents
ListOpsItemEventsResponse
rs
          ListOpsItemEventsResponse
-> Getting (First Text) ListOpsItemEventsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListOpsItemEventsResponse
-> Const (First Text) ListOpsItemEventsResponse
Lens' ListOpsItemEventsResponse (Maybe Text)
listOpsItemEventsResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListOpsItemEventsResponse
 -> Const (First Text) ListOpsItemEventsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListOpsItemEventsResponse 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 ListOpsItemEvents where
  type
    AWSResponse ListOpsItemEvents =
      ListOpsItemEventsResponse
  request :: ListOpsItemEvents -> Request ListOpsItemEvents
request = Service -> ListOpsItemEvents -> Request ListOpsItemEvents
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ListOpsItemEvents
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListOpsItemEvents)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListOpsItemEvents))
-> Logger
-> Service
-> Proxy ListOpsItemEvents
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListOpsItemEvents)))
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
-> Maybe [OpsItemEventSummary] -> Int -> ListOpsItemEventsResponse
ListOpsItemEventsResponse'
            (Maybe Text
 -> Maybe [OpsItemEventSummary] -> Int -> ListOpsItemEventsResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe [OpsItemEventSummary] -> Int -> ListOpsItemEventsResponse)
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
  (Maybe [OpsItemEventSummary] -> Int -> ListOpsItemEventsResponse)
-> Either String (Maybe [OpsItemEventSummary])
-> Either String (Int -> ListOpsItemEventsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text -> Either String (Maybe (Maybe [OpsItemEventSummary]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Summaries" Either String (Maybe (Maybe [OpsItemEventSummary]))
-> Maybe [OpsItemEventSummary]
-> Either String (Maybe [OpsItemEventSummary])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [OpsItemEventSummary]
forall a. Monoid a => a
Prelude.mempty)
            Either String (Int -> ListOpsItemEventsResponse)
-> Either String Int -> Either String ListOpsItemEventsResponse
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))
      )

instance Prelude.Hashable ListOpsItemEvents

instance Prelude.NFData ListOpsItemEvents

instance Core.ToHeaders ListOpsItemEvents where
  toHeaders :: ListOpsItemEvents -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListOpsItemEvents -> 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
"AmazonSSM.ListOpsItemEvents" ::
                          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 ListOpsItemEvents where
  toJSON :: ListOpsItemEvents -> Value
toJSON ListOpsItemEvents' {Maybe Natural
Maybe [OpsItemEventFilter]
Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
filters :: Maybe [OpsItemEventFilter]
$sel:maxResults:ListOpsItemEvents' :: ListOpsItemEvents -> Maybe Natural
$sel:nextToken:ListOpsItemEvents' :: ListOpsItemEvents -> Maybe Text
$sel:filters:ListOpsItemEvents' :: ListOpsItemEvents -> Maybe [OpsItemEventFilter]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Filters" Text -> [OpsItemEventFilter] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([OpsItemEventFilter] -> Pair)
-> Maybe [OpsItemEventFilter] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [OpsItemEventFilter]
filters,
            (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
"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 ListOpsItemEvents where
  toPath :: ListOpsItemEvents -> ByteString
toPath = ByteString -> ListOpsItemEvents -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

-- | /See:/ 'newListOpsItemEventsResponse' smart constructor.
data ListOpsItemEventsResponse = ListOpsItemEventsResponse'
  { -- | The token for the next set of items to return. Use this token to get the
    -- next set of results.
    ListOpsItemEventsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | A list of event information for the specified OpsItems.
    ListOpsItemEventsResponse -> Maybe [OpsItemEventSummary]
summaries :: Prelude.Maybe [OpsItemEventSummary],
    -- | The response's http status code.
    ListOpsItemEventsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListOpsItemEventsResponse -> ListOpsItemEventsResponse -> Bool
(ListOpsItemEventsResponse -> ListOpsItemEventsResponse -> Bool)
-> (ListOpsItemEventsResponse -> ListOpsItemEventsResponse -> Bool)
-> Eq ListOpsItemEventsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListOpsItemEventsResponse -> ListOpsItemEventsResponse -> Bool
$c/= :: ListOpsItemEventsResponse -> ListOpsItemEventsResponse -> Bool
== :: ListOpsItemEventsResponse -> ListOpsItemEventsResponse -> Bool
$c== :: ListOpsItemEventsResponse -> ListOpsItemEventsResponse -> Bool
Prelude.Eq, ReadPrec [ListOpsItemEventsResponse]
ReadPrec ListOpsItemEventsResponse
Int -> ReadS ListOpsItemEventsResponse
ReadS [ListOpsItemEventsResponse]
(Int -> ReadS ListOpsItemEventsResponse)
-> ReadS [ListOpsItemEventsResponse]
-> ReadPrec ListOpsItemEventsResponse
-> ReadPrec [ListOpsItemEventsResponse]
-> Read ListOpsItemEventsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListOpsItemEventsResponse]
$creadListPrec :: ReadPrec [ListOpsItemEventsResponse]
readPrec :: ReadPrec ListOpsItemEventsResponse
$creadPrec :: ReadPrec ListOpsItemEventsResponse
readList :: ReadS [ListOpsItemEventsResponse]
$creadList :: ReadS [ListOpsItemEventsResponse]
readsPrec :: Int -> ReadS ListOpsItemEventsResponse
$creadsPrec :: Int -> ReadS ListOpsItemEventsResponse
Prelude.Read, Int -> ListOpsItemEventsResponse -> ShowS
[ListOpsItemEventsResponse] -> ShowS
ListOpsItemEventsResponse -> String
(Int -> ListOpsItemEventsResponse -> ShowS)
-> (ListOpsItemEventsResponse -> String)
-> ([ListOpsItemEventsResponse] -> ShowS)
-> Show ListOpsItemEventsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListOpsItemEventsResponse] -> ShowS
$cshowList :: [ListOpsItemEventsResponse] -> ShowS
show :: ListOpsItemEventsResponse -> String
$cshow :: ListOpsItemEventsResponse -> String
showsPrec :: Int -> ListOpsItemEventsResponse -> ShowS
$cshowsPrec :: Int -> ListOpsItemEventsResponse -> ShowS
Prelude.Show, (forall x.
 ListOpsItemEventsResponse -> Rep ListOpsItemEventsResponse x)
-> (forall x.
    Rep ListOpsItemEventsResponse x -> ListOpsItemEventsResponse)
-> Generic ListOpsItemEventsResponse
forall x.
Rep ListOpsItemEventsResponse x -> ListOpsItemEventsResponse
forall x.
ListOpsItemEventsResponse -> Rep ListOpsItemEventsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListOpsItemEventsResponse x -> ListOpsItemEventsResponse
$cfrom :: forall x.
ListOpsItemEventsResponse -> Rep ListOpsItemEventsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListOpsItemEventsResponse' 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', 'listOpsItemEventsResponse_nextToken' - The token for the next set of items to return. Use this token to get the
-- next set of results.
--
-- 'summaries', 'listOpsItemEventsResponse_summaries' - A list of event information for the specified OpsItems.
--
-- 'httpStatus', 'listOpsItemEventsResponse_httpStatus' - The response's http status code.
newListOpsItemEventsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListOpsItemEventsResponse
newListOpsItemEventsResponse :: Int -> ListOpsItemEventsResponse
newListOpsItemEventsResponse Int
pHttpStatus_ =
  ListOpsItemEventsResponse' :: Maybe Text
-> Maybe [OpsItemEventSummary] -> Int -> ListOpsItemEventsResponse
ListOpsItemEventsResponse'
    { $sel:nextToken:ListOpsItemEventsResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:summaries:ListOpsItemEventsResponse' :: Maybe [OpsItemEventSummary]
summaries = Maybe [OpsItemEventSummary]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListOpsItemEventsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The token for the next set of items to return. Use this token to get the
-- next set of results.
listOpsItemEventsResponse_nextToken :: Lens.Lens' ListOpsItemEventsResponse (Prelude.Maybe Prelude.Text)
listOpsItemEventsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListOpsItemEventsResponse -> f ListOpsItemEventsResponse
listOpsItemEventsResponse_nextToken = (ListOpsItemEventsResponse -> Maybe Text)
-> (ListOpsItemEventsResponse
    -> Maybe Text -> ListOpsItemEventsResponse)
-> Lens' ListOpsItemEventsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListOpsItemEventsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListOpsItemEventsResponse' :: ListOpsItemEventsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListOpsItemEventsResponse
s@ListOpsItemEventsResponse' {} Maybe Text
a -> ListOpsItemEventsResponse
s {$sel:nextToken:ListOpsItemEventsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListOpsItemEventsResponse)

-- | A list of event information for the specified OpsItems.
listOpsItemEventsResponse_summaries :: Lens.Lens' ListOpsItemEventsResponse (Prelude.Maybe [OpsItemEventSummary])
listOpsItemEventsResponse_summaries :: (Maybe [OpsItemEventSummary] -> f (Maybe [OpsItemEventSummary]))
-> ListOpsItemEventsResponse -> f ListOpsItemEventsResponse
listOpsItemEventsResponse_summaries = (ListOpsItemEventsResponse -> Maybe [OpsItemEventSummary])
-> (ListOpsItemEventsResponse
    -> Maybe [OpsItemEventSummary] -> ListOpsItemEventsResponse)
-> Lens' ListOpsItemEventsResponse (Maybe [OpsItemEventSummary])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListOpsItemEventsResponse' {Maybe [OpsItemEventSummary]
summaries :: Maybe [OpsItemEventSummary]
$sel:summaries:ListOpsItemEventsResponse' :: ListOpsItemEventsResponse -> Maybe [OpsItemEventSummary]
summaries} -> Maybe [OpsItemEventSummary]
summaries) (\s :: ListOpsItemEventsResponse
s@ListOpsItemEventsResponse' {} Maybe [OpsItemEventSummary]
a -> ListOpsItemEventsResponse
s {$sel:summaries:ListOpsItemEventsResponse' :: Maybe [OpsItemEventSummary]
summaries = Maybe [OpsItemEventSummary]
a} :: ListOpsItemEventsResponse) ((Maybe [OpsItemEventSummary] -> f (Maybe [OpsItemEventSummary]))
 -> ListOpsItemEventsResponse -> f ListOpsItemEventsResponse)
-> ((Maybe [OpsItemEventSummary]
     -> f (Maybe [OpsItemEventSummary]))
    -> Maybe [OpsItemEventSummary] -> f (Maybe [OpsItemEventSummary]))
-> (Maybe [OpsItemEventSummary] -> f (Maybe [OpsItemEventSummary]))
-> ListOpsItemEventsResponse
-> f ListOpsItemEventsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [OpsItemEventSummary]
  [OpsItemEventSummary]
  [OpsItemEventSummary]
  [OpsItemEventSummary]
-> Iso
     (Maybe [OpsItemEventSummary])
     (Maybe [OpsItemEventSummary])
     (Maybe [OpsItemEventSummary])
     (Maybe [OpsItemEventSummary])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  [OpsItemEventSummary]
  [OpsItemEventSummary]
  [OpsItemEventSummary]
  [OpsItemEventSummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData ListOpsItemEventsResponse