{-# 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.ResourceSummary
-- 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.ResourceSummary 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

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

-- |
-- Create a value of 'ResourceSummary' 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', 'resourceSummary_arn' - The Amazon Resource Name (ARN) of the resource.
--
-- 'id', 'resourceSummary_id' - The ID of the resource.
--
-- 'resourceType', 'resourceSummary_resourceType' - The resource type.
newResourceSummary ::
  -- | 'resourceType'
  Prelude.Text ->
  ResourceSummary
newResourceSummary :: Text -> ResourceSummary
newResourceSummary Text
pResourceType_ =
  ResourceSummary'
    { $sel:arn:ResourceSummary' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:id:ResourceSummary' :: Maybe Text
id = forall a. Maybe a
Prelude.Nothing,
      $sel:resourceType:ResourceSummary' :: Text
resourceType = Text
pResourceType_
    }

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

-- | The ID of the resource.
resourceSummary_id :: Lens.Lens' ResourceSummary (Prelude.Maybe Prelude.Text)
resourceSummary_id :: Lens' ResourceSummary (Maybe Text)
resourceSummary_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceSummary' {Maybe Text
id :: Maybe Text
$sel:id:ResourceSummary' :: ResourceSummary -> Maybe Text
id} -> Maybe Text
id) (\s :: ResourceSummary
s@ResourceSummary' {} Maybe Text
a -> ResourceSummary
s {$sel:id:ResourceSummary' :: Maybe Text
id = Maybe Text
a} :: ResourceSummary)

-- | The resource type.
resourceSummary_resourceType :: Lens.Lens' ResourceSummary Prelude.Text
resourceSummary_resourceType :: Lens' ResourceSummary Text
resourceSummary_resourceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceSummary' {Text
resourceType :: Text
$sel:resourceType:ResourceSummary' :: ResourceSummary -> Text
resourceType} -> Text
resourceType) (\s :: ResourceSummary
s@ResourceSummary' {} Text
a -> ResourceSummary
s {$sel:resourceType:ResourceSummary' :: Text
resourceType = Text
a} :: ResourceSummary)

instance Data.FromJSON ResourceSummary where
  parseJSON :: Value -> Parser ResourceSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ResourceSummary"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Text -> ResourceSummary
ResourceSummary'
            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
"arn")
            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
"id")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"resourceType")
      )

instance Prelude.Hashable ResourceSummary where
  hashWithSalt :: Int -> ResourceSummary -> Int
hashWithSalt Int
_salt ResourceSummary' {Maybe Text
Text
resourceType :: Text
id :: Maybe Text
arn :: Maybe Text
$sel:resourceType:ResourceSummary' :: ResourceSummary -> Text
$sel:id:ResourceSummary' :: ResourceSummary -> Maybe Text
$sel:arn:ResourceSummary' :: ResourceSummary -> 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
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
resourceType

instance Prelude.NFData ResourceSummary where
  rnf :: ResourceSummary -> ()
rnf ResourceSummary' {Maybe Text
Text
resourceType :: Text
id :: Maybe Text
arn :: Maybe Text
$sel:resourceType:ResourceSummary' :: ResourceSummary -> Text
$sel:id:ResourceSummary' :: ResourceSummary -> Maybe Text
$sel:arn:ResourceSummary' :: ResourceSummary -> 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
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
resourceType