{-# 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-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.ResponsePartitionKey where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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 dimension(s) for this partition.
    ResponsePartitionKey -> HashMap Text Text
dimensions :: Prelude.HashMap Prelude.Text Prelude.Text
  }
  deriving (ResponsePartitionKey -> ResponsePartitionKey -> Bool
(ResponsePartitionKey -> ResponsePartitionKey -> Bool)
-> (ResponsePartitionKey -> ResponsePartitionKey -> Bool)
-> Eq ResponsePartitionKey
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]
(Int -> ReadS ResponsePartitionKey)
-> ReadS [ResponsePartitionKey]
-> ReadPrec ResponsePartitionKey
-> ReadPrec [ResponsePartitionKey]
-> Read 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
(Int -> ResponsePartitionKey -> ShowS)
-> (ResponsePartitionKey -> String)
-> ([ResponsePartitionKey] -> ShowS)
-> Show ResponsePartitionKey
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. ResponsePartitionKey -> Rep ResponsePartitionKey x)
-> (forall x. Rep ResponsePartitionKey x -> ResponsePartitionKey)
-> Generic ResponsePartitionKey
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 dimension(s) for this partition.
newResponsePartitionKey ::
  ResponsePartitionKey
newResponsePartitionKey :: ResponsePartitionKey
newResponsePartitionKey =
  ResponsePartitionKey' :: HashMap Text Text -> ResponsePartitionKey
ResponsePartitionKey' {$sel:dimensions:ResponsePartitionKey' :: HashMap Text Text
dimensions = HashMap Text Text
forall a. Monoid a => a
Prelude.mempty}

-- | A dimension map that contains the dimension(s) for this partition.
responsePartitionKey_dimensions :: Lens.Lens' ResponsePartitionKey (Prelude.HashMap Prelude.Text Prelude.Text)
responsePartitionKey_dimensions :: (HashMap Text Text -> f (HashMap Text Text))
-> ResponsePartitionKey -> f ResponsePartitionKey
responsePartitionKey_dimensions = (ResponsePartitionKey -> HashMap Text Text)
-> (ResponsePartitionKey
    -> HashMap Text Text -> ResponsePartitionKey)
-> Lens
     ResponsePartitionKey
     ResponsePartitionKey
     (HashMap Text Text)
     (HashMap Text Text)
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) ((HashMap Text Text -> f (HashMap Text Text))
 -> ResponsePartitionKey -> f ResponsePartitionKey)
-> ((HashMap Text Text -> f (HashMap Text Text))
    -> HashMap Text Text -> f (HashMap Text Text))
-> (HashMap Text Text -> f (HashMap Text Text))
-> ResponsePartitionKey
-> f ResponsePartitionKey
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (HashMap Text Text -> f (HashMap Text Text))
-> HashMap Text Text -> f (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.Hashable ResponsePartitionKey

instance Prelude.NFData ResponsePartitionKey