{-# 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.EMRContainers.Types.ContainerInfo
-- 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.EMRContainers.Types.ContainerInfo where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.EMRContainers.Types.EksInfo
import qualified Amazonka.Prelude as Prelude

-- | The information about the container used for a job run or a managed
-- endpoint.
--
-- /See:/ 'newContainerInfo' smart constructor.
data ContainerInfo = ContainerInfo'
  { -- | The information about the EKS cluster.
    ContainerInfo -> Maybe EksInfo
eksInfo :: Prelude.Maybe EksInfo
  }
  deriving (ContainerInfo -> ContainerInfo -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ContainerInfo -> ContainerInfo -> Bool
$c/= :: ContainerInfo -> ContainerInfo -> Bool
== :: ContainerInfo -> ContainerInfo -> Bool
$c== :: ContainerInfo -> ContainerInfo -> Bool
Prelude.Eq, ReadPrec [ContainerInfo]
ReadPrec ContainerInfo
Int -> ReadS ContainerInfo
ReadS [ContainerInfo]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ContainerInfo]
$creadListPrec :: ReadPrec [ContainerInfo]
readPrec :: ReadPrec ContainerInfo
$creadPrec :: ReadPrec ContainerInfo
readList :: ReadS [ContainerInfo]
$creadList :: ReadS [ContainerInfo]
readsPrec :: Int -> ReadS ContainerInfo
$creadsPrec :: Int -> ReadS ContainerInfo
Prelude.Read, Int -> ContainerInfo -> ShowS
[ContainerInfo] -> ShowS
ContainerInfo -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ContainerInfo] -> ShowS
$cshowList :: [ContainerInfo] -> ShowS
show :: ContainerInfo -> String
$cshow :: ContainerInfo -> String
showsPrec :: Int -> ContainerInfo -> ShowS
$cshowsPrec :: Int -> ContainerInfo -> ShowS
Prelude.Show, forall x. Rep ContainerInfo x -> ContainerInfo
forall x. ContainerInfo -> Rep ContainerInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ContainerInfo x -> ContainerInfo
$cfrom :: forall x. ContainerInfo -> Rep ContainerInfo x
Prelude.Generic)

-- |
-- Create a value of 'ContainerInfo' 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:
--
-- 'eksInfo', 'containerInfo_eksInfo' - The information about the EKS cluster.
newContainerInfo ::
  ContainerInfo
newContainerInfo :: ContainerInfo
newContainerInfo =
  ContainerInfo' {$sel:eksInfo:ContainerInfo' :: Maybe EksInfo
eksInfo = forall a. Maybe a
Prelude.Nothing}

-- | The information about the EKS cluster.
containerInfo_eksInfo :: Lens.Lens' ContainerInfo (Prelude.Maybe EksInfo)
containerInfo_eksInfo :: Lens' ContainerInfo (Maybe EksInfo)
containerInfo_eksInfo = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContainerInfo' {Maybe EksInfo
eksInfo :: Maybe EksInfo
$sel:eksInfo:ContainerInfo' :: ContainerInfo -> Maybe EksInfo
eksInfo} -> Maybe EksInfo
eksInfo) (\s :: ContainerInfo
s@ContainerInfo' {} Maybe EksInfo
a -> ContainerInfo
s {$sel:eksInfo:ContainerInfo' :: Maybe EksInfo
eksInfo = Maybe EksInfo
a} :: ContainerInfo)

instance Data.FromJSON ContainerInfo where
  parseJSON :: Value -> Parser ContainerInfo
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ContainerInfo"
      ( \Object
x ->
          Maybe EksInfo -> ContainerInfo
ContainerInfo' 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
"eksInfo")
      )

instance Prelude.Hashable ContainerInfo where
  hashWithSalt :: Int -> ContainerInfo -> Int
hashWithSalt Int
_salt ContainerInfo' {Maybe EksInfo
eksInfo :: Maybe EksInfo
$sel:eksInfo:ContainerInfo' :: ContainerInfo -> Maybe EksInfo
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe EksInfo
eksInfo

instance Prelude.NFData ContainerInfo where
  rnf :: ContainerInfo -> ()
rnf ContainerInfo' {Maybe EksInfo
eksInfo :: Maybe EksInfo
$sel:eksInfo:ContainerInfo' :: ContainerInfo -> Maybe EksInfo
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe EksInfo
eksInfo

instance Data.ToJSON ContainerInfo where
  toJSON :: ContainerInfo -> Value
toJSON ContainerInfo' {Maybe EksInfo
eksInfo :: Maybe EksInfo
$sel:eksInfo:ContainerInfo' :: ContainerInfo -> Maybe EksInfo
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Key
"eksInfo" 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 EksInfo
eksInfo]
      )