{-# 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.GetOpsSummary
-- 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)
--
-- View a summary of operations metadata (OpsData) based on specified
-- filters and aggregators. OpsData can include information about Amazon
-- Web Services Systems Manager OpsCenter operational workitems (OpsItems)
-- as well as information about any Amazon Web Services resource or service
-- configured to report OpsData to Amazon Web Services Systems Manager
-- Explorer.
--
-- This operation returns paginated results.
module Amazonka.SSM.GetOpsSummary
  ( -- * Creating a Request
    GetOpsSummary (..),
    newGetOpsSummary,

    -- * Request Lenses
    getOpsSummary_aggregators,
    getOpsSummary_syncName,
    getOpsSummary_filters,
    getOpsSummary_resultAttributes,
    getOpsSummary_nextToken,
    getOpsSummary_maxResults,

    -- * Destructuring the Response
    GetOpsSummaryResponse (..),
    newGetOpsSummaryResponse,

    -- * Response Lenses
    getOpsSummaryResponse_entities,
    getOpsSummaryResponse_nextToken,
    getOpsSummaryResponse_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:/ 'newGetOpsSummary' smart constructor.
data GetOpsSummary = GetOpsSummary'
  { -- | Optional aggregators that return counts of OpsData based on one or more
    -- expressions.
    GetOpsSummary -> Maybe (NonEmpty OpsAggregator)
aggregators :: Prelude.Maybe (Prelude.NonEmpty OpsAggregator),
    -- | Specify the name of a resource data sync to get.
    GetOpsSummary -> Maybe Text
syncName :: Prelude.Maybe Prelude.Text,
    -- | Optional filters used to scope down the returned OpsData.
    GetOpsSummary -> Maybe (NonEmpty OpsFilter)
filters :: Prelude.Maybe (Prelude.NonEmpty OpsFilter),
    -- | The OpsData data type to return.
    GetOpsSummary -> Maybe (NonEmpty OpsResultAttribute)
resultAttributes :: Prelude.Maybe (Prelude.NonEmpty OpsResultAttribute),
    -- | A token to start the list. Use this token to get the next set of
    -- results.
    GetOpsSummary -> 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.
    GetOpsSummary -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
  }
  deriving (GetOpsSummary -> GetOpsSummary -> Bool
(GetOpsSummary -> GetOpsSummary -> Bool)
-> (GetOpsSummary -> GetOpsSummary -> Bool) -> Eq GetOpsSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetOpsSummary -> GetOpsSummary -> Bool
$c/= :: GetOpsSummary -> GetOpsSummary -> Bool
== :: GetOpsSummary -> GetOpsSummary -> Bool
$c== :: GetOpsSummary -> GetOpsSummary -> Bool
Prelude.Eq, ReadPrec [GetOpsSummary]
ReadPrec GetOpsSummary
Int -> ReadS GetOpsSummary
ReadS [GetOpsSummary]
(Int -> ReadS GetOpsSummary)
-> ReadS [GetOpsSummary]
-> ReadPrec GetOpsSummary
-> ReadPrec [GetOpsSummary]
-> Read GetOpsSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetOpsSummary]
$creadListPrec :: ReadPrec [GetOpsSummary]
readPrec :: ReadPrec GetOpsSummary
$creadPrec :: ReadPrec GetOpsSummary
readList :: ReadS [GetOpsSummary]
$creadList :: ReadS [GetOpsSummary]
readsPrec :: Int -> ReadS GetOpsSummary
$creadsPrec :: Int -> ReadS GetOpsSummary
Prelude.Read, Int -> GetOpsSummary -> ShowS
[GetOpsSummary] -> ShowS
GetOpsSummary -> String
(Int -> GetOpsSummary -> ShowS)
-> (GetOpsSummary -> String)
-> ([GetOpsSummary] -> ShowS)
-> Show GetOpsSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetOpsSummary] -> ShowS
$cshowList :: [GetOpsSummary] -> ShowS
show :: GetOpsSummary -> String
$cshow :: GetOpsSummary -> String
showsPrec :: Int -> GetOpsSummary -> ShowS
$cshowsPrec :: Int -> GetOpsSummary -> ShowS
Prelude.Show, (forall x. GetOpsSummary -> Rep GetOpsSummary x)
-> (forall x. Rep GetOpsSummary x -> GetOpsSummary)
-> Generic GetOpsSummary
forall x. Rep GetOpsSummary x -> GetOpsSummary
forall x. GetOpsSummary -> Rep GetOpsSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetOpsSummary x -> GetOpsSummary
$cfrom :: forall x. GetOpsSummary -> Rep GetOpsSummary x
Prelude.Generic)

-- |
-- Create a value of 'GetOpsSummary' 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:
--
-- 'aggregators', 'getOpsSummary_aggregators' - Optional aggregators that return counts of OpsData based on one or more
-- expressions.
--
-- 'syncName', 'getOpsSummary_syncName' - Specify the name of a resource data sync to get.
--
-- 'filters', 'getOpsSummary_filters' - Optional filters used to scope down the returned OpsData.
--
-- 'resultAttributes', 'getOpsSummary_resultAttributes' - The OpsData data type to return.
--
-- 'nextToken', 'getOpsSummary_nextToken' - A token to start the list. Use this token to get the next set of
-- results.
--
-- 'maxResults', 'getOpsSummary_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.
newGetOpsSummary ::
  GetOpsSummary
newGetOpsSummary :: GetOpsSummary
newGetOpsSummary =
  GetOpsSummary' :: Maybe (NonEmpty OpsAggregator)
-> Maybe Text
-> Maybe (NonEmpty OpsFilter)
-> Maybe (NonEmpty OpsResultAttribute)
-> Maybe Text
-> Maybe Natural
-> GetOpsSummary
GetOpsSummary'
    { $sel:aggregators:GetOpsSummary' :: Maybe (NonEmpty OpsAggregator)
aggregators = Maybe (NonEmpty OpsAggregator)
forall a. Maybe a
Prelude.Nothing,
      $sel:syncName:GetOpsSummary' :: Maybe Text
syncName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:filters:GetOpsSummary' :: Maybe (NonEmpty OpsFilter)
filters = Maybe (NonEmpty OpsFilter)
forall a. Maybe a
Prelude.Nothing,
      $sel:resultAttributes:GetOpsSummary' :: Maybe (NonEmpty OpsResultAttribute)
resultAttributes = Maybe (NonEmpty OpsResultAttribute)
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:GetOpsSummary' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:GetOpsSummary' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | Optional aggregators that return counts of OpsData based on one or more
-- expressions.
getOpsSummary_aggregators :: Lens.Lens' GetOpsSummary (Prelude.Maybe (Prelude.NonEmpty OpsAggregator))
getOpsSummary_aggregators :: (Maybe (NonEmpty OpsAggregator)
 -> f (Maybe (NonEmpty OpsAggregator)))
-> GetOpsSummary -> f GetOpsSummary
getOpsSummary_aggregators = (GetOpsSummary -> Maybe (NonEmpty OpsAggregator))
-> (GetOpsSummary
    -> Maybe (NonEmpty OpsAggregator) -> GetOpsSummary)
-> Lens
     GetOpsSummary
     GetOpsSummary
     (Maybe (NonEmpty OpsAggregator))
     (Maybe (NonEmpty OpsAggregator))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetOpsSummary' {Maybe (NonEmpty OpsAggregator)
aggregators :: Maybe (NonEmpty OpsAggregator)
$sel:aggregators:GetOpsSummary' :: GetOpsSummary -> Maybe (NonEmpty OpsAggregator)
aggregators} -> Maybe (NonEmpty OpsAggregator)
aggregators) (\s :: GetOpsSummary
s@GetOpsSummary' {} Maybe (NonEmpty OpsAggregator)
a -> GetOpsSummary
s {$sel:aggregators:GetOpsSummary' :: Maybe (NonEmpty OpsAggregator)
aggregators = Maybe (NonEmpty OpsAggregator)
a} :: GetOpsSummary) ((Maybe (NonEmpty OpsAggregator)
  -> f (Maybe (NonEmpty OpsAggregator)))
 -> GetOpsSummary -> f GetOpsSummary)
-> ((Maybe (NonEmpty OpsAggregator)
     -> f (Maybe (NonEmpty OpsAggregator)))
    -> Maybe (NonEmpty OpsAggregator)
    -> f (Maybe (NonEmpty OpsAggregator)))
-> (Maybe (NonEmpty OpsAggregator)
    -> f (Maybe (NonEmpty OpsAggregator)))
-> GetOpsSummary
-> f GetOpsSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty OpsAggregator)
  (NonEmpty OpsAggregator)
  (NonEmpty OpsAggregator)
  (NonEmpty OpsAggregator)
-> Iso
     (Maybe (NonEmpty OpsAggregator))
     (Maybe (NonEmpty OpsAggregator))
     (Maybe (NonEmpty OpsAggregator))
     (Maybe (NonEmpty OpsAggregator))
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
  (NonEmpty OpsAggregator)
  (NonEmpty OpsAggregator)
  (NonEmpty OpsAggregator)
  (NonEmpty OpsAggregator)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Specify the name of a resource data sync to get.
getOpsSummary_syncName :: Lens.Lens' GetOpsSummary (Prelude.Maybe Prelude.Text)
getOpsSummary_syncName :: (Maybe Text -> f (Maybe Text)) -> GetOpsSummary -> f GetOpsSummary
getOpsSummary_syncName = (GetOpsSummary -> Maybe Text)
-> (GetOpsSummary -> Maybe Text -> GetOpsSummary)
-> Lens GetOpsSummary GetOpsSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetOpsSummary' {Maybe Text
syncName :: Maybe Text
$sel:syncName:GetOpsSummary' :: GetOpsSummary -> Maybe Text
syncName} -> Maybe Text
syncName) (\s :: GetOpsSummary
s@GetOpsSummary' {} Maybe Text
a -> GetOpsSummary
s {$sel:syncName:GetOpsSummary' :: Maybe Text
syncName = Maybe Text
a} :: GetOpsSummary)

-- | Optional filters used to scope down the returned OpsData.
getOpsSummary_filters :: Lens.Lens' GetOpsSummary (Prelude.Maybe (Prelude.NonEmpty OpsFilter))
getOpsSummary_filters :: (Maybe (NonEmpty OpsFilter) -> f (Maybe (NonEmpty OpsFilter)))
-> GetOpsSummary -> f GetOpsSummary
getOpsSummary_filters = (GetOpsSummary -> Maybe (NonEmpty OpsFilter))
-> (GetOpsSummary -> Maybe (NonEmpty OpsFilter) -> GetOpsSummary)
-> Lens
     GetOpsSummary
     GetOpsSummary
     (Maybe (NonEmpty OpsFilter))
     (Maybe (NonEmpty OpsFilter))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetOpsSummary' {Maybe (NonEmpty OpsFilter)
filters :: Maybe (NonEmpty OpsFilter)
$sel:filters:GetOpsSummary' :: GetOpsSummary -> Maybe (NonEmpty OpsFilter)
filters} -> Maybe (NonEmpty OpsFilter)
filters) (\s :: GetOpsSummary
s@GetOpsSummary' {} Maybe (NonEmpty OpsFilter)
a -> GetOpsSummary
s {$sel:filters:GetOpsSummary' :: Maybe (NonEmpty OpsFilter)
filters = Maybe (NonEmpty OpsFilter)
a} :: GetOpsSummary) ((Maybe (NonEmpty OpsFilter) -> f (Maybe (NonEmpty OpsFilter)))
 -> GetOpsSummary -> f GetOpsSummary)
-> ((Maybe (NonEmpty OpsFilter) -> f (Maybe (NonEmpty OpsFilter)))
    -> Maybe (NonEmpty OpsFilter) -> f (Maybe (NonEmpty OpsFilter)))
-> (Maybe (NonEmpty OpsFilter) -> f (Maybe (NonEmpty OpsFilter)))
-> GetOpsSummary
-> f GetOpsSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty OpsFilter)
  (NonEmpty OpsFilter)
  (NonEmpty OpsFilter)
  (NonEmpty OpsFilter)
-> Iso
     (Maybe (NonEmpty OpsFilter))
     (Maybe (NonEmpty OpsFilter))
     (Maybe (NonEmpty OpsFilter))
     (Maybe (NonEmpty OpsFilter))
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
  (NonEmpty OpsFilter)
  (NonEmpty OpsFilter)
  (NonEmpty OpsFilter)
  (NonEmpty OpsFilter)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The OpsData data type to return.
getOpsSummary_resultAttributes :: Lens.Lens' GetOpsSummary (Prelude.Maybe (Prelude.NonEmpty OpsResultAttribute))
getOpsSummary_resultAttributes :: (Maybe (NonEmpty OpsResultAttribute)
 -> f (Maybe (NonEmpty OpsResultAttribute)))
-> GetOpsSummary -> f GetOpsSummary
getOpsSummary_resultAttributes = (GetOpsSummary -> Maybe (NonEmpty OpsResultAttribute))
-> (GetOpsSummary
    -> Maybe (NonEmpty OpsResultAttribute) -> GetOpsSummary)
-> Lens
     GetOpsSummary
     GetOpsSummary
     (Maybe (NonEmpty OpsResultAttribute))
     (Maybe (NonEmpty OpsResultAttribute))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetOpsSummary' {Maybe (NonEmpty OpsResultAttribute)
resultAttributes :: Maybe (NonEmpty OpsResultAttribute)
$sel:resultAttributes:GetOpsSummary' :: GetOpsSummary -> Maybe (NonEmpty OpsResultAttribute)
resultAttributes} -> Maybe (NonEmpty OpsResultAttribute)
resultAttributes) (\s :: GetOpsSummary
s@GetOpsSummary' {} Maybe (NonEmpty OpsResultAttribute)
a -> GetOpsSummary
s {$sel:resultAttributes:GetOpsSummary' :: Maybe (NonEmpty OpsResultAttribute)
resultAttributes = Maybe (NonEmpty OpsResultAttribute)
a} :: GetOpsSummary) ((Maybe (NonEmpty OpsResultAttribute)
  -> f (Maybe (NonEmpty OpsResultAttribute)))
 -> GetOpsSummary -> f GetOpsSummary)
-> ((Maybe (NonEmpty OpsResultAttribute)
     -> f (Maybe (NonEmpty OpsResultAttribute)))
    -> Maybe (NonEmpty OpsResultAttribute)
    -> f (Maybe (NonEmpty OpsResultAttribute)))
-> (Maybe (NonEmpty OpsResultAttribute)
    -> f (Maybe (NonEmpty OpsResultAttribute)))
-> GetOpsSummary
-> f GetOpsSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty OpsResultAttribute)
  (NonEmpty OpsResultAttribute)
  (NonEmpty OpsResultAttribute)
  (NonEmpty OpsResultAttribute)
-> Iso
     (Maybe (NonEmpty OpsResultAttribute))
     (Maybe (NonEmpty OpsResultAttribute))
     (Maybe (NonEmpty OpsResultAttribute))
     (Maybe (NonEmpty OpsResultAttribute))
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
  (NonEmpty OpsResultAttribute)
  (NonEmpty OpsResultAttribute)
  (NonEmpty OpsResultAttribute)
  (NonEmpty OpsResultAttribute)
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.
getOpsSummary_nextToken :: Lens.Lens' GetOpsSummary (Prelude.Maybe Prelude.Text)
getOpsSummary_nextToken :: (Maybe Text -> f (Maybe Text)) -> GetOpsSummary -> f GetOpsSummary
getOpsSummary_nextToken = (GetOpsSummary -> Maybe Text)
-> (GetOpsSummary -> Maybe Text -> GetOpsSummary)
-> Lens GetOpsSummary GetOpsSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetOpsSummary' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetOpsSummary' :: GetOpsSummary -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetOpsSummary
s@GetOpsSummary' {} Maybe Text
a -> GetOpsSummary
s {$sel:nextToken:GetOpsSummary' :: Maybe Text
nextToken = Maybe Text
a} :: GetOpsSummary)

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

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

instance Prelude.NFData GetOpsSummary

instance Core.ToHeaders GetOpsSummary where
  toHeaders :: GetOpsSummary -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetOpsSummary -> 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.GetOpsSummary" :: 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 GetOpsSummary where
  toJSON :: GetOpsSummary -> Value
toJSON GetOpsSummary' {Maybe Natural
Maybe (NonEmpty OpsFilter)
Maybe (NonEmpty OpsAggregator)
Maybe (NonEmpty OpsResultAttribute)
Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
resultAttributes :: Maybe (NonEmpty OpsResultAttribute)
filters :: Maybe (NonEmpty OpsFilter)
syncName :: Maybe Text
aggregators :: Maybe (NonEmpty OpsAggregator)
$sel:maxResults:GetOpsSummary' :: GetOpsSummary -> Maybe Natural
$sel:nextToken:GetOpsSummary' :: GetOpsSummary -> Maybe Text
$sel:resultAttributes:GetOpsSummary' :: GetOpsSummary -> Maybe (NonEmpty OpsResultAttribute)
$sel:filters:GetOpsSummary' :: GetOpsSummary -> Maybe (NonEmpty OpsFilter)
$sel:syncName:GetOpsSummary' :: GetOpsSummary -> Maybe Text
$sel:aggregators:GetOpsSummary' :: GetOpsSummary -> Maybe (NonEmpty OpsAggregator)
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Aggregators" Text -> NonEmpty OpsAggregator -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (NonEmpty OpsAggregator -> Pair)
-> Maybe (NonEmpty OpsAggregator) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty OpsAggregator)
aggregators,
            (Text
"SyncName" 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
syncName,
            (Text
"Filters" Text -> NonEmpty OpsFilter -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (NonEmpty OpsFilter -> Pair)
-> Maybe (NonEmpty OpsFilter) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty OpsFilter)
filters,
            (Text
"ResultAttributes" Text -> NonEmpty OpsResultAttribute -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (NonEmpty OpsResultAttribute -> Pair)
-> Maybe (NonEmpty OpsResultAttribute) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty OpsResultAttribute)
resultAttributes,
            (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 GetOpsSummary where
  toPath :: GetOpsSummary -> ByteString
toPath = ByteString -> GetOpsSummary -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

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

-- |
-- Create a value of 'GetOpsSummaryResponse' 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:
--
-- 'entities', 'getOpsSummaryResponse_entities' - The list of aggregated details and filtered OpsData.
--
-- 'nextToken', 'getOpsSummaryResponse_nextToken' - The token for the next set of items to return. Use this token to get the
-- next set of results.
--
-- 'httpStatus', 'getOpsSummaryResponse_httpStatus' - The response's http status code.
newGetOpsSummaryResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetOpsSummaryResponse
newGetOpsSummaryResponse :: Int -> GetOpsSummaryResponse
newGetOpsSummaryResponse Int
pHttpStatus_ =
  GetOpsSummaryResponse' :: Maybe [OpsEntity] -> Maybe Text -> Int -> GetOpsSummaryResponse
GetOpsSummaryResponse'
    { $sel:entities:GetOpsSummaryResponse' :: Maybe [OpsEntity]
entities = Maybe [OpsEntity]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:GetOpsSummaryResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetOpsSummaryResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The list of aggregated details and filtered OpsData.
getOpsSummaryResponse_entities :: Lens.Lens' GetOpsSummaryResponse (Prelude.Maybe [OpsEntity])
getOpsSummaryResponse_entities :: (Maybe [OpsEntity] -> f (Maybe [OpsEntity]))
-> GetOpsSummaryResponse -> f GetOpsSummaryResponse
getOpsSummaryResponse_entities = (GetOpsSummaryResponse -> Maybe [OpsEntity])
-> (GetOpsSummaryResponse
    -> Maybe [OpsEntity] -> GetOpsSummaryResponse)
-> Lens' GetOpsSummaryResponse (Maybe [OpsEntity])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetOpsSummaryResponse' {Maybe [OpsEntity]
entities :: Maybe [OpsEntity]
$sel:entities:GetOpsSummaryResponse' :: GetOpsSummaryResponse -> Maybe [OpsEntity]
entities} -> Maybe [OpsEntity]
entities) (\s :: GetOpsSummaryResponse
s@GetOpsSummaryResponse' {} Maybe [OpsEntity]
a -> GetOpsSummaryResponse
s {$sel:entities:GetOpsSummaryResponse' :: Maybe [OpsEntity]
entities = Maybe [OpsEntity]
a} :: GetOpsSummaryResponse) ((Maybe [OpsEntity] -> f (Maybe [OpsEntity]))
 -> GetOpsSummaryResponse -> f GetOpsSummaryResponse)
-> ((Maybe [OpsEntity] -> f (Maybe [OpsEntity]))
    -> Maybe [OpsEntity] -> f (Maybe [OpsEntity]))
-> (Maybe [OpsEntity] -> f (Maybe [OpsEntity]))
-> GetOpsSummaryResponse
-> f GetOpsSummaryResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [OpsEntity] [OpsEntity] [OpsEntity] [OpsEntity]
-> Iso
     (Maybe [OpsEntity])
     (Maybe [OpsEntity])
     (Maybe [OpsEntity])
     (Maybe [OpsEntity])
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 [OpsEntity] [OpsEntity] [OpsEntity] [OpsEntity]
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. Use this token to get the
-- next set of results.
getOpsSummaryResponse_nextToken :: Lens.Lens' GetOpsSummaryResponse (Prelude.Maybe Prelude.Text)
getOpsSummaryResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> GetOpsSummaryResponse -> f GetOpsSummaryResponse
getOpsSummaryResponse_nextToken = (GetOpsSummaryResponse -> Maybe Text)
-> (GetOpsSummaryResponse -> Maybe Text -> GetOpsSummaryResponse)
-> Lens' GetOpsSummaryResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetOpsSummaryResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetOpsSummaryResponse' :: GetOpsSummaryResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetOpsSummaryResponse
s@GetOpsSummaryResponse' {} Maybe Text
a -> GetOpsSummaryResponse
s {$sel:nextToken:GetOpsSummaryResponse' :: Maybe Text
nextToken = Maybe Text
a} :: GetOpsSummaryResponse)

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

instance Prelude.NFData GetOpsSummaryResponse