{-# 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.SnowDeviceManagement.Types.DeviceSummary
-- 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.SnowDeviceManagement.Types.DeviceSummary 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

-- | Identifying information about the device.
--
-- /See:/ 'newDeviceSummary' smart constructor.
data DeviceSummary = DeviceSummary'
  { -- | The ID of the job used to order the device.
    DeviceSummary -> Maybe Text
associatedWithJob :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the device.
    DeviceSummary -> Maybe Text
managedDeviceArn :: Prelude.Maybe Prelude.Text,
    -- | The ID of the device.
    DeviceSummary -> Maybe Text
managedDeviceId :: Prelude.Maybe Prelude.Text,
    -- | Optional metadata that you assign to a resource. You can use tags to
    -- categorize a resource in different ways, such as by purpose, owner, or
    -- environment.
    DeviceSummary -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text)
  }
  deriving (DeviceSummary -> DeviceSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeviceSummary -> DeviceSummary -> Bool
$c/= :: DeviceSummary -> DeviceSummary -> Bool
== :: DeviceSummary -> DeviceSummary -> Bool
$c== :: DeviceSummary -> DeviceSummary -> Bool
Prelude.Eq, ReadPrec [DeviceSummary]
ReadPrec DeviceSummary
Int -> ReadS DeviceSummary
ReadS [DeviceSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeviceSummary]
$creadListPrec :: ReadPrec [DeviceSummary]
readPrec :: ReadPrec DeviceSummary
$creadPrec :: ReadPrec DeviceSummary
readList :: ReadS [DeviceSummary]
$creadList :: ReadS [DeviceSummary]
readsPrec :: Int -> ReadS DeviceSummary
$creadsPrec :: Int -> ReadS DeviceSummary
Prelude.Read, Int -> DeviceSummary -> ShowS
[DeviceSummary] -> ShowS
DeviceSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeviceSummary] -> ShowS
$cshowList :: [DeviceSummary] -> ShowS
show :: DeviceSummary -> String
$cshow :: DeviceSummary -> String
showsPrec :: Int -> DeviceSummary -> ShowS
$cshowsPrec :: Int -> DeviceSummary -> ShowS
Prelude.Show, forall x. Rep DeviceSummary x -> DeviceSummary
forall x. DeviceSummary -> Rep DeviceSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeviceSummary x -> DeviceSummary
$cfrom :: forall x. DeviceSummary -> Rep DeviceSummary x
Prelude.Generic)

-- |
-- Create a value of 'DeviceSummary' 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:
--
-- 'associatedWithJob', 'deviceSummary_associatedWithJob' - The ID of the job used to order the device.
--
-- 'managedDeviceArn', 'deviceSummary_managedDeviceArn' - The Amazon Resource Name (ARN) of the device.
--
-- 'managedDeviceId', 'deviceSummary_managedDeviceId' - The ID of the device.
--
-- 'tags', 'deviceSummary_tags' - Optional metadata that you assign to a resource. You can use tags to
-- categorize a resource in different ways, such as by purpose, owner, or
-- environment.
newDeviceSummary ::
  DeviceSummary
newDeviceSummary :: DeviceSummary
newDeviceSummary =
  DeviceSummary'
    { $sel:associatedWithJob:DeviceSummary' :: Maybe Text
associatedWithJob = forall a. Maybe a
Prelude.Nothing,
      $sel:managedDeviceArn:DeviceSummary' :: Maybe Text
managedDeviceArn = forall a. Maybe a
Prelude.Nothing,
      $sel:managedDeviceId:DeviceSummary' :: Maybe Text
managedDeviceId = forall a. Maybe a
Prelude.Nothing,
      $sel:tags:DeviceSummary' :: Maybe (HashMap Text Text)
tags = forall a. Maybe a
Prelude.Nothing
    }

-- | The ID of the job used to order the device.
deviceSummary_associatedWithJob :: Lens.Lens' DeviceSummary (Prelude.Maybe Prelude.Text)
deviceSummary_associatedWithJob :: Lens' DeviceSummary (Maybe Text)
deviceSummary_associatedWithJob = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeviceSummary' {Maybe Text
associatedWithJob :: Maybe Text
$sel:associatedWithJob:DeviceSummary' :: DeviceSummary -> Maybe Text
associatedWithJob} -> Maybe Text
associatedWithJob) (\s :: DeviceSummary
s@DeviceSummary' {} Maybe Text
a -> DeviceSummary
s {$sel:associatedWithJob:DeviceSummary' :: Maybe Text
associatedWithJob = Maybe Text
a} :: DeviceSummary)

-- | The Amazon Resource Name (ARN) of the device.
deviceSummary_managedDeviceArn :: Lens.Lens' DeviceSummary (Prelude.Maybe Prelude.Text)
deviceSummary_managedDeviceArn :: Lens' DeviceSummary (Maybe Text)
deviceSummary_managedDeviceArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeviceSummary' {Maybe Text
managedDeviceArn :: Maybe Text
$sel:managedDeviceArn:DeviceSummary' :: DeviceSummary -> Maybe Text
managedDeviceArn} -> Maybe Text
managedDeviceArn) (\s :: DeviceSummary
s@DeviceSummary' {} Maybe Text
a -> DeviceSummary
s {$sel:managedDeviceArn:DeviceSummary' :: Maybe Text
managedDeviceArn = Maybe Text
a} :: DeviceSummary)

-- | The ID of the device.
deviceSummary_managedDeviceId :: Lens.Lens' DeviceSummary (Prelude.Maybe Prelude.Text)
deviceSummary_managedDeviceId :: Lens' DeviceSummary (Maybe Text)
deviceSummary_managedDeviceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeviceSummary' {Maybe Text
managedDeviceId :: Maybe Text
$sel:managedDeviceId:DeviceSummary' :: DeviceSummary -> Maybe Text
managedDeviceId} -> Maybe Text
managedDeviceId) (\s :: DeviceSummary
s@DeviceSummary' {} Maybe Text
a -> DeviceSummary
s {$sel:managedDeviceId:DeviceSummary' :: Maybe Text
managedDeviceId = Maybe Text
a} :: DeviceSummary)

-- | Optional metadata that you assign to a resource. You can use tags to
-- categorize a resource in different ways, such as by purpose, owner, or
-- environment.
deviceSummary_tags :: Lens.Lens' DeviceSummary (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
deviceSummary_tags :: Lens' DeviceSummary (Maybe (HashMap Text Text))
deviceSummary_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeviceSummary' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:DeviceSummary' :: DeviceSummary -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: DeviceSummary
s@DeviceSummary' {} Maybe (HashMap Text Text)
a -> DeviceSummary
s {$sel:tags:DeviceSummary' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: DeviceSummary) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON DeviceSummary where
  parseJSON :: Value -> Parser DeviceSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"DeviceSummary"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> DeviceSummary
DeviceSummary'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"associatedWithJob")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"managedDeviceArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"managedDeviceId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"tags" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable DeviceSummary where
  hashWithSalt :: Int -> DeviceSummary -> Int
hashWithSalt Int
_salt DeviceSummary' {Maybe Text
Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
managedDeviceId :: Maybe Text
managedDeviceArn :: Maybe Text
associatedWithJob :: Maybe Text
$sel:tags:DeviceSummary' :: DeviceSummary -> Maybe (HashMap Text Text)
$sel:managedDeviceId:DeviceSummary' :: DeviceSummary -> Maybe Text
$sel:managedDeviceArn:DeviceSummary' :: DeviceSummary -> Maybe Text
$sel:associatedWithJob:DeviceSummary' :: DeviceSummary -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
associatedWithJob
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
managedDeviceArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
managedDeviceId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
tags

instance Prelude.NFData DeviceSummary where
  rnf :: DeviceSummary -> ()
rnf DeviceSummary' {Maybe Text
Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
managedDeviceId :: Maybe Text
managedDeviceArn :: Maybe Text
associatedWithJob :: Maybe Text
$sel:tags:DeviceSummary' :: DeviceSummary -> Maybe (HashMap Text Text)
$sel:managedDeviceId:DeviceSummary' :: DeviceSummary -> Maybe Text
$sel:managedDeviceArn:DeviceSummary' :: DeviceSummary -> Maybe Text
$sel:associatedWithJob:DeviceSummary' :: DeviceSummary -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
associatedWithJob
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
managedDeviceArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
managedDeviceId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
tags