{-# 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.MacieV2.Types.AwsService
-- 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.MacieV2.Types.AwsService 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

-- | Provides information about an Amazon Web Service that performed an
-- action on an affected resource.
--
-- /See:/ 'newAwsService' smart constructor.
data AwsService = AwsService'
  { -- | The name of the Amazon Web Service that performed the action.
    AwsService -> Maybe Text
invokedBy :: Prelude.Maybe Prelude.Text
  }
  deriving (AwsService -> AwsService -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsService -> AwsService -> Bool
$c/= :: AwsService -> AwsService -> Bool
== :: AwsService -> AwsService -> Bool
$c== :: AwsService -> AwsService -> Bool
Prelude.Eq, ReadPrec [AwsService]
ReadPrec AwsService
Int -> ReadS AwsService
ReadS [AwsService]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AwsService]
$creadListPrec :: ReadPrec [AwsService]
readPrec :: ReadPrec AwsService
$creadPrec :: ReadPrec AwsService
readList :: ReadS [AwsService]
$creadList :: ReadS [AwsService]
readsPrec :: Int -> ReadS AwsService
$creadsPrec :: Int -> ReadS AwsService
Prelude.Read, Int -> AwsService -> ShowS
[AwsService] -> ShowS
AwsService -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsService] -> ShowS
$cshowList :: [AwsService] -> ShowS
show :: AwsService -> String
$cshow :: AwsService -> String
showsPrec :: Int -> AwsService -> ShowS
$cshowsPrec :: Int -> AwsService -> ShowS
Prelude.Show, forall x. Rep AwsService x -> AwsService
forall x. AwsService -> Rep AwsService x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AwsService x -> AwsService
$cfrom :: forall x. AwsService -> Rep AwsService x
Prelude.Generic)

-- |
-- Create a value of 'AwsService' 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:
--
-- 'invokedBy', 'awsService_invokedBy' - The name of the Amazon Web Service that performed the action.
newAwsService ::
  AwsService
newAwsService :: AwsService
newAwsService =
  AwsService' {$sel:invokedBy:AwsService' :: Maybe Text
invokedBy = forall a. Maybe a
Prelude.Nothing}

-- | The name of the Amazon Web Service that performed the action.
awsService_invokedBy :: Lens.Lens' AwsService (Prelude.Maybe Prelude.Text)
awsService_invokedBy :: Lens' AwsService (Maybe Text)
awsService_invokedBy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsService' {Maybe Text
invokedBy :: Maybe Text
$sel:invokedBy:AwsService' :: AwsService -> Maybe Text
invokedBy} -> Maybe Text
invokedBy) (\s :: AwsService
s@AwsService' {} Maybe Text
a -> AwsService
s {$sel:invokedBy:AwsService' :: Maybe Text
invokedBy = Maybe Text
a} :: AwsService)

instance Data.FromJSON AwsService where
  parseJSON :: Value -> Parser AwsService
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AwsService"
      ( \Object
x ->
          Maybe Text -> AwsService
AwsService' 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
"invokedBy")
      )

instance Prelude.Hashable AwsService where
  hashWithSalt :: Int -> AwsService -> Int
hashWithSalt Int
_salt AwsService' {Maybe Text
invokedBy :: Maybe Text
$sel:invokedBy:AwsService' :: AwsService -> Maybe Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
invokedBy

instance Prelude.NFData AwsService where
  rnf :: AwsService -> ()
rnf AwsService' {Maybe Text
invokedBy :: Maybe Text
$sel:invokedBy:AwsService' :: AwsService -> Maybe Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
invokedBy