{-# 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.ListOpsItemRelatedItems
-- 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 related-item resources associated with a Systems Manager
-- OpsCenter OpsItem. OpsCenter is a capability of Amazon Web Services
-- Systems Manager.
--
-- This operation returns paginated results.
module Amazonka.SSM.ListOpsItemRelatedItems
  ( -- * Creating a Request
    ListOpsItemRelatedItems (..),
    newListOpsItemRelatedItems,

    -- * Request Lenses
    listOpsItemRelatedItems_opsItemId,
    listOpsItemRelatedItems_filters,
    listOpsItemRelatedItems_nextToken,
    listOpsItemRelatedItems_maxResults,

    -- * Destructuring the Response
    ListOpsItemRelatedItemsResponse (..),
    newListOpsItemRelatedItemsResponse,

    -- * Response Lenses
    listOpsItemRelatedItemsResponse_nextToken,
    listOpsItemRelatedItemsResponse_summaries,
    listOpsItemRelatedItemsResponse_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:/ 'newListOpsItemRelatedItems' smart constructor.
data ListOpsItemRelatedItems = ListOpsItemRelatedItems'
  { -- | The ID of the OpsItem for which you want to list all related-item
    -- resources.
    ListOpsItemRelatedItems -> Maybe Text
opsItemId :: Prelude.Maybe Prelude.Text,
    -- | One or more OpsItem filters. Use a filter to return a more specific list
    -- of results.
    ListOpsItemRelatedItems -> Maybe [OpsItemRelatedItemsFilter]
filters :: Prelude.Maybe [OpsItemRelatedItemsFilter],
    -- | The token for the next set of items to return. (You received this token
    -- from a previous call.)
    ListOpsItemRelatedItems -> 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.
    ListOpsItemRelatedItems -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
  }
  deriving (ListOpsItemRelatedItems -> ListOpsItemRelatedItems -> Bool
(ListOpsItemRelatedItems -> ListOpsItemRelatedItems -> Bool)
-> (ListOpsItemRelatedItems -> ListOpsItemRelatedItems -> Bool)
-> Eq ListOpsItemRelatedItems
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListOpsItemRelatedItems -> ListOpsItemRelatedItems -> Bool
$c/= :: ListOpsItemRelatedItems -> ListOpsItemRelatedItems -> Bool
== :: ListOpsItemRelatedItems -> ListOpsItemRelatedItems -> Bool
$c== :: ListOpsItemRelatedItems -> ListOpsItemRelatedItems -> Bool
Prelude.Eq, ReadPrec [ListOpsItemRelatedItems]
ReadPrec ListOpsItemRelatedItems
Int -> ReadS ListOpsItemRelatedItems
ReadS [ListOpsItemRelatedItems]
(Int -> ReadS ListOpsItemRelatedItems)
-> ReadS [ListOpsItemRelatedItems]
-> ReadPrec ListOpsItemRelatedItems
-> ReadPrec [ListOpsItemRelatedItems]
-> Read ListOpsItemRelatedItems
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListOpsItemRelatedItems]
$creadListPrec :: ReadPrec [ListOpsItemRelatedItems]
readPrec :: ReadPrec ListOpsItemRelatedItems
$creadPrec :: ReadPrec ListOpsItemRelatedItems
readList :: ReadS [ListOpsItemRelatedItems]
$creadList :: ReadS [ListOpsItemRelatedItems]
readsPrec :: Int -> ReadS ListOpsItemRelatedItems
$creadsPrec :: Int -> ReadS ListOpsItemRelatedItems
Prelude.Read, Int -> ListOpsItemRelatedItems -> ShowS
[ListOpsItemRelatedItems] -> ShowS
ListOpsItemRelatedItems -> String
(Int -> ListOpsItemRelatedItems -> ShowS)
-> (ListOpsItemRelatedItems -> String)
-> ([ListOpsItemRelatedItems] -> ShowS)
-> Show ListOpsItemRelatedItems
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListOpsItemRelatedItems] -> ShowS
$cshowList :: [ListOpsItemRelatedItems] -> ShowS
show :: ListOpsItemRelatedItems -> String
$cshow :: ListOpsItemRelatedItems -> String
showsPrec :: Int -> ListOpsItemRelatedItems -> ShowS
$cshowsPrec :: Int -> ListOpsItemRelatedItems -> ShowS
Prelude.Show, (forall x.
 ListOpsItemRelatedItems -> Rep ListOpsItemRelatedItems x)
-> (forall x.
    Rep ListOpsItemRelatedItems x -> ListOpsItemRelatedItems)
-> Generic ListOpsItemRelatedItems
forall x. Rep ListOpsItemRelatedItems x -> ListOpsItemRelatedItems
forall x. ListOpsItemRelatedItems -> Rep ListOpsItemRelatedItems x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListOpsItemRelatedItems x -> ListOpsItemRelatedItems
$cfrom :: forall x. ListOpsItemRelatedItems -> Rep ListOpsItemRelatedItems x
Prelude.Generic)

-- |
-- Create a value of 'ListOpsItemRelatedItems' 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:
--
-- 'opsItemId', 'listOpsItemRelatedItems_opsItemId' - The ID of the OpsItem for which you want to list all related-item
-- resources.
--
-- 'filters', 'listOpsItemRelatedItems_filters' - One or more OpsItem filters. Use a filter to return a more specific list
-- of results.
--
-- 'nextToken', 'listOpsItemRelatedItems_nextToken' - The token for the next set of items to return. (You received this token
-- from a previous call.)
--
-- 'maxResults', 'listOpsItemRelatedItems_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.
newListOpsItemRelatedItems ::
  ListOpsItemRelatedItems
newListOpsItemRelatedItems :: ListOpsItemRelatedItems
newListOpsItemRelatedItems =
  ListOpsItemRelatedItems' :: Maybe Text
-> Maybe [OpsItemRelatedItemsFilter]
-> Maybe Text
-> Maybe Natural
-> ListOpsItemRelatedItems
ListOpsItemRelatedItems'
    { $sel:opsItemId:ListOpsItemRelatedItems' :: Maybe Text
opsItemId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:filters:ListOpsItemRelatedItems' :: Maybe [OpsItemRelatedItemsFilter]
filters = Maybe [OpsItemRelatedItemsFilter]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListOpsItemRelatedItems' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListOpsItemRelatedItems' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | The ID of the OpsItem for which you want to list all related-item
-- resources.
listOpsItemRelatedItems_opsItemId :: Lens.Lens' ListOpsItemRelatedItems (Prelude.Maybe Prelude.Text)
listOpsItemRelatedItems_opsItemId :: (Maybe Text -> f (Maybe Text))
-> ListOpsItemRelatedItems -> f ListOpsItemRelatedItems
listOpsItemRelatedItems_opsItemId = (ListOpsItemRelatedItems -> Maybe Text)
-> (ListOpsItemRelatedItems
    -> Maybe Text -> ListOpsItemRelatedItems)
-> Lens
     ListOpsItemRelatedItems
     ListOpsItemRelatedItems
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListOpsItemRelatedItems' {Maybe Text
opsItemId :: Maybe Text
$sel:opsItemId:ListOpsItemRelatedItems' :: ListOpsItemRelatedItems -> Maybe Text
opsItemId} -> Maybe Text
opsItemId) (\s :: ListOpsItemRelatedItems
s@ListOpsItemRelatedItems' {} Maybe Text
a -> ListOpsItemRelatedItems
s {$sel:opsItemId:ListOpsItemRelatedItems' :: Maybe Text
opsItemId = Maybe Text
a} :: ListOpsItemRelatedItems)

-- | One or more OpsItem filters. Use a filter to return a more specific list
-- of results.
listOpsItemRelatedItems_filters :: Lens.Lens' ListOpsItemRelatedItems (Prelude.Maybe [OpsItemRelatedItemsFilter])
listOpsItemRelatedItems_filters :: (Maybe [OpsItemRelatedItemsFilter]
 -> f (Maybe [OpsItemRelatedItemsFilter]))
-> ListOpsItemRelatedItems -> f ListOpsItemRelatedItems
listOpsItemRelatedItems_filters = (ListOpsItemRelatedItems -> Maybe [OpsItemRelatedItemsFilter])
-> (ListOpsItemRelatedItems
    -> Maybe [OpsItemRelatedItemsFilter] -> ListOpsItemRelatedItems)
-> Lens
     ListOpsItemRelatedItems
     ListOpsItemRelatedItems
     (Maybe [OpsItemRelatedItemsFilter])
     (Maybe [OpsItemRelatedItemsFilter])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListOpsItemRelatedItems' {Maybe [OpsItemRelatedItemsFilter]
filters :: Maybe [OpsItemRelatedItemsFilter]
$sel:filters:ListOpsItemRelatedItems' :: ListOpsItemRelatedItems -> Maybe [OpsItemRelatedItemsFilter]
filters} -> Maybe [OpsItemRelatedItemsFilter]
filters) (\s :: ListOpsItemRelatedItems
s@ListOpsItemRelatedItems' {} Maybe [OpsItemRelatedItemsFilter]
a -> ListOpsItemRelatedItems
s {$sel:filters:ListOpsItemRelatedItems' :: Maybe [OpsItemRelatedItemsFilter]
filters = Maybe [OpsItemRelatedItemsFilter]
a} :: ListOpsItemRelatedItems) ((Maybe [OpsItemRelatedItemsFilter]
  -> f (Maybe [OpsItemRelatedItemsFilter]))
 -> ListOpsItemRelatedItems -> f ListOpsItemRelatedItems)
-> ((Maybe [OpsItemRelatedItemsFilter]
     -> f (Maybe [OpsItemRelatedItemsFilter]))
    -> Maybe [OpsItemRelatedItemsFilter]
    -> f (Maybe [OpsItemRelatedItemsFilter]))
-> (Maybe [OpsItemRelatedItemsFilter]
    -> f (Maybe [OpsItemRelatedItemsFilter]))
-> ListOpsItemRelatedItems
-> f ListOpsItemRelatedItems
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [OpsItemRelatedItemsFilter]
  [OpsItemRelatedItemsFilter]
  [OpsItemRelatedItemsFilter]
  [OpsItemRelatedItemsFilter]
-> Iso
     (Maybe [OpsItemRelatedItemsFilter])
     (Maybe [OpsItemRelatedItemsFilter])
     (Maybe [OpsItemRelatedItemsFilter])
     (Maybe [OpsItemRelatedItemsFilter])
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
  [OpsItemRelatedItemsFilter]
  [OpsItemRelatedItemsFilter]
  [OpsItemRelatedItemsFilter]
  [OpsItemRelatedItemsFilter]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The token for the next set of items to return. (You received this token
-- from a previous call.)
listOpsItemRelatedItems_nextToken :: Lens.Lens' ListOpsItemRelatedItems (Prelude.Maybe Prelude.Text)
listOpsItemRelatedItems_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListOpsItemRelatedItems -> f ListOpsItemRelatedItems
listOpsItemRelatedItems_nextToken = (ListOpsItemRelatedItems -> Maybe Text)
-> (ListOpsItemRelatedItems
    -> Maybe Text -> ListOpsItemRelatedItems)
-> Lens
     ListOpsItemRelatedItems
     ListOpsItemRelatedItems
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListOpsItemRelatedItems' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListOpsItemRelatedItems' :: ListOpsItemRelatedItems -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListOpsItemRelatedItems
s@ListOpsItemRelatedItems' {} Maybe Text
a -> ListOpsItemRelatedItems
s {$sel:nextToken:ListOpsItemRelatedItems' :: Maybe Text
nextToken = Maybe Text
a} :: ListOpsItemRelatedItems)

-- | 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.
listOpsItemRelatedItems_maxResults :: Lens.Lens' ListOpsItemRelatedItems (Prelude.Maybe Prelude.Natural)
listOpsItemRelatedItems_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListOpsItemRelatedItems -> f ListOpsItemRelatedItems
listOpsItemRelatedItems_maxResults = (ListOpsItemRelatedItems -> Maybe Natural)
-> (ListOpsItemRelatedItems
    -> Maybe Natural -> ListOpsItemRelatedItems)
-> Lens
     ListOpsItemRelatedItems
     ListOpsItemRelatedItems
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListOpsItemRelatedItems' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListOpsItemRelatedItems' :: ListOpsItemRelatedItems -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListOpsItemRelatedItems
s@ListOpsItemRelatedItems' {} Maybe Natural
a -> ListOpsItemRelatedItems
s {$sel:maxResults:ListOpsItemRelatedItems' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListOpsItemRelatedItems)

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

instance Prelude.NFData ListOpsItemRelatedItems

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

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

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

-- |
-- Create a value of 'ListOpsItemRelatedItemsResponse' 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', 'listOpsItemRelatedItemsResponse_nextToken' - The token for the next set of items to return. Use this token to get the
-- next set of results.
--
-- 'summaries', 'listOpsItemRelatedItemsResponse_summaries' - A list of related-item resources for the specified OpsItem.
--
-- 'httpStatus', 'listOpsItemRelatedItemsResponse_httpStatus' - The response's http status code.
newListOpsItemRelatedItemsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListOpsItemRelatedItemsResponse
newListOpsItemRelatedItemsResponse :: Int -> ListOpsItemRelatedItemsResponse
newListOpsItemRelatedItemsResponse Int
pHttpStatus_ =
  ListOpsItemRelatedItemsResponse' :: Maybe Text
-> Maybe [OpsItemRelatedItemSummary]
-> Int
-> ListOpsItemRelatedItemsResponse
ListOpsItemRelatedItemsResponse'
    { $sel:nextToken:ListOpsItemRelatedItemsResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:summaries:ListOpsItemRelatedItemsResponse' :: Maybe [OpsItemRelatedItemSummary]
summaries = Maybe [OpsItemRelatedItemSummary]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListOpsItemRelatedItemsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

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

-- | A list of related-item resources for the specified OpsItem.
listOpsItemRelatedItemsResponse_summaries :: Lens.Lens' ListOpsItemRelatedItemsResponse (Prelude.Maybe [OpsItemRelatedItemSummary])
listOpsItemRelatedItemsResponse_summaries :: (Maybe [OpsItemRelatedItemSummary]
 -> f (Maybe [OpsItemRelatedItemSummary]))
-> ListOpsItemRelatedItemsResponse
-> f ListOpsItemRelatedItemsResponse
listOpsItemRelatedItemsResponse_summaries = (ListOpsItemRelatedItemsResponse
 -> Maybe [OpsItemRelatedItemSummary])
-> (ListOpsItemRelatedItemsResponse
    -> Maybe [OpsItemRelatedItemSummary]
    -> ListOpsItemRelatedItemsResponse)
-> Lens'
     ListOpsItemRelatedItemsResponse (Maybe [OpsItemRelatedItemSummary])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListOpsItemRelatedItemsResponse' {Maybe [OpsItemRelatedItemSummary]
summaries :: Maybe [OpsItemRelatedItemSummary]
$sel:summaries:ListOpsItemRelatedItemsResponse' :: ListOpsItemRelatedItemsResponse
-> Maybe [OpsItemRelatedItemSummary]
summaries} -> Maybe [OpsItemRelatedItemSummary]
summaries) (\s :: ListOpsItemRelatedItemsResponse
s@ListOpsItemRelatedItemsResponse' {} Maybe [OpsItemRelatedItemSummary]
a -> ListOpsItemRelatedItemsResponse
s {$sel:summaries:ListOpsItemRelatedItemsResponse' :: Maybe [OpsItemRelatedItemSummary]
summaries = Maybe [OpsItemRelatedItemSummary]
a} :: ListOpsItemRelatedItemsResponse) ((Maybe [OpsItemRelatedItemSummary]
  -> f (Maybe [OpsItemRelatedItemSummary]))
 -> ListOpsItemRelatedItemsResponse
 -> f ListOpsItemRelatedItemsResponse)
-> ((Maybe [OpsItemRelatedItemSummary]
     -> f (Maybe [OpsItemRelatedItemSummary]))
    -> Maybe [OpsItemRelatedItemSummary]
    -> f (Maybe [OpsItemRelatedItemSummary]))
-> (Maybe [OpsItemRelatedItemSummary]
    -> f (Maybe [OpsItemRelatedItemSummary]))
-> ListOpsItemRelatedItemsResponse
-> f ListOpsItemRelatedItemsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [OpsItemRelatedItemSummary]
  [OpsItemRelatedItemSummary]
  [OpsItemRelatedItemSummary]
  [OpsItemRelatedItemSummary]
-> Iso
     (Maybe [OpsItemRelatedItemSummary])
     (Maybe [OpsItemRelatedItemSummary])
     (Maybe [OpsItemRelatedItemSummary])
     (Maybe [OpsItemRelatedItemSummary])
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
  [OpsItemRelatedItemSummary]
  [OpsItemRelatedItemSummary]
  [OpsItemRelatedItemSummary]
  [OpsItemRelatedItemSummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    ListOpsItemRelatedItemsResponse