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

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.GreengrassV2.Types.CloudComponentState
import Amazonka.GreengrassV2.Types.VendorGuidance
import qualified Amazonka.Prelude as Prelude

-- | Contains the status of a component version in the IoT Greengrass
-- service.
--
-- /See:/ 'newCloudComponentStatus' smart constructor.
data CloudComponentStatus = CloudComponentStatus'
  { -- | The state of the component version.
    CloudComponentStatus -> Maybe CloudComponentState
componentState :: Prelude.Maybe CloudComponentState,
    -- | A dictionary of errors that communicate why the component version is in
    -- an error state. For example, if IoT Greengrass can\'t access an artifact
    -- for the component version, then @errors@ contains the artifact\'s URI as
    -- a key, and the error message as the value for that key.
    CloudComponentStatus -> Maybe (HashMap Text Text)
errors :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | A message that communicates details, such as errors, about the status of
    -- the component version.
    CloudComponentStatus -> Maybe Text
message :: Prelude.Maybe Prelude.Text,
    -- | The vendor guidance state for the component version. This state
    -- indicates whether the component version has any issues that you should
    -- consider before you deploy it. The vendor guidance state can be:
    --
    -- -   @ACTIVE@ – This component version is available and recommended for
    --     use.
    --
    -- -   @DISCONTINUED@ – This component version has been discontinued by its
    --     publisher. You can deploy this component version, but we recommend
    --     that you use a different version of this component.
    --
    -- -   @DELETED@ – This component version has been deleted by its
    --     publisher, so you can\'t deploy it. If you have any existing
    --     deployments that specify this component version, those deployments
    --     will fail.
    CloudComponentStatus -> Maybe VendorGuidance
vendorGuidance :: Prelude.Maybe VendorGuidance,
    -- | A message that communicates details about the vendor guidance state of
    -- the component version. This message communicates why a component version
    -- is discontinued or deleted.
    CloudComponentStatus -> Maybe Text
vendorGuidanceMessage :: Prelude.Maybe Prelude.Text
  }
  deriving (CloudComponentStatus -> CloudComponentStatus -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CloudComponentStatus -> CloudComponentStatus -> Bool
$c/= :: CloudComponentStatus -> CloudComponentStatus -> Bool
== :: CloudComponentStatus -> CloudComponentStatus -> Bool
$c== :: CloudComponentStatus -> CloudComponentStatus -> Bool
Prelude.Eq, ReadPrec [CloudComponentStatus]
ReadPrec CloudComponentStatus
Int -> ReadS CloudComponentStatus
ReadS [CloudComponentStatus]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CloudComponentStatus]
$creadListPrec :: ReadPrec [CloudComponentStatus]
readPrec :: ReadPrec CloudComponentStatus
$creadPrec :: ReadPrec CloudComponentStatus
readList :: ReadS [CloudComponentStatus]
$creadList :: ReadS [CloudComponentStatus]
readsPrec :: Int -> ReadS CloudComponentStatus
$creadsPrec :: Int -> ReadS CloudComponentStatus
Prelude.Read, Int -> CloudComponentStatus -> ShowS
[CloudComponentStatus] -> ShowS
CloudComponentStatus -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CloudComponentStatus] -> ShowS
$cshowList :: [CloudComponentStatus] -> ShowS
show :: CloudComponentStatus -> String
$cshow :: CloudComponentStatus -> String
showsPrec :: Int -> CloudComponentStatus -> ShowS
$cshowsPrec :: Int -> CloudComponentStatus -> ShowS
Prelude.Show, forall x. Rep CloudComponentStatus x -> CloudComponentStatus
forall x. CloudComponentStatus -> Rep CloudComponentStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CloudComponentStatus x -> CloudComponentStatus
$cfrom :: forall x. CloudComponentStatus -> Rep CloudComponentStatus x
Prelude.Generic)

-- |
-- Create a value of 'CloudComponentStatus' 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:
--
-- 'componentState', 'cloudComponentStatus_componentState' - The state of the component version.
--
-- 'errors', 'cloudComponentStatus_errors' - A dictionary of errors that communicate why the component version is in
-- an error state. For example, if IoT Greengrass can\'t access an artifact
-- for the component version, then @errors@ contains the artifact\'s URI as
-- a key, and the error message as the value for that key.
--
-- 'message', 'cloudComponentStatus_message' - A message that communicates details, such as errors, about the status of
-- the component version.
--
-- 'vendorGuidance', 'cloudComponentStatus_vendorGuidance' - The vendor guidance state for the component version. This state
-- indicates whether the component version has any issues that you should
-- consider before you deploy it. The vendor guidance state can be:
--
-- -   @ACTIVE@ – This component version is available and recommended for
--     use.
--
-- -   @DISCONTINUED@ – This component version has been discontinued by its
--     publisher. You can deploy this component version, but we recommend
--     that you use a different version of this component.
--
-- -   @DELETED@ – This component version has been deleted by its
--     publisher, so you can\'t deploy it. If you have any existing
--     deployments that specify this component version, those deployments
--     will fail.
--
-- 'vendorGuidanceMessage', 'cloudComponentStatus_vendorGuidanceMessage' - A message that communicates details about the vendor guidance state of
-- the component version. This message communicates why a component version
-- is discontinued or deleted.
newCloudComponentStatus ::
  CloudComponentStatus
newCloudComponentStatus :: CloudComponentStatus
newCloudComponentStatus =
  CloudComponentStatus'
    { $sel:componentState:CloudComponentStatus' :: Maybe CloudComponentState
componentState =
        forall a. Maybe a
Prelude.Nothing,
      $sel:errors:CloudComponentStatus' :: Maybe (HashMap Text Text)
errors = forall a. Maybe a
Prelude.Nothing,
      $sel:message:CloudComponentStatus' :: Maybe Text
message = forall a. Maybe a
Prelude.Nothing,
      $sel:vendorGuidance:CloudComponentStatus' :: Maybe VendorGuidance
vendorGuidance = forall a. Maybe a
Prelude.Nothing,
      $sel:vendorGuidanceMessage:CloudComponentStatus' :: Maybe Text
vendorGuidanceMessage = forall a. Maybe a
Prelude.Nothing
    }

-- | The state of the component version.
cloudComponentStatus_componentState :: Lens.Lens' CloudComponentStatus (Prelude.Maybe CloudComponentState)
cloudComponentStatus_componentState :: Lens' CloudComponentStatus (Maybe CloudComponentState)
cloudComponentStatus_componentState = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudComponentStatus' {Maybe CloudComponentState
componentState :: Maybe CloudComponentState
$sel:componentState:CloudComponentStatus' :: CloudComponentStatus -> Maybe CloudComponentState
componentState} -> Maybe CloudComponentState
componentState) (\s :: CloudComponentStatus
s@CloudComponentStatus' {} Maybe CloudComponentState
a -> CloudComponentStatus
s {$sel:componentState:CloudComponentStatus' :: Maybe CloudComponentState
componentState = Maybe CloudComponentState
a} :: CloudComponentStatus)

-- | A dictionary of errors that communicate why the component version is in
-- an error state. For example, if IoT Greengrass can\'t access an artifact
-- for the component version, then @errors@ contains the artifact\'s URI as
-- a key, and the error message as the value for that key.
cloudComponentStatus_errors :: Lens.Lens' CloudComponentStatus (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
cloudComponentStatus_errors :: Lens' CloudComponentStatus (Maybe (HashMap Text Text))
cloudComponentStatus_errors = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudComponentStatus' {Maybe (HashMap Text Text)
errors :: Maybe (HashMap Text Text)
$sel:errors:CloudComponentStatus' :: CloudComponentStatus -> Maybe (HashMap Text Text)
errors} -> Maybe (HashMap Text Text)
errors) (\s :: CloudComponentStatus
s@CloudComponentStatus' {} Maybe (HashMap Text Text)
a -> CloudComponentStatus
s {$sel:errors:CloudComponentStatus' :: Maybe (HashMap Text Text)
errors = Maybe (HashMap Text Text)
a} :: CloudComponentStatus) 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

-- | A message that communicates details, such as errors, about the status of
-- the component version.
cloudComponentStatus_message :: Lens.Lens' CloudComponentStatus (Prelude.Maybe Prelude.Text)
cloudComponentStatus_message :: Lens' CloudComponentStatus (Maybe Text)
cloudComponentStatus_message = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudComponentStatus' {Maybe Text
message :: Maybe Text
$sel:message:CloudComponentStatus' :: CloudComponentStatus -> Maybe Text
message} -> Maybe Text
message) (\s :: CloudComponentStatus
s@CloudComponentStatus' {} Maybe Text
a -> CloudComponentStatus
s {$sel:message:CloudComponentStatus' :: Maybe Text
message = Maybe Text
a} :: CloudComponentStatus)

-- | The vendor guidance state for the component version. This state
-- indicates whether the component version has any issues that you should
-- consider before you deploy it. The vendor guidance state can be:
--
-- -   @ACTIVE@ – This component version is available and recommended for
--     use.
--
-- -   @DISCONTINUED@ – This component version has been discontinued by its
--     publisher. You can deploy this component version, but we recommend
--     that you use a different version of this component.
--
-- -   @DELETED@ – This component version has been deleted by its
--     publisher, so you can\'t deploy it. If you have any existing
--     deployments that specify this component version, those deployments
--     will fail.
cloudComponentStatus_vendorGuidance :: Lens.Lens' CloudComponentStatus (Prelude.Maybe VendorGuidance)
cloudComponentStatus_vendorGuidance :: Lens' CloudComponentStatus (Maybe VendorGuidance)
cloudComponentStatus_vendorGuidance = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudComponentStatus' {Maybe VendorGuidance
vendorGuidance :: Maybe VendorGuidance
$sel:vendorGuidance:CloudComponentStatus' :: CloudComponentStatus -> Maybe VendorGuidance
vendorGuidance} -> Maybe VendorGuidance
vendorGuidance) (\s :: CloudComponentStatus
s@CloudComponentStatus' {} Maybe VendorGuidance
a -> CloudComponentStatus
s {$sel:vendorGuidance:CloudComponentStatus' :: Maybe VendorGuidance
vendorGuidance = Maybe VendorGuidance
a} :: CloudComponentStatus)

-- | A message that communicates details about the vendor guidance state of
-- the component version. This message communicates why a component version
-- is discontinued or deleted.
cloudComponentStatus_vendorGuidanceMessage :: Lens.Lens' CloudComponentStatus (Prelude.Maybe Prelude.Text)
cloudComponentStatus_vendorGuidanceMessage :: Lens' CloudComponentStatus (Maybe Text)
cloudComponentStatus_vendorGuidanceMessage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudComponentStatus' {Maybe Text
vendorGuidanceMessage :: Maybe Text
$sel:vendorGuidanceMessage:CloudComponentStatus' :: CloudComponentStatus -> Maybe Text
vendorGuidanceMessage} -> Maybe Text
vendorGuidanceMessage) (\s :: CloudComponentStatus
s@CloudComponentStatus' {} Maybe Text
a -> CloudComponentStatus
s {$sel:vendorGuidanceMessage:CloudComponentStatus' :: Maybe Text
vendorGuidanceMessage = Maybe Text
a} :: CloudComponentStatus)

instance Data.FromJSON CloudComponentStatus where
  parseJSON :: Value -> Parser CloudComponentStatus
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"CloudComponentStatus"
      ( \Object
x ->
          Maybe CloudComponentState
-> Maybe (HashMap Text Text)
-> Maybe Text
-> Maybe VendorGuidance
-> Maybe Text
-> CloudComponentStatus
CloudComponentStatus'
            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
"componentState")
            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
"errors" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            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
"message")
            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
"vendorGuidance")
            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
"vendorGuidanceMessage")
      )

instance Prelude.Hashable CloudComponentStatus where
  hashWithSalt :: Int -> CloudComponentStatus -> Int
hashWithSalt Int
_salt CloudComponentStatus' {Maybe Text
Maybe (HashMap Text Text)
Maybe CloudComponentState
Maybe VendorGuidance
vendorGuidanceMessage :: Maybe Text
vendorGuidance :: Maybe VendorGuidance
message :: Maybe Text
errors :: Maybe (HashMap Text Text)
componentState :: Maybe CloudComponentState
$sel:vendorGuidanceMessage:CloudComponentStatus' :: CloudComponentStatus -> Maybe Text
$sel:vendorGuidance:CloudComponentStatus' :: CloudComponentStatus -> Maybe VendorGuidance
$sel:message:CloudComponentStatus' :: CloudComponentStatus -> Maybe Text
$sel:errors:CloudComponentStatus' :: CloudComponentStatus -> Maybe (HashMap Text Text)
$sel:componentState:CloudComponentStatus' :: CloudComponentStatus -> Maybe CloudComponentState
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CloudComponentState
componentState
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
errors
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
message
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe VendorGuidance
vendorGuidance
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
vendorGuidanceMessage

instance Prelude.NFData CloudComponentStatus where
  rnf :: CloudComponentStatus -> ()
rnf CloudComponentStatus' {Maybe Text
Maybe (HashMap Text Text)
Maybe CloudComponentState
Maybe VendorGuidance
vendorGuidanceMessage :: Maybe Text
vendorGuidance :: Maybe VendorGuidance
message :: Maybe Text
errors :: Maybe (HashMap Text Text)
componentState :: Maybe CloudComponentState
$sel:vendorGuidanceMessage:CloudComponentStatus' :: CloudComponentStatus -> Maybe Text
$sel:vendorGuidance:CloudComponentStatus' :: CloudComponentStatus -> Maybe VendorGuidance
$sel:message:CloudComponentStatus' :: CloudComponentStatus -> Maybe Text
$sel:errors:CloudComponentStatus' :: CloudComponentStatus -> Maybe (HashMap Text Text)
$sel:componentState:CloudComponentStatus' :: CloudComponentStatus -> Maybe CloudComponentState
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe CloudComponentState
componentState
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
errors
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
message
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe VendorGuidance
vendorGuidance
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
vendorGuidanceMessage