{-# 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.AccessAnalyzer.Types.AnalyzedResourceSummary
-- 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.AccessAnalyzer.Types.AnalyzedResourceSummary where

import Amazonka.AccessAnalyzer.Types.ResourceType
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

-- | Contains the ARN of the analyzed resource.
--
-- /See:/ 'newAnalyzedResourceSummary' smart constructor.
data AnalyzedResourceSummary = AnalyzedResourceSummary'
  { -- | The ARN of the analyzed resource.
    AnalyzedResourceSummary -> Text
resourceArn :: Prelude.Text,
    -- | The Amazon Web Services account ID that owns the resource.
    AnalyzedResourceSummary -> Text
resourceOwnerAccount :: Prelude.Text,
    -- | The type of resource that was analyzed.
    AnalyzedResourceSummary -> ResourceType
resourceType :: ResourceType
  }
  deriving (AnalyzedResourceSummary -> AnalyzedResourceSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AnalyzedResourceSummary -> AnalyzedResourceSummary -> Bool
$c/= :: AnalyzedResourceSummary -> AnalyzedResourceSummary -> Bool
== :: AnalyzedResourceSummary -> AnalyzedResourceSummary -> Bool
$c== :: AnalyzedResourceSummary -> AnalyzedResourceSummary -> Bool
Prelude.Eq, ReadPrec [AnalyzedResourceSummary]
ReadPrec AnalyzedResourceSummary
Int -> ReadS AnalyzedResourceSummary
ReadS [AnalyzedResourceSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AnalyzedResourceSummary]
$creadListPrec :: ReadPrec [AnalyzedResourceSummary]
readPrec :: ReadPrec AnalyzedResourceSummary
$creadPrec :: ReadPrec AnalyzedResourceSummary
readList :: ReadS [AnalyzedResourceSummary]
$creadList :: ReadS [AnalyzedResourceSummary]
readsPrec :: Int -> ReadS AnalyzedResourceSummary
$creadsPrec :: Int -> ReadS AnalyzedResourceSummary
Prelude.Read, Int -> AnalyzedResourceSummary -> ShowS
[AnalyzedResourceSummary] -> ShowS
AnalyzedResourceSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AnalyzedResourceSummary] -> ShowS
$cshowList :: [AnalyzedResourceSummary] -> ShowS
show :: AnalyzedResourceSummary -> String
$cshow :: AnalyzedResourceSummary -> String
showsPrec :: Int -> AnalyzedResourceSummary -> ShowS
$cshowsPrec :: Int -> AnalyzedResourceSummary -> ShowS
Prelude.Show, forall x. Rep AnalyzedResourceSummary x -> AnalyzedResourceSummary
forall x. AnalyzedResourceSummary -> Rep AnalyzedResourceSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AnalyzedResourceSummary x -> AnalyzedResourceSummary
$cfrom :: forall x. AnalyzedResourceSummary -> Rep AnalyzedResourceSummary x
Prelude.Generic)

-- |
-- Create a value of 'AnalyzedResourceSummary' 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:
--
-- 'resourceArn', 'analyzedResourceSummary_resourceArn' - The ARN of the analyzed resource.
--
-- 'resourceOwnerAccount', 'analyzedResourceSummary_resourceOwnerAccount' - The Amazon Web Services account ID that owns the resource.
--
-- 'resourceType', 'analyzedResourceSummary_resourceType' - The type of resource that was analyzed.
newAnalyzedResourceSummary ::
  -- | 'resourceArn'
  Prelude.Text ->
  -- | 'resourceOwnerAccount'
  Prelude.Text ->
  -- | 'resourceType'
  ResourceType ->
  AnalyzedResourceSummary
newAnalyzedResourceSummary :: Text -> Text -> ResourceType -> AnalyzedResourceSummary
newAnalyzedResourceSummary
  Text
pResourceArn_
  Text
pResourceOwnerAccount_
  ResourceType
pResourceType_ =
    AnalyzedResourceSummary'
      { $sel:resourceArn:AnalyzedResourceSummary' :: Text
resourceArn =
          Text
pResourceArn_,
        $sel:resourceOwnerAccount:AnalyzedResourceSummary' :: Text
resourceOwnerAccount = Text
pResourceOwnerAccount_,
        $sel:resourceType:AnalyzedResourceSummary' :: ResourceType
resourceType = ResourceType
pResourceType_
      }

-- | The ARN of the analyzed resource.
analyzedResourceSummary_resourceArn :: Lens.Lens' AnalyzedResourceSummary Prelude.Text
analyzedResourceSummary_resourceArn :: Lens' AnalyzedResourceSummary Text
analyzedResourceSummary_resourceArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnalyzedResourceSummary' {Text
resourceArn :: Text
$sel:resourceArn:AnalyzedResourceSummary' :: AnalyzedResourceSummary -> Text
resourceArn} -> Text
resourceArn) (\s :: AnalyzedResourceSummary
s@AnalyzedResourceSummary' {} Text
a -> AnalyzedResourceSummary
s {$sel:resourceArn:AnalyzedResourceSummary' :: Text
resourceArn = Text
a} :: AnalyzedResourceSummary)

-- | The Amazon Web Services account ID that owns the resource.
analyzedResourceSummary_resourceOwnerAccount :: Lens.Lens' AnalyzedResourceSummary Prelude.Text
analyzedResourceSummary_resourceOwnerAccount :: Lens' AnalyzedResourceSummary Text
analyzedResourceSummary_resourceOwnerAccount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnalyzedResourceSummary' {Text
resourceOwnerAccount :: Text
$sel:resourceOwnerAccount:AnalyzedResourceSummary' :: AnalyzedResourceSummary -> Text
resourceOwnerAccount} -> Text
resourceOwnerAccount) (\s :: AnalyzedResourceSummary
s@AnalyzedResourceSummary' {} Text
a -> AnalyzedResourceSummary
s {$sel:resourceOwnerAccount:AnalyzedResourceSummary' :: Text
resourceOwnerAccount = Text
a} :: AnalyzedResourceSummary)

-- | The type of resource that was analyzed.
analyzedResourceSummary_resourceType :: Lens.Lens' AnalyzedResourceSummary ResourceType
analyzedResourceSummary_resourceType :: Lens' AnalyzedResourceSummary ResourceType
analyzedResourceSummary_resourceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnalyzedResourceSummary' {ResourceType
resourceType :: ResourceType
$sel:resourceType:AnalyzedResourceSummary' :: AnalyzedResourceSummary -> ResourceType
resourceType} -> ResourceType
resourceType) (\s :: AnalyzedResourceSummary
s@AnalyzedResourceSummary' {} ResourceType
a -> AnalyzedResourceSummary
s {$sel:resourceType:AnalyzedResourceSummary' :: ResourceType
resourceType = ResourceType
a} :: AnalyzedResourceSummary)

instance Data.FromJSON AnalyzedResourceSummary where
  parseJSON :: Value -> Parser AnalyzedResourceSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AnalyzedResourceSummary"
      ( \Object
x ->
          Text -> Text -> ResourceType -> AnalyzedResourceSummary
AnalyzedResourceSummary'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"resourceArn")
            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
"resourceOwnerAccount")
            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
"resourceType")
      )

instance Prelude.Hashable AnalyzedResourceSummary where
  hashWithSalt :: Int -> AnalyzedResourceSummary -> Int
hashWithSalt Int
_salt AnalyzedResourceSummary' {Text
ResourceType
resourceType :: ResourceType
resourceOwnerAccount :: Text
resourceArn :: Text
$sel:resourceType:AnalyzedResourceSummary' :: AnalyzedResourceSummary -> ResourceType
$sel:resourceOwnerAccount:AnalyzedResourceSummary' :: AnalyzedResourceSummary -> Text
$sel:resourceArn:AnalyzedResourceSummary' :: AnalyzedResourceSummary -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
resourceArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
resourceOwnerAccount
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ResourceType
resourceType

instance Prelude.NFData AnalyzedResourceSummary where
  rnf :: AnalyzedResourceSummary -> ()
rnf AnalyzedResourceSummary' {Text
ResourceType
resourceType :: ResourceType
resourceOwnerAccount :: Text
resourceArn :: Text
$sel:resourceType:AnalyzedResourceSummary' :: AnalyzedResourceSummary -> ResourceType
$sel:resourceOwnerAccount:AnalyzedResourceSummary' :: AnalyzedResourceSummary -> Text
$sel:resourceArn:AnalyzedResourceSummary' :: AnalyzedResourceSummary -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
resourceArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
resourceOwnerAccount
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ResourceType
resourceType