{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Pi.Types.DimensionKeyDetail
-- 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)
module Amazonka.Pi.Types.DimensionKeyDetail where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Pi.Types.DetailStatus
import qualified Amazonka.Prelude as Prelude

-- | An object that describes the details for a specified dimension.
--
-- /See:/ 'newDimensionKeyDetail' smart constructor.
data DimensionKeyDetail = DimensionKeyDetail'
  { -- | The status of the dimension detail data. Possible values include the
    -- following:
    --
    -- -   @AVAILABLE@ - The dimension detail data is ready to be retrieved.
    --
    -- -   @PROCESSING@ - The dimension detail data isn\'t ready to be
    --     retrieved because more processing time is required. If the requested
    --     detail data for @db.sql.statement@ has the status @PROCESSING@,
    --     Performance Insights returns the truncated query.
    --
    -- -   @UNAVAILABLE@ - The dimension detail data could not be collected
    --     successfully.
    DimensionKeyDetail -> Maybe DetailStatus
status :: Prelude.Maybe DetailStatus,
    -- | The full name of the dimension. The full name includes the group name
    -- and key name. The only valid value is @db.sql.statement@.
    DimensionKeyDetail -> Maybe Text
dimension :: Prelude.Maybe Prelude.Text,
    -- | The value of the dimension detail data. For the @db.sql.statement@
    -- dimension, this value is either the full or truncated SQL query,
    -- depending on the return status.
    DimensionKeyDetail -> Maybe Text
value :: Prelude.Maybe Prelude.Text
  }
  deriving (DimensionKeyDetail -> DimensionKeyDetail -> Bool
(DimensionKeyDetail -> DimensionKeyDetail -> Bool)
-> (DimensionKeyDetail -> DimensionKeyDetail -> Bool)
-> Eq DimensionKeyDetail
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DimensionKeyDetail -> DimensionKeyDetail -> Bool
$c/= :: DimensionKeyDetail -> DimensionKeyDetail -> Bool
== :: DimensionKeyDetail -> DimensionKeyDetail -> Bool
$c== :: DimensionKeyDetail -> DimensionKeyDetail -> Bool
Prelude.Eq, ReadPrec [DimensionKeyDetail]
ReadPrec DimensionKeyDetail
Int -> ReadS DimensionKeyDetail
ReadS [DimensionKeyDetail]
(Int -> ReadS DimensionKeyDetail)
-> ReadS [DimensionKeyDetail]
-> ReadPrec DimensionKeyDetail
-> ReadPrec [DimensionKeyDetail]
-> Read DimensionKeyDetail
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DimensionKeyDetail]
$creadListPrec :: ReadPrec [DimensionKeyDetail]
readPrec :: ReadPrec DimensionKeyDetail
$creadPrec :: ReadPrec DimensionKeyDetail
readList :: ReadS [DimensionKeyDetail]
$creadList :: ReadS [DimensionKeyDetail]
readsPrec :: Int -> ReadS DimensionKeyDetail
$creadsPrec :: Int -> ReadS DimensionKeyDetail
Prelude.Read, Int -> DimensionKeyDetail -> ShowS
[DimensionKeyDetail] -> ShowS
DimensionKeyDetail -> String
(Int -> DimensionKeyDetail -> ShowS)
-> (DimensionKeyDetail -> String)
-> ([DimensionKeyDetail] -> ShowS)
-> Show DimensionKeyDetail
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DimensionKeyDetail] -> ShowS
$cshowList :: [DimensionKeyDetail] -> ShowS
show :: DimensionKeyDetail -> String
$cshow :: DimensionKeyDetail -> String
showsPrec :: Int -> DimensionKeyDetail -> ShowS
$cshowsPrec :: Int -> DimensionKeyDetail -> ShowS
Prelude.Show, (forall x. DimensionKeyDetail -> Rep DimensionKeyDetail x)
-> (forall x. Rep DimensionKeyDetail x -> DimensionKeyDetail)
-> Generic DimensionKeyDetail
forall x. Rep DimensionKeyDetail x -> DimensionKeyDetail
forall x. DimensionKeyDetail -> Rep DimensionKeyDetail x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DimensionKeyDetail x -> DimensionKeyDetail
$cfrom :: forall x. DimensionKeyDetail -> Rep DimensionKeyDetail x
Prelude.Generic)

-- |
-- Create a value of 'DimensionKeyDetail' 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:
--
-- 'status', 'dimensionKeyDetail_status' - The status of the dimension detail data. Possible values include the
-- following:
--
-- -   @AVAILABLE@ - The dimension detail data is ready to be retrieved.
--
-- -   @PROCESSING@ - The dimension detail data isn\'t ready to be
--     retrieved because more processing time is required. If the requested
--     detail data for @db.sql.statement@ has the status @PROCESSING@,
--     Performance Insights returns the truncated query.
--
-- -   @UNAVAILABLE@ - The dimension detail data could not be collected
--     successfully.
--
-- 'dimension', 'dimensionKeyDetail_dimension' - The full name of the dimension. The full name includes the group name
-- and key name. The only valid value is @db.sql.statement@.
--
-- 'value', 'dimensionKeyDetail_value' - The value of the dimension detail data. For the @db.sql.statement@
-- dimension, this value is either the full or truncated SQL query,
-- depending on the return status.
newDimensionKeyDetail ::
  DimensionKeyDetail
newDimensionKeyDetail :: DimensionKeyDetail
newDimensionKeyDetail =
  DimensionKeyDetail' :: Maybe DetailStatus
-> Maybe Text -> Maybe Text -> DimensionKeyDetail
DimensionKeyDetail'
    { $sel:status:DimensionKeyDetail' :: Maybe DetailStatus
status = Maybe DetailStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:dimension:DimensionKeyDetail' :: Maybe Text
dimension = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:value:DimensionKeyDetail' :: Maybe Text
value = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The status of the dimension detail data. Possible values include the
-- following:
--
-- -   @AVAILABLE@ - The dimension detail data is ready to be retrieved.
--
-- -   @PROCESSING@ - The dimension detail data isn\'t ready to be
--     retrieved because more processing time is required. If the requested
--     detail data for @db.sql.statement@ has the status @PROCESSING@,
--     Performance Insights returns the truncated query.
--
-- -   @UNAVAILABLE@ - The dimension detail data could not be collected
--     successfully.
dimensionKeyDetail_status :: Lens.Lens' DimensionKeyDetail (Prelude.Maybe DetailStatus)
dimensionKeyDetail_status :: (Maybe DetailStatus -> f (Maybe DetailStatus))
-> DimensionKeyDetail -> f DimensionKeyDetail
dimensionKeyDetail_status = (DimensionKeyDetail -> Maybe DetailStatus)
-> (DimensionKeyDetail -> Maybe DetailStatus -> DimensionKeyDetail)
-> Lens
     DimensionKeyDetail
     DimensionKeyDetail
     (Maybe DetailStatus)
     (Maybe DetailStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DimensionKeyDetail' {Maybe DetailStatus
status :: Maybe DetailStatus
$sel:status:DimensionKeyDetail' :: DimensionKeyDetail -> Maybe DetailStatus
status} -> Maybe DetailStatus
status) (\s :: DimensionKeyDetail
s@DimensionKeyDetail' {} Maybe DetailStatus
a -> DimensionKeyDetail
s {$sel:status:DimensionKeyDetail' :: Maybe DetailStatus
status = Maybe DetailStatus
a} :: DimensionKeyDetail)

-- | The full name of the dimension. The full name includes the group name
-- and key name. The only valid value is @db.sql.statement@.
dimensionKeyDetail_dimension :: Lens.Lens' DimensionKeyDetail (Prelude.Maybe Prelude.Text)
dimensionKeyDetail_dimension :: (Maybe Text -> f (Maybe Text))
-> DimensionKeyDetail -> f DimensionKeyDetail
dimensionKeyDetail_dimension = (DimensionKeyDetail -> Maybe Text)
-> (DimensionKeyDetail -> Maybe Text -> DimensionKeyDetail)
-> Lens
     DimensionKeyDetail DimensionKeyDetail (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DimensionKeyDetail' {Maybe Text
dimension :: Maybe Text
$sel:dimension:DimensionKeyDetail' :: DimensionKeyDetail -> Maybe Text
dimension} -> Maybe Text
dimension) (\s :: DimensionKeyDetail
s@DimensionKeyDetail' {} Maybe Text
a -> DimensionKeyDetail
s {$sel:dimension:DimensionKeyDetail' :: Maybe Text
dimension = Maybe Text
a} :: DimensionKeyDetail)

-- | The value of the dimension detail data. For the @db.sql.statement@
-- dimension, this value is either the full or truncated SQL query,
-- depending on the return status.
dimensionKeyDetail_value :: Lens.Lens' DimensionKeyDetail (Prelude.Maybe Prelude.Text)
dimensionKeyDetail_value :: (Maybe Text -> f (Maybe Text))
-> DimensionKeyDetail -> f DimensionKeyDetail
dimensionKeyDetail_value = (DimensionKeyDetail -> Maybe Text)
-> (DimensionKeyDetail -> Maybe Text -> DimensionKeyDetail)
-> Lens
     DimensionKeyDetail DimensionKeyDetail (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DimensionKeyDetail' {Maybe Text
value :: Maybe Text
$sel:value:DimensionKeyDetail' :: DimensionKeyDetail -> Maybe Text
value} -> Maybe Text
value) (\s :: DimensionKeyDetail
s@DimensionKeyDetail' {} Maybe Text
a -> DimensionKeyDetail
s {$sel:value:DimensionKeyDetail' :: Maybe Text
value = Maybe Text
a} :: DimensionKeyDetail)

instance Core.FromJSON DimensionKeyDetail where
  parseJSON :: Value -> Parser DimensionKeyDetail
parseJSON =
    String
-> (Object -> Parser DimensionKeyDetail)
-> Value
-> Parser DimensionKeyDetail
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DimensionKeyDetail"
      ( \Object
x ->
          Maybe DetailStatus
-> Maybe Text -> Maybe Text -> DimensionKeyDetail
DimensionKeyDetail'
            (Maybe DetailStatus
 -> Maybe Text -> Maybe Text -> DimensionKeyDetail)
-> Parser (Maybe DetailStatus)
-> Parser (Maybe Text -> Maybe Text -> DimensionKeyDetail)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe DetailStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Status")
            Parser (Maybe Text -> Maybe Text -> DimensionKeyDetail)
-> Parser (Maybe Text) -> Parser (Maybe Text -> DimensionKeyDetail)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Dimension")
            Parser (Maybe Text -> DimensionKeyDetail)
-> Parser (Maybe Text) -> Parser DimensionKeyDetail
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Value")
      )

instance Prelude.Hashable DimensionKeyDetail

instance Prelude.NFData DimensionKeyDetail