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

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.EC2.Internal
import qualified Amazonka.Prelude as Prelude

-- | Describes an IAM instance profile.
--
-- /See:/ 'newIamInstanceProfile' smart constructor.
data IamInstanceProfile = IamInstanceProfile'
  { -- | The Amazon Resource Name (ARN) of the instance profile.
    IamInstanceProfile -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The ID of the instance profile.
    IamInstanceProfile -> Maybe Text
id :: Prelude.Maybe Prelude.Text
  }
  deriving (IamInstanceProfile -> IamInstanceProfile -> Bool
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]
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
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. 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 Amazon Resource Name (ARN) of the instance profile.
--
-- 'id', 'iamInstanceProfile_id' - The ID of the instance profile.
newIamInstanceProfile ::
  IamInstanceProfile
newIamInstanceProfile :: IamInstanceProfile
newIamInstanceProfile =
  IamInstanceProfile'
    { $sel:arn:IamInstanceProfile' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:id:IamInstanceProfile' :: Maybe Text
id = forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Name (ARN) of the instance profile.
iamInstanceProfile_arn :: Lens.Lens' IamInstanceProfile (Prelude.Maybe Prelude.Text)
iamInstanceProfile_arn :: Lens' IamInstanceProfile (Maybe Text)
iamInstanceProfile_arn = 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 ID of the instance profile.
iamInstanceProfile_id :: Lens.Lens' IamInstanceProfile (Prelude.Maybe Prelude.Text)
iamInstanceProfile_id :: Lens' IamInstanceProfile (Maybe Text)
iamInstanceProfile_id = 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 Data.FromXML IamInstanceProfile where
  parseXML :: [Node] -> Either String IamInstanceProfile
parseXML [Node]
x =
    Maybe Text -> Maybe Text -> IamInstanceProfile
IamInstanceProfile'
      forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"arn")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"id")

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

instance Prelude.NFData IamInstanceProfile where
  rnf :: IamInstanceProfile -> ()
rnf IamInstanceProfile' {Maybe Text
id :: Maybe Text
arn :: Maybe Text
$sel:id:IamInstanceProfile' :: IamInstanceProfile -> Maybe Text
$sel:arn:IamInstanceProfile' :: IamInstanceProfile -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
arn seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
id