{-# 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.EKS.Types.AddonVersionInfo
-- 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.EKS.Types.AddonVersionInfo where

import qualified Amazonka.Core as Core
import Amazonka.EKS.Types.Compatibility
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Information about an add-on version.
--
-- /See:/ 'newAddonVersionInfo' smart constructor.
data AddonVersionInfo = AddonVersionInfo'
  { -- | The version of the add-on.
    AddonVersionInfo -> Maybe Text
addonVersion :: Prelude.Maybe Prelude.Text,
    -- | The architectures that the version supports.
    AddonVersionInfo -> Maybe [Text]
architecture :: Prelude.Maybe [Prelude.Text],
    -- | An object that represents the compatibilities of a version.
    AddonVersionInfo -> Maybe [Compatibility]
compatibilities :: Prelude.Maybe [Compatibility]
  }
  deriving (AddonVersionInfo -> AddonVersionInfo -> Bool
(AddonVersionInfo -> AddonVersionInfo -> Bool)
-> (AddonVersionInfo -> AddonVersionInfo -> Bool)
-> Eq AddonVersionInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AddonVersionInfo -> AddonVersionInfo -> Bool
$c/= :: AddonVersionInfo -> AddonVersionInfo -> Bool
== :: AddonVersionInfo -> AddonVersionInfo -> Bool
$c== :: AddonVersionInfo -> AddonVersionInfo -> Bool
Prelude.Eq, ReadPrec [AddonVersionInfo]
ReadPrec AddonVersionInfo
Int -> ReadS AddonVersionInfo
ReadS [AddonVersionInfo]
(Int -> ReadS AddonVersionInfo)
-> ReadS [AddonVersionInfo]
-> ReadPrec AddonVersionInfo
-> ReadPrec [AddonVersionInfo]
-> Read AddonVersionInfo
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AddonVersionInfo]
$creadListPrec :: ReadPrec [AddonVersionInfo]
readPrec :: ReadPrec AddonVersionInfo
$creadPrec :: ReadPrec AddonVersionInfo
readList :: ReadS [AddonVersionInfo]
$creadList :: ReadS [AddonVersionInfo]
readsPrec :: Int -> ReadS AddonVersionInfo
$creadsPrec :: Int -> ReadS AddonVersionInfo
Prelude.Read, Int -> AddonVersionInfo -> ShowS
[AddonVersionInfo] -> ShowS
AddonVersionInfo -> String
(Int -> AddonVersionInfo -> ShowS)
-> (AddonVersionInfo -> String)
-> ([AddonVersionInfo] -> ShowS)
-> Show AddonVersionInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AddonVersionInfo] -> ShowS
$cshowList :: [AddonVersionInfo] -> ShowS
show :: AddonVersionInfo -> String
$cshow :: AddonVersionInfo -> String
showsPrec :: Int -> AddonVersionInfo -> ShowS
$cshowsPrec :: Int -> AddonVersionInfo -> ShowS
Prelude.Show, (forall x. AddonVersionInfo -> Rep AddonVersionInfo x)
-> (forall x. Rep AddonVersionInfo x -> AddonVersionInfo)
-> Generic AddonVersionInfo
forall x. Rep AddonVersionInfo x -> AddonVersionInfo
forall x. AddonVersionInfo -> Rep AddonVersionInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AddonVersionInfo x -> AddonVersionInfo
$cfrom :: forall x. AddonVersionInfo -> Rep AddonVersionInfo x
Prelude.Generic)

-- |
-- Create a value of 'AddonVersionInfo' 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:
--
-- 'addonVersion', 'addonVersionInfo_addonVersion' - The version of the add-on.
--
-- 'architecture', 'addonVersionInfo_architecture' - The architectures that the version supports.
--
-- 'compatibilities', 'addonVersionInfo_compatibilities' - An object that represents the compatibilities of a version.
newAddonVersionInfo ::
  AddonVersionInfo
newAddonVersionInfo :: AddonVersionInfo
newAddonVersionInfo =
  AddonVersionInfo' :: Maybe Text
-> Maybe [Text] -> Maybe [Compatibility] -> AddonVersionInfo
AddonVersionInfo'
    { $sel:addonVersion:AddonVersionInfo' :: Maybe Text
addonVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:architecture:AddonVersionInfo' :: Maybe [Text]
architecture = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:compatibilities:AddonVersionInfo' :: Maybe [Compatibility]
compatibilities = Maybe [Compatibility]
forall a. Maybe a
Prelude.Nothing
    }

-- | The version of the add-on.
addonVersionInfo_addonVersion :: Lens.Lens' AddonVersionInfo (Prelude.Maybe Prelude.Text)
addonVersionInfo_addonVersion :: (Maybe Text -> f (Maybe Text))
-> AddonVersionInfo -> f AddonVersionInfo
addonVersionInfo_addonVersion = (AddonVersionInfo -> Maybe Text)
-> (AddonVersionInfo -> Maybe Text -> AddonVersionInfo)
-> Lens AddonVersionInfo AddonVersionInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddonVersionInfo' {Maybe Text
addonVersion :: Maybe Text
$sel:addonVersion:AddonVersionInfo' :: AddonVersionInfo -> Maybe Text
addonVersion} -> Maybe Text
addonVersion) (\s :: AddonVersionInfo
s@AddonVersionInfo' {} Maybe Text
a -> AddonVersionInfo
s {$sel:addonVersion:AddonVersionInfo' :: Maybe Text
addonVersion = Maybe Text
a} :: AddonVersionInfo)

-- | The architectures that the version supports.
addonVersionInfo_architecture :: Lens.Lens' AddonVersionInfo (Prelude.Maybe [Prelude.Text])
addonVersionInfo_architecture :: (Maybe [Text] -> f (Maybe [Text]))
-> AddonVersionInfo -> f AddonVersionInfo
addonVersionInfo_architecture = (AddonVersionInfo -> Maybe [Text])
-> (AddonVersionInfo -> Maybe [Text] -> AddonVersionInfo)
-> Lens
     AddonVersionInfo AddonVersionInfo (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddonVersionInfo' {Maybe [Text]
architecture :: Maybe [Text]
$sel:architecture:AddonVersionInfo' :: AddonVersionInfo -> Maybe [Text]
architecture} -> Maybe [Text]
architecture) (\s :: AddonVersionInfo
s@AddonVersionInfo' {} Maybe [Text]
a -> AddonVersionInfo
s {$sel:architecture:AddonVersionInfo' :: Maybe [Text]
architecture = Maybe [Text]
a} :: AddonVersionInfo) ((Maybe [Text] -> f (Maybe [Text]))
 -> AddonVersionInfo -> f AddonVersionInfo)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> AddonVersionInfo
-> f AddonVersionInfo
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | An object that represents the compatibilities of a version.
addonVersionInfo_compatibilities :: Lens.Lens' AddonVersionInfo (Prelude.Maybe [Compatibility])
addonVersionInfo_compatibilities :: (Maybe [Compatibility] -> f (Maybe [Compatibility]))
-> AddonVersionInfo -> f AddonVersionInfo
addonVersionInfo_compatibilities = (AddonVersionInfo -> Maybe [Compatibility])
-> (AddonVersionInfo -> Maybe [Compatibility] -> AddonVersionInfo)
-> Lens
     AddonVersionInfo
     AddonVersionInfo
     (Maybe [Compatibility])
     (Maybe [Compatibility])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddonVersionInfo' {Maybe [Compatibility]
compatibilities :: Maybe [Compatibility]
$sel:compatibilities:AddonVersionInfo' :: AddonVersionInfo -> Maybe [Compatibility]
compatibilities} -> Maybe [Compatibility]
compatibilities) (\s :: AddonVersionInfo
s@AddonVersionInfo' {} Maybe [Compatibility]
a -> AddonVersionInfo
s {$sel:compatibilities:AddonVersionInfo' :: Maybe [Compatibility]
compatibilities = Maybe [Compatibility]
a} :: AddonVersionInfo) ((Maybe [Compatibility] -> f (Maybe [Compatibility]))
 -> AddonVersionInfo -> f AddonVersionInfo)
-> ((Maybe [Compatibility] -> f (Maybe [Compatibility]))
    -> Maybe [Compatibility] -> f (Maybe [Compatibility]))
-> (Maybe [Compatibility] -> f (Maybe [Compatibility]))
-> AddonVersionInfo
-> f AddonVersionInfo
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [Compatibility] [Compatibility] [Compatibility] [Compatibility]
-> Iso
     (Maybe [Compatibility])
     (Maybe [Compatibility])
     (Maybe [Compatibility])
     (Maybe [Compatibility])
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
  [Compatibility] [Compatibility] [Compatibility] [Compatibility]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON AddonVersionInfo where
  parseJSON :: Value -> Parser AddonVersionInfo
parseJSON =
    String
-> (Object -> Parser AddonVersionInfo)
-> Value
-> Parser AddonVersionInfo
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AddonVersionInfo"
      ( \Object
x ->
          Maybe Text
-> Maybe [Text] -> Maybe [Compatibility] -> AddonVersionInfo
AddonVersionInfo'
            (Maybe Text
 -> Maybe [Text] -> Maybe [Compatibility] -> AddonVersionInfo)
-> Parser (Maybe Text)
-> Parser
     (Maybe [Text] -> Maybe [Compatibility] -> AddonVersionInfo)
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
"addonVersion")
            Parser (Maybe [Text] -> Maybe [Compatibility] -> AddonVersionInfo)
-> Parser (Maybe [Text])
-> Parser (Maybe [Compatibility] -> AddonVersionInfo)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"architecture" Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
            Parser (Maybe [Compatibility] -> AddonVersionInfo)
-> Parser (Maybe [Compatibility]) -> Parser AddonVersionInfo
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [Compatibility]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"compatibilities"
                            Parser (Maybe (Maybe [Compatibility]))
-> Maybe [Compatibility] -> Parser (Maybe [Compatibility])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Compatibility]
forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable AddonVersionInfo

instance Prelude.NFData AddonVersionInfo