{-# 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.GuardDuty.Types.IamInstanceProfile
-- 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.GuardDuty.Types.IamInstanceProfile where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Contains information about the EC2 instance profile.
--
-- /See:/ 'newIamInstanceProfile' smart constructor.
data IamInstanceProfile = IamInstanceProfile'
  { -- | The profile ARN of the EC2 instance.
    IamInstanceProfile -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The profile ID of the EC2 instance.
    IamInstanceProfile -> Maybe Text
id :: Prelude.Maybe Prelude.Text
  }
  deriving (IamInstanceProfile -> IamInstanceProfile -> Bool
(IamInstanceProfile -> IamInstanceProfile -> Bool)
-> (IamInstanceProfile -> IamInstanceProfile -> Bool)
-> Eq IamInstanceProfile
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IamInstanceProfile -> IamInstanceProfile -> Bool
$c/= :: IamInstanceProfile -> IamInstanceProfile -> Bool
== :: IamInstanceProfile -> IamInstanceProfile -> Bool
$c== :: IamInstanceProfile -> IamInstanceProfile -> Bool
Prelude.Eq, ReadPrec [IamInstanceProfile]
ReadPrec IamInstanceProfile
Int -> ReadS IamInstanceProfile
ReadS [IamInstanceProfile]
(Int -> ReadS IamInstanceProfile)
-> ReadS [IamInstanceProfile]
-> ReadPrec IamInstanceProfile
-> ReadPrec [IamInstanceProfile]
-> Read IamInstanceProfile
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [IamInstanceProfile]
$creadListPrec :: ReadPrec [IamInstanceProfile]
readPrec :: ReadPrec IamInstanceProfile
$creadPrec :: ReadPrec IamInstanceProfile
readList :: ReadS [IamInstanceProfile]
$creadList :: ReadS [IamInstanceProfile]
readsPrec :: Int -> ReadS IamInstanceProfile
$creadsPrec :: Int -> ReadS IamInstanceProfile
Prelude.Read, Int -> IamInstanceProfile -> ShowS
[IamInstanceProfile] -> ShowS
IamInstanceProfile -> String
(Int -> IamInstanceProfile -> ShowS)
-> (IamInstanceProfile -> String)
-> ([IamInstanceProfile] -> ShowS)
-> Show IamInstanceProfile
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IamInstanceProfile] -> ShowS
$cshowList :: [IamInstanceProfile] -> ShowS
show :: IamInstanceProfile -> String
$cshow :: IamInstanceProfile -> String
showsPrec :: Int -> IamInstanceProfile -> ShowS
$cshowsPrec :: Int -> IamInstanceProfile -> ShowS
Prelude.Show, (forall x. IamInstanceProfile -> Rep IamInstanceProfile x)
-> (forall x. Rep IamInstanceProfile x -> IamInstanceProfile)
-> Generic IamInstanceProfile
forall x. Rep IamInstanceProfile x -> IamInstanceProfile
forall x. IamInstanceProfile -> Rep IamInstanceProfile x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep IamInstanceProfile x -> IamInstanceProfile
$cfrom :: forall x. IamInstanceProfile -> Rep IamInstanceProfile x
Prelude.Generic)

-- |
-- Create a value of 'IamInstanceProfile' 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:
--
-- 'arn', 'iamInstanceProfile_arn' - The profile ARN of the EC2 instance.
--
-- 'id', 'iamInstanceProfile_id' - The profile ID of the EC2 instance.
newIamInstanceProfile ::
  IamInstanceProfile
newIamInstanceProfile :: IamInstanceProfile
newIamInstanceProfile =
  IamInstanceProfile' :: Maybe Text -> Maybe Text -> IamInstanceProfile
IamInstanceProfile'
    { $sel:arn:IamInstanceProfile' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:id:IamInstanceProfile' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The profile ARN of the EC2 instance.
iamInstanceProfile_arn :: Lens.Lens' IamInstanceProfile (Prelude.Maybe Prelude.Text)
iamInstanceProfile_arn :: (Maybe Text -> f (Maybe Text))
-> IamInstanceProfile -> f IamInstanceProfile
iamInstanceProfile_arn = (IamInstanceProfile -> Maybe Text)
-> (IamInstanceProfile -> Maybe Text -> IamInstanceProfile)
-> Lens
     IamInstanceProfile IamInstanceProfile (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IamInstanceProfile' {Maybe Text
arn :: Maybe Text
$sel:arn:IamInstanceProfile' :: IamInstanceProfile -> Maybe Text
arn} -> Maybe Text
arn) (\s :: IamInstanceProfile
s@IamInstanceProfile' {} Maybe Text
a -> IamInstanceProfile
s {$sel:arn:IamInstanceProfile' :: Maybe Text
arn = Maybe Text
a} :: IamInstanceProfile)

-- | The profile ID of the EC2 instance.
iamInstanceProfile_id :: Lens.Lens' IamInstanceProfile (Prelude.Maybe Prelude.Text)
iamInstanceProfile_id :: (Maybe Text -> f (Maybe Text))
-> IamInstanceProfile -> f IamInstanceProfile
iamInstanceProfile_id = (IamInstanceProfile -> Maybe Text)
-> (IamInstanceProfile -> Maybe Text -> IamInstanceProfile)
-> Lens
     IamInstanceProfile IamInstanceProfile (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IamInstanceProfile' {Maybe Text
id :: Maybe Text
$sel:id:IamInstanceProfile' :: IamInstanceProfile -> Maybe Text
id} -> Maybe Text
id) (\s :: IamInstanceProfile
s@IamInstanceProfile' {} Maybe Text
a -> IamInstanceProfile
s {$sel:id:IamInstanceProfile' :: Maybe Text
id = Maybe Text
a} :: IamInstanceProfile)

instance Core.FromJSON IamInstanceProfile where
  parseJSON :: Value -> Parser IamInstanceProfile
parseJSON =
    String
-> (Object -> Parser IamInstanceProfile)
-> Value
-> Parser IamInstanceProfile
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"IamInstanceProfile"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> IamInstanceProfile
IamInstanceProfile'
            (Maybe Text -> Maybe Text -> IamInstanceProfile)
-> Parser (Maybe Text) -> Parser (Maybe Text -> IamInstanceProfile)
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
"arn") Parser (Maybe Text -> IamInstanceProfile)
-> Parser (Maybe Text) -> Parser IamInstanceProfile
forall (f :: * -> *) a b. Applicative f => 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
"id")
      )

instance Prelude.Hashable IamInstanceProfile

instance Prelude.NFData IamInstanceProfile