{-# 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.IamInstanceProfileSpecification
-- 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.IamInstanceProfileSpecification 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:/ 'newIamInstanceProfileSpecification' smart constructor.
data IamInstanceProfileSpecification = IamInstanceProfileSpecification'
  { -- | The Amazon Resource Name (ARN) of the instance profile.
    IamInstanceProfileSpecification -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The name of the instance profile.
    IamInstanceProfileSpecification -> Maybe Text
name :: Prelude.Maybe Prelude.Text
  }
  deriving (IamInstanceProfileSpecification
-> IamInstanceProfileSpecification -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IamInstanceProfileSpecification
-> IamInstanceProfileSpecification -> Bool
$c/= :: IamInstanceProfileSpecification
-> IamInstanceProfileSpecification -> Bool
== :: IamInstanceProfileSpecification
-> IamInstanceProfileSpecification -> Bool
$c== :: IamInstanceProfileSpecification
-> IamInstanceProfileSpecification -> Bool
Prelude.Eq, ReadPrec [IamInstanceProfileSpecification]
ReadPrec IamInstanceProfileSpecification
Int -> ReadS IamInstanceProfileSpecification
ReadS [IamInstanceProfileSpecification]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [IamInstanceProfileSpecification]
$creadListPrec :: ReadPrec [IamInstanceProfileSpecification]
readPrec :: ReadPrec IamInstanceProfileSpecification
$creadPrec :: ReadPrec IamInstanceProfileSpecification
readList :: ReadS [IamInstanceProfileSpecification]
$creadList :: ReadS [IamInstanceProfileSpecification]
readsPrec :: Int -> ReadS IamInstanceProfileSpecification
$creadsPrec :: Int -> ReadS IamInstanceProfileSpecification
Prelude.Read, Int -> IamInstanceProfileSpecification -> ShowS
[IamInstanceProfileSpecification] -> ShowS
IamInstanceProfileSpecification -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IamInstanceProfileSpecification] -> ShowS
$cshowList :: [IamInstanceProfileSpecification] -> ShowS
show :: IamInstanceProfileSpecification -> String
$cshow :: IamInstanceProfileSpecification -> String
showsPrec :: Int -> IamInstanceProfileSpecification -> ShowS
$cshowsPrec :: Int -> IamInstanceProfileSpecification -> ShowS
Prelude.Show, forall x.
Rep IamInstanceProfileSpecification x
-> IamInstanceProfileSpecification
forall x.
IamInstanceProfileSpecification
-> Rep IamInstanceProfileSpecification x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep IamInstanceProfileSpecification x
-> IamInstanceProfileSpecification
$cfrom :: forall x.
IamInstanceProfileSpecification
-> Rep IamInstanceProfileSpecification x
Prelude.Generic)

-- |
-- Create a value of 'IamInstanceProfileSpecification' 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', 'iamInstanceProfileSpecification_arn' - The Amazon Resource Name (ARN) of the instance profile.
--
-- 'name', 'iamInstanceProfileSpecification_name' - The name of the instance profile.
newIamInstanceProfileSpecification ::
  IamInstanceProfileSpecification
newIamInstanceProfileSpecification :: IamInstanceProfileSpecification
newIamInstanceProfileSpecification =
  IamInstanceProfileSpecification'
    { $sel:arn:IamInstanceProfileSpecification' :: Maybe Text
arn =
        forall a. Maybe a
Prelude.Nothing,
      $sel:name:IamInstanceProfileSpecification' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Name (ARN) of the instance profile.
iamInstanceProfileSpecification_arn :: Lens.Lens' IamInstanceProfileSpecification (Prelude.Maybe Prelude.Text)
iamInstanceProfileSpecification_arn :: Lens' IamInstanceProfileSpecification (Maybe Text)
iamInstanceProfileSpecification_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IamInstanceProfileSpecification' {Maybe Text
arn :: Maybe Text
$sel:arn:IamInstanceProfileSpecification' :: IamInstanceProfileSpecification -> Maybe Text
arn} -> Maybe Text
arn) (\s :: IamInstanceProfileSpecification
s@IamInstanceProfileSpecification' {} Maybe Text
a -> IamInstanceProfileSpecification
s {$sel:arn:IamInstanceProfileSpecification' :: Maybe Text
arn = Maybe Text
a} :: IamInstanceProfileSpecification)

-- | The name of the instance profile.
iamInstanceProfileSpecification_name :: Lens.Lens' IamInstanceProfileSpecification (Prelude.Maybe Prelude.Text)
iamInstanceProfileSpecification_name :: Lens' IamInstanceProfileSpecification (Maybe Text)
iamInstanceProfileSpecification_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IamInstanceProfileSpecification' {Maybe Text
name :: Maybe Text
$sel:name:IamInstanceProfileSpecification' :: IamInstanceProfileSpecification -> Maybe Text
name} -> Maybe Text
name) (\s :: IamInstanceProfileSpecification
s@IamInstanceProfileSpecification' {} Maybe Text
a -> IamInstanceProfileSpecification
s {$sel:name:IamInstanceProfileSpecification' :: Maybe Text
name = Maybe Text
a} :: IamInstanceProfileSpecification)

instance Data.FromXML IamInstanceProfileSpecification where
  parseXML :: [Node] -> Either String IamInstanceProfileSpecification
parseXML [Node]
x =
    Maybe Text -> Maybe Text -> IamInstanceProfileSpecification
IamInstanceProfileSpecification'
      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
"name")

instance
  Prelude.Hashable
    IamInstanceProfileSpecification
  where
  hashWithSalt :: Int -> IamInstanceProfileSpecification -> Int
hashWithSalt
    Int
_salt
    IamInstanceProfileSpecification' {Maybe Text
name :: Maybe Text
arn :: Maybe Text
$sel:name:IamInstanceProfileSpecification' :: IamInstanceProfileSpecification -> Maybe Text
$sel:arn:IamInstanceProfileSpecification' :: IamInstanceProfileSpecification -> 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
name

instance
  Prelude.NFData
    IamInstanceProfileSpecification
  where
  rnf :: IamInstanceProfileSpecification -> ()
rnf IamInstanceProfileSpecification' {Maybe Text
name :: Maybe Text
arn :: Maybe Text
$sel:name:IamInstanceProfileSpecification' :: IamInstanceProfileSpecification -> Maybe Text
$sel:arn:IamInstanceProfileSpecification' :: IamInstanceProfileSpecification -> 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
name

instance Data.ToQuery IamInstanceProfileSpecification where
  toQuery :: IamInstanceProfileSpecification -> QueryString
toQuery IamInstanceProfileSpecification' {Maybe Text
name :: Maybe Text
arn :: Maybe Text
$sel:name:IamInstanceProfileSpecification' :: IamInstanceProfileSpecification -> Maybe Text
$sel:arn:IamInstanceProfileSpecification' :: IamInstanceProfileSpecification -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"Arn" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
arn, ByteString
"Name" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
name]