{-# 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.Batch.Types.EksHostPath
-- 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.Batch.Types.EksHostPath where

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

-- | Specifies the configuration of a Kubernetes @hostPath@ volume. A
-- @hostPath@ volume mounts an existing file or directory from the host
-- node\'s filesystem into your pod. For more information, see
-- <https://kubernetes.io/docs/concepts/storage/volumes/#hostpath hostPath>
-- in the /Kubernetes documentation/.
--
-- /See:/ 'newEksHostPath' smart constructor.
data EksHostPath = EksHostPath'
  { -- | The path of the file or directory on the host to mount into containers
    -- on the pod.
    EksHostPath -> Maybe Text
path :: Prelude.Maybe Prelude.Text
  }
  deriving (EksHostPath -> EksHostPath -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EksHostPath -> EksHostPath -> Bool
$c/= :: EksHostPath -> EksHostPath -> Bool
== :: EksHostPath -> EksHostPath -> Bool
$c== :: EksHostPath -> EksHostPath -> Bool
Prelude.Eq, ReadPrec [EksHostPath]
ReadPrec EksHostPath
Int -> ReadS EksHostPath
ReadS [EksHostPath]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EksHostPath]
$creadListPrec :: ReadPrec [EksHostPath]
readPrec :: ReadPrec EksHostPath
$creadPrec :: ReadPrec EksHostPath
readList :: ReadS [EksHostPath]
$creadList :: ReadS [EksHostPath]
readsPrec :: Int -> ReadS EksHostPath
$creadsPrec :: Int -> ReadS EksHostPath
Prelude.Read, Int -> EksHostPath -> ShowS
[EksHostPath] -> ShowS
EksHostPath -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EksHostPath] -> ShowS
$cshowList :: [EksHostPath] -> ShowS
show :: EksHostPath -> String
$cshow :: EksHostPath -> String
showsPrec :: Int -> EksHostPath -> ShowS
$cshowsPrec :: Int -> EksHostPath -> ShowS
Prelude.Show, forall x. Rep EksHostPath x -> EksHostPath
forall x. EksHostPath -> Rep EksHostPath x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EksHostPath x -> EksHostPath
$cfrom :: forall x. EksHostPath -> Rep EksHostPath x
Prelude.Generic)

-- |
-- Create a value of 'EksHostPath' 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:
--
-- 'path', 'eksHostPath_path' - The path of the file or directory on the host to mount into containers
-- on the pod.
newEksHostPath ::
  EksHostPath
newEksHostPath :: EksHostPath
newEksHostPath = EksHostPath' {$sel:path:EksHostPath' :: Maybe Text
path = forall a. Maybe a
Prelude.Nothing}

-- | The path of the file or directory on the host to mount into containers
-- on the pod.
eksHostPath_path :: Lens.Lens' EksHostPath (Prelude.Maybe Prelude.Text)
eksHostPath_path :: Lens' EksHostPath (Maybe Text)
eksHostPath_path = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EksHostPath' {Maybe Text
path :: Maybe Text
$sel:path:EksHostPath' :: EksHostPath -> Maybe Text
path} -> Maybe Text
path) (\s :: EksHostPath
s@EksHostPath' {} Maybe Text
a -> EksHostPath
s {$sel:path:EksHostPath' :: Maybe Text
path = Maybe Text
a} :: EksHostPath)

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

instance Prelude.Hashable EksHostPath where
  hashWithSalt :: Int -> EksHostPath -> Int
hashWithSalt Int
_salt EksHostPath' {Maybe Text
path :: Maybe Text
$sel:path:EksHostPath' :: EksHostPath -> Maybe Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
path

instance Prelude.NFData EksHostPath where
  rnf :: EksHostPath -> ()
rnf EksHostPath' {Maybe Text
path :: Maybe Text
$sel:path:EksHostPath' :: EksHostPath -> Maybe Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
path

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