{-# 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.Inspector.Types.AssetAttributes
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Inspector.Types.AssetAttributes where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Inspector.Types.NetworkInterface
import Amazonka.Inspector.Types.Tag
import qualified Amazonka.Prelude as Prelude

-- | A collection of attributes of the host from which the finding is
-- generated.
--
-- /See:/ 'newAssetAttributes' smart constructor.
data AssetAttributes = AssetAttributes'
  { -- | The ID of the agent that is installed on the EC2 instance where the
    -- finding is generated.
    AssetAttributes -> Maybe Text
agentId :: Prelude.Maybe Prelude.Text,
    -- | The ID of the Amazon Machine Image (AMI) that is installed on the EC2
    -- instance where the finding is generated.
    AssetAttributes -> Maybe Text
amiId :: Prelude.Maybe Prelude.Text,
    -- | The Auto Scaling group of the EC2 instance where the finding is
    -- generated.
    AssetAttributes -> Maybe Text
autoScalingGroup :: Prelude.Maybe Prelude.Text,
    -- | The hostname of the EC2 instance where the finding is generated.
    AssetAttributes -> Maybe Text
hostname :: Prelude.Maybe Prelude.Text,
    -- | The list of IP v4 addresses of the EC2 instance where the finding is
    -- generated.
    AssetAttributes -> Maybe [Text]
ipv4Addresses :: Prelude.Maybe [Prelude.Text],
    -- | An array of the network interfaces interacting with the EC2 instance
    -- where the finding is generated.
    AssetAttributes -> Maybe [NetworkInterface]
networkInterfaces :: Prelude.Maybe [NetworkInterface],
    -- | The tags related to the EC2 instance where the finding is generated.
    AssetAttributes -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | The schema version of this data type.
    AssetAttributes -> Natural
schemaVersion :: Prelude.Natural
  }
  deriving (AssetAttributes -> AssetAttributes -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssetAttributes -> AssetAttributes -> Bool
$c/= :: AssetAttributes -> AssetAttributes -> Bool
== :: AssetAttributes -> AssetAttributes -> Bool
$c== :: AssetAttributes -> AssetAttributes -> Bool
Prelude.Eq, ReadPrec [AssetAttributes]
ReadPrec AssetAttributes
Int -> ReadS AssetAttributes
ReadS [AssetAttributes]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssetAttributes]
$creadListPrec :: ReadPrec [AssetAttributes]
readPrec :: ReadPrec AssetAttributes
$creadPrec :: ReadPrec AssetAttributes
readList :: ReadS [AssetAttributes]
$creadList :: ReadS [AssetAttributes]
readsPrec :: Int -> ReadS AssetAttributes
$creadsPrec :: Int -> ReadS AssetAttributes
Prelude.Read, Int -> AssetAttributes -> ShowS
[AssetAttributes] -> ShowS
AssetAttributes -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssetAttributes] -> ShowS
$cshowList :: [AssetAttributes] -> ShowS
show :: AssetAttributes -> String
$cshow :: AssetAttributes -> String
showsPrec :: Int -> AssetAttributes -> ShowS
$cshowsPrec :: Int -> AssetAttributes -> ShowS
Prelude.Show, forall x. Rep AssetAttributes x -> AssetAttributes
forall x. AssetAttributes -> Rep AssetAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AssetAttributes x -> AssetAttributes
$cfrom :: forall x. AssetAttributes -> Rep AssetAttributes x
Prelude.Generic)

-- |
-- Create a value of 'AssetAttributes' 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:
--
-- 'agentId', 'assetAttributes_agentId' - The ID of the agent that is installed on the EC2 instance where the
-- finding is generated.
--
-- 'amiId', 'assetAttributes_amiId' - The ID of the Amazon Machine Image (AMI) that is installed on the EC2
-- instance where the finding is generated.
--
-- 'autoScalingGroup', 'assetAttributes_autoScalingGroup' - The Auto Scaling group of the EC2 instance where the finding is
-- generated.
--
-- 'hostname', 'assetAttributes_hostname' - The hostname of the EC2 instance where the finding is generated.
--
-- 'ipv4Addresses', 'assetAttributes_ipv4Addresses' - The list of IP v4 addresses of the EC2 instance where the finding is
-- generated.
--
-- 'networkInterfaces', 'assetAttributes_networkInterfaces' - An array of the network interfaces interacting with the EC2 instance
-- where the finding is generated.
--
-- 'tags', 'assetAttributes_tags' - The tags related to the EC2 instance where the finding is generated.
--
-- 'schemaVersion', 'assetAttributes_schemaVersion' - The schema version of this data type.
newAssetAttributes ::
  -- | 'schemaVersion'
  Prelude.Natural ->
  AssetAttributes
newAssetAttributes :: Natural -> AssetAttributes
newAssetAttributes Natural
pSchemaVersion_ =
  AssetAttributes'
    { $sel:agentId:AssetAttributes' :: Maybe Text
agentId = forall a. Maybe a
Prelude.Nothing,
      $sel:amiId:AssetAttributes' :: Maybe Text
amiId = forall a. Maybe a
Prelude.Nothing,
      $sel:autoScalingGroup:AssetAttributes' :: Maybe Text
autoScalingGroup = forall a. Maybe a
Prelude.Nothing,
      $sel:hostname:AssetAttributes' :: Maybe Text
hostname = forall a. Maybe a
Prelude.Nothing,
      $sel:ipv4Addresses:AssetAttributes' :: Maybe [Text]
ipv4Addresses = forall a. Maybe a
Prelude.Nothing,
      $sel:networkInterfaces:AssetAttributes' :: Maybe [NetworkInterface]
networkInterfaces = forall a. Maybe a
Prelude.Nothing,
      $sel:tags:AssetAttributes' :: Maybe [Tag]
tags = forall a. Maybe a
Prelude.Nothing,
      $sel:schemaVersion:AssetAttributes' :: Natural
schemaVersion = Natural
pSchemaVersion_
    }

-- | The ID of the agent that is installed on the EC2 instance where the
-- finding is generated.
assetAttributes_agentId :: Lens.Lens' AssetAttributes (Prelude.Maybe Prelude.Text)
assetAttributes_agentId :: Lens' AssetAttributes (Maybe Text)
assetAttributes_agentId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssetAttributes' {Maybe Text
agentId :: Maybe Text
$sel:agentId:AssetAttributes' :: AssetAttributes -> Maybe Text
agentId} -> Maybe Text
agentId) (\s :: AssetAttributes
s@AssetAttributes' {} Maybe Text
a -> AssetAttributes
s {$sel:agentId:AssetAttributes' :: Maybe Text
agentId = Maybe Text
a} :: AssetAttributes)

-- | The ID of the Amazon Machine Image (AMI) that is installed on the EC2
-- instance where the finding is generated.
assetAttributes_amiId :: Lens.Lens' AssetAttributes (Prelude.Maybe Prelude.Text)
assetAttributes_amiId :: Lens' AssetAttributes (Maybe Text)
assetAttributes_amiId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssetAttributes' {Maybe Text
amiId :: Maybe Text
$sel:amiId:AssetAttributes' :: AssetAttributes -> Maybe Text
amiId} -> Maybe Text
amiId) (\s :: AssetAttributes
s@AssetAttributes' {} Maybe Text
a -> AssetAttributes
s {$sel:amiId:AssetAttributes' :: Maybe Text
amiId = Maybe Text
a} :: AssetAttributes)

-- | The Auto Scaling group of the EC2 instance where the finding is
-- generated.
assetAttributes_autoScalingGroup :: Lens.Lens' AssetAttributes (Prelude.Maybe Prelude.Text)
assetAttributes_autoScalingGroup :: Lens' AssetAttributes (Maybe Text)
assetAttributes_autoScalingGroup = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssetAttributes' {Maybe Text
autoScalingGroup :: Maybe Text
$sel:autoScalingGroup:AssetAttributes' :: AssetAttributes -> Maybe Text
autoScalingGroup} -> Maybe Text
autoScalingGroup) (\s :: AssetAttributes
s@AssetAttributes' {} Maybe Text
a -> AssetAttributes
s {$sel:autoScalingGroup:AssetAttributes' :: Maybe Text
autoScalingGroup = Maybe Text
a} :: AssetAttributes)

-- | The hostname of the EC2 instance where the finding is generated.
assetAttributes_hostname :: Lens.Lens' AssetAttributes (Prelude.Maybe Prelude.Text)
assetAttributes_hostname :: Lens' AssetAttributes (Maybe Text)
assetAttributes_hostname = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssetAttributes' {Maybe Text
hostname :: Maybe Text
$sel:hostname:AssetAttributes' :: AssetAttributes -> Maybe Text
hostname} -> Maybe Text
hostname) (\s :: AssetAttributes
s@AssetAttributes' {} Maybe Text
a -> AssetAttributes
s {$sel:hostname:AssetAttributes' :: Maybe Text
hostname = Maybe Text
a} :: AssetAttributes)

-- | The list of IP v4 addresses of the EC2 instance where the finding is
-- generated.
assetAttributes_ipv4Addresses :: Lens.Lens' AssetAttributes (Prelude.Maybe [Prelude.Text])
assetAttributes_ipv4Addresses :: Lens' AssetAttributes (Maybe [Text])
assetAttributes_ipv4Addresses = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssetAttributes' {Maybe [Text]
ipv4Addresses :: Maybe [Text]
$sel:ipv4Addresses:AssetAttributes' :: AssetAttributes -> Maybe [Text]
ipv4Addresses} -> Maybe [Text]
ipv4Addresses) (\s :: AssetAttributes
s@AssetAttributes' {} Maybe [Text]
a -> AssetAttributes
s {$sel:ipv4Addresses:AssetAttributes' :: Maybe [Text]
ipv4Addresses = Maybe [Text]
a} :: AssetAttributes) 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

-- | An array of the network interfaces interacting with the EC2 instance
-- where the finding is generated.
assetAttributes_networkInterfaces :: Lens.Lens' AssetAttributes (Prelude.Maybe [NetworkInterface])
assetAttributes_networkInterfaces :: Lens' AssetAttributes (Maybe [NetworkInterface])
assetAttributes_networkInterfaces = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssetAttributes' {Maybe [NetworkInterface]
networkInterfaces :: Maybe [NetworkInterface]
$sel:networkInterfaces:AssetAttributes' :: AssetAttributes -> Maybe [NetworkInterface]
networkInterfaces} -> Maybe [NetworkInterface]
networkInterfaces) (\s :: AssetAttributes
s@AssetAttributes' {} Maybe [NetworkInterface]
a -> AssetAttributes
s {$sel:networkInterfaces:AssetAttributes' :: Maybe [NetworkInterface]
networkInterfaces = Maybe [NetworkInterface]
a} :: AssetAttributes) 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

-- | The tags related to the EC2 instance where the finding is generated.
assetAttributes_tags :: Lens.Lens' AssetAttributes (Prelude.Maybe [Tag])
assetAttributes_tags :: Lens' AssetAttributes (Maybe [Tag])
assetAttributes_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssetAttributes' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:AssetAttributes' :: AssetAttributes -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: AssetAttributes
s@AssetAttributes' {} Maybe [Tag]
a -> AssetAttributes
s {$sel:tags:AssetAttributes' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: AssetAttributes) 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

-- | The schema version of this data type.
assetAttributes_schemaVersion :: Lens.Lens' AssetAttributes Prelude.Natural
assetAttributes_schemaVersion :: Lens' AssetAttributes Natural
assetAttributes_schemaVersion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssetAttributes' {Natural
schemaVersion :: Natural
$sel:schemaVersion:AssetAttributes' :: AssetAttributes -> Natural
schemaVersion} -> Natural
schemaVersion) (\s :: AssetAttributes
s@AssetAttributes' {} Natural
a -> AssetAttributes
s {$sel:schemaVersion:AssetAttributes' :: Natural
schemaVersion = Natural
a} :: AssetAttributes)

instance Data.FromJSON AssetAttributes where
  parseJSON :: Value -> Parser AssetAttributes
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AssetAttributes"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [Text]
-> Maybe [NetworkInterface]
-> Maybe [Tag]
-> Natural
-> AssetAttributes
AssetAttributes'
            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
"agentId")
            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
"amiId")
            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
"autoScalingGroup")
            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
"hostname")
            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
"ipv4Addresses" 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
"networkInterfaces"
                            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
"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
"schemaVersion")
      )

instance Prelude.Hashable AssetAttributes where
  hashWithSalt :: Int -> AssetAttributes -> Int
hashWithSalt Int
_salt AssetAttributes' {Natural
Maybe [Text]
Maybe [NetworkInterface]
Maybe [Tag]
Maybe Text
schemaVersion :: Natural
tags :: Maybe [Tag]
networkInterfaces :: Maybe [NetworkInterface]
ipv4Addresses :: Maybe [Text]
hostname :: Maybe Text
autoScalingGroup :: Maybe Text
amiId :: Maybe Text
agentId :: Maybe Text
$sel:schemaVersion:AssetAttributes' :: AssetAttributes -> Natural
$sel:tags:AssetAttributes' :: AssetAttributes -> Maybe [Tag]
$sel:networkInterfaces:AssetAttributes' :: AssetAttributes -> Maybe [NetworkInterface]
$sel:ipv4Addresses:AssetAttributes' :: AssetAttributes -> Maybe [Text]
$sel:hostname:AssetAttributes' :: AssetAttributes -> Maybe Text
$sel:autoScalingGroup:AssetAttributes' :: AssetAttributes -> Maybe Text
$sel:amiId:AssetAttributes' :: AssetAttributes -> Maybe Text
$sel:agentId:AssetAttributes' :: AssetAttributes -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
agentId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
amiId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
autoScalingGroup
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
hostname
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
ipv4Addresses
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [NetworkInterface]
networkInterfaces
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Tag]
tags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
schemaVersion

instance Prelude.NFData AssetAttributes where
  rnf :: AssetAttributes -> ()
rnf AssetAttributes' {Natural
Maybe [Text]
Maybe [NetworkInterface]
Maybe [Tag]
Maybe Text
schemaVersion :: Natural
tags :: Maybe [Tag]
networkInterfaces :: Maybe [NetworkInterface]
ipv4Addresses :: Maybe [Text]
hostname :: Maybe Text
autoScalingGroup :: Maybe Text
amiId :: Maybe Text
agentId :: Maybe Text
$sel:schemaVersion:AssetAttributes' :: AssetAttributes -> Natural
$sel:tags:AssetAttributes' :: AssetAttributes -> Maybe [Tag]
$sel:networkInterfaces:AssetAttributes' :: AssetAttributes -> Maybe [NetworkInterface]
$sel:ipv4Addresses:AssetAttributes' :: AssetAttributes -> Maybe [Text]
$sel:hostname:AssetAttributes' :: AssetAttributes -> Maybe Text
$sel:autoScalingGroup:AssetAttributes' :: AssetAttributes -> Maybe Text
$sel:amiId:AssetAttributes' :: AssetAttributes -> Maybe Text
$sel:agentId:AssetAttributes' :: AssetAttributes -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
agentId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
amiId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
autoScalingGroup
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
hostname
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
ipv4Addresses
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [NetworkInterface]
networkInterfaces
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Tag]
tags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Natural
schemaVersion