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

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.EKS.Types.TaintEffect
import qualified Amazonka.Prelude as Prelude

-- | A property that allows a node to repel a set of pods. For more
-- information, see
-- <https://docs.aws.amazon.com/eks/latest/userguide/node-taints-managed-node-groups.html Node taints on managed node groups>.
--
-- /See:/ 'newTaint' smart constructor.
data Taint = Taint'
  { -- | The effect of the taint.
    Taint -> Maybe TaintEffect
effect :: Prelude.Maybe TaintEffect,
    -- | The key of the taint.
    Taint -> Maybe Text
key :: Prelude.Maybe Prelude.Text,
    -- | The value of the taint.
    Taint -> Maybe Text
value :: Prelude.Maybe Prelude.Text
  }
  deriving (Taint -> Taint -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Taint -> Taint -> Bool
$c/= :: Taint -> Taint -> Bool
== :: Taint -> Taint -> Bool
$c== :: Taint -> Taint -> Bool
Prelude.Eq, ReadPrec [Taint]
ReadPrec Taint
Int -> ReadS Taint
ReadS [Taint]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Taint]
$creadListPrec :: ReadPrec [Taint]
readPrec :: ReadPrec Taint
$creadPrec :: ReadPrec Taint
readList :: ReadS [Taint]
$creadList :: ReadS [Taint]
readsPrec :: Int -> ReadS Taint
$creadsPrec :: Int -> ReadS Taint
Prelude.Read, Int -> Taint -> ShowS
[Taint] -> ShowS
Taint -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Taint] -> ShowS
$cshowList :: [Taint] -> ShowS
show :: Taint -> String
$cshow :: Taint -> String
showsPrec :: Int -> Taint -> ShowS
$cshowsPrec :: Int -> Taint -> ShowS
Prelude.Show, forall x. Rep Taint x -> Taint
forall x. Taint -> Rep Taint x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Taint x -> Taint
$cfrom :: forall x. Taint -> Rep Taint x
Prelude.Generic)

-- |
-- Create a value of 'Taint' 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:
--
-- 'effect', 'taint_effect' - The effect of the taint.
--
-- 'key', 'taint_key' - The key of the taint.
--
-- 'value', 'taint_value' - The value of the taint.
newTaint ::
  Taint
newTaint :: Taint
newTaint =
  Taint'
    { $sel:effect:Taint' :: Maybe TaintEffect
effect = forall a. Maybe a
Prelude.Nothing,
      $sel:key:Taint' :: Maybe Text
key = forall a. Maybe a
Prelude.Nothing,
      $sel:value:Taint' :: Maybe Text
value = forall a. Maybe a
Prelude.Nothing
    }

-- | The effect of the taint.
taint_effect :: Lens.Lens' Taint (Prelude.Maybe TaintEffect)
taint_effect :: Lens' Taint (Maybe TaintEffect)
taint_effect = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Taint' {Maybe TaintEffect
effect :: Maybe TaintEffect
$sel:effect:Taint' :: Taint -> Maybe TaintEffect
effect} -> Maybe TaintEffect
effect) (\s :: Taint
s@Taint' {} Maybe TaintEffect
a -> Taint
s {$sel:effect:Taint' :: Maybe TaintEffect
effect = Maybe TaintEffect
a} :: Taint)

-- | The key of the taint.
taint_key :: Lens.Lens' Taint (Prelude.Maybe Prelude.Text)
taint_key :: Lens' Taint (Maybe Text)
taint_key = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Taint' {Maybe Text
key :: Maybe Text
$sel:key:Taint' :: Taint -> Maybe Text
key} -> Maybe Text
key) (\s :: Taint
s@Taint' {} Maybe Text
a -> Taint
s {$sel:key:Taint' :: Maybe Text
key = Maybe Text
a} :: Taint)

-- | The value of the taint.
taint_value :: Lens.Lens' Taint (Prelude.Maybe Prelude.Text)
taint_value :: Lens' Taint (Maybe Text)
taint_value = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Taint' {Maybe Text
value :: Maybe Text
$sel:value:Taint' :: Taint -> Maybe Text
value} -> Maybe Text
value) (\s :: Taint
s@Taint' {} Maybe Text
a -> Taint
s {$sel:value:Taint' :: Maybe Text
value = Maybe Text
a} :: Taint)

instance Data.FromJSON Taint where
  parseJSON :: Value -> Parser Taint
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Taint"
      ( \Object
x ->
          Maybe TaintEffect -> Maybe Text -> Maybe Text -> Taint
Taint'
            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
"effect")
            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
"key")
            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
"value")
      )

instance Prelude.Hashable Taint where
  hashWithSalt :: Int -> Taint -> Int
hashWithSalt Int
_salt Taint' {Maybe Text
Maybe TaintEffect
value :: Maybe Text
key :: Maybe Text
effect :: Maybe TaintEffect
$sel:value:Taint' :: Taint -> Maybe Text
$sel:key:Taint' :: Taint -> Maybe Text
$sel:effect:Taint' :: Taint -> Maybe TaintEffect
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TaintEffect
effect
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
key
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
value

instance Prelude.NFData Taint where
  rnf :: Taint -> ()
rnf Taint' {Maybe Text
Maybe TaintEffect
value :: Maybe Text
key :: Maybe Text
effect :: Maybe TaintEffect
$sel:value:Taint' :: Taint -> Maybe Text
$sel:key:Taint' :: Taint -> Maybe Text
$sel:effect:Taint' :: Taint -> Maybe TaintEffect
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe TaintEffect
effect
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
key
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
value

instance Data.ToJSON Taint where
  toJSON :: Taint -> Value
toJSON Taint' {Maybe Text
Maybe TaintEffect
value :: Maybe Text
key :: Maybe Text
effect :: Maybe TaintEffect
$sel:value:Taint' :: Taint -> Maybe Text
$sel:key:Taint' :: Taint -> Maybe Text
$sel:effect:Taint' :: Taint -> Maybe TaintEffect
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"effect" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe TaintEffect
effect,
            (Key
"key" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
key,
            (Key
"value" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
value
          ]
      )