{-# 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.DynamoDB.DescribeContributorInsights
-- 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)
--
-- Returns information about contributor insights, for a given table or
-- global secondary index.
module Amazonka.DynamoDB.DescribeContributorInsights
  ( -- * Creating a Request
    DescribeContributorInsights (..),
    newDescribeContributorInsights,

    -- * Request Lenses
    describeContributorInsights_indexName,
    describeContributorInsights_tableName,

    -- * Destructuring the Response
    DescribeContributorInsightsResponse (..),
    newDescribeContributorInsightsResponse,

    -- * Response Lenses
    describeContributorInsightsResponse_contributorInsightsRuleList,
    describeContributorInsightsResponse_failureException,
    describeContributorInsightsResponse_contributorInsightsStatus,
    describeContributorInsightsResponse_lastUpdateDateTime,
    describeContributorInsightsResponse_tableName,
    describeContributorInsightsResponse_indexName,
    describeContributorInsightsResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.DynamoDB.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newDescribeContributorInsights' smart constructor.
data DescribeContributorInsights = DescribeContributorInsights'
  { -- | The name of the global secondary index to describe, if applicable.
    DescribeContributorInsights -> Maybe Text
indexName :: Prelude.Maybe Prelude.Text,
    -- | The name of the table to describe.
    DescribeContributorInsights -> Text
tableName :: Prelude.Text
  }
  deriving (DescribeContributorInsights -> DescribeContributorInsights -> Bool
(DescribeContributorInsights
 -> DescribeContributorInsights -> Bool)
-> (DescribeContributorInsights
    -> DescribeContributorInsights -> Bool)
-> Eq DescribeContributorInsights
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeContributorInsights -> DescribeContributorInsights -> Bool
$c/= :: DescribeContributorInsights -> DescribeContributorInsights -> Bool
== :: DescribeContributorInsights -> DescribeContributorInsights -> Bool
$c== :: DescribeContributorInsights -> DescribeContributorInsights -> Bool
Prelude.Eq, ReadPrec [DescribeContributorInsights]
ReadPrec DescribeContributorInsights
Int -> ReadS DescribeContributorInsights
ReadS [DescribeContributorInsights]
(Int -> ReadS DescribeContributorInsights)
-> ReadS [DescribeContributorInsights]
-> ReadPrec DescribeContributorInsights
-> ReadPrec [DescribeContributorInsights]
-> Read DescribeContributorInsights
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeContributorInsights]
$creadListPrec :: ReadPrec [DescribeContributorInsights]
readPrec :: ReadPrec DescribeContributorInsights
$creadPrec :: ReadPrec DescribeContributorInsights
readList :: ReadS [DescribeContributorInsights]
$creadList :: ReadS [DescribeContributorInsights]
readsPrec :: Int -> ReadS DescribeContributorInsights
$creadsPrec :: Int -> ReadS DescribeContributorInsights
Prelude.Read, Int -> DescribeContributorInsights -> ShowS
[DescribeContributorInsights] -> ShowS
DescribeContributorInsights -> String
(Int -> DescribeContributorInsights -> ShowS)
-> (DescribeContributorInsights -> String)
-> ([DescribeContributorInsights] -> ShowS)
-> Show DescribeContributorInsights
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeContributorInsights] -> ShowS
$cshowList :: [DescribeContributorInsights] -> ShowS
show :: DescribeContributorInsights -> String
$cshow :: DescribeContributorInsights -> String
showsPrec :: Int -> DescribeContributorInsights -> ShowS
$cshowsPrec :: Int -> DescribeContributorInsights -> ShowS
Prelude.Show, (forall x.
 DescribeContributorInsights -> Rep DescribeContributorInsights x)
-> (forall x.
    Rep DescribeContributorInsights x -> DescribeContributorInsights)
-> Generic DescribeContributorInsights
forall x.
Rep DescribeContributorInsights x -> DescribeContributorInsights
forall x.
DescribeContributorInsights -> Rep DescribeContributorInsights x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeContributorInsights x -> DescribeContributorInsights
$cfrom :: forall x.
DescribeContributorInsights -> Rep DescribeContributorInsights x
Prelude.Generic)

-- |
-- Create a value of 'DescribeContributorInsights' 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:
--
-- 'indexName', 'describeContributorInsights_indexName' - The name of the global secondary index to describe, if applicable.
--
-- 'tableName', 'describeContributorInsights_tableName' - The name of the table to describe.
newDescribeContributorInsights ::
  -- | 'tableName'
  Prelude.Text ->
  DescribeContributorInsights
newDescribeContributorInsights :: Text -> DescribeContributorInsights
newDescribeContributorInsights Text
pTableName_ =
  DescribeContributorInsights' :: Maybe Text -> Text -> DescribeContributorInsights
DescribeContributorInsights'
    { $sel:indexName:DescribeContributorInsights' :: Maybe Text
indexName =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tableName:DescribeContributorInsights' :: Text
tableName = Text
pTableName_
    }

-- | The name of the global secondary index to describe, if applicable.
describeContributorInsights_indexName :: Lens.Lens' DescribeContributorInsights (Prelude.Maybe Prelude.Text)
describeContributorInsights_indexName :: (Maybe Text -> f (Maybe Text))
-> DescribeContributorInsights -> f DescribeContributorInsights
describeContributorInsights_indexName = (DescribeContributorInsights -> Maybe Text)
-> (DescribeContributorInsights
    -> Maybe Text -> DescribeContributorInsights)
-> Lens
     DescribeContributorInsights
     DescribeContributorInsights
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeContributorInsights' {Maybe Text
indexName :: Maybe Text
$sel:indexName:DescribeContributorInsights' :: DescribeContributorInsights -> Maybe Text
indexName} -> Maybe Text
indexName) (\s :: DescribeContributorInsights
s@DescribeContributorInsights' {} Maybe Text
a -> DescribeContributorInsights
s {$sel:indexName:DescribeContributorInsights' :: Maybe Text
indexName = Maybe Text
a} :: DescribeContributorInsights)

-- | The name of the table to describe.
describeContributorInsights_tableName :: Lens.Lens' DescribeContributorInsights Prelude.Text
describeContributorInsights_tableName :: (Text -> f Text)
-> DescribeContributorInsights -> f DescribeContributorInsights
describeContributorInsights_tableName = (DescribeContributorInsights -> Text)
-> (DescribeContributorInsights
    -> Text -> DescribeContributorInsights)
-> Lens
     DescribeContributorInsights DescribeContributorInsights Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeContributorInsights' {Text
tableName :: Text
$sel:tableName:DescribeContributorInsights' :: DescribeContributorInsights -> Text
tableName} -> Text
tableName) (\s :: DescribeContributorInsights
s@DescribeContributorInsights' {} Text
a -> DescribeContributorInsights
s {$sel:tableName:DescribeContributorInsights' :: Text
tableName = Text
a} :: DescribeContributorInsights)

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

instance Prelude.NFData DescribeContributorInsights

instance Core.ToHeaders DescribeContributorInsights where
  toHeaders :: DescribeContributorInsights -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeContributorInsights -> 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
"DynamoDB_20120810.DescribeContributorInsights" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.0" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON DescribeContributorInsights where
  toJSON :: DescribeContributorInsights -> Value
toJSON DescribeContributorInsights' {Maybe Text
Text
tableName :: Text
indexName :: Maybe Text
$sel:tableName:DescribeContributorInsights' :: DescribeContributorInsights -> Text
$sel:indexName:DescribeContributorInsights' :: DescribeContributorInsights -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"IndexName" 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
indexName,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"TableName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
tableName)
          ]
      )

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

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

-- | /See:/ 'newDescribeContributorInsightsResponse' smart constructor.
data DescribeContributorInsightsResponse = DescribeContributorInsightsResponse'
  { -- | List of names of the associated Alpine rules.
    DescribeContributorInsightsResponse -> Maybe [Text]
contributorInsightsRuleList :: Prelude.Maybe [Prelude.Text],
    -- | Returns information about the last failure that encountered.
    --
    -- The most common exceptions for a FAILED status are:
    --
    -- -   LimitExceededException - Per-account Amazon CloudWatch Contributor
    --     Insights rule limit reached. Please disable Contributor Insights for
    --     other tables\/indexes OR disable Contributor Insights rules before
    --     retrying.
    --
    -- -   AccessDeniedException - Amazon CloudWatch Contributor Insights rules
    --     cannot be modified due to insufficient permissions.
    --
    -- -   AccessDeniedException - Failed to create service-linked role for
    --     Contributor Insights due to insufficient permissions.
    --
    -- -   InternalServerError - Failed to create Amazon CloudWatch Contributor
    --     Insights rules. Please retry request.
    DescribeContributorInsightsResponse -> Maybe FailureException
failureException :: Prelude.Maybe FailureException,
    -- | Current Status contributor insights.
    DescribeContributorInsightsResponse
-> Maybe ContributorInsightsStatus
contributorInsightsStatus :: Prelude.Maybe ContributorInsightsStatus,
    -- | Timestamp of the last time the status was changed.
    DescribeContributorInsightsResponse -> Maybe POSIX
lastUpdateDateTime :: Prelude.Maybe Core.POSIX,
    -- | The name of the table being described.
    DescribeContributorInsightsResponse -> Maybe Text
tableName :: Prelude.Maybe Prelude.Text,
    -- | The name of the global secondary index being described.
    DescribeContributorInsightsResponse -> Maybe Text
indexName :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DescribeContributorInsightsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeContributorInsightsResponse
-> DescribeContributorInsightsResponse -> Bool
(DescribeContributorInsightsResponse
 -> DescribeContributorInsightsResponse -> Bool)
-> (DescribeContributorInsightsResponse
    -> DescribeContributorInsightsResponse -> Bool)
-> Eq DescribeContributorInsightsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeContributorInsightsResponse
-> DescribeContributorInsightsResponse -> Bool
$c/= :: DescribeContributorInsightsResponse
-> DescribeContributorInsightsResponse -> Bool
== :: DescribeContributorInsightsResponse
-> DescribeContributorInsightsResponse -> Bool
$c== :: DescribeContributorInsightsResponse
-> DescribeContributorInsightsResponse -> Bool
Prelude.Eq, ReadPrec [DescribeContributorInsightsResponse]
ReadPrec DescribeContributorInsightsResponse
Int -> ReadS DescribeContributorInsightsResponse
ReadS [DescribeContributorInsightsResponse]
(Int -> ReadS DescribeContributorInsightsResponse)
-> ReadS [DescribeContributorInsightsResponse]
-> ReadPrec DescribeContributorInsightsResponse
-> ReadPrec [DescribeContributorInsightsResponse]
-> Read DescribeContributorInsightsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeContributorInsightsResponse]
$creadListPrec :: ReadPrec [DescribeContributorInsightsResponse]
readPrec :: ReadPrec DescribeContributorInsightsResponse
$creadPrec :: ReadPrec DescribeContributorInsightsResponse
readList :: ReadS [DescribeContributorInsightsResponse]
$creadList :: ReadS [DescribeContributorInsightsResponse]
readsPrec :: Int -> ReadS DescribeContributorInsightsResponse
$creadsPrec :: Int -> ReadS DescribeContributorInsightsResponse
Prelude.Read, Int -> DescribeContributorInsightsResponse -> ShowS
[DescribeContributorInsightsResponse] -> ShowS
DescribeContributorInsightsResponse -> String
(Int -> DescribeContributorInsightsResponse -> ShowS)
-> (DescribeContributorInsightsResponse -> String)
-> ([DescribeContributorInsightsResponse] -> ShowS)
-> Show DescribeContributorInsightsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeContributorInsightsResponse] -> ShowS
$cshowList :: [DescribeContributorInsightsResponse] -> ShowS
show :: DescribeContributorInsightsResponse -> String
$cshow :: DescribeContributorInsightsResponse -> String
showsPrec :: Int -> DescribeContributorInsightsResponse -> ShowS
$cshowsPrec :: Int -> DescribeContributorInsightsResponse -> ShowS
Prelude.Show, (forall x.
 DescribeContributorInsightsResponse
 -> Rep DescribeContributorInsightsResponse x)
-> (forall x.
    Rep DescribeContributorInsightsResponse x
    -> DescribeContributorInsightsResponse)
-> Generic DescribeContributorInsightsResponse
forall x.
Rep DescribeContributorInsightsResponse x
-> DescribeContributorInsightsResponse
forall x.
DescribeContributorInsightsResponse
-> Rep DescribeContributorInsightsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeContributorInsightsResponse x
-> DescribeContributorInsightsResponse
$cfrom :: forall x.
DescribeContributorInsightsResponse
-> Rep DescribeContributorInsightsResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeContributorInsightsResponse' 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:
--
-- 'contributorInsightsRuleList', 'describeContributorInsightsResponse_contributorInsightsRuleList' - List of names of the associated Alpine rules.
--
-- 'failureException', 'describeContributorInsightsResponse_failureException' - Returns information about the last failure that encountered.
--
-- The most common exceptions for a FAILED status are:
--
-- -   LimitExceededException - Per-account Amazon CloudWatch Contributor
--     Insights rule limit reached. Please disable Contributor Insights for
--     other tables\/indexes OR disable Contributor Insights rules before
--     retrying.
--
-- -   AccessDeniedException - Amazon CloudWatch Contributor Insights rules
--     cannot be modified due to insufficient permissions.
--
-- -   AccessDeniedException - Failed to create service-linked role for
--     Contributor Insights due to insufficient permissions.
--
-- -   InternalServerError - Failed to create Amazon CloudWatch Contributor
--     Insights rules. Please retry request.
--
-- 'contributorInsightsStatus', 'describeContributorInsightsResponse_contributorInsightsStatus' - Current Status contributor insights.
--
-- 'lastUpdateDateTime', 'describeContributorInsightsResponse_lastUpdateDateTime' - Timestamp of the last time the status was changed.
--
-- 'tableName', 'describeContributorInsightsResponse_tableName' - The name of the table being described.
--
-- 'indexName', 'describeContributorInsightsResponse_indexName' - The name of the global secondary index being described.
--
-- 'httpStatus', 'describeContributorInsightsResponse_httpStatus' - The response's http status code.
newDescribeContributorInsightsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeContributorInsightsResponse
newDescribeContributorInsightsResponse :: Int -> DescribeContributorInsightsResponse
newDescribeContributorInsightsResponse Int
pHttpStatus_ =
  DescribeContributorInsightsResponse' :: Maybe [Text]
-> Maybe FailureException
-> Maybe ContributorInsightsStatus
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Int
-> DescribeContributorInsightsResponse
DescribeContributorInsightsResponse'
    { $sel:contributorInsightsRuleList:DescribeContributorInsightsResponse' :: Maybe [Text]
contributorInsightsRuleList =
        Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:failureException:DescribeContributorInsightsResponse' :: Maybe FailureException
failureException = Maybe FailureException
forall a. Maybe a
Prelude.Nothing,
      $sel:contributorInsightsStatus:DescribeContributorInsightsResponse' :: Maybe ContributorInsightsStatus
contributorInsightsStatus =
        Maybe ContributorInsightsStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdateDateTime:DescribeContributorInsightsResponse' :: Maybe POSIX
lastUpdateDateTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:tableName:DescribeContributorInsightsResponse' :: Maybe Text
tableName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:indexName:DescribeContributorInsightsResponse' :: Maybe Text
indexName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeContributorInsightsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | List of names of the associated Alpine rules.
describeContributorInsightsResponse_contributorInsightsRuleList :: Lens.Lens' DescribeContributorInsightsResponse (Prelude.Maybe [Prelude.Text])
describeContributorInsightsResponse_contributorInsightsRuleList :: (Maybe [Text] -> f (Maybe [Text]))
-> DescribeContributorInsightsResponse
-> f DescribeContributorInsightsResponse
describeContributorInsightsResponse_contributorInsightsRuleList = (DescribeContributorInsightsResponse -> Maybe [Text])
-> (DescribeContributorInsightsResponse
    -> Maybe [Text] -> DescribeContributorInsightsResponse)
-> Lens
     DescribeContributorInsightsResponse
     DescribeContributorInsightsResponse
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeContributorInsightsResponse' {Maybe [Text]
contributorInsightsRuleList :: Maybe [Text]
$sel:contributorInsightsRuleList:DescribeContributorInsightsResponse' :: DescribeContributorInsightsResponse -> Maybe [Text]
contributorInsightsRuleList} -> Maybe [Text]
contributorInsightsRuleList) (\s :: DescribeContributorInsightsResponse
s@DescribeContributorInsightsResponse' {} Maybe [Text]
a -> DescribeContributorInsightsResponse
s {$sel:contributorInsightsRuleList:DescribeContributorInsightsResponse' :: Maybe [Text]
contributorInsightsRuleList = Maybe [Text]
a} :: DescribeContributorInsightsResponse) ((Maybe [Text] -> f (Maybe [Text]))
 -> DescribeContributorInsightsResponse
 -> f DescribeContributorInsightsResponse)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> DescribeContributorInsightsResponse
-> f DescribeContributorInsightsResponse
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

-- | Returns information about the last failure that encountered.
--
-- The most common exceptions for a FAILED status are:
--
-- -   LimitExceededException - Per-account Amazon CloudWatch Contributor
--     Insights rule limit reached. Please disable Contributor Insights for
--     other tables\/indexes OR disable Contributor Insights rules before
--     retrying.
--
-- -   AccessDeniedException - Amazon CloudWatch Contributor Insights rules
--     cannot be modified due to insufficient permissions.
--
-- -   AccessDeniedException - Failed to create service-linked role for
--     Contributor Insights due to insufficient permissions.
--
-- -   InternalServerError - Failed to create Amazon CloudWatch Contributor
--     Insights rules. Please retry request.
describeContributorInsightsResponse_failureException :: Lens.Lens' DescribeContributorInsightsResponse (Prelude.Maybe FailureException)
describeContributorInsightsResponse_failureException :: (Maybe FailureException -> f (Maybe FailureException))
-> DescribeContributorInsightsResponse
-> f DescribeContributorInsightsResponse
describeContributorInsightsResponse_failureException = (DescribeContributorInsightsResponse -> Maybe FailureException)
-> (DescribeContributorInsightsResponse
    -> Maybe FailureException -> DescribeContributorInsightsResponse)
-> Lens
     DescribeContributorInsightsResponse
     DescribeContributorInsightsResponse
     (Maybe FailureException)
     (Maybe FailureException)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeContributorInsightsResponse' {Maybe FailureException
failureException :: Maybe FailureException
$sel:failureException:DescribeContributorInsightsResponse' :: DescribeContributorInsightsResponse -> Maybe FailureException
failureException} -> Maybe FailureException
failureException) (\s :: DescribeContributorInsightsResponse
s@DescribeContributorInsightsResponse' {} Maybe FailureException
a -> DescribeContributorInsightsResponse
s {$sel:failureException:DescribeContributorInsightsResponse' :: Maybe FailureException
failureException = Maybe FailureException
a} :: DescribeContributorInsightsResponse)

-- | Current Status contributor insights.
describeContributorInsightsResponse_contributorInsightsStatus :: Lens.Lens' DescribeContributorInsightsResponse (Prelude.Maybe ContributorInsightsStatus)
describeContributorInsightsResponse_contributorInsightsStatus :: (Maybe ContributorInsightsStatus
 -> f (Maybe ContributorInsightsStatus))
-> DescribeContributorInsightsResponse
-> f DescribeContributorInsightsResponse
describeContributorInsightsResponse_contributorInsightsStatus = (DescribeContributorInsightsResponse
 -> Maybe ContributorInsightsStatus)
-> (DescribeContributorInsightsResponse
    -> Maybe ContributorInsightsStatus
    -> DescribeContributorInsightsResponse)
-> Lens
     DescribeContributorInsightsResponse
     DescribeContributorInsightsResponse
     (Maybe ContributorInsightsStatus)
     (Maybe ContributorInsightsStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeContributorInsightsResponse' {Maybe ContributorInsightsStatus
contributorInsightsStatus :: Maybe ContributorInsightsStatus
$sel:contributorInsightsStatus:DescribeContributorInsightsResponse' :: DescribeContributorInsightsResponse
-> Maybe ContributorInsightsStatus
contributorInsightsStatus} -> Maybe ContributorInsightsStatus
contributorInsightsStatus) (\s :: DescribeContributorInsightsResponse
s@DescribeContributorInsightsResponse' {} Maybe ContributorInsightsStatus
a -> DescribeContributorInsightsResponse
s {$sel:contributorInsightsStatus:DescribeContributorInsightsResponse' :: Maybe ContributorInsightsStatus
contributorInsightsStatus = Maybe ContributorInsightsStatus
a} :: DescribeContributorInsightsResponse)

-- | Timestamp of the last time the status was changed.
describeContributorInsightsResponse_lastUpdateDateTime :: Lens.Lens' DescribeContributorInsightsResponse (Prelude.Maybe Prelude.UTCTime)
describeContributorInsightsResponse_lastUpdateDateTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> DescribeContributorInsightsResponse
-> f DescribeContributorInsightsResponse
describeContributorInsightsResponse_lastUpdateDateTime = (DescribeContributorInsightsResponse -> Maybe POSIX)
-> (DescribeContributorInsightsResponse
    -> Maybe POSIX -> DescribeContributorInsightsResponse)
-> Lens
     DescribeContributorInsightsResponse
     DescribeContributorInsightsResponse
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeContributorInsightsResponse' {Maybe POSIX
lastUpdateDateTime :: Maybe POSIX
$sel:lastUpdateDateTime:DescribeContributorInsightsResponse' :: DescribeContributorInsightsResponse -> Maybe POSIX
lastUpdateDateTime} -> Maybe POSIX
lastUpdateDateTime) (\s :: DescribeContributorInsightsResponse
s@DescribeContributorInsightsResponse' {} Maybe POSIX
a -> DescribeContributorInsightsResponse
s {$sel:lastUpdateDateTime:DescribeContributorInsightsResponse' :: Maybe POSIX
lastUpdateDateTime = Maybe POSIX
a} :: DescribeContributorInsightsResponse) ((Maybe POSIX -> f (Maybe POSIX))
 -> DescribeContributorInsightsResponse
 -> f DescribeContributorInsightsResponse)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> DescribeContributorInsightsResponse
-> f DescribeContributorInsightsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The name of the table being described.
describeContributorInsightsResponse_tableName :: Lens.Lens' DescribeContributorInsightsResponse (Prelude.Maybe Prelude.Text)
describeContributorInsightsResponse_tableName :: (Maybe Text -> f (Maybe Text))
-> DescribeContributorInsightsResponse
-> f DescribeContributorInsightsResponse
describeContributorInsightsResponse_tableName = (DescribeContributorInsightsResponse -> Maybe Text)
-> (DescribeContributorInsightsResponse
    -> Maybe Text -> DescribeContributorInsightsResponse)
-> Lens
     DescribeContributorInsightsResponse
     DescribeContributorInsightsResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeContributorInsightsResponse' {Maybe Text
tableName :: Maybe Text
$sel:tableName:DescribeContributorInsightsResponse' :: DescribeContributorInsightsResponse -> Maybe Text
tableName} -> Maybe Text
tableName) (\s :: DescribeContributorInsightsResponse
s@DescribeContributorInsightsResponse' {} Maybe Text
a -> DescribeContributorInsightsResponse
s {$sel:tableName:DescribeContributorInsightsResponse' :: Maybe Text
tableName = Maybe Text
a} :: DescribeContributorInsightsResponse)

-- | The name of the global secondary index being described.
describeContributorInsightsResponse_indexName :: Lens.Lens' DescribeContributorInsightsResponse (Prelude.Maybe Prelude.Text)
describeContributorInsightsResponse_indexName :: (Maybe Text -> f (Maybe Text))
-> DescribeContributorInsightsResponse
-> f DescribeContributorInsightsResponse
describeContributorInsightsResponse_indexName = (DescribeContributorInsightsResponse -> Maybe Text)
-> (DescribeContributorInsightsResponse
    -> Maybe Text -> DescribeContributorInsightsResponse)
-> Lens
     DescribeContributorInsightsResponse
     DescribeContributorInsightsResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeContributorInsightsResponse' {Maybe Text
indexName :: Maybe Text
$sel:indexName:DescribeContributorInsightsResponse' :: DescribeContributorInsightsResponse -> Maybe Text
indexName} -> Maybe Text
indexName) (\s :: DescribeContributorInsightsResponse
s@DescribeContributorInsightsResponse' {} Maybe Text
a -> DescribeContributorInsightsResponse
s {$sel:indexName:DescribeContributorInsightsResponse' :: Maybe Text
indexName = Maybe Text
a} :: DescribeContributorInsightsResponse)

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

instance
  Prelude.NFData
    DescribeContributorInsightsResponse