{-# 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.GreengrassV2.Types.InstalledComponent
-- 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.GreengrassV2.Types.InstalledComponent where

import qualified Amazonka.Core as Core
import Amazonka.GreengrassV2.Types.InstalledComponentLifecycleState
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Contains information about a component on a Greengrass core device.
--
-- /See:/ 'newInstalledComponent' smart constructor.
data InstalledComponent = InstalledComponent'
  { -- | Whether or not the component is a root component.
    InstalledComponent -> Maybe Bool
isRoot :: Prelude.Maybe Prelude.Bool,
    -- | The version of the component.
    InstalledComponent -> Maybe Text
componentVersion :: Prelude.Maybe Prelude.Text,
    -- | The name of the component.
    InstalledComponent -> Maybe Text
componentName :: Prelude.Maybe Prelude.Text,
    -- | The details about the lifecycle state of the component.
    InstalledComponent -> Maybe Text
lifecycleStateDetails :: Prelude.Maybe Prelude.Text,
    -- | The lifecycle state of the component.
    InstalledComponent -> Maybe InstalledComponentLifecycleState
lifecycleState :: Prelude.Maybe InstalledComponentLifecycleState
  }
  deriving (InstalledComponent -> InstalledComponent -> Bool
(InstalledComponent -> InstalledComponent -> Bool)
-> (InstalledComponent -> InstalledComponent -> Bool)
-> Eq InstalledComponent
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InstalledComponent -> InstalledComponent -> Bool
$c/= :: InstalledComponent -> InstalledComponent -> Bool
== :: InstalledComponent -> InstalledComponent -> Bool
$c== :: InstalledComponent -> InstalledComponent -> Bool
Prelude.Eq, ReadPrec [InstalledComponent]
ReadPrec InstalledComponent
Int -> ReadS InstalledComponent
ReadS [InstalledComponent]
(Int -> ReadS InstalledComponent)
-> ReadS [InstalledComponent]
-> ReadPrec InstalledComponent
-> ReadPrec [InstalledComponent]
-> Read InstalledComponent
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InstalledComponent]
$creadListPrec :: ReadPrec [InstalledComponent]
readPrec :: ReadPrec InstalledComponent
$creadPrec :: ReadPrec InstalledComponent
readList :: ReadS [InstalledComponent]
$creadList :: ReadS [InstalledComponent]
readsPrec :: Int -> ReadS InstalledComponent
$creadsPrec :: Int -> ReadS InstalledComponent
Prelude.Read, Int -> InstalledComponent -> ShowS
[InstalledComponent] -> ShowS
InstalledComponent -> String
(Int -> InstalledComponent -> ShowS)
-> (InstalledComponent -> String)
-> ([InstalledComponent] -> ShowS)
-> Show InstalledComponent
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InstalledComponent] -> ShowS
$cshowList :: [InstalledComponent] -> ShowS
show :: InstalledComponent -> String
$cshow :: InstalledComponent -> String
showsPrec :: Int -> InstalledComponent -> ShowS
$cshowsPrec :: Int -> InstalledComponent -> ShowS
Prelude.Show, (forall x. InstalledComponent -> Rep InstalledComponent x)
-> (forall x. Rep InstalledComponent x -> InstalledComponent)
-> Generic InstalledComponent
forall x. Rep InstalledComponent x -> InstalledComponent
forall x. InstalledComponent -> Rep InstalledComponent x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InstalledComponent x -> InstalledComponent
$cfrom :: forall x. InstalledComponent -> Rep InstalledComponent x
Prelude.Generic)

-- |
-- Create a value of 'InstalledComponent' 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:
--
-- 'isRoot', 'installedComponent_isRoot' - Whether or not the component is a root component.
--
-- 'componentVersion', 'installedComponent_componentVersion' - The version of the component.
--
-- 'componentName', 'installedComponent_componentName' - The name of the component.
--
-- 'lifecycleStateDetails', 'installedComponent_lifecycleStateDetails' - The details about the lifecycle state of the component.
--
-- 'lifecycleState', 'installedComponent_lifecycleState' - The lifecycle state of the component.
newInstalledComponent ::
  InstalledComponent
newInstalledComponent :: InstalledComponent
newInstalledComponent =
  InstalledComponent' :: Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe InstalledComponentLifecycleState
-> InstalledComponent
InstalledComponent'
    { $sel:isRoot:InstalledComponent' :: Maybe Bool
isRoot = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:componentVersion:InstalledComponent' :: Maybe Text
componentVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:componentName:InstalledComponent' :: Maybe Text
componentName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:lifecycleStateDetails:InstalledComponent' :: Maybe Text
lifecycleStateDetails = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:lifecycleState:InstalledComponent' :: Maybe InstalledComponentLifecycleState
lifecycleState = Maybe InstalledComponentLifecycleState
forall a. Maybe a
Prelude.Nothing
    }

-- | Whether or not the component is a root component.
installedComponent_isRoot :: Lens.Lens' InstalledComponent (Prelude.Maybe Prelude.Bool)
installedComponent_isRoot :: (Maybe Bool -> f (Maybe Bool))
-> InstalledComponent -> f InstalledComponent
installedComponent_isRoot = (InstalledComponent -> Maybe Bool)
-> (InstalledComponent -> Maybe Bool -> InstalledComponent)
-> Lens
     InstalledComponent InstalledComponent (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstalledComponent' {Maybe Bool
isRoot :: Maybe Bool
$sel:isRoot:InstalledComponent' :: InstalledComponent -> Maybe Bool
isRoot} -> Maybe Bool
isRoot) (\s :: InstalledComponent
s@InstalledComponent' {} Maybe Bool
a -> InstalledComponent
s {$sel:isRoot:InstalledComponent' :: Maybe Bool
isRoot = Maybe Bool
a} :: InstalledComponent)

-- | The version of the component.
installedComponent_componentVersion :: Lens.Lens' InstalledComponent (Prelude.Maybe Prelude.Text)
installedComponent_componentVersion :: (Maybe Text -> f (Maybe Text))
-> InstalledComponent -> f InstalledComponent
installedComponent_componentVersion = (InstalledComponent -> Maybe Text)
-> (InstalledComponent -> Maybe Text -> InstalledComponent)
-> Lens
     InstalledComponent InstalledComponent (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstalledComponent' {Maybe Text
componentVersion :: Maybe Text
$sel:componentVersion:InstalledComponent' :: InstalledComponent -> Maybe Text
componentVersion} -> Maybe Text
componentVersion) (\s :: InstalledComponent
s@InstalledComponent' {} Maybe Text
a -> InstalledComponent
s {$sel:componentVersion:InstalledComponent' :: Maybe Text
componentVersion = Maybe Text
a} :: InstalledComponent)

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

-- | The details about the lifecycle state of the component.
installedComponent_lifecycleStateDetails :: Lens.Lens' InstalledComponent (Prelude.Maybe Prelude.Text)
installedComponent_lifecycleStateDetails :: (Maybe Text -> f (Maybe Text))
-> InstalledComponent -> f InstalledComponent
installedComponent_lifecycleStateDetails = (InstalledComponent -> Maybe Text)
-> (InstalledComponent -> Maybe Text -> InstalledComponent)
-> Lens
     InstalledComponent InstalledComponent (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstalledComponent' {Maybe Text
lifecycleStateDetails :: Maybe Text
$sel:lifecycleStateDetails:InstalledComponent' :: InstalledComponent -> Maybe Text
lifecycleStateDetails} -> Maybe Text
lifecycleStateDetails) (\s :: InstalledComponent
s@InstalledComponent' {} Maybe Text
a -> InstalledComponent
s {$sel:lifecycleStateDetails:InstalledComponent' :: Maybe Text
lifecycleStateDetails = Maybe Text
a} :: InstalledComponent)

-- | The lifecycle state of the component.
installedComponent_lifecycleState :: Lens.Lens' InstalledComponent (Prelude.Maybe InstalledComponentLifecycleState)
installedComponent_lifecycleState :: (Maybe InstalledComponentLifecycleState
 -> f (Maybe InstalledComponentLifecycleState))
-> InstalledComponent -> f InstalledComponent
installedComponent_lifecycleState = (InstalledComponent -> Maybe InstalledComponentLifecycleState)
-> (InstalledComponent
    -> Maybe InstalledComponentLifecycleState -> InstalledComponent)
-> Lens
     InstalledComponent
     InstalledComponent
     (Maybe InstalledComponentLifecycleState)
     (Maybe InstalledComponentLifecycleState)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstalledComponent' {Maybe InstalledComponentLifecycleState
lifecycleState :: Maybe InstalledComponentLifecycleState
$sel:lifecycleState:InstalledComponent' :: InstalledComponent -> Maybe InstalledComponentLifecycleState
lifecycleState} -> Maybe InstalledComponentLifecycleState
lifecycleState) (\s :: InstalledComponent
s@InstalledComponent' {} Maybe InstalledComponentLifecycleState
a -> InstalledComponent
s {$sel:lifecycleState:InstalledComponent' :: Maybe InstalledComponentLifecycleState
lifecycleState = Maybe InstalledComponentLifecycleState
a} :: InstalledComponent)

instance Core.FromJSON InstalledComponent where
  parseJSON :: Value -> Parser InstalledComponent
parseJSON =
    String
-> (Object -> Parser InstalledComponent)
-> Value
-> Parser InstalledComponent
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"InstalledComponent"
      ( \Object
x ->
          Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe InstalledComponentLifecycleState
-> InstalledComponent
InstalledComponent'
            (Maybe Bool
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe InstalledComponentLifecycleState
 -> InstalledComponent)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe InstalledComponentLifecycleState
      -> InstalledComponent)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"isRoot")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe InstalledComponentLifecycleState
   -> InstalledComponent)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe InstalledComponentLifecycleState
      -> InstalledComponent)
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
"componentVersion")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe InstalledComponentLifecycleState
   -> InstalledComponent)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe InstalledComponentLifecycleState -> InstalledComponent)
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
"componentName")
            Parser
  (Maybe Text
   -> Maybe InstalledComponentLifecycleState -> InstalledComponent)
-> Parser (Maybe Text)
-> Parser
     (Maybe InstalledComponentLifecycleState -> InstalledComponent)
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
"lifecycleStateDetails")
            Parser
  (Maybe InstalledComponentLifecycleState -> InstalledComponent)
-> Parser (Maybe InstalledComponentLifecycleState)
-> Parser InstalledComponent
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe InstalledComponentLifecycleState)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"lifecycleState")
      )

instance Prelude.Hashable InstalledComponent

instance Prelude.NFData InstalledComponent