{-# 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.SSMIncidents.ListRelatedItems
-- 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)
--
-- List all related items for an incident record.
--
-- This operation returns paginated results.
module Amazonka.SSMIncidents.ListRelatedItems
  ( -- * Creating a Request
    ListRelatedItems (..),
    newListRelatedItems,

    -- * Request Lenses
    listRelatedItems_nextToken,
    listRelatedItems_maxResults,
    listRelatedItems_incidentRecordArn,

    -- * Destructuring the Response
    ListRelatedItemsResponse (..),
    newListRelatedItemsResponse,

    -- * Response Lenses
    listRelatedItemsResponse_nextToken,
    listRelatedItemsResponse_httpStatus,
    listRelatedItemsResponse_relatedItems,
  )
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.SSMIncidents.Types

-- | /See:/ 'newListRelatedItems' smart constructor.
data ListRelatedItems = ListRelatedItems'
  { -- | The pagination token to continue to the next page of results.
    ListRelatedItems -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of related items per page.
    ListRelatedItems -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The Amazon Resource Name (ARN) of the incident record that you are
    -- listing related items for.
    ListRelatedItems -> Text
incidentRecordArn :: Prelude.Text
  }
  deriving (ListRelatedItems -> ListRelatedItems -> Bool
(ListRelatedItems -> ListRelatedItems -> Bool)
-> (ListRelatedItems -> ListRelatedItems -> Bool)
-> Eq ListRelatedItems
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListRelatedItems -> ListRelatedItems -> Bool
$c/= :: ListRelatedItems -> ListRelatedItems -> Bool
== :: ListRelatedItems -> ListRelatedItems -> Bool
$c== :: ListRelatedItems -> ListRelatedItems -> Bool
Prelude.Eq, ReadPrec [ListRelatedItems]
ReadPrec ListRelatedItems
Int -> ReadS ListRelatedItems
ReadS [ListRelatedItems]
(Int -> ReadS ListRelatedItems)
-> ReadS [ListRelatedItems]
-> ReadPrec ListRelatedItems
-> ReadPrec [ListRelatedItems]
-> Read ListRelatedItems
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListRelatedItems]
$creadListPrec :: ReadPrec [ListRelatedItems]
readPrec :: ReadPrec ListRelatedItems
$creadPrec :: ReadPrec ListRelatedItems
readList :: ReadS [ListRelatedItems]
$creadList :: ReadS [ListRelatedItems]
readsPrec :: Int -> ReadS ListRelatedItems
$creadsPrec :: Int -> ReadS ListRelatedItems
Prelude.Read, Int -> ListRelatedItems -> ShowS
[ListRelatedItems] -> ShowS
ListRelatedItems -> String
(Int -> ListRelatedItems -> ShowS)
-> (ListRelatedItems -> String)
-> ([ListRelatedItems] -> ShowS)
-> Show ListRelatedItems
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListRelatedItems] -> ShowS
$cshowList :: [ListRelatedItems] -> ShowS
show :: ListRelatedItems -> String
$cshow :: ListRelatedItems -> String
showsPrec :: Int -> ListRelatedItems -> ShowS
$cshowsPrec :: Int -> ListRelatedItems -> ShowS
Prelude.Show, (forall x. ListRelatedItems -> Rep ListRelatedItems x)
-> (forall x. Rep ListRelatedItems x -> ListRelatedItems)
-> Generic ListRelatedItems
forall x. Rep ListRelatedItems x -> ListRelatedItems
forall x. ListRelatedItems -> Rep ListRelatedItems x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListRelatedItems x -> ListRelatedItems
$cfrom :: forall x. ListRelatedItems -> Rep ListRelatedItems x
Prelude.Generic)

-- |
-- Create a value of 'ListRelatedItems' 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', 'listRelatedItems_nextToken' - The pagination token to continue to the next page of results.
--
-- 'maxResults', 'listRelatedItems_maxResults' - The maximum number of related items per page.
--
-- 'incidentRecordArn', 'listRelatedItems_incidentRecordArn' - The Amazon Resource Name (ARN) of the incident record that you are
-- listing related items for.
newListRelatedItems ::
  -- | 'incidentRecordArn'
  Prelude.Text ->
  ListRelatedItems
newListRelatedItems :: Text -> ListRelatedItems
newListRelatedItems Text
pIncidentRecordArn_ =
  ListRelatedItems' :: Maybe Text -> Maybe Natural -> Text -> ListRelatedItems
ListRelatedItems'
    { $sel:nextToken:ListRelatedItems' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListRelatedItems' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:incidentRecordArn:ListRelatedItems' :: Text
incidentRecordArn = Text
pIncidentRecordArn_
    }

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

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

-- | The Amazon Resource Name (ARN) of the incident record that you are
-- listing related items for.
listRelatedItems_incidentRecordArn :: Lens.Lens' ListRelatedItems Prelude.Text
listRelatedItems_incidentRecordArn :: (Text -> f Text) -> ListRelatedItems -> f ListRelatedItems
listRelatedItems_incidentRecordArn = (ListRelatedItems -> Text)
-> (ListRelatedItems -> Text -> ListRelatedItems)
-> Lens ListRelatedItems ListRelatedItems Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRelatedItems' {Text
incidentRecordArn :: Text
$sel:incidentRecordArn:ListRelatedItems' :: ListRelatedItems -> Text
incidentRecordArn} -> Text
incidentRecordArn) (\s :: ListRelatedItems
s@ListRelatedItems' {} Text
a -> ListRelatedItems
s {$sel:incidentRecordArn:ListRelatedItems' :: Text
incidentRecordArn = Text
a} :: ListRelatedItems)

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

instance Prelude.Hashable ListRelatedItems

instance Prelude.NFData ListRelatedItems

instance Core.ToHeaders ListRelatedItems where
  toHeaders :: ListRelatedItems -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListRelatedItems -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ 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 ListRelatedItems where
  toJSON :: ListRelatedItems -> Value
toJSON ListRelatedItems' {Maybe Natural
Maybe Text
Text
incidentRecordArn :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:incidentRecordArn:ListRelatedItems' :: ListRelatedItems -> Text
$sel:maxResults:ListRelatedItems' :: ListRelatedItems -> Maybe Natural
$sel:nextToken:ListRelatedItems' :: ListRelatedItems -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (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,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"incidentRecordArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
incidentRecordArn)
          ]
      )

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

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

-- | /See:/ 'newListRelatedItemsResponse' smart constructor.
data ListRelatedItemsResponse = ListRelatedItemsResponse'
  { -- | The pagination token to continue to the next page of results.
    ListRelatedItemsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListRelatedItemsResponse -> Int
httpStatus :: Prelude.Int,
    -- | Details about each related item.
    ListRelatedItemsResponse -> [RelatedItem]
relatedItems :: [RelatedItem]
  }
  deriving (ListRelatedItemsResponse -> ListRelatedItemsResponse -> Bool
(ListRelatedItemsResponse -> ListRelatedItemsResponse -> Bool)
-> (ListRelatedItemsResponse -> ListRelatedItemsResponse -> Bool)
-> Eq ListRelatedItemsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListRelatedItemsResponse -> ListRelatedItemsResponse -> Bool
$c/= :: ListRelatedItemsResponse -> ListRelatedItemsResponse -> Bool
== :: ListRelatedItemsResponse -> ListRelatedItemsResponse -> Bool
$c== :: ListRelatedItemsResponse -> ListRelatedItemsResponse -> Bool
Prelude.Eq, ReadPrec [ListRelatedItemsResponse]
ReadPrec ListRelatedItemsResponse
Int -> ReadS ListRelatedItemsResponse
ReadS [ListRelatedItemsResponse]
(Int -> ReadS ListRelatedItemsResponse)
-> ReadS [ListRelatedItemsResponse]
-> ReadPrec ListRelatedItemsResponse
-> ReadPrec [ListRelatedItemsResponse]
-> Read ListRelatedItemsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListRelatedItemsResponse]
$creadListPrec :: ReadPrec [ListRelatedItemsResponse]
readPrec :: ReadPrec ListRelatedItemsResponse
$creadPrec :: ReadPrec ListRelatedItemsResponse
readList :: ReadS [ListRelatedItemsResponse]
$creadList :: ReadS [ListRelatedItemsResponse]
readsPrec :: Int -> ReadS ListRelatedItemsResponse
$creadsPrec :: Int -> ReadS ListRelatedItemsResponse
Prelude.Read, Int -> ListRelatedItemsResponse -> ShowS
[ListRelatedItemsResponse] -> ShowS
ListRelatedItemsResponse -> String
(Int -> ListRelatedItemsResponse -> ShowS)
-> (ListRelatedItemsResponse -> String)
-> ([ListRelatedItemsResponse] -> ShowS)
-> Show ListRelatedItemsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListRelatedItemsResponse] -> ShowS
$cshowList :: [ListRelatedItemsResponse] -> ShowS
show :: ListRelatedItemsResponse -> String
$cshow :: ListRelatedItemsResponse -> String
showsPrec :: Int -> ListRelatedItemsResponse -> ShowS
$cshowsPrec :: Int -> ListRelatedItemsResponse -> ShowS
Prelude.Show, (forall x.
 ListRelatedItemsResponse -> Rep ListRelatedItemsResponse x)
-> (forall x.
    Rep ListRelatedItemsResponse x -> ListRelatedItemsResponse)
-> Generic ListRelatedItemsResponse
forall x.
Rep ListRelatedItemsResponse x -> ListRelatedItemsResponse
forall x.
ListRelatedItemsResponse -> Rep ListRelatedItemsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListRelatedItemsResponse x -> ListRelatedItemsResponse
$cfrom :: forall x.
ListRelatedItemsResponse -> Rep ListRelatedItemsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListRelatedItemsResponse' 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', 'listRelatedItemsResponse_nextToken' - The pagination token to continue to the next page of results.
--
-- 'httpStatus', 'listRelatedItemsResponse_httpStatus' - The response's http status code.
--
-- 'relatedItems', 'listRelatedItemsResponse_relatedItems' - Details about each related item.
newListRelatedItemsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListRelatedItemsResponse
newListRelatedItemsResponse :: Int -> ListRelatedItemsResponse
newListRelatedItemsResponse Int
pHttpStatus_ =
  ListRelatedItemsResponse' :: Maybe Text -> Int -> [RelatedItem] -> ListRelatedItemsResponse
ListRelatedItemsResponse'
    { $sel:nextToken:ListRelatedItemsResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListRelatedItemsResponse' :: Int
httpStatus = Int
pHttpStatus_,
      $sel:relatedItems:ListRelatedItemsResponse' :: [RelatedItem]
relatedItems = [RelatedItem]
forall a. Monoid a => a
Prelude.mempty
    }

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

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

-- | Details about each related item.
listRelatedItemsResponse_relatedItems :: Lens.Lens' ListRelatedItemsResponse [RelatedItem]
listRelatedItemsResponse_relatedItems :: ([RelatedItem] -> f [RelatedItem])
-> ListRelatedItemsResponse -> f ListRelatedItemsResponse
listRelatedItemsResponse_relatedItems = (ListRelatedItemsResponse -> [RelatedItem])
-> (ListRelatedItemsResponse
    -> [RelatedItem] -> ListRelatedItemsResponse)
-> Lens' ListRelatedItemsResponse [RelatedItem]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRelatedItemsResponse' {[RelatedItem]
relatedItems :: [RelatedItem]
$sel:relatedItems:ListRelatedItemsResponse' :: ListRelatedItemsResponse -> [RelatedItem]
relatedItems} -> [RelatedItem]
relatedItems) (\s :: ListRelatedItemsResponse
s@ListRelatedItemsResponse' {} [RelatedItem]
a -> ListRelatedItemsResponse
s {$sel:relatedItems:ListRelatedItemsResponse' :: [RelatedItem]
relatedItems = [RelatedItem]
a} :: ListRelatedItemsResponse) (([RelatedItem] -> f [RelatedItem])
 -> ListRelatedItemsResponse -> f ListRelatedItemsResponse)
-> (([RelatedItem] -> f [RelatedItem])
    -> [RelatedItem] -> f [RelatedItem])
-> ([RelatedItem] -> f [RelatedItem])
-> ListRelatedItemsResponse
-> f ListRelatedItemsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([RelatedItem] -> f [RelatedItem])
-> [RelatedItem] -> f [RelatedItem]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Prelude.NFData ListRelatedItemsResponse