{-# 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.ResponsePartitionKey
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Pi.Types.ResponsePartitionKey where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | If @PartitionBy@ was specified in a @DescribeDimensionKeys@ request, the
-- dimensions are returned in an array. Each element in the array specifies
-- one dimension.
--
-- /See:/ 'newResponsePartitionKey' smart constructor.
data ResponsePartitionKey = ResponsePartitionKey'
  { -- | A dimension map that contains the dimensions for this partition.
    ResponsePartitionKey -> HashMap Text Text
dimensions :: Prelude.HashMap Prelude.Text Prelude.Text
  }
  deriving (ResponsePartitionKey -> ResponsePartitionKey -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResponsePartitionKey -> ResponsePartitionKey -> Bool
$c/= :: ResponsePartitionKey -> ResponsePartitionKey -> Bool
== :: ResponsePartitionKey -> ResponsePartitionKey -> Bool
$c== :: ResponsePartitionKey -> ResponsePartitionKey -> Bool
Prelude.Eq, ReadPrec [ResponsePartitionKey]
ReadPrec ResponsePartitionKey
Int -> ReadS ResponsePartitionKey
ReadS [ResponsePartitionKey]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ResponsePartitionKey]
$creadListPrec :: ReadPrec [ResponsePartitionKey]
readPrec :: ReadPrec ResponsePartitionKey
$creadPrec :: ReadPrec ResponsePartitionKey
readList :: ReadS [ResponsePartitionKey]
$creadList :: ReadS [ResponsePartitionKey]
readsPrec :: Int -> ReadS ResponsePartitionKey
$creadsPrec :: Int -> ReadS ResponsePartitionKey
Prelude.Read, Int -> ResponsePartitionKey -> ShowS
[ResponsePartitionKey] -> ShowS
ResponsePartitionKey -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResponsePartitionKey] -> ShowS
$cshowList :: [ResponsePartitionKey] -> ShowS
show :: ResponsePartitionKey -> String
$cshow :: ResponsePartitionKey -> String
showsPrec :: Int -> ResponsePartitionKey -> ShowS
$cshowsPrec :: Int -> ResponsePartitionKey -> ShowS
Prelude.Show, forall x. Rep ResponsePartitionKey x -> ResponsePartitionKey
forall x. ResponsePartitionKey -> Rep ResponsePartitionKey x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ResponsePartitionKey x -> ResponsePartitionKey
$cfrom :: forall x. ResponsePartitionKey -> Rep ResponsePartitionKey x
Prelude.Generic)

-- |
-- Create a value of 'ResponsePartitionKey' 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:
--
-- 'dimensions', 'responsePartitionKey_dimensions' - A dimension map that contains the dimensions for this partition.
newResponsePartitionKey ::
  ResponsePartitionKey
newResponsePartitionKey :: ResponsePartitionKey
newResponsePartitionKey =
  ResponsePartitionKey' {$sel:dimensions:ResponsePartitionKey' :: HashMap Text Text
dimensions = forall a. Monoid a => a
Prelude.mempty}

-- | A dimension map that contains the dimensions for this partition.
responsePartitionKey_dimensions :: Lens.Lens' ResponsePartitionKey (Prelude.HashMap Prelude.Text Prelude.Text)
responsePartitionKey_dimensions :: Lens' ResponsePartitionKey (HashMap Text Text)
responsePartitionKey_dimensions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResponsePartitionKey' {HashMap Text Text
dimensions :: HashMap Text Text
$sel:dimensions:ResponsePartitionKey' :: ResponsePartitionKey -> HashMap Text Text
dimensions} -> HashMap Text Text
dimensions) (\s :: ResponsePartitionKey
s@ResponsePartitionKey' {} HashMap Text Text
a -> ResponsePartitionKey
s {$sel:dimensions:ResponsePartitionKey' :: HashMap Text Text
dimensions = HashMap Text Text
a} :: ResponsePartitionKey) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON ResponsePartitionKey where
  parseJSON :: Value -> Parser ResponsePartitionKey
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ResponsePartitionKey"
      ( \Object
x ->
          HashMap Text Text -> ResponsePartitionKey
ResponsePartitionKey'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Dimensions" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable ResponsePartitionKey where
  hashWithSalt :: Int -> ResponsePartitionKey -> Int
hashWithSalt Int
_salt ResponsePartitionKey' {HashMap Text Text
dimensions :: HashMap Text Text
$sel:dimensions:ResponsePartitionKey' :: ResponsePartitionKey -> HashMap Text Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` HashMap Text Text
dimensions

instance Prelude.NFData ResponsePartitionKey where
  rnf :: ResponsePartitionKey -> ()
rnf ResponsePartitionKey' {HashMap Text Text
dimensions :: HashMap Text Text
$sel:dimensions:ResponsePartitionKey' :: ResponsePartitionKey -> HashMap Text Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf HashMap Text Text
dimensions