{-# 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.IoTWireless.Types.DeviceProfile
-- 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.IoTWireless.Types.DeviceProfile where

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

-- | Describes a device profile.
--
-- /See:/ 'newDeviceProfile' smart constructor.
data DeviceProfile = DeviceProfile'
  { -- | The Amazon Resource Name of the resource.
    DeviceProfile -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The name of the resource.
    DeviceProfile -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The ID of the device profile.
    DeviceProfile -> Maybe Text
id :: Prelude.Maybe Prelude.Text
  }
  deriving (DeviceProfile -> DeviceProfile -> Bool
(DeviceProfile -> DeviceProfile -> Bool)
-> (DeviceProfile -> DeviceProfile -> Bool) -> Eq DeviceProfile
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeviceProfile -> DeviceProfile -> Bool
$c/= :: DeviceProfile -> DeviceProfile -> Bool
== :: DeviceProfile -> DeviceProfile -> Bool
$c== :: DeviceProfile -> DeviceProfile -> Bool
Prelude.Eq, ReadPrec [DeviceProfile]
ReadPrec DeviceProfile
Int -> ReadS DeviceProfile
ReadS [DeviceProfile]
(Int -> ReadS DeviceProfile)
-> ReadS [DeviceProfile]
-> ReadPrec DeviceProfile
-> ReadPrec [DeviceProfile]
-> Read DeviceProfile
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeviceProfile]
$creadListPrec :: ReadPrec [DeviceProfile]
readPrec :: ReadPrec DeviceProfile
$creadPrec :: ReadPrec DeviceProfile
readList :: ReadS [DeviceProfile]
$creadList :: ReadS [DeviceProfile]
readsPrec :: Int -> ReadS DeviceProfile
$creadsPrec :: Int -> ReadS DeviceProfile
Prelude.Read, Int -> DeviceProfile -> ShowS
[DeviceProfile] -> ShowS
DeviceProfile -> String
(Int -> DeviceProfile -> ShowS)
-> (DeviceProfile -> String)
-> ([DeviceProfile] -> ShowS)
-> Show DeviceProfile
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeviceProfile] -> ShowS
$cshowList :: [DeviceProfile] -> ShowS
show :: DeviceProfile -> String
$cshow :: DeviceProfile -> String
showsPrec :: Int -> DeviceProfile -> ShowS
$cshowsPrec :: Int -> DeviceProfile -> ShowS
Prelude.Show, (forall x. DeviceProfile -> Rep DeviceProfile x)
-> (forall x. Rep DeviceProfile x -> DeviceProfile)
-> Generic DeviceProfile
forall x. Rep DeviceProfile x -> DeviceProfile
forall x. DeviceProfile -> Rep DeviceProfile x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeviceProfile x -> DeviceProfile
$cfrom :: forall x. DeviceProfile -> Rep DeviceProfile x
Prelude.Generic)

-- |
-- Create a value of 'DeviceProfile' 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', 'deviceProfile_arn' - The Amazon Resource Name of the resource.
--
-- 'name', 'deviceProfile_name' - The name of the resource.
--
-- 'id', 'deviceProfile_id' - The ID of the device profile.
newDeviceProfile ::
  DeviceProfile
newDeviceProfile :: DeviceProfile
newDeviceProfile =
  DeviceProfile' :: Maybe Text -> Maybe Text -> Maybe Text -> DeviceProfile
DeviceProfile'
    { $sel:arn:DeviceProfile' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:DeviceProfile' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:id:DeviceProfile' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Name of the resource.
deviceProfile_arn :: Lens.Lens' DeviceProfile (Prelude.Maybe Prelude.Text)
deviceProfile_arn :: (Maybe Text -> f (Maybe Text)) -> DeviceProfile -> f DeviceProfile
deviceProfile_arn = (DeviceProfile -> Maybe Text)
-> (DeviceProfile -> Maybe Text -> DeviceProfile)
-> Lens DeviceProfile DeviceProfile (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeviceProfile' {Maybe Text
arn :: Maybe Text
$sel:arn:DeviceProfile' :: DeviceProfile -> Maybe Text
arn} -> Maybe Text
arn) (\s :: DeviceProfile
s@DeviceProfile' {} Maybe Text
a -> DeviceProfile
s {$sel:arn:DeviceProfile' :: Maybe Text
arn = Maybe Text
a} :: DeviceProfile)

-- | The name of the resource.
deviceProfile_name :: Lens.Lens' DeviceProfile (Prelude.Maybe Prelude.Text)
deviceProfile_name :: (Maybe Text -> f (Maybe Text)) -> DeviceProfile -> f DeviceProfile
deviceProfile_name = (DeviceProfile -> Maybe Text)
-> (DeviceProfile -> Maybe Text -> DeviceProfile)
-> Lens DeviceProfile DeviceProfile (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeviceProfile' {Maybe Text
name :: Maybe Text
$sel:name:DeviceProfile' :: DeviceProfile -> Maybe Text
name} -> Maybe Text
name) (\s :: DeviceProfile
s@DeviceProfile' {} Maybe Text
a -> DeviceProfile
s {$sel:name:DeviceProfile' :: Maybe Text
name = Maybe Text
a} :: DeviceProfile)

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

instance Core.FromJSON DeviceProfile where
  parseJSON :: Value -> Parser DeviceProfile
parseJSON =
    String
-> (Object -> Parser DeviceProfile)
-> Value
-> Parser DeviceProfile
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DeviceProfile"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Maybe Text -> DeviceProfile
DeviceProfile'
            (Maybe Text -> Maybe Text -> Maybe Text -> DeviceProfile)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> DeviceProfile)
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 -> Maybe Text -> DeviceProfile)
-> Parser (Maybe Text) -> Parser (Maybe Text -> DeviceProfile)
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
"Name")
            Parser (Maybe Text -> DeviceProfile)
-> Parser (Maybe Text) -> Parser DeviceProfile
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 DeviceProfile

instance Prelude.NFData DeviceProfile