{-# 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.Inspector2.Types.Resource where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Inspector2.Types.ResourceDetails
import Amazonka.Inspector2.Types.ResourceType
import qualified Amazonka.Prelude as Prelude
data Resource = Resource'
{
Resource -> Maybe ResourceDetails
details :: Prelude.Maybe ResourceDetails,
Resource -> Maybe Text
partition :: Prelude.Maybe Prelude.Text,
Resource -> Maybe Text
region :: Prelude.Maybe Prelude.Text,
Resource -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
Resource -> Text
id :: Prelude.Text,
Resource -> ResourceType
type' :: ResourceType
}
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 ::
Prelude.Text ->
ResourceType ->
Resource
newResource :: Text -> ResourceType -> Resource
newResource Text
pId_ ResourceType
pType_ =
Resource'
{ $sel:details:Resource' :: Maybe ResourceDetails
details = forall a. Maybe a
Prelude.Nothing,
$sel:partition:Resource' :: Maybe Text
partition = forall a. Maybe a
Prelude.Nothing,
$sel:region:Resource' :: Maybe Text
region = forall a. Maybe a
Prelude.Nothing,
$sel:tags:Resource' :: Maybe (HashMap Text Text)
tags = forall a. Maybe a
Prelude.Nothing,
$sel:id:Resource' :: Text
id = Text
pId_,
$sel:type':Resource' :: ResourceType
type' = ResourceType
pType_
}
resource_details :: Lens.Lens' Resource (Prelude.Maybe ResourceDetails)
resource_details :: Lens' Resource (Maybe ResourceDetails)
resource_details = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Resource' {Maybe ResourceDetails
details :: Maybe ResourceDetails
$sel:details:Resource' :: Resource -> Maybe ResourceDetails
details} -> Maybe ResourceDetails
details) (\s :: Resource
s@Resource' {} Maybe ResourceDetails
a -> Resource
s {$sel:details:Resource' :: Maybe ResourceDetails
details = Maybe ResourceDetails
a} :: Resource)
resource_partition :: Lens.Lens' Resource (Prelude.Maybe Prelude.Text)
resource_partition :: Lens' Resource (Maybe Text)
resource_partition = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Resource' {Maybe Text
partition :: Maybe Text
$sel:partition:Resource' :: Resource -> Maybe Text
partition} -> Maybe Text
partition) (\s :: Resource
s@Resource' {} Maybe Text
a -> Resource
s {$sel:partition:Resource' :: Maybe Text
partition = Maybe Text
a} :: Resource)
resource_region :: Lens.Lens' Resource (Prelude.Maybe Prelude.Text)
resource_region :: Lens' Resource (Maybe Text)
resource_region = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Resource' {Maybe Text
region :: Maybe Text
$sel:region:Resource' :: Resource -> Maybe Text
region} -> Maybe Text
region) (\s :: Resource
s@Resource' {} Maybe Text
a -> Resource
s {$sel:region:Resource' :: Maybe Text
region = Maybe Text
a} :: Resource)
resource_tags :: Lens.Lens' Resource (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
resource_tags :: Lens' Resource (Maybe (HashMap Text Text))
resource_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Resource' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:Resource' :: Resource -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: Resource
s@Resource' {} Maybe (HashMap Text Text)
a -> Resource
s {$sel:tags:Resource' :: Maybe (HashMap Text Text)
tags = 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_id :: Lens.Lens' Resource Prelude.Text
resource_id :: Lens' Resource Text
resource_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Resource' {Text
id :: Text
$sel:id:Resource' :: Resource -> Text
id} -> Text
id) (\s :: Resource
s@Resource' {} Text
a -> Resource
s {$sel:id:Resource' :: Text
id = Text
a} :: Resource)
resource_type :: Lens.Lens' Resource ResourceType
resource_type :: Lens' Resource ResourceType
resource_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Resource' {ResourceType
type' :: ResourceType
$sel:type':Resource' :: Resource -> ResourceType
type'} -> ResourceType
type') (\s :: Resource
s@Resource' {} ResourceType
a -> Resource
s {$sel:type':Resource' :: ResourceType
type' = ResourceType
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 ResourceDetails
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Text
-> ResourceType
-> 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
"details")
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
"partition")
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
"region")
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
"tags" 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 a
Data..: Key
"id")
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
"type")
)
instance Prelude.Hashable Resource where
hashWithSalt :: Int -> Resource -> Int
hashWithSalt Int
_salt Resource' {Maybe Text
Maybe (HashMap Text Text)
Maybe ResourceDetails
Text
ResourceType
type' :: ResourceType
id :: Text
tags :: Maybe (HashMap Text Text)
region :: Maybe Text
partition :: Maybe Text
details :: Maybe ResourceDetails
$sel:type':Resource' :: Resource -> ResourceType
$sel:id:Resource' :: Resource -> Text
$sel:tags:Resource' :: Resource -> Maybe (HashMap Text Text)
$sel:region:Resource' :: Resource -> Maybe Text
$sel:partition:Resource' :: Resource -> Maybe Text
$sel:details:Resource' :: Resource -> Maybe ResourceDetails
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ResourceDetails
details
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
partition
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
region
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
tags
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
id
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ResourceType
type'
instance Prelude.NFData Resource where
rnf :: Resource -> ()
rnf Resource' {Maybe Text
Maybe (HashMap Text Text)
Maybe ResourceDetails
Text
ResourceType
type' :: ResourceType
id :: Text
tags :: Maybe (HashMap Text Text)
region :: Maybe Text
partition :: Maybe Text
details :: Maybe ResourceDetails
$sel:type':Resource' :: Resource -> ResourceType
$sel:id:Resource' :: Resource -> Text
$sel:tags:Resource' :: Resource -> Maybe (HashMap Text Text)
$sel:region:Resource' :: Resource -> Maybe Text
$sel:partition:Resource' :: Resource -> Maybe Text
$sel:details:Resource' :: Resource -> Maybe ResourceDetails
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe ResourceDetails
details
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
partition
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
region
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
tags
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
id
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ResourceType
type'