{-# 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.GuardDuty.Types.HostPath
-- 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.GuardDuty.Types.HostPath 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

-- | Represents a pre-existing file or directory on the host machine that the
-- volume maps to.
--
-- /See:/ 'newHostPath' smart constructor.
data HostPath = HostPath'
  { -- | Path of the file or directory on the host that the volume maps to.
    HostPath -> Maybe Text
path :: Prelude.Maybe Prelude.Text
  }
  deriving (HostPath -> HostPath -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HostPath -> HostPath -> Bool
$c/= :: HostPath -> HostPath -> Bool
== :: HostPath -> HostPath -> Bool
$c== :: HostPath -> HostPath -> Bool
Prelude.Eq, ReadPrec [HostPath]
ReadPrec HostPath
Int -> ReadS HostPath
ReadS [HostPath]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [HostPath]
$creadListPrec :: ReadPrec [HostPath]
readPrec :: ReadPrec HostPath
$creadPrec :: ReadPrec HostPath
readList :: ReadS [HostPath]
$creadList :: ReadS [HostPath]
readsPrec :: Int -> ReadS HostPath
$creadsPrec :: Int -> ReadS HostPath
Prelude.Read, Int -> HostPath -> ShowS
[HostPath] -> ShowS
HostPath -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HostPath] -> ShowS
$cshowList :: [HostPath] -> ShowS
show :: HostPath -> String
$cshow :: HostPath -> String
showsPrec :: Int -> HostPath -> ShowS
$cshowsPrec :: Int -> HostPath -> ShowS
Prelude.Show, forall x. Rep HostPath x -> HostPath
forall x. HostPath -> Rep HostPath x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep HostPath x -> HostPath
$cfrom :: forall x. HostPath -> Rep HostPath x
Prelude.Generic)

-- |
-- Create a value of 'HostPath' 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', 'hostPath_path' - Path of the file or directory on the host that the volume maps to.
newHostPath ::
  HostPath
newHostPath :: HostPath
newHostPath = HostPath' {$sel:path:HostPath' :: Maybe Text
path = forall a. Maybe a
Prelude.Nothing}

-- | Path of the file or directory on the host that the volume maps to.
hostPath_path :: Lens.Lens' HostPath (Prelude.Maybe Prelude.Text)
hostPath_path :: Lens' HostPath (Maybe Text)
hostPath_path = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HostPath' {Maybe Text
path :: Maybe Text
$sel:path:HostPath' :: HostPath -> Maybe Text
path} -> Maybe Text
path) (\s :: HostPath
s@HostPath' {} Maybe Text
a -> HostPath
s {$sel:path:HostPath' :: Maybe Text
path = Maybe Text
a} :: HostPath)

instance Data.FromJSON HostPath where
  parseJSON :: Value -> Parser HostPath
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"HostPath"
      (\Object
x -> Maybe Text -> HostPath
HostPath' 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 HostPath where
  hashWithSalt :: Int -> HostPath -> Int
hashWithSalt Int
_salt HostPath' {Maybe Text
path :: Maybe Text
$sel:path:HostPath' :: HostPath -> Maybe Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
path

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