{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- 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.Lens as Lens
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
(AnalyzedResourceSummary -> AnalyzedResourceSummary -> Bool)
-> (AnalyzedResourceSummary -> AnalyzedResourceSummary -> Bool)
-> Eq AnalyzedResourceSummary
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]
(Int -> ReadS AnalyzedResourceSummary)
-> ReadS [AnalyzedResourceSummary]
-> ReadPrec AnalyzedResourceSummary
-> ReadPrec [AnalyzedResourceSummary]
-> Read 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
(Int -> AnalyzedResourceSummary -> ShowS)
-> (AnalyzedResourceSummary -> String)
-> ([AnalyzedResourceSummary] -> ShowS)
-> Show AnalyzedResourceSummary
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.
 AnalyzedResourceSummary -> Rep AnalyzedResourceSummary x)
-> (forall x.
    Rep AnalyzedResourceSummary x -> AnalyzedResourceSummary)
-> Generic AnalyzedResourceSummary
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' :: Text -> Text -> ResourceType -> AnalyzedResourceSummary
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 :: (Text -> f Text)
-> AnalyzedResourceSummary -> f AnalyzedResourceSummary
analyzedResourceSummary_resourceArn = (AnalyzedResourceSummary -> Text)
-> (AnalyzedResourceSummary -> Text -> AnalyzedResourceSummary)
-> Lens AnalyzedResourceSummary AnalyzedResourceSummary Text Text
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 :: (Text -> f Text)
-> AnalyzedResourceSummary -> f AnalyzedResourceSummary
analyzedResourceSummary_resourceOwnerAccount = (AnalyzedResourceSummary -> Text)
-> (AnalyzedResourceSummary -> Text -> AnalyzedResourceSummary)
-> Lens AnalyzedResourceSummary AnalyzedResourceSummary Text Text
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 :: (ResourceType -> f ResourceType)
-> AnalyzedResourceSummary -> f AnalyzedResourceSummary
analyzedResourceSummary_resourceType = (AnalyzedResourceSummary -> ResourceType)
-> (AnalyzedResourceSummary
    -> ResourceType -> AnalyzedResourceSummary)
-> Lens
     AnalyzedResourceSummary
     AnalyzedResourceSummary
     ResourceType
     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 Core.FromJSON AnalyzedResourceSummary where
  parseJSON :: Value -> Parser AnalyzedResourceSummary
parseJSON =
    String
-> (Object -> Parser AnalyzedResourceSummary)
-> Value
-> Parser AnalyzedResourceSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AnalyzedResourceSummary"
      ( \Object
x ->
          Text -> Text -> ResourceType -> AnalyzedResourceSummary
AnalyzedResourceSummary'
            (Text -> Text -> ResourceType -> AnalyzedResourceSummary)
-> Parser Text
-> Parser (Text -> ResourceType -> AnalyzedResourceSummary)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"resourceArn")
            Parser (Text -> ResourceType -> AnalyzedResourceSummary)
-> Parser Text -> Parser (ResourceType -> AnalyzedResourceSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"resourceOwnerAccount")
            Parser (ResourceType -> AnalyzedResourceSummary)
-> Parser ResourceType -> Parser AnalyzedResourceSummary
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser ResourceType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"resourceType")
      )

instance Prelude.Hashable AnalyzedResourceSummary

instance Prelude.NFData AnalyzedResourceSummary