{-# 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.IoTFleetWise.Types.IamResources
-- 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.IoTFleetWise.Types.IamResources 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

-- | The IAM resource that enables Amazon Web Services IoT FleetWise edge
-- agent software to send data to Amazon Timestream.
--
-- For more information, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles.html IAM roles>
-- in the /Identity and Access Management User Guide/.
--
-- /See:/ 'newIamResources' smart constructor.
data IamResources = IamResources'
  { -- | The Amazon Resource Name (ARN) of the IAM resource that allows Amazon
    -- Web Services IoT FleetWise to send data to Amazon Timestream. For
    -- example, @arn:aws:iam::123456789012:role\/SERVICE-ROLE-ARN@.
    IamResources -> Text
roleArn :: Prelude.Text
  }
  deriving (IamResources -> IamResources -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IamResources -> IamResources -> Bool
$c/= :: IamResources -> IamResources -> Bool
== :: IamResources -> IamResources -> Bool
$c== :: IamResources -> IamResources -> Bool
Prelude.Eq, ReadPrec [IamResources]
ReadPrec IamResources
Int -> ReadS IamResources
ReadS [IamResources]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [IamResources]
$creadListPrec :: ReadPrec [IamResources]
readPrec :: ReadPrec IamResources
$creadPrec :: ReadPrec IamResources
readList :: ReadS [IamResources]
$creadList :: ReadS [IamResources]
readsPrec :: Int -> ReadS IamResources
$creadsPrec :: Int -> ReadS IamResources
Prelude.Read, Int -> IamResources -> ShowS
[IamResources] -> ShowS
IamResources -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IamResources] -> ShowS
$cshowList :: [IamResources] -> ShowS
show :: IamResources -> String
$cshow :: IamResources -> String
showsPrec :: Int -> IamResources -> ShowS
$cshowsPrec :: Int -> IamResources -> ShowS
Prelude.Show, forall x. Rep IamResources x -> IamResources
forall x. IamResources -> Rep IamResources x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep IamResources x -> IamResources
$cfrom :: forall x. IamResources -> Rep IamResources x
Prelude.Generic)

-- |
-- Create a value of 'IamResources' 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:
--
-- 'roleArn', 'iamResources_roleArn' - The Amazon Resource Name (ARN) of the IAM resource that allows Amazon
-- Web Services IoT FleetWise to send data to Amazon Timestream. For
-- example, @arn:aws:iam::123456789012:role\/SERVICE-ROLE-ARN@.
newIamResources ::
  -- | 'roleArn'
  Prelude.Text ->
  IamResources
newIamResources :: Text -> IamResources
newIamResources Text
pRoleArn_ =
  IamResources' {$sel:roleArn:IamResources' :: Text
roleArn = Text
pRoleArn_}

-- | The Amazon Resource Name (ARN) of the IAM resource that allows Amazon
-- Web Services IoT FleetWise to send data to Amazon Timestream. For
-- example, @arn:aws:iam::123456789012:role\/SERVICE-ROLE-ARN@.
iamResources_roleArn :: Lens.Lens' IamResources Prelude.Text
iamResources_roleArn :: Lens' IamResources Text
iamResources_roleArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IamResources' {Text
roleArn :: Text
$sel:roleArn:IamResources' :: IamResources -> Text
roleArn} -> Text
roleArn) (\s :: IamResources
s@IamResources' {} Text
a -> IamResources
s {$sel:roleArn:IamResources' :: Text
roleArn = Text
a} :: IamResources)

instance Data.FromJSON IamResources where
  parseJSON :: Value -> Parser IamResources
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"IamResources"
      ( \Object
x ->
          Text -> IamResources
IamResources' forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"roleArn")
      )

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

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

instance Data.ToJSON IamResources where
  toJSON :: IamResources -> Value
toJSON IamResources' {Text
roleArn :: Text
$sel:roleArn:IamResources' :: IamResources -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"roleArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
roleArn)]
      )