{-# 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.XRay.GetInsightSummaries
-- 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)
--
-- Retrieves the summaries of all insights in the specified group matching
-- the provided filter values.
module Amazonka.XRay.GetInsightSummaries
  ( -- * Creating a Request
    GetInsightSummaries (..),
    newGetInsightSummaries,

    -- * Request Lenses
    getInsightSummaries_states,
    getInsightSummaries_nextToken,
    getInsightSummaries_groupARN,
    getInsightSummaries_groupName,
    getInsightSummaries_maxResults,
    getInsightSummaries_startTime,
    getInsightSummaries_endTime,

    -- * Destructuring the Response
    GetInsightSummariesResponse (..),
    newGetInsightSummariesResponse,

    -- * Response Lenses
    getInsightSummariesResponse_insightSummaries,
    getInsightSummariesResponse_nextToken,
    getInsightSummariesResponse_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.XRay.Types

-- | /See:/ 'newGetInsightSummaries' smart constructor.
data GetInsightSummaries = GetInsightSummaries'
  { -- | The list of insight states.
    GetInsightSummaries -> Maybe [InsightState]
states :: Prelude.Maybe [InsightState],
    -- | Pagination token.
    GetInsightSummaries -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the group. Required if the GroupName
    -- isn\'t provided.
    GetInsightSummaries -> Maybe Text
groupARN :: Prelude.Maybe Prelude.Text,
    -- | The name of the group. Required if the GroupARN isn\'t provided.
    GetInsightSummaries -> Maybe Text
groupName :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results to display.
    GetInsightSummaries -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The beginning of the time frame in which the insights started. The start
    -- time can\'t be more than 30 days old.
    GetInsightSummaries -> POSIX
startTime :: Core.POSIX,
    -- | The end of the time frame in which the insights ended. The end time
    -- can\'t be more than 30 days old.
    GetInsightSummaries -> POSIX
endTime :: Core.POSIX
  }
  deriving (GetInsightSummaries -> GetInsightSummaries -> Bool
(GetInsightSummaries -> GetInsightSummaries -> Bool)
-> (GetInsightSummaries -> GetInsightSummaries -> Bool)
-> Eq GetInsightSummaries
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetInsightSummaries -> GetInsightSummaries -> Bool
$c/= :: GetInsightSummaries -> GetInsightSummaries -> Bool
== :: GetInsightSummaries -> GetInsightSummaries -> Bool
$c== :: GetInsightSummaries -> GetInsightSummaries -> Bool
Prelude.Eq, ReadPrec [GetInsightSummaries]
ReadPrec GetInsightSummaries
Int -> ReadS GetInsightSummaries
ReadS [GetInsightSummaries]
(Int -> ReadS GetInsightSummaries)
-> ReadS [GetInsightSummaries]
-> ReadPrec GetInsightSummaries
-> ReadPrec [GetInsightSummaries]
-> Read GetInsightSummaries
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetInsightSummaries]
$creadListPrec :: ReadPrec [GetInsightSummaries]
readPrec :: ReadPrec GetInsightSummaries
$creadPrec :: ReadPrec GetInsightSummaries
readList :: ReadS [GetInsightSummaries]
$creadList :: ReadS [GetInsightSummaries]
readsPrec :: Int -> ReadS GetInsightSummaries
$creadsPrec :: Int -> ReadS GetInsightSummaries
Prelude.Read, Int -> GetInsightSummaries -> ShowS
[GetInsightSummaries] -> ShowS
GetInsightSummaries -> String
(Int -> GetInsightSummaries -> ShowS)
-> (GetInsightSummaries -> String)
-> ([GetInsightSummaries] -> ShowS)
-> Show GetInsightSummaries
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetInsightSummaries] -> ShowS
$cshowList :: [GetInsightSummaries] -> ShowS
show :: GetInsightSummaries -> String
$cshow :: GetInsightSummaries -> String
showsPrec :: Int -> GetInsightSummaries -> ShowS
$cshowsPrec :: Int -> GetInsightSummaries -> ShowS
Prelude.Show, (forall x. GetInsightSummaries -> Rep GetInsightSummaries x)
-> (forall x. Rep GetInsightSummaries x -> GetInsightSummaries)
-> Generic GetInsightSummaries
forall x. Rep GetInsightSummaries x -> GetInsightSummaries
forall x. GetInsightSummaries -> Rep GetInsightSummaries x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetInsightSummaries x -> GetInsightSummaries
$cfrom :: forall x. GetInsightSummaries -> Rep GetInsightSummaries x
Prelude.Generic)

-- |
-- Create a value of 'GetInsightSummaries' 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:
--
-- 'states', 'getInsightSummaries_states' - The list of insight states.
--
-- 'nextToken', 'getInsightSummaries_nextToken' - Pagination token.
--
-- 'groupARN', 'getInsightSummaries_groupARN' - The Amazon Resource Name (ARN) of the group. Required if the GroupName
-- isn\'t provided.
--
-- 'groupName', 'getInsightSummaries_groupName' - The name of the group. Required if the GroupARN isn\'t provided.
--
-- 'maxResults', 'getInsightSummaries_maxResults' - The maximum number of results to display.
--
-- 'startTime', 'getInsightSummaries_startTime' - The beginning of the time frame in which the insights started. The start
-- time can\'t be more than 30 days old.
--
-- 'endTime', 'getInsightSummaries_endTime' - The end of the time frame in which the insights ended. The end time
-- can\'t be more than 30 days old.
newGetInsightSummaries ::
  -- | 'startTime'
  Prelude.UTCTime ->
  -- | 'endTime'
  Prelude.UTCTime ->
  GetInsightSummaries
newGetInsightSummaries :: UTCTime -> UTCTime -> GetInsightSummaries
newGetInsightSummaries UTCTime
pStartTime_ UTCTime
pEndTime_ =
  GetInsightSummaries' :: Maybe [InsightState]
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Natural
-> POSIX
-> POSIX
-> GetInsightSummaries
GetInsightSummaries'
    { $sel:states:GetInsightSummaries' :: Maybe [InsightState]
states = Maybe [InsightState]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:GetInsightSummaries' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:groupARN:GetInsightSummaries' :: Maybe Text
groupARN = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:groupName:GetInsightSummaries' :: Maybe Text
groupName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:GetInsightSummaries' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:startTime:GetInsightSummaries' :: POSIX
startTime = Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pStartTime_,
      $sel:endTime:GetInsightSummaries' :: POSIX
endTime = Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pEndTime_
    }

-- | The list of insight states.
getInsightSummaries_states :: Lens.Lens' GetInsightSummaries (Prelude.Maybe [InsightState])
getInsightSummaries_states :: (Maybe [InsightState] -> f (Maybe [InsightState]))
-> GetInsightSummaries -> f GetInsightSummaries
getInsightSummaries_states = (GetInsightSummaries -> Maybe [InsightState])
-> (GetInsightSummaries
    -> Maybe [InsightState] -> GetInsightSummaries)
-> Lens
     GetInsightSummaries
     GetInsightSummaries
     (Maybe [InsightState])
     (Maybe [InsightState])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInsightSummaries' {Maybe [InsightState]
states :: Maybe [InsightState]
$sel:states:GetInsightSummaries' :: GetInsightSummaries -> Maybe [InsightState]
states} -> Maybe [InsightState]
states) (\s :: GetInsightSummaries
s@GetInsightSummaries' {} Maybe [InsightState]
a -> GetInsightSummaries
s {$sel:states:GetInsightSummaries' :: Maybe [InsightState]
states = Maybe [InsightState]
a} :: GetInsightSummaries) ((Maybe [InsightState] -> f (Maybe [InsightState]))
 -> GetInsightSummaries -> f GetInsightSummaries)
-> ((Maybe [InsightState] -> f (Maybe [InsightState]))
    -> Maybe [InsightState] -> f (Maybe [InsightState]))
-> (Maybe [InsightState] -> f (Maybe [InsightState]))
-> GetInsightSummaries
-> f GetInsightSummaries
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [InsightState] [InsightState] [InsightState] [InsightState]
-> Iso
     (Maybe [InsightState])
     (Maybe [InsightState])
     (Maybe [InsightState])
     (Maybe [InsightState])
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 [InsightState] [InsightState] [InsightState] [InsightState]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Pagination token.
getInsightSummaries_nextToken :: Lens.Lens' GetInsightSummaries (Prelude.Maybe Prelude.Text)
getInsightSummaries_nextToken :: (Maybe Text -> f (Maybe Text))
-> GetInsightSummaries -> f GetInsightSummaries
getInsightSummaries_nextToken = (GetInsightSummaries -> Maybe Text)
-> (GetInsightSummaries -> Maybe Text -> GetInsightSummaries)
-> Lens
     GetInsightSummaries GetInsightSummaries (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInsightSummaries' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetInsightSummaries' :: GetInsightSummaries -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetInsightSummaries
s@GetInsightSummaries' {} Maybe Text
a -> GetInsightSummaries
s {$sel:nextToken:GetInsightSummaries' :: Maybe Text
nextToken = Maybe Text
a} :: GetInsightSummaries)

-- | The Amazon Resource Name (ARN) of the group. Required if the GroupName
-- isn\'t provided.
getInsightSummaries_groupARN :: Lens.Lens' GetInsightSummaries (Prelude.Maybe Prelude.Text)
getInsightSummaries_groupARN :: (Maybe Text -> f (Maybe Text))
-> GetInsightSummaries -> f GetInsightSummaries
getInsightSummaries_groupARN = (GetInsightSummaries -> Maybe Text)
-> (GetInsightSummaries -> Maybe Text -> GetInsightSummaries)
-> Lens
     GetInsightSummaries GetInsightSummaries (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInsightSummaries' {Maybe Text
groupARN :: Maybe Text
$sel:groupARN:GetInsightSummaries' :: GetInsightSummaries -> Maybe Text
groupARN} -> Maybe Text
groupARN) (\s :: GetInsightSummaries
s@GetInsightSummaries' {} Maybe Text
a -> GetInsightSummaries
s {$sel:groupARN:GetInsightSummaries' :: Maybe Text
groupARN = Maybe Text
a} :: GetInsightSummaries)

-- | The name of the group. Required if the GroupARN isn\'t provided.
getInsightSummaries_groupName :: Lens.Lens' GetInsightSummaries (Prelude.Maybe Prelude.Text)
getInsightSummaries_groupName :: (Maybe Text -> f (Maybe Text))
-> GetInsightSummaries -> f GetInsightSummaries
getInsightSummaries_groupName = (GetInsightSummaries -> Maybe Text)
-> (GetInsightSummaries -> Maybe Text -> GetInsightSummaries)
-> Lens
     GetInsightSummaries GetInsightSummaries (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInsightSummaries' {Maybe Text
groupName :: Maybe Text
$sel:groupName:GetInsightSummaries' :: GetInsightSummaries -> Maybe Text
groupName} -> Maybe Text
groupName) (\s :: GetInsightSummaries
s@GetInsightSummaries' {} Maybe Text
a -> GetInsightSummaries
s {$sel:groupName:GetInsightSummaries' :: Maybe Text
groupName = Maybe Text
a} :: GetInsightSummaries)

-- | The maximum number of results to display.
getInsightSummaries_maxResults :: Lens.Lens' GetInsightSummaries (Prelude.Maybe Prelude.Natural)
getInsightSummaries_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> GetInsightSummaries -> f GetInsightSummaries
getInsightSummaries_maxResults = (GetInsightSummaries -> Maybe Natural)
-> (GetInsightSummaries -> Maybe Natural -> GetInsightSummaries)
-> Lens
     GetInsightSummaries
     GetInsightSummaries
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInsightSummaries' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:GetInsightSummaries' :: GetInsightSummaries -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: GetInsightSummaries
s@GetInsightSummaries' {} Maybe Natural
a -> GetInsightSummaries
s {$sel:maxResults:GetInsightSummaries' :: Maybe Natural
maxResults = Maybe Natural
a} :: GetInsightSummaries)

-- | The beginning of the time frame in which the insights started. The start
-- time can\'t be more than 30 days old.
getInsightSummaries_startTime :: Lens.Lens' GetInsightSummaries Prelude.UTCTime
getInsightSummaries_startTime :: (UTCTime -> f UTCTime)
-> GetInsightSummaries -> f GetInsightSummaries
getInsightSummaries_startTime = (GetInsightSummaries -> POSIX)
-> (GetInsightSummaries -> POSIX -> GetInsightSummaries)
-> Lens GetInsightSummaries GetInsightSummaries POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInsightSummaries' {POSIX
startTime :: POSIX
$sel:startTime:GetInsightSummaries' :: GetInsightSummaries -> POSIX
startTime} -> POSIX
startTime) (\s :: GetInsightSummaries
s@GetInsightSummaries' {} POSIX
a -> GetInsightSummaries
s {$sel:startTime:GetInsightSummaries' :: POSIX
startTime = POSIX
a} :: GetInsightSummaries) ((POSIX -> f POSIX)
 -> GetInsightSummaries -> f GetInsightSummaries)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> GetInsightSummaries
-> f GetInsightSummaries
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The end of the time frame in which the insights ended. The end time
-- can\'t be more than 30 days old.
getInsightSummaries_endTime :: Lens.Lens' GetInsightSummaries Prelude.UTCTime
getInsightSummaries_endTime :: (UTCTime -> f UTCTime)
-> GetInsightSummaries -> f GetInsightSummaries
getInsightSummaries_endTime = (GetInsightSummaries -> POSIX)
-> (GetInsightSummaries -> POSIX -> GetInsightSummaries)
-> Lens GetInsightSummaries GetInsightSummaries POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInsightSummaries' {POSIX
endTime :: POSIX
$sel:endTime:GetInsightSummaries' :: GetInsightSummaries -> POSIX
endTime} -> POSIX
endTime) (\s :: GetInsightSummaries
s@GetInsightSummaries' {} POSIX
a -> GetInsightSummaries
s {$sel:endTime:GetInsightSummaries' :: POSIX
endTime = POSIX
a} :: GetInsightSummaries) ((POSIX -> f POSIX)
 -> GetInsightSummaries -> f GetInsightSummaries)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> GetInsightSummaries
-> f GetInsightSummaries
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

instance Core.AWSRequest GetInsightSummaries where
  type
    AWSResponse GetInsightSummaries =
      GetInsightSummariesResponse
  request :: GetInsightSummaries -> Request GetInsightSummaries
request = Service -> GetInsightSummaries -> Request GetInsightSummaries
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy GetInsightSummaries
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetInsightSummaries)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetInsightSummaries))
-> Logger
-> Service
-> Proxy GetInsightSummaries
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetInsightSummaries)))
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 [InsightSummary]
-> Maybe Text -> Int -> GetInsightSummariesResponse
GetInsightSummariesResponse'
            (Maybe [InsightSummary]
 -> Maybe Text -> Int -> GetInsightSummariesResponse)
-> Either String (Maybe [InsightSummary])
-> Either String (Maybe Text -> Int -> GetInsightSummariesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Either String (Maybe (Maybe [InsightSummary]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"InsightSummaries"
                            Either String (Maybe (Maybe [InsightSummary]))
-> Maybe [InsightSummary] -> Either String (Maybe [InsightSummary])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [InsightSummary]
forall a. Monoid a => a
Prelude.mempty
                        )
            Either String (Maybe Text -> Int -> GetInsightSummariesResponse)
-> Either String (Maybe Text)
-> Either String (Int -> GetInsightSummariesResponse)
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 -> GetInsightSummariesResponse)
-> Either String Int -> Either String GetInsightSummariesResponse
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 GetInsightSummaries

instance Prelude.NFData GetInsightSummaries

instance Core.ToHeaders GetInsightSummaries where
  toHeaders :: GetInsightSummaries -> ResponseHeaders
toHeaders = ResponseHeaders -> GetInsightSummaries -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

instance Core.ToJSON GetInsightSummaries where
  toJSON :: GetInsightSummaries -> Value
toJSON GetInsightSummaries' {Maybe Natural
Maybe [InsightState]
Maybe Text
POSIX
endTime :: POSIX
startTime :: POSIX
maxResults :: Maybe Natural
groupName :: Maybe Text
groupARN :: Maybe Text
nextToken :: Maybe Text
states :: Maybe [InsightState]
$sel:endTime:GetInsightSummaries' :: GetInsightSummaries -> POSIX
$sel:startTime:GetInsightSummaries' :: GetInsightSummaries -> POSIX
$sel:maxResults:GetInsightSummaries' :: GetInsightSummaries -> Maybe Natural
$sel:groupName:GetInsightSummaries' :: GetInsightSummaries -> Maybe Text
$sel:groupARN:GetInsightSummaries' :: GetInsightSummaries -> Maybe Text
$sel:nextToken:GetInsightSummaries' :: GetInsightSummaries -> Maybe Text
$sel:states:GetInsightSummaries' :: GetInsightSummaries -> Maybe [InsightState]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"States" Text -> [InsightState] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([InsightState] -> Pair) -> Maybe [InsightState] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [InsightState]
states,
            (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
"GroupARN" 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
groupARN,
            (Text
"GroupName" 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
groupName,
            (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
"StartTime" Text -> POSIX -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= POSIX
startTime),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"EndTime" Text -> POSIX -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= POSIX
endTime)
          ]
      )

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

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

-- | /See:/ 'newGetInsightSummariesResponse' smart constructor.
data GetInsightSummariesResponse = GetInsightSummariesResponse'
  { -- | The summary of each insight within the group matching the provided
    -- filters. The summary contains the InsightID, start and end time, the
    -- root cause service, the root cause and client impact statistics, the top
    -- anomalous services, and the status of the insight.
    GetInsightSummariesResponse -> Maybe [InsightSummary]
insightSummaries :: Prelude.Maybe [InsightSummary],
    -- | Pagination token.
    GetInsightSummariesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    GetInsightSummariesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetInsightSummariesResponse -> GetInsightSummariesResponse -> Bool
(GetInsightSummariesResponse
 -> GetInsightSummariesResponse -> Bool)
-> (GetInsightSummariesResponse
    -> GetInsightSummariesResponse -> Bool)
-> Eq GetInsightSummariesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetInsightSummariesResponse -> GetInsightSummariesResponse -> Bool
$c/= :: GetInsightSummariesResponse -> GetInsightSummariesResponse -> Bool
== :: GetInsightSummariesResponse -> GetInsightSummariesResponse -> Bool
$c== :: GetInsightSummariesResponse -> GetInsightSummariesResponse -> Bool
Prelude.Eq, ReadPrec [GetInsightSummariesResponse]
ReadPrec GetInsightSummariesResponse
Int -> ReadS GetInsightSummariesResponse
ReadS [GetInsightSummariesResponse]
(Int -> ReadS GetInsightSummariesResponse)
-> ReadS [GetInsightSummariesResponse]
-> ReadPrec GetInsightSummariesResponse
-> ReadPrec [GetInsightSummariesResponse]
-> Read GetInsightSummariesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetInsightSummariesResponse]
$creadListPrec :: ReadPrec [GetInsightSummariesResponse]
readPrec :: ReadPrec GetInsightSummariesResponse
$creadPrec :: ReadPrec GetInsightSummariesResponse
readList :: ReadS [GetInsightSummariesResponse]
$creadList :: ReadS [GetInsightSummariesResponse]
readsPrec :: Int -> ReadS GetInsightSummariesResponse
$creadsPrec :: Int -> ReadS GetInsightSummariesResponse
Prelude.Read, Int -> GetInsightSummariesResponse -> ShowS
[GetInsightSummariesResponse] -> ShowS
GetInsightSummariesResponse -> String
(Int -> GetInsightSummariesResponse -> ShowS)
-> (GetInsightSummariesResponse -> String)
-> ([GetInsightSummariesResponse] -> ShowS)
-> Show GetInsightSummariesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetInsightSummariesResponse] -> ShowS
$cshowList :: [GetInsightSummariesResponse] -> ShowS
show :: GetInsightSummariesResponse -> String
$cshow :: GetInsightSummariesResponse -> String
showsPrec :: Int -> GetInsightSummariesResponse -> ShowS
$cshowsPrec :: Int -> GetInsightSummariesResponse -> ShowS
Prelude.Show, (forall x.
 GetInsightSummariesResponse -> Rep GetInsightSummariesResponse x)
-> (forall x.
    Rep GetInsightSummariesResponse x -> GetInsightSummariesResponse)
-> Generic GetInsightSummariesResponse
forall x.
Rep GetInsightSummariesResponse x -> GetInsightSummariesResponse
forall x.
GetInsightSummariesResponse -> Rep GetInsightSummariesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetInsightSummariesResponse x -> GetInsightSummariesResponse
$cfrom :: forall x.
GetInsightSummariesResponse -> Rep GetInsightSummariesResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetInsightSummariesResponse' 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:
--
-- 'insightSummaries', 'getInsightSummariesResponse_insightSummaries' - The summary of each insight within the group matching the provided
-- filters. The summary contains the InsightID, start and end time, the
-- root cause service, the root cause and client impact statistics, the top
-- anomalous services, and the status of the insight.
--
-- 'nextToken', 'getInsightSummariesResponse_nextToken' - Pagination token.
--
-- 'httpStatus', 'getInsightSummariesResponse_httpStatus' - The response's http status code.
newGetInsightSummariesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetInsightSummariesResponse
newGetInsightSummariesResponse :: Int -> GetInsightSummariesResponse
newGetInsightSummariesResponse Int
pHttpStatus_ =
  GetInsightSummariesResponse' :: Maybe [InsightSummary]
-> Maybe Text -> Int -> GetInsightSummariesResponse
GetInsightSummariesResponse'
    { $sel:insightSummaries:GetInsightSummariesResponse' :: Maybe [InsightSummary]
insightSummaries =
        Maybe [InsightSummary]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:GetInsightSummariesResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetInsightSummariesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The summary of each insight within the group matching the provided
-- filters. The summary contains the InsightID, start and end time, the
-- root cause service, the root cause and client impact statistics, the top
-- anomalous services, and the status of the insight.
getInsightSummariesResponse_insightSummaries :: Lens.Lens' GetInsightSummariesResponse (Prelude.Maybe [InsightSummary])
getInsightSummariesResponse_insightSummaries :: (Maybe [InsightSummary] -> f (Maybe [InsightSummary]))
-> GetInsightSummariesResponse -> f GetInsightSummariesResponse
getInsightSummariesResponse_insightSummaries = (GetInsightSummariesResponse -> Maybe [InsightSummary])
-> (GetInsightSummariesResponse
    -> Maybe [InsightSummary] -> GetInsightSummariesResponse)
-> Lens
     GetInsightSummariesResponse
     GetInsightSummariesResponse
     (Maybe [InsightSummary])
     (Maybe [InsightSummary])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInsightSummariesResponse' {Maybe [InsightSummary]
insightSummaries :: Maybe [InsightSummary]
$sel:insightSummaries:GetInsightSummariesResponse' :: GetInsightSummariesResponse -> Maybe [InsightSummary]
insightSummaries} -> Maybe [InsightSummary]
insightSummaries) (\s :: GetInsightSummariesResponse
s@GetInsightSummariesResponse' {} Maybe [InsightSummary]
a -> GetInsightSummariesResponse
s {$sel:insightSummaries:GetInsightSummariesResponse' :: Maybe [InsightSummary]
insightSummaries = Maybe [InsightSummary]
a} :: GetInsightSummariesResponse) ((Maybe [InsightSummary] -> f (Maybe [InsightSummary]))
 -> GetInsightSummariesResponse -> f GetInsightSummariesResponse)
-> ((Maybe [InsightSummary] -> f (Maybe [InsightSummary]))
    -> Maybe [InsightSummary] -> f (Maybe [InsightSummary]))
-> (Maybe [InsightSummary] -> f (Maybe [InsightSummary]))
-> GetInsightSummariesResponse
-> f GetInsightSummariesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [InsightSummary] [InsightSummary] [InsightSummary] [InsightSummary]
-> Iso
     (Maybe [InsightSummary])
     (Maybe [InsightSummary])
     (Maybe [InsightSummary])
     (Maybe [InsightSummary])
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
  [InsightSummary] [InsightSummary] [InsightSummary] [InsightSummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Pagination token.
getInsightSummariesResponse_nextToken :: Lens.Lens' GetInsightSummariesResponse (Prelude.Maybe Prelude.Text)
getInsightSummariesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> GetInsightSummariesResponse -> f GetInsightSummariesResponse
getInsightSummariesResponse_nextToken = (GetInsightSummariesResponse -> Maybe Text)
-> (GetInsightSummariesResponse
    -> Maybe Text -> GetInsightSummariesResponse)
-> Lens
     GetInsightSummariesResponse
     GetInsightSummariesResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInsightSummariesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetInsightSummariesResponse' :: GetInsightSummariesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetInsightSummariesResponse
s@GetInsightSummariesResponse' {} Maybe Text
a -> GetInsightSummariesResponse
s {$sel:nextToken:GetInsightSummariesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: GetInsightSummariesResponse)

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

instance Prelude.NFData GetInsightSummariesResponse