{-# 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.DynamoDB.Types.AttributeValue
-- 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.DynamoDB.Types.AttributeValue where

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

-- | Represents the data for an attribute.
--
-- Each attribute value is described as a name-value pair. The name is the
-- data type, and the value is the data itself.
--
-- For more information, see
-- <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.NamingRulesDataTypes.html#HowItWorks.DataTypes Data Types>
-- in the /Amazon DynamoDB Developer Guide/.
--
-- /See:/ 'newAttributeValue' smart constructor.
data AttributeValue = AttributeValue'
  { -- | An attribute of type List. For example:
    --
    -- @\"L\": [ {\"S\": \"Cookies\"} , {\"S\": \"Coffee\"}, {\"N\", \"3.14159\"}]@
    AttributeValue -> Maybe [AttributeValue]
l :: Prelude.Maybe [AttributeValue],
    -- | An attribute of type Number Set. For example:
    --
    -- @\"NS\": [\"42.2\", \"-19\", \"7.5\", \"3.14\"]@
    --
    -- Numbers are sent across the network to DynamoDB as strings, to maximize
    -- compatibility across languages and libraries. However, DynamoDB treats
    -- them as number type attributes for mathematical operations.
    AttributeValue -> Maybe [Text]
ns :: Prelude.Maybe [Prelude.Text],
    -- | An attribute of type Map. For example:
    --
    -- @\"M\": {\"Name\": {\"S\": \"Joe\"}, \"Age\": {\"N\": \"35\"}}@
    AttributeValue -> Maybe (HashMap Text AttributeValue)
m :: Prelude.Maybe (Prelude.HashMap Prelude.Text AttributeValue),
    -- | An attribute of type Null. For example:
    --
    -- @\"NULL\": true@
    AttributeValue -> Maybe Bool
null :: Prelude.Maybe Prelude.Bool,
    -- | An attribute of type Number. For example:
    --
    -- @\"N\": \"123.45\"@
    --
    -- Numbers are sent across the network to DynamoDB as strings, to maximize
    -- compatibility across languages and libraries. However, DynamoDB treats
    -- them as number type attributes for mathematical operations.
    AttributeValue -> Maybe Text
n :: Prelude.Maybe Prelude.Text,
    -- | An attribute of type Binary Set. For example:
    --
    -- @\"BS\": [\"U3Vubnk=\", \"UmFpbnk=\", \"U25vd3k=\"]@
    AttributeValue -> Maybe [Base64]
bs :: Prelude.Maybe [Core.Base64],
    -- | An attribute of type Binary. For example:
    --
    -- @\"B\": \"dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk\"@
    AttributeValue -> Maybe Base64
b :: Prelude.Maybe Core.Base64,
    -- | An attribute of type String Set. For example:
    --
    -- @\"SS\": [\"Giraffe\", \"Hippo\" ,\"Zebra\"]@
    AttributeValue -> Maybe [Text]
ss :: Prelude.Maybe [Prelude.Text],
    -- | An attribute of type String. For example:
    --
    -- @\"S\": \"Hello\"@
    AttributeValue -> Maybe Text
s :: Prelude.Maybe Prelude.Text,
    -- | An attribute of type Boolean. For example:
    --
    -- @\"BOOL\": true@
    AttributeValue -> Maybe Bool
bool :: Prelude.Maybe Prelude.Bool
  }
  deriving (AttributeValue -> AttributeValue -> Bool
(AttributeValue -> AttributeValue -> Bool)
-> (AttributeValue -> AttributeValue -> Bool) -> Eq AttributeValue
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AttributeValue -> AttributeValue -> Bool
$c/= :: AttributeValue -> AttributeValue -> Bool
== :: AttributeValue -> AttributeValue -> Bool
$c== :: AttributeValue -> AttributeValue -> Bool
Prelude.Eq, ReadPrec [AttributeValue]
ReadPrec AttributeValue
Int -> ReadS AttributeValue
ReadS [AttributeValue]
(Int -> ReadS AttributeValue)
-> ReadS [AttributeValue]
-> ReadPrec AttributeValue
-> ReadPrec [AttributeValue]
-> Read AttributeValue
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AttributeValue]
$creadListPrec :: ReadPrec [AttributeValue]
readPrec :: ReadPrec AttributeValue
$creadPrec :: ReadPrec AttributeValue
readList :: ReadS [AttributeValue]
$creadList :: ReadS [AttributeValue]
readsPrec :: Int -> ReadS AttributeValue
$creadsPrec :: Int -> ReadS AttributeValue
Prelude.Read, Int -> AttributeValue -> ShowS
[AttributeValue] -> ShowS
AttributeValue -> String
(Int -> AttributeValue -> ShowS)
-> (AttributeValue -> String)
-> ([AttributeValue] -> ShowS)
-> Show AttributeValue
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AttributeValue] -> ShowS
$cshowList :: [AttributeValue] -> ShowS
show :: AttributeValue -> String
$cshow :: AttributeValue -> String
showsPrec :: Int -> AttributeValue -> ShowS
$cshowsPrec :: Int -> AttributeValue -> ShowS
Prelude.Show, (forall x. AttributeValue -> Rep AttributeValue x)
-> (forall x. Rep AttributeValue x -> AttributeValue)
-> Generic AttributeValue
forall x. Rep AttributeValue x -> AttributeValue
forall x. AttributeValue -> Rep AttributeValue x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AttributeValue x -> AttributeValue
$cfrom :: forall x. AttributeValue -> Rep AttributeValue x
Prelude.Generic)

-- |
-- Create a value of 'AttributeValue' 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:
--
-- 'l', 'attributeValue_l' - An attribute of type List. For example:
--
-- @\"L\": [ {\"S\": \"Cookies\"} , {\"S\": \"Coffee\"}, {\"N\", \"3.14159\"}]@
--
-- 'ns', 'attributeValue_ns' - An attribute of type Number Set. For example:
--
-- @\"NS\": [\"42.2\", \"-19\", \"7.5\", \"3.14\"]@
--
-- Numbers are sent across the network to DynamoDB as strings, to maximize
-- compatibility across languages and libraries. However, DynamoDB treats
-- them as number type attributes for mathematical operations.
--
-- 'm', 'attributeValue_m' - An attribute of type Map. For example:
--
-- @\"M\": {\"Name\": {\"S\": \"Joe\"}, \"Age\": {\"N\": \"35\"}}@
--
-- 'null', 'attributeValue_null' - An attribute of type Null. For example:
--
-- @\"NULL\": true@
--
-- 'n', 'attributeValue_n' - An attribute of type Number. For example:
--
-- @\"N\": \"123.45\"@
--
-- Numbers are sent across the network to DynamoDB as strings, to maximize
-- compatibility across languages and libraries. However, DynamoDB treats
-- them as number type attributes for mathematical operations.
--
-- 'bs', 'attributeValue_bs' - An attribute of type Binary Set. For example:
--
-- @\"BS\": [\"U3Vubnk=\", \"UmFpbnk=\", \"U25vd3k=\"]@
--
-- 'b', 'attributeValue_b' - An attribute of type Binary. For example:
--
-- @\"B\": \"dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk\"@--
-- -- /Note:/ This 'Lens' automatically encodes and decodes Base64 data.
-- -- The underlying isomorphism will encode to Base64 representation during
-- -- serialisation, and decode from Base64 representation during deserialisation.
-- -- This 'Lens' accepts and returns only raw unencoded data.
--
-- 'ss', 'attributeValue_ss' - An attribute of type String Set. For example:
--
-- @\"SS\": [\"Giraffe\", \"Hippo\" ,\"Zebra\"]@
--
-- 's', 'attributeValue_s' - An attribute of type String. For example:
--
-- @\"S\": \"Hello\"@
--
-- 'bool', 'attributeValue_bool' - An attribute of type Boolean. For example:
--
-- @\"BOOL\": true@
newAttributeValue ::
  AttributeValue
newAttributeValue :: AttributeValue
newAttributeValue =
  AttributeValue' :: Maybe [AttributeValue]
-> Maybe [Text]
-> Maybe (HashMap Text AttributeValue)
-> Maybe Bool
-> Maybe Text
-> Maybe [Base64]
-> Maybe Base64
-> Maybe [Text]
-> Maybe Text
-> Maybe Bool
-> AttributeValue
AttributeValue'
    { $sel:l:AttributeValue' :: Maybe [AttributeValue]
l = Maybe [AttributeValue]
forall a. Maybe a
Prelude.Nothing,
      $sel:ns:AttributeValue' :: Maybe [Text]
ns = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:m:AttributeValue' :: Maybe (HashMap Text AttributeValue)
m = Maybe (HashMap Text AttributeValue)
forall a. Maybe a
Prelude.Nothing,
      $sel:null:AttributeValue' :: Maybe Bool
null = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:n:AttributeValue' :: Maybe Text
n = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:bs:AttributeValue' :: Maybe [Base64]
bs = Maybe [Base64]
forall a. Maybe a
Prelude.Nothing,
      $sel:b:AttributeValue' :: Maybe Base64
b = Maybe Base64
forall a. Maybe a
Prelude.Nothing,
      $sel:ss:AttributeValue' :: Maybe [Text]
ss = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:s:AttributeValue' :: Maybe Text
s = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:bool:AttributeValue' :: Maybe Bool
bool = Maybe Bool
forall a. Maybe a
Prelude.Nothing
    }

-- | An attribute of type List. For example:
--
-- @\"L\": [ {\"S\": \"Cookies\"} , {\"S\": \"Coffee\"}, {\"N\", \"3.14159\"}]@
attributeValue_l :: Lens.Lens' AttributeValue (Prelude.Maybe [AttributeValue])
attributeValue_l :: (Maybe [AttributeValue] -> f (Maybe [AttributeValue]))
-> AttributeValue -> f AttributeValue
attributeValue_l = (AttributeValue -> Maybe [AttributeValue])
-> (AttributeValue -> Maybe [AttributeValue] -> AttributeValue)
-> Lens
     AttributeValue
     AttributeValue
     (Maybe [AttributeValue])
     (Maybe [AttributeValue])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttributeValue' {Maybe [AttributeValue]
l :: Maybe [AttributeValue]
$sel:l:AttributeValue' :: AttributeValue -> Maybe [AttributeValue]
l} -> Maybe [AttributeValue]
l) (\s :: AttributeValue
s@AttributeValue' {} Maybe [AttributeValue]
a -> AttributeValue
s {$sel:l:AttributeValue' :: Maybe [AttributeValue]
l = Maybe [AttributeValue]
a} :: AttributeValue) ((Maybe [AttributeValue] -> f (Maybe [AttributeValue]))
 -> AttributeValue -> f AttributeValue)
-> ((Maybe [AttributeValue] -> f (Maybe [AttributeValue]))
    -> Maybe [AttributeValue] -> f (Maybe [AttributeValue]))
-> (Maybe [AttributeValue] -> f (Maybe [AttributeValue]))
-> AttributeValue
-> f AttributeValue
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [AttributeValue] [AttributeValue] [AttributeValue] [AttributeValue]
-> Iso
     (Maybe [AttributeValue])
     (Maybe [AttributeValue])
     (Maybe [AttributeValue])
     (Maybe [AttributeValue])
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
  [AttributeValue] [AttributeValue] [AttributeValue] [AttributeValue]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | An attribute of type Number Set. For example:
--
-- @\"NS\": [\"42.2\", \"-19\", \"7.5\", \"3.14\"]@
--
-- Numbers are sent across the network to DynamoDB as strings, to maximize
-- compatibility across languages and libraries. However, DynamoDB treats
-- them as number type attributes for mathematical operations.
attributeValue_ns :: Lens.Lens' AttributeValue (Prelude.Maybe [Prelude.Text])
attributeValue_ns :: (Maybe [Text] -> f (Maybe [Text]))
-> AttributeValue -> f AttributeValue
attributeValue_ns = (AttributeValue -> Maybe [Text])
-> (AttributeValue -> Maybe [Text] -> AttributeValue)
-> Lens AttributeValue AttributeValue (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttributeValue' {Maybe [Text]
ns :: Maybe [Text]
$sel:ns:AttributeValue' :: AttributeValue -> Maybe [Text]
ns} -> Maybe [Text]
ns) (\s :: AttributeValue
s@AttributeValue' {} Maybe [Text]
a -> AttributeValue
s {$sel:ns:AttributeValue' :: Maybe [Text]
ns = Maybe [Text]
a} :: AttributeValue) ((Maybe [Text] -> f (Maybe [Text]))
 -> AttributeValue -> f AttributeValue)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> AttributeValue
-> f AttributeValue
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

-- | An attribute of type Map. For example:
--
-- @\"M\": {\"Name\": {\"S\": \"Joe\"}, \"Age\": {\"N\": \"35\"}}@
attributeValue_m :: Lens.Lens' AttributeValue (Prelude.Maybe (Prelude.HashMap Prelude.Text AttributeValue))
attributeValue_m :: (Maybe (HashMap Text AttributeValue)
 -> f (Maybe (HashMap Text AttributeValue)))
-> AttributeValue -> f AttributeValue
attributeValue_m = (AttributeValue -> Maybe (HashMap Text AttributeValue))
-> (AttributeValue
    -> Maybe (HashMap Text AttributeValue) -> AttributeValue)
-> Lens
     AttributeValue
     AttributeValue
     (Maybe (HashMap Text AttributeValue))
     (Maybe (HashMap Text AttributeValue))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttributeValue' {Maybe (HashMap Text AttributeValue)
m :: Maybe (HashMap Text AttributeValue)
$sel:m:AttributeValue' :: AttributeValue -> Maybe (HashMap Text AttributeValue)
m} -> Maybe (HashMap Text AttributeValue)
m) (\s :: AttributeValue
s@AttributeValue' {} Maybe (HashMap Text AttributeValue)
a -> AttributeValue
s {$sel:m:AttributeValue' :: Maybe (HashMap Text AttributeValue)
m = Maybe (HashMap Text AttributeValue)
a} :: AttributeValue) ((Maybe (HashMap Text AttributeValue)
  -> f (Maybe (HashMap Text AttributeValue)))
 -> AttributeValue -> f AttributeValue)
-> ((Maybe (HashMap Text AttributeValue)
     -> f (Maybe (HashMap Text AttributeValue)))
    -> Maybe (HashMap Text AttributeValue)
    -> f (Maybe (HashMap Text AttributeValue)))
-> (Maybe (HashMap Text AttributeValue)
    -> f (Maybe (HashMap Text AttributeValue)))
-> AttributeValue
-> f AttributeValue
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text AttributeValue)
  (HashMap Text AttributeValue)
  (HashMap Text AttributeValue)
  (HashMap Text AttributeValue)
-> Iso
     (Maybe (HashMap Text AttributeValue))
     (Maybe (HashMap Text AttributeValue))
     (Maybe (HashMap Text AttributeValue))
     (Maybe (HashMap Text AttributeValue))
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
  (HashMap Text AttributeValue)
  (HashMap Text AttributeValue)
  (HashMap Text AttributeValue)
  (HashMap Text AttributeValue)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | An attribute of type Null. For example:
--
-- @\"NULL\": true@
attributeValue_null :: Lens.Lens' AttributeValue (Prelude.Maybe Prelude.Bool)
attributeValue_null :: (Maybe Bool -> f (Maybe Bool))
-> AttributeValue -> f AttributeValue
attributeValue_null = (AttributeValue -> Maybe Bool)
-> (AttributeValue -> Maybe Bool -> AttributeValue)
-> Lens AttributeValue AttributeValue (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttributeValue' {Maybe Bool
null :: Maybe Bool
$sel:null:AttributeValue' :: AttributeValue -> Maybe Bool
null} -> Maybe Bool
null) (\s :: AttributeValue
s@AttributeValue' {} Maybe Bool
a -> AttributeValue
s {$sel:null:AttributeValue' :: Maybe Bool
null = Maybe Bool
a} :: AttributeValue)

-- | An attribute of type Number. For example:
--
-- @\"N\": \"123.45\"@
--
-- Numbers are sent across the network to DynamoDB as strings, to maximize
-- compatibility across languages and libraries. However, DynamoDB treats
-- them as number type attributes for mathematical operations.
attributeValue_n :: Lens.Lens' AttributeValue (Prelude.Maybe Prelude.Text)
attributeValue_n :: (Maybe Text -> f (Maybe Text))
-> AttributeValue -> f AttributeValue
attributeValue_n = (AttributeValue -> Maybe Text)
-> (AttributeValue -> Maybe Text -> AttributeValue)
-> Lens AttributeValue AttributeValue (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttributeValue' {Maybe Text
n :: Maybe Text
$sel:n:AttributeValue' :: AttributeValue -> Maybe Text
n} -> Maybe Text
n) (\s :: AttributeValue
s@AttributeValue' {} Maybe Text
a -> AttributeValue
s {$sel:n:AttributeValue' :: Maybe Text
n = Maybe Text
a} :: AttributeValue)

-- | An attribute of type Binary Set. For example:
--
-- @\"BS\": [\"U3Vubnk=\", \"UmFpbnk=\", \"U25vd3k=\"]@
attributeValue_bs :: Lens.Lens' AttributeValue (Prelude.Maybe [Prelude.ByteString])
attributeValue_bs :: (Maybe [ByteString] -> f (Maybe [ByteString]))
-> AttributeValue -> f AttributeValue
attributeValue_bs = (AttributeValue -> Maybe [Base64])
-> (AttributeValue -> Maybe [Base64] -> AttributeValue)
-> Lens
     AttributeValue AttributeValue (Maybe [Base64]) (Maybe [Base64])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttributeValue' {Maybe [Base64]
bs :: Maybe [Base64]
$sel:bs:AttributeValue' :: AttributeValue -> Maybe [Base64]
bs} -> Maybe [Base64]
bs) (\s :: AttributeValue
s@AttributeValue' {} Maybe [Base64]
a -> AttributeValue
s {$sel:bs:AttributeValue' :: Maybe [Base64]
bs = Maybe [Base64]
a} :: AttributeValue) ((Maybe [Base64] -> f (Maybe [Base64]))
 -> AttributeValue -> f AttributeValue)
-> ((Maybe [ByteString] -> f (Maybe [ByteString]))
    -> Maybe [Base64] -> f (Maybe [Base64]))
-> (Maybe [ByteString] -> f (Maybe [ByteString]))
-> AttributeValue
-> f AttributeValue
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Base64] [Base64] [ByteString] [ByteString]
-> Iso
     (Maybe [Base64])
     (Maybe [Base64])
     (Maybe [ByteString])
     (Maybe [ByteString])
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 [Base64] [Base64] [ByteString] [ByteString]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | An attribute of type Binary. For example:
--
-- @\"B\": \"dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk\"@--
-- -- /Note:/ This 'Lens' automatically encodes and decodes Base64 data.
-- -- The underlying isomorphism will encode to Base64 representation during
-- -- serialisation, and decode from Base64 representation during deserialisation.
-- -- This 'Lens' accepts and returns only raw unencoded data.
attributeValue_b :: Lens.Lens' AttributeValue (Prelude.Maybe Prelude.ByteString)
attributeValue_b :: (Maybe ByteString -> f (Maybe ByteString))
-> AttributeValue -> f AttributeValue
attributeValue_b = (AttributeValue -> Maybe Base64)
-> (AttributeValue -> Maybe Base64 -> AttributeValue)
-> Lens AttributeValue AttributeValue (Maybe Base64) (Maybe Base64)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttributeValue' {Maybe Base64
b :: Maybe Base64
$sel:b:AttributeValue' :: AttributeValue -> Maybe Base64
b} -> Maybe Base64
b) (\s :: AttributeValue
s@AttributeValue' {} Maybe Base64
a -> AttributeValue
s {$sel:b:AttributeValue' :: Maybe Base64
b = Maybe Base64
a} :: AttributeValue) ((Maybe Base64 -> f (Maybe Base64))
 -> AttributeValue -> f AttributeValue)
-> ((Maybe ByteString -> f (Maybe ByteString))
    -> Maybe Base64 -> f (Maybe Base64))
-> (Maybe ByteString -> f (Maybe ByteString))
-> AttributeValue
-> f AttributeValue
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso Base64 Base64 ByteString ByteString
-> Iso
     (Maybe Base64) (Maybe Base64) (Maybe ByteString) (Maybe ByteString)
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 Base64 Base64 ByteString ByteString
Iso' Base64 ByteString
Core._Base64

-- | An attribute of type String Set. For example:
--
-- @\"SS\": [\"Giraffe\", \"Hippo\" ,\"Zebra\"]@
attributeValue_ss :: Lens.Lens' AttributeValue (Prelude.Maybe [Prelude.Text])
attributeValue_ss :: (Maybe [Text] -> f (Maybe [Text]))
-> AttributeValue -> f AttributeValue
attributeValue_ss = (AttributeValue -> Maybe [Text])
-> (AttributeValue -> Maybe [Text] -> AttributeValue)
-> Lens AttributeValue AttributeValue (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttributeValue' {Maybe [Text]
ss :: Maybe [Text]
$sel:ss:AttributeValue' :: AttributeValue -> Maybe [Text]
ss} -> Maybe [Text]
ss) (\s :: AttributeValue
s@AttributeValue' {} Maybe [Text]
a -> AttributeValue
s {$sel:ss:AttributeValue' :: Maybe [Text]
ss = Maybe [Text]
a} :: AttributeValue) ((Maybe [Text] -> f (Maybe [Text]))
 -> AttributeValue -> f AttributeValue)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> AttributeValue
-> f AttributeValue
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

-- | An attribute of type String. For example:
--
-- @\"S\": \"Hello\"@
attributeValue_s :: Lens.Lens' AttributeValue (Prelude.Maybe Prelude.Text)
attributeValue_s :: (Maybe Text -> f (Maybe Text))
-> AttributeValue -> f AttributeValue
attributeValue_s = (AttributeValue -> Maybe Text)
-> (AttributeValue -> Maybe Text -> AttributeValue)
-> Lens AttributeValue AttributeValue (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttributeValue' {Maybe Text
s :: Maybe Text
$sel:s:AttributeValue' :: AttributeValue -> Maybe Text
s} -> Maybe Text
s) (\s :: AttributeValue
s@AttributeValue' {} Maybe Text
a -> AttributeValue
s {$sel:s:AttributeValue' :: Maybe Text
s = Maybe Text
a} :: AttributeValue)

-- | An attribute of type Boolean. For example:
--
-- @\"BOOL\": true@
attributeValue_bool :: Lens.Lens' AttributeValue (Prelude.Maybe Prelude.Bool)
attributeValue_bool :: (Maybe Bool -> f (Maybe Bool))
-> AttributeValue -> f AttributeValue
attributeValue_bool = (AttributeValue -> Maybe Bool)
-> (AttributeValue -> Maybe Bool -> AttributeValue)
-> Lens AttributeValue AttributeValue (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttributeValue' {Maybe Bool
bool :: Maybe Bool
$sel:bool:AttributeValue' :: AttributeValue -> Maybe Bool
bool} -> Maybe Bool
bool) (\s :: AttributeValue
s@AttributeValue' {} Maybe Bool
a -> AttributeValue
s {$sel:bool:AttributeValue' :: Maybe Bool
bool = Maybe Bool
a} :: AttributeValue)

instance Core.FromJSON AttributeValue where
  parseJSON :: Value -> Parser AttributeValue
parseJSON =
    String
-> (Object -> Parser AttributeValue)
-> Value
-> Parser AttributeValue
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AttributeValue"
      ( \Object
x ->
          Maybe [AttributeValue]
-> Maybe [Text]
-> Maybe (HashMap Text AttributeValue)
-> Maybe Bool
-> Maybe Text
-> Maybe [Base64]
-> Maybe Base64
-> Maybe [Text]
-> Maybe Text
-> Maybe Bool
-> AttributeValue
AttributeValue'
            (Maybe [AttributeValue]
 -> Maybe [Text]
 -> Maybe (HashMap Text AttributeValue)
 -> Maybe Bool
 -> Maybe Text
 -> Maybe [Base64]
 -> Maybe Base64
 -> Maybe [Text]
 -> Maybe Text
 -> Maybe Bool
 -> AttributeValue)
-> Parser (Maybe [AttributeValue])
-> Parser
     (Maybe [Text]
      -> Maybe (HashMap Text AttributeValue)
      -> Maybe Bool
      -> Maybe Text
      -> Maybe [Base64]
      -> Maybe Base64
      -> Maybe [Text]
      -> Maybe Text
      -> Maybe Bool
      -> AttributeValue)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe [AttributeValue]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"L" Parser (Maybe (Maybe [AttributeValue]))
-> Maybe [AttributeValue] -> Parser (Maybe [AttributeValue])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [AttributeValue]
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe [Text]
   -> Maybe (HashMap Text AttributeValue)
   -> Maybe Bool
   -> Maybe Text
   -> Maybe [Base64]
   -> Maybe Base64
   -> Maybe [Text]
   -> Maybe Text
   -> Maybe Bool
   -> AttributeValue)
-> Parser (Maybe [Text])
-> Parser
     (Maybe (HashMap Text AttributeValue)
      -> Maybe Bool
      -> Maybe Text
      -> Maybe [Base64]
      -> Maybe Base64
      -> Maybe [Text]
      -> Maybe Text
      -> Maybe Bool
      -> AttributeValue)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"NS" Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe (HashMap Text AttributeValue)
   -> Maybe Bool
   -> Maybe Text
   -> Maybe [Base64]
   -> Maybe Base64
   -> Maybe [Text]
   -> Maybe Text
   -> Maybe Bool
   -> AttributeValue)
-> Parser (Maybe (HashMap Text AttributeValue))
-> Parser
     (Maybe Bool
      -> Maybe Text
      -> Maybe [Base64]
      -> Maybe Base64
      -> Maybe [Text]
      -> Maybe Text
      -> Maybe Bool
      -> AttributeValue)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text -> Parser (Maybe (Maybe (HashMap Text AttributeValue)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"M" Parser (Maybe (Maybe (HashMap Text AttributeValue)))
-> Maybe (HashMap Text AttributeValue)
-> Parser (Maybe (HashMap Text AttributeValue))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text AttributeValue)
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe Bool
   -> Maybe Text
   -> Maybe [Base64]
   -> Maybe Base64
   -> Maybe [Text]
   -> Maybe Text
   -> Maybe Bool
   -> AttributeValue)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Text
      -> Maybe [Base64]
      -> Maybe Base64
      -> Maybe [Text]
      -> Maybe Text
      -> Maybe Bool
      -> AttributeValue)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"NULL")
            Parser
  (Maybe Text
   -> Maybe [Base64]
   -> Maybe Base64
   -> Maybe [Text]
   -> Maybe Text
   -> Maybe Bool
   -> AttributeValue)
-> Parser (Maybe Text)
-> Parser
     (Maybe [Base64]
      -> Maybe Base64
      -> Maybe [Text]
      -> Maybe Text
      -> Maybe Bool
      -> AttributeValue)
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
"N")
            Parser
  (Maybe [Base64]
   -> Maybe Base64
   -> Maybe [Text]
   -> Maybe Text
   -> Maybe Bool
   -> AttributeValue)
-> Parser (Maybe [Base64])
-> Parser
     (Maybe Base64
      -> Maybe [Text] -> Maybe Text -> Maybe Bool -> AttributeValue)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Base64]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"BS" Parser (Maybe (Maybe [Base64]))
-> Maybe [Base64] -> Parser (Maybe [Base64])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Base64]
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe Base64
   -> Maybe [Text] -> Maybe Text -> Maybe Bool -> AttributeValue)
-> Parser (Maybe Base64)
-> Parser
     (Maybe [Text] -> Maybe Text -> Maybe Bool -> AttributeValue)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Base64)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"B")
            Parser (Maybe [Text] -> Maybe Text -> Maybe Bool -> AttributeValue)
-> Parser (Maybe [Text])
-> Parser (Maybe Text -> Maybe Bool -> AttributeValue)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SS" Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
            Parser (Maybe Text -> Maybe Bool -> AttributeValue)
-> Parser (Maybe Text) -> Parser (Maybe Bool -> AttributeValue)
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
"S")
            Parser (Maybe Bool -> AttributeValue)
-> Parser (Maybe Bool) -> Parser AttributeValue
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"BOOL")
      )

instance Prelude.Hashable AttributeValue

instance Prelude.NFData AttributeValue

instance Core.ToJSON AttributeValue where
  toJSON :: AttributeValue -> Value
toJSON AttributeValue' {Maybe Bool
Maybe [Text]
Maybe [Base64]
Maybe [AttributeValue]
Maybe Text
Maybe (HashMap Text AttributeValue)
Maybe Base64
bool :: Maybe Bool
s :: Maybe Text
ss :: Maybe [Text]
b :: Maybe Base64
bs :: Maybe [Base64]
n :: Maybe Text
null :: Maybe Bool
m :: Maybe (HashMap Text AttributeValue)
ns :: Maybe [Text]
l :: Maybe [AttributeValue]
$sel:bool:AttributeValue' :: AttributeValue -> Maybe Bool
$sel:s:AttributeValue' :: AttributeValue -> Maybe Text
$sel:ss:AttributeValue' :: AttributeValue -> Maybe [Text]
$sel:b:AttributeValue' :: AttributeValue -> Maybe Base64
$sel:bs:AttributeValue' :: AttributeValue -> Maybe [Base64]
$sel:n:AttributeValue' :: AttributeValue -> Maybe Text
$sel:null:AttributeValue' :: AttributeValue -> Maybe Bool
$sel:m:AttributeValue' :: AttributeValue -> Maybe (HashMap Text AttributeValue)
$sel:ns:AttributeValue' :: AttributeValue -> Maybe [Text]
$sel:l:AttributeValue' :: AttributeValue -> Maybe [AttributeValue]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"L" Text -> [AttributeValue] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([AttributeValue] -> Pair) -> Maybe [AttributeValue] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [AttributeValue]
l,
            (Text
"NS" 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]
ns,
            (Text
"M" Text -> HashMap Text AttributeValue -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text AttributeValue -> Pair)
-> Maybe (HashMap Text AttributeValue) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text AttributeValue)
m,
            (Text
"NULL" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
null,
            (Text
"N" 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
n,
            (Text
"BS" Text -> [Base64] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Base64] -> Pair) -> Maybe [Base64] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Base64]
bs,
            (Text
"B" Text -> Base64 -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Base64 -> Pair) -> Maybe Base64 -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Base64
b,
            (Text
"SS" 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]
ss,
            (Text
"S" 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
s,
            (Text
"BOOL" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
bool
          ]
      )