{-# 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 #-}
module Amazonka.DataBrew.Types.DatetimeOptions 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
data DatetimeOptions = DatetimeOptions'
{
DatetimeOptions -> Maybe Text
localeCode :: Prelude.Maybe Prelude.Text,
DatetimeOptions -> Maybe Text
timezoneOffset :: Prelude.Maybe Prelude.Text,
DatetimeOptions -> Text
format :: Prelude.Text
}
deriving (DatetimeOptions -> DatetimeOptions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DatetimeOptions -> DatetimeOptions -> Bool
$c/= :: DatetimeOptions -> DatetimeOptions -> Bool
== :: DatetimeOptions -> DatetimeOptions -> Bool
$c== :: DatetimeOptions -> DatetimeOptions -> Bool
Prelude.Eq, ReadPrec [DatetimeOptions]
ReadPrec DatetimeOptions
Int -> ReadS DatetimeOptions
ReadS [DatetimeOptions]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DatetimeOptions]
$creadListPrec :: ReadPrec [DatetimeOptions]
readPrec :: ReadPrec DatetimeOptions
$creadPrec :: ReadPrec DatetimeOptions
readList :: ReadS [DatetimeOptions]
$creadList :: ReadS [DatetimeOptions]
readsPrec :: Int -> ReadS DatetimeOptions
$creadsPrec :: Int -> ReadS DatetimeOptions
Prelude.Read, Int -> DatetimeOptions -> ShowS
[DatetimeOptions] -> ShowS
DatetimeOptions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DatetimeOptions] -> ShowS
$cshowList :: [DatetimeOptions] -> ShowS
show :: DatetimeOptions -> String
$cshow :: DatetimeOptions -> String
showsPrec :: Int -> DatetimeOptions -> ShowS
$cshowsPrec :: Int -> DatetimeOptions -> ShowS
Prelude.Show, forall x. Rep DatetimeOptions x -> DatetimeOptions
forall x. DatetimeOptions -> Rep DatetimeOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DatetimeOptions x -> DatetimeOptions
$cfrom :: forall x. DatetimeOptions -> Rep DatetimeOptions x
Prelude.Generic)
newDatetimeOptions ::
Prelude.Text ->
DatetimeOptions
newDatetimeOptions :: Text -> DatetimeOptions
newDatetimeOptions Text
pFormat_ =
DatetimeOptions'
{ $sel:localeCode:DatetimeOptions' :: Maybe Text
localeCode = forall a. Maybe a
Prelude.Nothing,
$sel:timezoneOffset:DatetimeOptions' :: Maybe Text
timezoneOffset = forall a. Maybe a
Prelude.Nothing,
$sel:format:DatetimeOptions' :: Text
format = Text
pFormat_
}
datetimeOptions_localeCode :: Lens.Lens' DatetimeOptions (Prelude.Maybe Prelude.Text)
datetimeOptions_localeCode :: Lens' DatetimeOptions (Maybe Text)
datetimeOptions_localeCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DatetimeOptions' {Maybe Text
localeCode :: Maybe Text
$sel:localeCode:DatetimeOptions' :: DatetimeOptions -> Maybe Text
localeCode} -> Maybe Text
localeCode) (\s :: DatetimeOptions
s@DatetimeOptions' {} Maybe Text
a -> DatetimeOptions
s {$sel:localeCode:DatetimeOptions' :: Maybe Text
localeCode = Maybe Text
a} :: DatetimeOptions)
datetimeOptions_timezoneOffset :: Lens.Lens' DatetimeOptions (Prelude.Maybe Prelude.Text)
datetimeOptions_timezoneOffset :: Lens' DatetimeOptions (Maybe Text)
datetimeOptions_timezoneOffset = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DatetimeOptions' {Maybe Text
timezoneOffset :: Maybe Text
$sel:timezoneOffset:DatetimeOptions' :: DatetimeOptions -> Maybe Text
timezoneOffset} -> Maybe Text
timezoneOffset) (\s :: DatetimeOptions
s@DatetimeOptions' {} Maybe Text
a -> DatetimeOptions
s {$sel:timezoneOffset:DatetimeOptions' :: Maybe Text
timezoneOffset = Maybe Text
a} :: DatetimeOptions)
datetimeOptions_format :: Lens.Lens' DatetimeOptions Prelude.Text
datetimeOptions_format :: Lens' DatetimeOptions Text
datetimeOptions_format = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DatetimeOptions' {Text
format :: Text
$sel:format:DatetimeOptions' :: DatetimeOptions -> Text
format} -> Text
format) (\s :: DatetimeOptions
s@DatetimeOptions' {} Text
a -> DatetimeOptions
s {$sel:format:DatetimeOptions' :: Text
format = Text
a} :: DatetimeOptions)
instance Data.FromJSON DatetimeOptions where
parseJSON :: Value -> Parser DatetimeOptions
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"DatetimeOptions"
( \Object
x ->
Maybe Text -> Maybe Text -> Text -> DatetimeOptions
DatetimeOptions'
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
"LocaleCode")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"TimezoneOffset")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Format")
)
instance Prelude.Hashable DatetimeOptions where
hashWithSalt :: Int -> DatetimeOptions -> Int
hashWithSalt Int
_salt DatetimeOptions' {Maybe Text
Text
format :: Text
timezoneOffset :: Maybe Text
localeCode :: Maybe Text
$sel:format:DatetimeOptions' :: DatetimeOptions -> Text
$sel:timezoneOffset:DatetimeOptions' :: DatetimeOptions -> Maybe Text
$sel:localeCode:DatetimeOptions' :: DatetimeOptions -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
localeCode
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
timezoneOffset
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
format
instance Prelude.NFData DatetimeOptions where
rnf :: DatetimeOptions -> ()
rnf DatetimeOptions' {Maybe Text
Text
format :: Text
timezoneOffset :: Maybe Text
localeCode :: Maybe Text
$sel:format:DatetimeOptions' :: DatetimeOptions -> Text
$sel:timezoneOffset:DatetimeOptions' :: DatetimeOptions -> Maybe Text
$sel:localeCode:DatetimeOptions' :: DatetimeOptions -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
localeCode
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
timezoneOffset
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
format
instance Data.ToJSON DatetimeOptions where
toJSON :: DatetimeOptions -> Value
toJSON DatetimeOptions' {Maybe Text
Text
format :: Text
timezoneOffset :: Maybe Text
localeCode :: Maybe Text
$sel:format:DatetimeOptions' :: DatetimeOptions -> Text
$sel:timezoneOffset:DatetimeOptions' :: DatetimeOptions -> Maybe Text
$sel:localeCode:DatetimeOptions' :: DatetimeOptions -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"LocaleCode" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
localeCode,
(Key
"TimezoneOffset" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
timezoneOffset,
forall a. a -> Maybe a
Prelude.Just (Key
"Format" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
format)
]
)