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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(AwsService -> AwsService -> Bool)
-> (AwsService -> AwsService -> Bool) -> Eq AwsService
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]
(Int -> ReadS AwsService)
-> ReadS [AwsService]
-> ReadPrec AwsService
-> ReadPrec [AwsService]
-> Read 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
(Int -> AwsService -> ShowS)
-> (AwsService -> String)
-> ([AwsService] -> ShowS)
-> Show AwsService
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. AwsService -> Rep AwsService x)
-> (forall x. Rep AwsService x -> AwsService) -> Generic AwsService
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' :: Maybe Text -> AwsService
AwsService' {$sel:invokedBy:AwsService' :: Maybe Text
invokedBy = Maybe Text
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 :: (Maybe Text -> f (Maybe Text)) -> AwsService -> f AwsService
awsService_invokedBy = (AwsService -> Maybe Text)
-> (AwsService -> Maybe Text -> AwsService)
-> Lens AwsService AwsService (Maybe Text) (Maybe Text)
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 Core.FromJSON AwsService where
  parseJSON :: Value -> Parser AwsService
parseJSON =
    String
-> (Object -> Parser AwsService) -> Value -> Parser AwsService
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AwsService"
      ( \Object
x ->
          Maybe Text -> AwsService
AwsService' (Maybe Text -> AwsService)
-> Parser (Maybe Text) -> Parser AwsService
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"invokedBy")
      )

instance Prelude.Hashable AwsService

instance Prelude.NFData AwsService