{-# 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.GreengrassV2.Types.LambdaDeviceMount
-- 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.GreengrassV2.Types.LambdaDeviceMount where

import qualified Amazonka.Core as Core
import Amazonka.GreengrassV2.Types.LambdaFilesystemPermission
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Contains information about a device that Linux processes in a container
-- can access.
--
-- /See:/ 'newLambdaDeviceMount' smart constructor.
data LambdaDeviceMount = LambdaDeviceMount'
  { -- | Whether or not to add the component\'s system user as an owner of the
    -- device.
    --
    -- Default: @false@
    LambdaDeviceMount -> Maybe Bool
addGroupOwner :: Prelude.Maybe Prelude.Bool,
    -- | The permission to access the device: read\/only (@ro@) or read\/write
    -- (@rw@).
    --
    -- Default: @ro@
    LambdaDeviceMount -> Maybe LambdaFilesystemPermission
permission :: Prelude.Maybe LambdaFilesystemPermission,
    -- | The mount path for the device in the file system.
    LambdaDeviceMount -> Text
path :: Prelude.Text
  }
  deriving (LambdaDeviceMount -> LambdaDeviceMount -> Bool
(LambdaDeviceMount -> LambdaDeviceMount -> Bool)
-> (LambdaDeviceMount -> LambdaDeviceMount -> Bool)
-> Eq LambdaDeviceMount
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LambdaDeviceMount -> LambdaDeviceMount -> Bool
$c/= :: LambdaDeviceMount -> LambdaDeviceMount -> Bool
== :: LambdaDeviceMount -> LambdaDeviceMount -> Bool
$c== :: LambdaDeviceMount -> LambdaDeviceMount -> Bool
Prelude.Eq, ReadPrec [LambdaDeviceMount]
ReadPrec LambdaDeviceMount
Int -> ReadS LambdaDeviceMount
ReadS [LambdaDeviceMount]
(Int -> ReadS LambdaDeviceMount)
-> ReadS [LambdaDeviceMount]
-> ReadPrec LambdaDeviceMount
-> ReadPrec [LambdaDeviceMount]
-> Read LambdaDeviceMount
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LambdaDeviceMount]
$creadListPrec :: ReadPrec [LambdaDeviceMount]
readPrec :: ReadPrec LambdaDeviceMount
$creadPrec :: ReadPrec LambdaDeviceMount
readList :: ReadS [LambdaDeviceMount]
$creadList :: ReadS [LambdaDeviceMount]
readsPrec :: Int -> ReadS LambdaDeviceMount
$creadsPrec :: Int -> ReadS LambdaDeviceMount
Prelude.Read, Int -> LambdaDeviceMount -> ShowS
[LambdaDeviceMount] -> ShowS
LambdaDeviceMount -> String
(Int -> LambdaDeviceMount -> ShowS)
-> (LambdaDeviceMount -> String)
-> ([LambdaDeviceMount] -> ShowS)
-> Show LambdaDeviceMount
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LambdaDeviceMount] -> ShowS
$cshowList :: [LambdaDeviceMount] -> ShowS
show :: LambdaDeviceMount -> String
$cshow :: LambdaDeviceMount -> String
showsPrec :: Int -> LambdaDeviceMount -> ShowS
$cshowsPrec :: Int -> LambdaDeviceMount -> ShowS
Prelude.Show, (forall x. LambdaDeviceMount -> Rep LambdaDeviceMount x)
-> (forall x. Rep LambdaDeviceMount x -> LambdaDeviceMount)
-> Generic LambdaDeviceMount
forall x. Rep LambdaDeviceMount x -> LambdaDeviceMount
forall x. LambdaDeviceMount -> Rep LambdaDeviceMount x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LambdaDeviceMount x -> LambdaDeviceMount
$cfrom :: forall x. LambdaDeviceMount -> Rep LambdaDeviceMount x
Prelude.Generic)

-- |
-- Create a value of 'LambdaDeviceMount' 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:
--
-- 'addGroupOwner', 'lambdaDeviceMount_addGroupOwner' - Whether or not to add the component\'s system user as an owner of the
-- device.
--
-- Default: @false@
--
-- 'permission', 'lambdaDeviceMount_permission' - The permission to access the device: read\/only (@ro@) or read\/write
-- (@rw@).
--
-- Default: @ro@
--
-- 'path', 'lambdaDeviceMount_path' - The mount path for the device in the file system.
newLambdaDeviceMount ::
  -- | 'path'
  Prelude.Text ->
  LambdaDeviceMount
newLambdaDeviceMount :: Text -> LambdaDeviceMount
newLambdaDeviceMount Text
pPath_ =
  LambdaDeviceMount' :: Maybe Bool
-> Maybe LambdaFilesystemPermission -> Text -> LambdaDeviceMount
LambdaDeviceMount'
    { $sel:addGroupOwner:LambdaDeviceMount' :: Maybe Bool
addGroupOwner = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:permission:LambdaDeviceMount' :: Maybe LambdaFilesystemPermission
permission = Maybe LambdaFilesystemPermission
forall a. Maybe a
Prelude.Nothing,
      $sel:path:LambdaDeviceMount' :: Text
path = Text
pPath_
    }

-- | Whether or not to add the component\'s system user as an owner of the
-- device.
--
-- Default: @false@
lambdaDeviceMount_addGroupOwner :: Lens.Lens' LambdaDeviceMount (Prelude.Maybe Prelude.Bool)
lambdaDeviceMount_addGroupOwner :: (Maybe Bool -> f (Maybe Bool))
-> LambdaDeviceMount -> f LambdaDeviceMount
lambdaDeviceMount_addGroupOwner = (LambdaDeviceMount -> Maybe Bool)
-> (LambdaDeviceMount -> Maybe Bool -> LambdaDeviceMount)
-> Lens
     LambdaDeviceMount LambdaDeviceMount (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LambdaDeviceMount' {Maybe Bool
addGroupOwner :: Maybe Bool
$sel:addGroupOwner:LambdaDeviceMount' :: LambdaDeviceMount -> Maybe Bool
addGroupOwner} -> Maybe Bool
addGroupOwner) (\s :: LambdaDeviceMount
s@LambdaDeviceMount' {} Maybe Bool
a -> LambdaDeviceMount
s {$sel:addGroupOwner:LambdaDeviceMount' :: Maybe Bool
addGroupOwner = Maybe Bool
a} :: LambdaDeviceMount)

-- | The permission to access the device: read\/only (@ro@) or read\/write
-- (@rw@).
--
-- Default: @ro@
lambdaDeviceMount_permission :: Lens.Lens' LambdaDeviceMount (Prelude.Maybe LambdaFilesystemPermission)
lambdaDeviceMount_permission :: (Maybe LambdaFilesystemPermission
 -> f (Maybe LambdaFilesystemPermission))
-> LambdaDeviceMount -> f LambdaDeviceMount
lambdaDeviceMount_permission = (LambdaDeviceMount -> Maybe LambdaFilesystemPermission)
-> (LambdaDeviceMount
    -> Maybe LambdaFilesystemPermission -> LambdaDeviceMount)
-> Lens
     LambdaDeviceMount
     LambdaDeviceMount
     (Maybe LambdaFilesystemPermission)
     (Maybe LambdaFilesystemPermission)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LambdaDeviceMount' {Maybe LambdaFilesystemPermission
permission :: Maybe LambdaFilesystemPermission
$sel:permission:LambdaDeviceMount' :: LambdaDeviceMount -> Maybe LambdaFilesystemPermission
permission} -> Maybe LambdaFilesystemPermission
permission) (\s :: LambdaDeviceMount
s@LambdaDeviceMount' {} Maybe LambdaFilesystemPermission
a -> LambdaDeviceMount
s {$sel:permission:LambdaDeviceMount' :: Maybe LambdaFilesystemPermission
permission = Maybe LambdaFilesystemPermission
a} :: LambdaDeviceMount)

-- | The mount path for the device in the file system.
lambdaDeviceMount_path :: Lens.Lens' LambdaDeviceMount Prelude.Text
lambdaDeviceMount_path :: (Text -> f Text) -> LambdaDeviceMount -> f LambdaDeviceMount
lambdaDeviceMount_path = (LambdaDeviceMount -> Text)
-> (LambdaDeviceMount -> Text -> LambdaDeviceMount)
-> Lens LambdaDeviceMount LambdaDeviceMount Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LambdaDeviceMount' {Text
path :: Text
$sel:path:LambdaDeviceMount' :: LambdaDeviceMount -> Text
path} -> Text
path) (\s :: LambdaDeviceMount
s@LambdaDeviceMount' {} Text
a -> LambdaDeviceMount
s {$sel:path:LambdaDeviceMount' :: Text
path = Text
a} :: LambdaDeviceMount)

instance Prelude.Hashable LambdaDeviceMount

instance Prelude.NFData LambdaDeviceMount

instance Core.ToJSON LambdaDeviceMount where
  toJSON :: LambdaDeviceMount -> Value
toJSON LambdaDeviceMount' {Maybe Bool
Maybe LambdaFilesystemPermission
Text
path :: Text
permission :: Maybe LambdaFilesystemPermission
addGroupOwner :: Maybe Bool
$sel:path:LambdaDeviceMount' :: LambdaDeviceMount -> Text
$sel:permission:LambdaDeviceMount' :: LambdaDeviceMount -> Maybe LambdaFilesystemPermission
$sel:addGroupOwner:LambdaDeviceMount' :: LambdaDeviceMount -> Maybe Bool
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"addGroupOwner" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
addGroupOwner,
            (Text
"permission" Text -> LambdaFilesystemPermission -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (LambdaFilesystemPermission -> Pair)
-> Maybe LambdaFilesystemPermission -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe LambdaFilesystemPermission
permission,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"path" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
path)
          ]
      )