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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(ResourceSummary -> ResourceSummary -> Bool)
-> (ResourceSummary -> ResourceSummary -> Bool)
-> Eq ResourceSummary
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]
(Int -> ReadS ResourceSummary)
-> ReadS [ResourceSummary]
-> ReadPrec ResourceSummary
-> ReadPrec [ResourceSummary]
-> Read 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
(Int -> ResourceSummary -> ShowS)
-> (ResourceSummary -> String)
-> ([ResourceSummary] -> ShowS)
-> Show ResourceSummary
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. ResourceSummary -> Rep ResourceSummary x)
-> (forall x. Rep ResourceSummary x -> ResourceSummary)
-> Generic ResourceSummary
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' :: Maybe Text -> Maybe Text -> Text -> ResourceSummary
ResourceSummary'
    { $sel:arn:ResourceSummary' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:id:ResourceSummary' :: Maybe Text
id = Maybe Text
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 :: (Maybe Text -> f (Maybe Text))
-> ResourceSummary -> f ResourceSummary
resourceSummary_arn = (ResourceSummary -> Maybe Text)
-> (ResourceSummary -> Maybe Text -> ResourceSummary)
-> Lens ResourceSummary ResourceSummary (Maybe Text) (Maybe Text)
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 :: (Maybe Text -> f (Maybe Text))
-> ResourceSummary -> f ResourceSummary
resourceSummary_id = (ResourceSummary -> Maybe Text)
-> (ResourceSummary -> Maybe Text -> ResourceSummary)
-> Lens ResourceSummary ResourceSummary (Maybe Text) (Maybe Text)
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 :: (Text -> f Text) -> ResourceSummary -> f ResourceSummary
resourceSummary_resourceType = (ResourceSummary -> Text)
-> (ResourceSummary -> Text -> ResourceSummary)
-> Lens ResourceSummary ResourceSummary Text Text
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 Core.FromJSON ResourceSummary where
  parseJSON :: Value -> Parser ResourceSummary
parseJSON =
    String
-> (Object -> Parser ResourceSummary)
-> Value
-> Parser ResourceSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ResourceSummary"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Text -> ResourceSummary
ResourceSummary'
            (Maybe Text -> Maybe Text -> Text -> ResourceSummary)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Text -> ResourceSummary)
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 -> Text -> ResourceSummary)
-> Parser (Maybe Text) -> Parser (Text -> ResourceSummary)
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")
            Parser (Text -> ResourceSummary)
-> Parser Text -> Parser ResourceSummary
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"resourceType")
      )

instance Prelude.Hashable ResourceSummary

instance Prelude.NFData ResourceSummary