{-# 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.SecurityHub.GetInsights
-- 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 and describes insights for the specified insight ARNs.
--
-- This operation returns paginated results.
module Amazonka.SecurityHub.GetInsights
  ( -- * Creating a Request
    GetInsights (..),
    newGetInsights,

    -- * Request Lenses
    getInsights_nextToken,
    getInsights_insightArns,
    getInsights_maxResults,

    -- * Destructuring the Response
    GetInsightsResponse (..),
    newGetInsightsResponse,

    -- * Response Lenses
    getInsightsResponse_nextToken,
    getInsightsResponse_httpStatus,
    getInsightsResponse_insights,
  )
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.SecurityHub.Types

-- | /See:/ 'newGetInsights' smart constructor.
data GetInsights = GetInsights'
  { -- | The token that is required for pagination. On your first call to the
    -- @GetInsights@ operation, set the value of this parameter to @NULL@.
    --
    -- For subsequent calls to the operation, to continue listing data, set the
    -- value of this parameter to the value returned from the previous
    -- response.
    GetInsights -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The ARNs of the insights to describe. If you do not provide any insight
    -- ARNs, then @GetInsights@ returns all of your custom insights. It does
    -- not return any managed insights.
    GetInsights -> Maybe [Text]
insightArns :: Prelude.Maybe [Prelude.Text],
    -- | The maximum number of items to return in the response.
    GetInsights -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
  }
  deriving (GetInsights -> GetInsights -> Bool
(GetInsights -> GetInsights -> Bool)
-> (GetInsights -> GetInsights -> Bool) -> Eq GetInsights
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetInsights -> GetInsights -> Bool
$c/= :: GetInsights -> GetInsights -> Bool
== :: GetInsights -> GetInsights -> Bool
$c== :: GetInsights -> GetInsights -> Bool
Prelude.Eq, ReadPrec [GetInsights]
ReadPrec GetInsights
Int -> ReadS GetInsights
ReadS [GetInsights]
(Int -> ReadS GetInsights)
-> ReadS [GetInsights]
-> ReadPrec GetInsights
-> ReadPrec [GetInsights]
-> Read GetInsights
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetInsights]
$creadListPrec :: ReadPrec [GetInsights]
readPrec :: ReadPrec GetInsights
$creadPrec :: ReadPrec GetInsights
readList :: ReadS [GetInsights]
$creadList :: ReadS [GetInsights]
readsPrec :: Int -> ReadS GetInsights
$creadsPrec :: Int -> ReadS GetInsights
Prelude.Read, Int -> GetInsights -> ShowS
[GetInsights] -> ShowS
GetInsights -> String
(Int -> GetInsights -> ShowS)
-> (GetInsights -> String)
-> ([GetInsights] -> ShowS)
-> Show GetInsights
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetInsights] -> ShowS
$cshowList :: [GetInsights] -> ShowS
show :: GetInsights -> String
$cshow :: GetInsights -> String
showsPrec :: Int -> GetInsights -> ShowS
$cshowsPrec :: Int -> GetInsights -> ShowS
Prelude.Show, (forall x. GetInsights -> Rep GetInsights x)
-> (forall x. Rep GetInsights x -> GetInsights)
-> Generic GetInsights
forall x. Rep GetInsights x -> GetInsights
forall x. GetInsights -> Rep GetInsights x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetInsights x -> GetInsights
$cfrom :: forall x. GetInsights -> Rep GetInsights x
Prelude.Generic)

-- |
-- Create a value of 'GetInsights' 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', 'getInsights_nextToken' - The token that is required for pagination. On your first call to the
-- @GetInsights@ operation, set the value of this parameter to @NULL@.
--
-- For subsequent calls to the operation, to continue listing data, set the
-- value of this parameter to the value returned from the previous
-- response.
--
-- 'insightArns', 'getInsights_insightArns' - The ARNs of the insights to describe. If you do not provide any insight
-- ARNs, then @GetInsights@ returns all of your custom insights. It does
-- not return any managed insights.
--
-- 'maxResults', 'getInsights_maxResults' - The maximum number of items to return in the response.
newGetInsights ::
  GetInsights
newGetInsights :: GetInsights
newGetInsights =
  GetInsights' :: Maybe Text -> Maybe [Text] -> Maybe Natural -> GetInsights
GetInsights'
    { $sel:nextToken:GetInsights' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:insightArns:GetInsights' :: Maybe [Text]
insightArns = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:GetInsights' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | The token that is required for pagination. On your first call to the
-- @GetInsights@ operation, set the value of this parameter to @NULL@.
--
-- For subsequent calls to the operation, to continue listing data, set the
-- value of this parameter to the value returned from the previous
-- response.
getInsights_nextToken :: Lens.Lens' GetInsights (Prelude.Maybe Prelude.Text)
getInsights_nextToken :: (Maybe Text -> f (Maybe Text)) -> GetInsights -> f GetInsights
getInsights_nextToken = (GetInsights -> Maybe Text)
-> (GetInsights -> Maybe Text -> GetInsights)
-> Lens GetInsights GetInsights (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInsights' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetInsights' :: GetInsights -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetInsights
s@GetInsights' {} Maybe Text
a -> GetInsights
s {$sel:nextToken:GetInsights' :: Maybe Text
nextToken = Maybe Text
a} :: GetInsights)

-- | The ARNs of the insights to describe. If you do not provide any insight
-- ARNs, then @GetInsights@ returns all of your custom insights. It does
-- not return any managed insights.
getInsights_insightArns :: Lens.Lens' GetInsights (Prelude.Maybe [Prelude.Text])
getInsights_insightArns :: (Maybe [Text] -> f (Maybe [Text])) -> GetInsights -> f GetInsights
getInsights_insightArns = (GetInsights -> Maybe [Text])
-> (GetInsights -> Maybe [Text] -> GetInsights)
-> Lens GetInsights GetInsights (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInsights' {Maybe [Text]
insightArns :: Maybe [Text]
$sel:insightArns:GetInsights' :: GetInsights -> Maybe [Text]
insightArns} -> Maybe [Text]
insightArns) (\s :: GetInsights
s@GetInsights' {} Maybe [Text]
a -> GetInsights
s {$sel:insightArns:GetInsights' :: Maybe [Text]
insightArns = Maybe [Text]
a} :: GetInsights) ((Maybe [Text] -> f (Maybe [Text]))
 -> GetInsights -> f GetInsights)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> GetInsights
-> f GetInsights
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The maximum number of items to return in the response.
getInsights_maxResults :: Lens.Lens' GetInsights (Prelude.Maybe Prelude.Natural)
getInsights_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> GetInsights -> f GetInsights
getInsights_maxResults = (GetInsights -> Maybe Natural)
-> (GetInsights -> Maybe Natural -> GetInsights)
-> Lens GetInsights GetInsights (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInsights' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:GetInsights' :: GetInsights -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: GetInsights
s@GetInsights' {} Maybe Natural
a -> GetInsights
s {$sel:maxResults:GetInsights' :: Maybe Natural
maxResults = Maybe Natural
a} :: GetInsights)

instance Core.AWSPager GetInsights where
  page :: GetInsights -> AWSResponse GetInsights -> Maybe GetInsights
page GetInsights
rq AWSResponse GetInsights
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse GetInsights
GetInsightsResponse
rs
            GetInsightsResponse
-> Getting (First Text) GetInsightsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> GetInsightsResponse -> Const (First Text) GetInsightsResponse
Lens' GetInsightsResponse (Maybe Text)
getInsightsResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
 -> GetInsightsResponse -> Const (First Text) GetInsightsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) GetInsightsResponse 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 GetInsights
forall a. Maybe a
Prelude.Nothing
    | [Insight] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop (AWSResponse GetInsights
GetInsightsResponse
rs GetInsightsResponse
-> Getting [Insight] GetInsightsResponse [Insight] -> [Insight]
forall s a. s -> Getting a s a -> a
Lens.^. Getting [Insight] GetInsightsResponse [Insight]
Lens' GetInsightsResponse [Insight]
getInsightsResponse_insights) =
      Maybe GetInsights
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      GetInsights -> Maybe GetInsights
forall a. a -> Maybe a
Prelude.Just (GetInsights -> Maybe GetInsights)
-> GetInsights -> Maybe GetInsights
forall a b. (a -> b) -> a -> b
Prelude.$
        GetInsights
rq
          GetInsights -> (GetInsights -> GetInsights) -> GetInsights
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> GetInsights -> Identity GetInsights
Lens GetInsights GetInsights (Maybe Text) (Maybe Text)
getInsights_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> GetInsights -> Identity GetInsights)
-> Maybe Text -> GetInsights -> GetInsights
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse GetInsights
GetInsightsResponse
rs
          GetInsightsResponse
-> Getting (First Text) GetInsightsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> GetInsightsResponse -> Const (First Text) GetInsightsResponse
Lens' GetInsightsResponse (Maybe Text)
getInsightsResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
 -> GetInsightsResponse -> Const (First Text) GetInsightsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) GetInsightsResponse 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 GetInsights where
  type AWSResponse GetInsights = GetInsightsResponse
  request :: GetInsights -> Request GetInsights
request = Service -> GetInsights -> Request GetInsights
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy GetInsights
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetInsights)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetInsights))
-> Logger
-> Service
-> Proxy GetInsights
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetInsights)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text -> Int -> [Insight] -> GetInsightsResponse
GetInsightsResponse'
            (Maybe Text -> Int -> [Insight] -> GetInsightsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> [Insight] -> GetInsightsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"NextToken")
            Either String (Int -> [Insight] -> GetInsightsResponse)
-> Either String Int
-> Either String ([Insight] -> GetInsightsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
            Either String ([Insight] -> GetInsightsResponse)
-> Either String [Insight] -> Either String GetInsightsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe [Insight])
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Insights" Either String (Maybe [Insight])
-> [Insight] -> Either String [Insight]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Insight]
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable GetInsights

instance Prelude.NFData GetInsights

instance Core.ToHeaders GetInsights where
  toHeaders :: GetInsights -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetInsights -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON GetInsights where
  toJSON :: GetInsights -> Value
toJSON GetInsights' {Maybe Natural
Maybe [Text]
Maybe Text
maxResults :: Maybe Natural
insightArns :: Maybe [Text]
nextToken :: Maybe Text
$sel:maxResults:GetInsights' :: GetInsights -> Maybe Natural
$sel:insightArns:GetInsights' :: GetInsights -> Maybe [Text]
$sel:nextToken:GetInsights' :: GetInsights -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"NextToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
            (Text
"InsightArns" 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]
insightArns,
            (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 GetInsights where
  toPath :: GetInsights -> ByteString
toPath = ByteString -> GetInsights -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/insights/get"

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

-- | /See:/ 'newGetInsightsResponse' smart constructor.
data GetInsightsResponse = GetInsightsResponse'
  { -- | The pagination token to use to request the next page of results.
    GetInsightsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    GetInsightsResponse -> Int
httpStatus :: Prelude.Int,
    -- | The insights returned by the operation.
    GetInsightsResponse -> [Insight]
insights :: [Insight]
  }
  deriving (GetInsightsResponse -> GetInsightsResponse -> Bool
(GetInsightsResponse -> GetInsightsResponse -> Bool)
-> (GetInsightsResponse -> GetInsightsResponse -> Bool)
-> Eq GetInsightsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetInsightsResponse -> GetInsightsResponse -> Bool
$c/= :: GetInsightsResponse -> GetInsightsResponse -> Bool
== :: GetInsightsResponse -> GetInsightsResponse -> Bool
$c== :: GetInsightsResponse -> GetInsightsResponse -> Bool
Prelude.Eq, ReadPrec [GetInsightsResponse]
ReadPrec GetInsightsResponse
Int -> ReadS GetInsightsResponse
ReadS [GetInsightsResponse]
(Int -> ReadS GetInsightsResponse)
-> ReadS [GetInsightsResponse]
-> ReadPrec GetInsightsResponse
-> ReadPrec [GetInsightsResponse]
-> Read GetInsightsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetInsightsResponse]
$creadListPrec :: ReadPrec [GetInsightsResponse]
readPrec :: ReadPrec GetInsightsResponse
$creadPrec :: ReadPrec GetInsightsResponse
readList :: ReadS [GetInsightsResponse]
$creadList :: ReadS [GetInsightsResponse]
readsPrec :: Int -> ReadS GetInsightsResponse
$creadsPrec :: Int -> ReadS GetInsightsResponse
Prelude.Read, Int -> GetInsightsResponse -> ShowS
[GetInsightsResponse] -> ShowS
GetInsightsResponse -> String
(Int -> GetInsightsResponse -> ShowS)
-> (GetInsightsResponse -> String)
-> ([GetInsightsResponse] -> ShowS)
-> Show GetInsightsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetInsightsResponse] -> ShowS
$cshowList :: [GetInsightsResponse] -> ShowS
show :: GetInsightsResponse -> String
$cshow :: GetInsightsResponse -> String
showsPrec :: Int -> GetInsightsResponse -> ShowS
$cshowsPrec :: Int -> GetInsightsResponse -> ShowS
Prelude.Show, (forall x. GetInsightsResponse -> Rep GetInsightsResponse x)
-> (forall x. Rep GetInsightsResponse x -> GetInsightsResponse)
-> Generic GetInsightsResponse
forall x. Rep GetInsightsResponse x -> GetInsightsResponse
forall x. GetInsightsResponse -> Rep GetInsightsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetInsightsResponse x -> GetInsightsResponse
$cfrom :: forall x. GetInsightsResponse -> Rep GetInsightsResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetInsightsResponse' 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', 'getInsightsResponse_nextToken' - The pagination token to use to request the next page of results.
--
-- 'httpStatus', 'getInsightsResponse_httpStatus' - The response's http status code.
--
-- 'insights', 'getInsightsResponse_insights' - The insights returned by the operation.
newGetInsightsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetInsightsResponse
newGetInsightsResponse :: Int -> GetInsightsResponse
newGetInsightsResponse Int
pHttpStatus_ =
  GetInsightsResponse' :: Maybe Text -> Int -> [Insight] -> GetInsightsResponse
GetInsightsResponse'
    { $sel:nextToken:GetInsightsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetInsightsResponse' :: Int
httpStatus = Int
pHttpStatus_,
      $sel:insights:GetInsightsResponse' :: [Insight]
insights = [Insight]
forall a. Monoid a => a
Prelude.mempty
    }

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

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

-- | The insights returned by the operation.
getInsightsResponse_insights :: Lens.Lens' GetInsightsResponse [Insight]
getInsightsResponse_insights :: ([Insight] -> f [Insight])
-> GetInsightsResponse -> f GetInsightsResponse
getInsightsResponse_insights = (GetInsightsResponse -> [Insight])
-> (GetInsightsResponse -> [Insight] -> GetInsightsResponse)
-> Lens' GetInsightsResponse [Insight]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInsightsResponse' {[Insight]
insights :: [Insight]
$sel:insights:GetInsightsResponse' :: GetInsightsResponse -> [Insight]
insights} -> [Insight]
insights) (\s :: GetInsightsResponse
s@GetInsightsResponse' {} [Insight]
a -> GetInsightsResponse
s {$sel:insights:GetInsightsResponse' :: [Insight]
insights = [Insight]
a} :: GetInsightsResponse) (([Insight] -> f [Insight])
 -> GetInsightsResponse -> f GetInsightsResponse)
-> (([Insight] -> f [Insight]) -> [Insight] -> f [Insight])
-> ([Insight] -> f [Insight])
-> GetInsightsResponse
-> f GetInsightsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Insight] -> f [Insight]) -> [Insight] -> f [Insight]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Prelude.NFData GetInsightsResponse