{-# 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.ResolvedComponentVersion
-- 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.ResolvedComponentVersion where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Contains information about a component version that is compatible to run
-- on a Greengrass core device.
--
-- /See:/ 'newResolvedComponentVersion' smart constructor.
data ResolvedComponentVersion = ResolvedComponentVersion'
  { -- | The
    -- <https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html ARN>
    -- of the component version.
    ResolvedComponentVersion -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The version of the component.
    ResolvedComponentVersion -> Maybe Text
componentVersion :: Prelude.Maybe Prelude.Text,
    -- | The recipe of the component version.
    ResolvedComponentVersion -> Maybe Base64
recipe :: Prelude.Maybe Core.Base64,
    -- | The name of the component.
    ResolvedComponentVersion -> Maybe Text
componentName :: Prelude.Maybe Prelude.Text
  }
  deriving (ResolvedComponentVersion -> ResolvedComponentVersion -> Bool
(ResolvedComponentVersion -> ResolvedComponentVersion -> Bool)
-> (ResolvedComponentVersion -> ResolvedComponentVersion -> Bool)
-> Eq ResolvedComponentVersion
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResolvedComponentVersion -> ResolvedComponentVersion -> Bool
$c/= :: ResolvedComponentVersion -> ResolvedComponentVersion -> Bool
== :: ResolvedComponentVersion -> ResolvedComponentVersion -> Bool
$c== :: ResolvedComponentVersion -> ResolvedComponentVersion -> Bool
Prelude.Eq, ReadPrec [ResolvedComponentVersion]
ReadPrec ResolvedComponentVersion
Int -> ReadS ResolvedComponentVersion
ReadS [ResolvedComponentVersion]
(Int -> ReadS ResolvedComponentVersion)
-> ReadS [ResolvedComponentVersion]
-> ReadPrec ResolvedComponentVersion
-> ReadPrec [ResolvedComponentVersion]
-> Read ResolvedComponentVersion
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ResolvedComponentVersion]
$creadListPrec :: ReadPrec [ResolvedComponentVersion]
readPrec :: ReadPrec ResolvedComponentVersion
$creadPrec :: ReadPrec ResolvedComponentVersion
readList :: ReadS [ResolvedComponentVersion]
$creadList :: ReadS [ResolvedComponentVersion]
readsPrec :: Int -> ReadS ResolvedComponentVersion
$creadsPrec :: Int -> ReadS ResolvedComponentVersion
Prelude.Read, Int -> ResolvedComponentVersion -> ShowS
[ResolvedComponentVersion] -> ShowS
ResolvedComponentVersion -> String
(Int -> ResolvedComponentVersion -> ShowS)
-> (ResolvedComponentVersion -> String)
-> ([ResolvedComponentVersion] -> ShowS)
-> Show ResolvedComponentVersion
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResolvedComponentVersion] -> ShowS
$cshowList :: [ResolvedComponentVersion] -> ShowS
show :: ResolvedComponentVersion -> String
$cshow :: ResolvedComponentVersion -> String
showsPrec :: Int -> ResolvedComponentVersion -> ShowS
$cshowsPrec :: Int -> ResolvedComponentVersion -> ShowS
Prelude.Show, (forall x.
 ResolvedComponentVersion -> Rep ResolvedComponentVersion x)
-> (forall x.
    Rep ResolvedComponentVersion x -> ResolvedComponentVersion)
-> Generic ResolvedComponentVersion
forall x.
Rep ResolvedComponentVersion x -> ResolvedComponentVersion
forall x.
ResolvedComponentVersion -> Rep ResolvedComponentVersion x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ResolvedComponentVersion x -> ResolvedComponentVersion
$cfrom :: forall x.
ResolvedComponentVersion -> Rep ResolvedComponentVersion x
Prelude.Generic)

-- |
-- Create a value of 'ResolvedComponentVersion' 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', 'resolvedComponentVersion_arn' - The
-- <https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html ARN>
-- of the component version.
--
-- 'componentVersion', 'resolvedComponentVersion_componentVersion' - The version of the component.
--
-- 'recipe', 'resolvedComponentVersion_recipe' - The recipe of the component version.--
-- -- /Note:/ This 'Lens' automatically encodes and decodes Base64 data.
-- -- The underlying isomorphism will encode to Base64 representation during
-- -- serialisation, and decode from Base64 representation during deserialisation.
-- -- This 'Lens' accepts and returns only raw unencoded data.
--
-- 'componentName', 'resolvedComponentVersion_componentName' - The name of the component.
newResolvedComponentVersion ::
  ResolvedComponentVersion
newResolvedComponentVersion :: ResolvedComponentVersion
newResolvedComponentVersion =
  ResolvedComponentVersion' :: Maybe Text
-> Maybe Text
-> Maybe Base64
-> Maybe Text
-> ResolvedComponentVersion
ResolvedComponentVersion'
    { $sel:arn:ResolvedComponentVersion' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:componentVersion:ResolvedComponentVersion' :: Maybe Text
componentVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:recipe:ResolvedComponentVersion' :: Maybe Base64
recipe = Maybe Base64
forall a. Maybe a
Prelude.Nothing,
      $sel:componentName:ResolvedComponentVersion' :: Maybe Text
componentName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The
-- <https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html ARN>
-- of the component version.
resolvedComponentVersion_arn :: Lens.Lens' ResolvedComponentVersion (Prelude.Maybe Prelude.Text)
resolvedComponentVersion_arn :: (Maybe Text -> f (Maybe Text))
-> ResolvedComponentVersion -> f ResolvedComponentVersion
resolvedComponentVersion_arn = (ResolvedComponentVersion -> Maybe Text)
-> (ResolvedComponentVersion
    -> Maybe Text -> ResolvedComponentVersion)
-> Lens
     ResolvedComponentVersion
     ResolvedComponentVersion
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResolvedComponentVersion' {Maybe Text
arn :: Maybe Text
$sel:arn:ResolvedComponentVersion' :: ResolvedComponentVersion -> Maybe Text
arn} -> Maybe Text
arn) (\s :: ResolvedComponentVersion
s@ResolvedComponentVersion' {} Maybe Text
a -> ResolvedComponentVersion
s {$sel:arn:ResolvedComponentVersion' :: Maybe Text
arn = Maybe Text
a} :: ResolvedComponentVersion)

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

-- | The recipe of the component version.--
-- -- /Note:/ This 'Lens' automatically encodes and decodes Base64 data.
-- -- The underlying isomorphism will encode to Base64 representation during
-- -- serialisation, and decode from Base64 representation during deserialisation.
-- -- This 'Lens' accepts and returns only raw unencoded data.
resolvedComponentVersion_recipe :: Lens.Lens' ResolvedComponentVersion (Prelude.Maybe Prelude.ByteString)
resolvedComponentVersion_recipe :: (Maybe ByteString -> f (Maybe ByteString))
-> ResolvedComponentVersion -> f ResolvedComponentVersion
resolvedComponentVersion_recipe = (ResolvedComponentVersion -> Maybe Base64)
-> (ResolvedComponentVersion
    -> Maybe Base64 -> ResolvedComponentVersion)
-> Lens
     ResolvedComponentVersion
     ResolvedComponentVersion
     (Maybe Base64)
     (Maybe Base64)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResolvedComponentVersion' {Maybe Base64
recipe :: Maybe Base64
$sel:recipe:ResolvedComponentVersion' :: ResolvedComponentVersion -> Maybe Base64
recipe} -> Maybe Base64
recipe) (\s :: ResolvedComponentVersion
s@ResolvedComponentVersion' {} Maybe Base64
a -> ResolvedComponentVersion
s {$sel:recipe:ResolvedComponentVersion' :: Maybe Base64
recipe = Maybe Base64
a} :: ResolvedComponentVersion) ((Maybe Base64 -> f (Maybe Base64))
 -> ResolvedComponentVersion -> f ResolvedComponentVersion)
-> ((Maybe ByteString -> f (Maybe ByteString))
    -> Maybe Base64 -> f (Maybe Base64))
-> (Maybe ByteString -> f (Maybe ByteString))
-> ResolvedComponentVersion
-> f ResolvedComponentVersion
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso Base64 Base64 ByteString ByteString
-> Iso
     (Maybe Base64) (Maybe Base64) (Maybe ByteString) (Maybe ByteString)
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 AnIso Base64 Base64 ByteString ByteString
Iso' Base64 ByteString
Core._Base64

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

instance Core.FromJSON ResolvedComponentVersion where
  parseJSON :: Value -> Parser ResolvedComponentVersion
parseJSON =
    String
-> (Object -> Parser ResolvedComponentVersion)
-> Value
-> Parser ResolvedComponentVersion
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ResolvedComponentVersion"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Base64
-> Maybe Text
-> ResolvedComponentVersion
ResolvedComponentVersion'
            (Maybe Text
 -> Maybe Text
 -> Maybe Base64
 -> Maybe Text
 -> ResolvedComponentVersion)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Base64 -> Maybe Text -> ResolvedComponentVersion)
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
   -> Maybe Base64 -> Maybe Text -> ResolvedComponentVersion)
-> Parser (Maybe Text)
-> Parser (Maybe Base64 -> Maybe Text -> ResolvedComponentVersion)
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 Base64 -> Maybe Text -> ResolvedComponentVersion)
-> Parser (Maybe Base64)
-> Parser (Maybe Text -> ResolvedComponentVersion)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Base64)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"recipe")
            Parser (Maybe Text -> ResolvedComponentVersion)
-> Parser (Maybe Text) -> Parser ResolvedComponentVersion
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")
      )

instance Prelude.Hashable ResolvedComponentVersion

instance Prelude.NFData ResolvedComponentVersion