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

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

-- | Compatibility information.
--
-- /See:/ 'newCompatibility' smart constructor.
data Compatibility = Compatibility'
  { -- | The supported default version.
    Compatibility -> Maybe Bool
defaultVersion :: Prelude.Maybe Prelude.Bool,
    -- | The supported Kubernetes version of the cluster.
    Compatibility -> Maybe Text
clusterVersion :: Prelude.Maybe Prelude.Text,
    -- | The supported compute platform.
    Compatibility -> Maybe [Text]
platformVersions :: Prelude.Maybe [Prelude.Text]
  }
  deriving (Compatibility -> Compatibility -> Bool
(Compatibility -> Compatibility -> Bool)
-> (Compatibility -> Compatibility -> Bool) -> Eq Compatibility
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Compatibility -> Compatibility -> Bool
$c/= :: Compatibility -> Compatibility -> Bool
== :: Compatibility -> Compatibility -> Bool
$c== :: Compatibility -> Compatibility -> Bool
Prelude.Eq, ReadPrec [Compatibility]
ReadPrec Compatibility
Int -> ReadS Compatibility
ReadS [Compatibility]
(Int -> ReadS Compatibility)
-> ReadS [Compatibility]
-> ReadPrec Compatibility
-> ReadPrec [Compatibility]
-> Read Compatibility
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Compatibility]
$creadListPrec :: ReadPrec [Compatibility]
readPrec :: ReadPrec Compatibility
$creadPrec :: ReadPrec Compatibility
readList :: ReadS [Compatibility]
$creadList :: ReadS [Compatibility]
readsPrec :: Int -> ReadS Compatibility
$creadsPrec :: Int -> ReadS Compatibility
Prelude.Read, Int -> Compatibility -> ShowS
[Compatibility] -> ShowS
Compatibility -> String
(Int -> Compatibility -> ShowS)
-> (Compatibility -> String)
-> ([Compatibility] -> ShowS)
-> Show Compatibility
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Compatibility] -> ShowS
$cshowList :: [Compatibility] -> ShowS
show :: Compatibility -> String
$cshow :: Compatibility -> String
showsPrec :: Int -> Compatibility -> ShowS
$cshowsPrec :: Int -> Compatibility -> ShowS
Prelude.Show, (forall x. Compatibility -> Rep Compatibility x)
-> (forall x. Rep Compatibility x -> Compatibility)
-> Generic Compatibility
forall x. Rep Compatibility x -> Compatibility
forall x. Compatibility -> Rep Compatibility x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Compatibility x -> Compatibility
$cfrom :: forall x. Compatibility -> Rep Compatibility x
Prelude.Generic)

-- |
-- Create a value of 'Compatibility' 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:
--
-- 'defaultVersion', 'compatibility_defaultVersion' - The supported default version.
--
-- 'clusterVersion', 'compatibility_clusterVersion' - The supported Kubernetes version of the cluster.
--
-- 'platformVersions', 'compatibility_platformVersions' - The supported compute platform.
newCompatibility ::
  Compatibility
newCompatibility :: Compatibility
newCompatibility =
  Compatibility' :: Maybe Bool -> Maybe Text -> Maybe [Text] -> Compatibility
Compatibility'
    { $sel:defaultVersion:Compatibility' :: Maybe Bool
defaultVersion = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:clusterVersion:Compatibility' :: Maybe Text
clusterVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:platformVersions:Compatibility' :: Maybe [Text]
platformVersions = Maybe [Text]
forall a. Maybe a
Prelude.Nothing
    }

-- | The supported default version.
compatibility_defaultVersion :: Lens.Lens' Compatibility (Prelude.Maybe Prelude.Bool)
compatibility_defaultVersion :: (Maybe Bool -> f (Maybe Bool)) -> Compatibility -> f Compatibility
compatibility_defaultVersion = (Compatibility -> Maybe Bool)
-> (Compatibility -> Maybe Bool -> Compatibility)
-> Lens Compatibility Compatibility (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Compatibility' {Maybe Bool
defaultVersion :: Maybe Bool
$sel:defaultVersion:Compatibility' :: Compatibility -> Maybe Bool
defaultVersion} -> Maybe Bool
defaultVersion) (\s :: Compatibility
s@Compatibility' {} Maybe Bool
a -> Compatibility
s {$sel:defaultVersion:Compatibility' :: Maybe Bool
defaultVersion = Maybe Bool
a} :: Compatibility)

-- | The supported Kubernetes version of the cluster.
compatibility_clusterVersion :: Lens.Lens' Compatibility (Prelude.Maybe Prelude.Text)
compatibility_clusterVersion :: (Maybe Text -> f (Maybe Text)) -> Compatibility -> f Compatibility
compatibility_clusterVersion = (Compatibility -> Maybe Text)
-> (Compatibility -> Maybe Text -> Compatibility)
-> Lens Compatibility Compatibility (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Compatibility' {Maybe Text
clusterVersion :: Maybe Text
$sel:clusterVersion:Compatibility' :: Compatibility -> Maybe Text
clusterVersion} -> Maybe Text
clusterVersion) (\s :: Compatibility
s@Compatibility' {} Maybe Text
a -> Compatibility
s {$sel:clusterVersion:Compatibility' :: Maybe Text
clusterVersion = Maybe Text
a} :: Compatibility)

-- | The supported compute platform.
compatibility_platformVersions :: Lens.Lens' Compatibility (Prelude.Maybe [Prelude.Text])
compatibility_platformVersions :: (Maybe [Text] -> f (Maybe [Text]))
-> Compatibility -> f Compatibility
compatibility_platformVersions = (Compatibility -> Maybe [Text])
-> (Compatibility -> Maybe [Text] -> Compatibility)
-> Lens Compatibility Compatibility (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Compatibility' {Maybe [Text]
platformVersions :: Maybe [Text]
$sel:platformVersions:Compatibility' :: Compatibility -> Maybe [Text]
platformVersions} -> Maybe [Text]
platformVersions) (\s :: Compatibility
s@Compatibility' {} Maybe [Text]
a -> Compatibility
s {$sel:platformVersions:Compatibility' :: Maybe [Text]
platformVersions = Maybe [Text]
a} :: Compatibility) ((Maybe [Text] -> f (Maybe [Text]))
 -> Compatibility -> f Compatibility)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> Compatibility
-> f Compatibility
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

instance Core.FromJSON Compatibility where
  parseJSON :: Value -> Parser Compatibility
parseJSON =
    String
-> (Object -> Parser Compatibility)
-> Value
-> Parser Compatibility
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Compatibility"
      ( \Object
x ->
          Maybe Bool -> Maybe Text -> Maybe [Text] -> Compatibility
Compatibility'
            (Maybe Bool -> Maybe Text -> Maybe [Text] -> Compatibility)
-> Parser (Maybe Bool)
-> Parser (Maybe Text -> Maybe [Text] -> Compatibility)
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
"defaultVersion")
            Parser (Maybe Text -> Maybe [Text] -> Compatibility)
-> Parser (Maybe Text) -> Parser (Maybe [Text] -> Compatibility)
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
"clusterVersion")
            Parser (Maybe [Text] -> Compatibility)
-> Parser (Maybe [Text]) -> Parser Compatibility
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
"platformVersions"
                            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
                        )
      )

instance Prelude.Hashable Compatibility

instance Prelude.NFData Compatibility