{-# 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.Mobile.Types.Resource 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 Resource = Resource'
{ Resource -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
Resource -> Maybe (HashMap Text Text)
attributes :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
Resource -> Maybe Text
feature :: Prelude.Maybe Prelude.Text,
Resource -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
Resource -> Maybe Text
type' :: Prelude.Maybe Prelude.Text
}
deriving (Resource -> Resource -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Resource -> Resource -> Bool
$c/= :: Resource -> Resource -> Bool
== :: Resource -> Resource -> Bool
$c== :: Resource -> Resource -> Bool
Prelude.Eq, ReadPrec [Resource]
ReadPrec Resource
Int -> ReadS Resource
ReadS [Resource]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Resource]
$creadListPrec :: ReadPrec [Resource]
readPrec :: ReadPrec Resource
$creadPrec :: ReadPrec Resource
readList :: ReadS [Resource]
$creadList :: ReadS [Resource]
readsPrec :: Int -> ReadS Resource
$creadsPrec :: Int -> ReadS Resource
Prelude.Read, Int -> Resource -> ShowS
[Resource] -> ShowS
Resource -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Resource] -> ShowS
$cshowList :: [Resource] -> ShowS
show :: Resource -> String
$cshow :: Resource -> String
showsPrec :: Int -> Resource -> ShowS
$cshowsPrec :: Int -> Resource -> ShowS
Prelude.Show, forall x. Rep Resource x -> Resource
forall x. Resource -> Rep Resource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Resource x -> Resource
$cfrom :: forall x. Resource -> Rep Resource x
Prelude.Generic)
newResource ::
Resource
newResource :: Resource
newResource =
Resource'
{ $sel:arn:Resource' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
$sel:attributes:Resource' :: Maybe (HashMap Text Text)
attributes = forall a. Maybe a
Prelude.Nothing,
$sel:feature:Resource' :: Maybe Text
feature = forall a. Maybe a
Prelude.Nothing,
$sel:name:Resource' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
$sel:type':Resource' :: Maybe Text
type' = forall a. Maybe a
Prelude.Nothing
}
resource_arn :: Lens.Lens' Resource (Prelude.Maybe Prelude.Text)
resource_arn :: Lens' Resource (Maybe Text)
resource_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Resource' {Maybe Text
arn :: Maybe Text
$sel:arn:Resource' :: Resource -> Maybe Text
arn} -> Maybe Text
arn) (\s :: Resource
s@Resource' {} Maybe Text
a -> Resource
s {$sel:arn:Resource' :: Maybe Text
arn = Maybe Text
a} :: Resource)
resource_attributes :: Lens.Lens' Resource (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
resource_attributes :: Lens' Resource (Maybe (HashMap Text Text))
resource_attributes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Resource' {Maybe (HashMap Text Text)
attributes :: Maybe (HashMap Text Text)
$sel:attributes:Resource' :: Resource -> Maybe (HashMap Text Text)
attributes} -> Maybe (HashMap Text Text)
attributes) (\s :: Resource
s@Resource' {} Maybe (HashMap Text Text)
a -> Resource
s {$sel:attributes:Resource' :: Maybe (HashMap Text Text)
attributes = Maybe (HashMap Text Text)
a} :: Resource) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
resource_feature :: Lens.Lens' Resource (Prelude.Maybe Prelude.Text)
resource_feature :: Lens' Resource (Maybe Text)
resource_feature = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Resource' {Maybe Text
feature :: Maybe Text
$sel:feature:Resource' :: Resource -> Maybe Text
feature} -> Maybe Text
feature) (\s :: Resource
s@Resource' {} Maybe Text
a -> Resource
s {$sel:feature:Resource' :: Maybe Text
feature = Maybe Text
a} :: Resource)
resource_name :: Lens.Lens' Resource (Prelude.Maybe Prelude.Text)
resource_name :: Lens' Resource (Maybe Text)
resource_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Resource' {Maybe Text
name :: Maybe Text
$sel:name:Resource' :: Resource -> Maybe Text
name} -> Maybe Text
name) (\s :: Resource
s@Resource' {} Maybe Text
a -> Resource
s {$sel:name:Resource' :: Maybe Text
name = Maybe Text
a} :: Resource)
resource_type :: Lens.Lens' Resource (Prelude.Maybe Prelude.Text)
resource_type :: Lens' Resource (Maybe Text)
resource_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Resource' {Maybe Text
type' :: Maybe Text
$sel:type':Resource' :: Resource -> Maybe Text
type'} -> Maybe Text
type') (\s :: Resource
s@Resource' {} Maybe Text
a -> Resource
s {$sel:type':Resource' :: Maybe Text
type' = Maybe Text
a} :: Resource)
instance Data.FromJSON Resource where
parseJSON :: Value -> Parser Resource
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"Resource"
( \Object
x ->
Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Resource
Resource'
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
"arn")
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
"attributes" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
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
"feature")
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
"name")
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
"type")
)
instance Prelude.Hashable Resource where
hashWithSalt :: Int -> Resource -> Int
hashWithSalt Int
_salt Resource' {Maybe Text
Maybe (HashMap Text Text)
type' :: Maybe Text
name :: Maybe Text
feature :: Maybe Text
attributes :: Maybe (HashMap Text Text)
arn :: Maybe Text
$sel:type':Resource' :: Resource -> Maybe Text
$sel:name:Resource' :: Resource -> Maybe Text
$sel:feature:Resource' :: Resource -> Maybe Text
$sel:attributes:Resource' :: Resource -> Maybe (HashMap Text Text)
$sel:arn:Resource' :: Resource -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
arn
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
attributes
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
feature
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
type'
instance Prelude.NFData Resource where
rnf :: Resource -> ()
rnf Resource' {Maybe Text
Maybe (HashMap Text Text)
type' :: Maybe Text
name :: Maybe Text
feature :: Maybe Text
attributes :: Maybe (HashMap Text Text)
arn :: Maybe Text
$sel:type':Resource' :: Resource -> Maybe Text
$sel:name:Resource' :: Resource -> Maybe Text
$sel:feature:Resource' :: Resource -> Maybe Text
$sel:attributes:Resource' :: Resource -> Maybe (HashMap Text Text)
$sel:arn:Resource' :: Resource -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
arn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
attributes
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
feature
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
type'