{-# 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.StorageGateway.Types.NFSFileShareDefaults
-- 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.StorageGateway.Types.NFSFileShareDefaults where

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

-- | Describes Network File System (NFS) file share default values. Files and
-- folders stored as Amazon S3 objects in S3 buckets don\'t, by default,
-- have Unix file permissions assigned to them. Upon discovery in an S3
-- bucket by Storage Gateway, the S3 objects that represent files and
-- folders are assigned these default Unix permissions. This operation is
-- only supported for S3 File Gateways.
--
-- /See:/ 'newNFSFileShareDefaults' smart constructor.
data NFSFileShareDefaults = NFSFileShareDefaults'
  { -- | The Unix file mode in the form \"nnnn\". For example, @0666@ represents
    -- the default file mode inside the file share. The default value is
    -- @0666@.
    NFSFileShareDefaults -> Maybe Text
fileMode :: Prelude.Maybe Prelude.Text,
    -- | The default owner ID for files in the file share (unless the files have
    -- another owner ID specified). The default value is @nfsnobody@.
    NFSFileShareDefaults -> Maybe Natural
ownerId :: Prelude.Maybe Prelude.Natural,
    -- | The Unix directory mode in the form \"nnnn\". For example, @0666@
    -- represents the default access mode for all directories inside the file
    -- share. The default value is @0777@.
    NFSFileShareDefaults -> Maybe Text
directoryMode :: Prelude.Maybe Prelude.Text,
    -- | The default group ID for the file share (unless the files have another
    -- group ID specified). The default value is @nfsnobody@.
    NFSFileShareDefaults -> Maybe Natural
groupId :: Prelude.Maybe Prelude.Natural
  }
  deriving (NFSFileShareDefaults -> NFSFileShareDefaults -> Bool
(NFSFileShareDefaults -> NFSFileShareDefaults -> Bool)
-> (NFSFileShareDefaults -> NFSFileShareDefaults -> Bool)
-> Eq NFSFileShareDefaults
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NFSFileShareDefaults -> NFSFileShareDefaults -> Bool
$c/= :: NFSFileShareDefaults -> NFSFileShareDefaults -> Bool
== :: NFSFileShareDefaults -> NFSFileShareDefaults -> Bool
$c== :: NFSFileShareDefaults -> NFSFileShareDefaults -> Bool
Prelude.Eq, ReadPrec [NFSFileShareDefaults]
ReadPrec NFSFileShareDefaults
Int -> ReadS NFSFileShareDefaults
ReadS [NFSFileShareDefaults]
(Int -> ReadS NFSFileShareDefaults)
-> ReadS [NFSFileShareDefaults]
-> ReadPrec NFSFileShareDefaults
-> ReadPrec [NFSFileShareDefaults]
-> Read NFSFileShareDefaults
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NFSFileShareDefaults]
$creadListPrec :: ReadPrec [NFSFileShareDefaults]
readPrec :: ReadPrec NFSFileShareDefaults
$creadPrec :: ReadPrec NFSFileShareDefaults
readList :: ReadS [NFSFileShareDefaults]
$creadList :: ReadS [NFSFileShareDefaults]
readsPrec :: Int -> ReadS NFSFileShareDefaults
$creadsPrec :: Int -> ReadS NFSFileShareDefaults
Prelude.Read, Int -> NFSFileShareDefaults -> ShowS
[NFSFileShareDefaults] -> ShowS
NFSFileShareDefaults -> String
(Int -> NFSFileShareDefaults -> ShowS)
-> (NFSFileShareDefaults -> String)
-> ([NFSFileShareDefaults] -> ShowS)
-> Show NFSFileShareDefaults
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NFSFileShareDefaults] -> ShowS
$cshowList :: [NFSFileShareDefaults] -> ShowS
show :: NFSFileShareDefaults -> String
$cshow :: NFSFileShareDefaults -> String
showsPrec :: Int -> NFSFileShareDefaults -> ShowS
$cshowsPrec :: Int -> NFSFileShareDefaults -> ShowS
Prelude.Show, (forall x. NFSFileShareDefaults -> Rep NFSFileShareDefaults x)
-> (forall x. Rep NFSFileShareDefaults x -> NFSFileShareDefaults)
-> Generic NFSFileShareDefaults
forall x. Rep NFSFileShareDefaults x -> NFSFileShareDefaults
forall x. NFSFileShareDefaults -> Rep NFSFileShareDefaults x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NFSFileShareDefaults x -> NFSFileShareDefaults
$cfrom :: forall x. NFSFileShareDefaults -> Rep NFSFileShareDefaults x
Prelude.Generic)

-- |
-- Create a value of 'NFSFileShareDefaults' 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:
--
-- 'fileMode', 'nFSFileShareDefaults_fileMode' - The Unix file mode in the form \"nnnn\". For example, @0666@ represents
-- the default file mode inside the file share. The default value is
-- @0666@.
--
-- 'ownerId', 'nFSFileShareDefaults_ownerId' - The default owner ID for files in the file share (unless the files have
-- another owner ID specified). The default value is @nfsnobody@.
--
-- 'directoryMode', 'nFSFileShareDefaults_directoryMode' - The Unix directory mode in the form \"nnnn\". For example, @0666@
-- represents the default access mode for all directories inside the file
-- share. The default value is @0777@.
--
-- 'groupId', 'nFSFileShareDefaults_groupId' - The default group ID for the file share (unless the files have another
-- group ID specified). The default value is @nfsnobody@.
newNFSFileShareDefaults ::
  NFSFileShareDefaults
newNFSFileShareDefaults :: NFSFileShareDefaults
newNFSFileShareDefaults =
  NFSFileShareDefaults' :: Maybe Text
-> Maybe Natural
-> Maybe Text
-> Maybe Natural
-> NFSFileShareDefaults
NFSFileShareDefaults'
    { $sel:fileMode:NFSFileShareDefaults' :: Maybe Text
fileMode = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:ownerId:NFSFileShareDefaults' :: Maybe Natural
ownerId = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:directoryMode:NFSFileShareDefaults' :: Maybe Text
directoryMode = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:groupId:NFSFileShareDefaults' :: Maybe Natural
groupId = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | The Unix file mode in the form \"nnnn\". For example, @0666@ represents
-- the default file mode inside the file share. The default value is
-- @0666@.
nFSFileShareDefaults_fileMode :: Lens.Lens' NFSFileShareDefaults (Prelude.Maybe Prelude.Text)
nFSFileShareDefaults_fileMode :: (Maybe Text -> f (Maybe Text))
-> NFSFileShareDefaults -> f NFSFileShareDefaults
nFSFileShareDefaults_fileMode = (NFSFileShareDefaults -> Maybe Text)
-> (NFSFileShareDefaults -> Maybe Text -> NFSFileShareDefaults)
-> Lens
     NFSFileShareDefaults NFSFileShareDefaults (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NFSFileShareDefaults' {Maybe Text
fileMode :: Maybe Text
$sel:fileMode:NFSFileShareDefaults' :: NFSFileShareDefaults -> Maybe Text
fileMode} -> Maybe Text
fileMode) (\s :: NFSFileShareDefaults
s@NFSFileShareDefaults' {} Maybe Text
a -> NFSFileShareDefaults
s {$sel:fileMode:NFSFileShareDefaults' :: Maybe Text
fileMode = Maybe Text
a} :: NFSFileShareDefaults)

-- | The default owner ID for files in the file share (unless the files have
-- another owner ID specified). The default value is @nfsnobody@.
nFSFileShareDefaults_ownerId :: Lens.Lens' NFSFileShareDefaults (Prelude.Maybe Prelude.Natural)
nFSFileShareDefaults_ownerId :: (Maybe Natural -> f (Maybe Natural))
-> NFSFileShareDefaults -> f NFSFileShareDefaults
nFSFileShareDefaults_ownerId = (NFSFileShareDefaults -> Maybe Natural)
-> (NFSFileShareDefaults -> Maybe Natural -> NFSFileShareDefaults)
-> Lens
     NFSFileShareDefaults
     NFSFileShareDefaults
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NFSFileShareDefaults' {Maybe Natural
ownerId :: Maybe Natural
$sel:ownerId:NFSFileShareDefaults' :: NFSFileShareDefaults -> Maybe Natural
ownerId} -> Maybe Natural
ownerId) (\s :: NFSFileShareDefaults
s@NFSFileShareDefaults' {} Maybe Natural
a -> NFSFileShareDefaults
s {$sel:ownerId:NFSFileShareDefaults' :: Maybe Natural
ownerId = Maybe Natural
a} :: NFSFileShareDefaults)

-- | The Unix directory mode in the form \"nnnn\". For example, @0666@
-- represents the default access mode for all directories inside the file
-- share. The default value is @0777@.
nFSFileShareDefaults_directoryMode :: Lens.Lens' NFSFileShareDefaults (Prelude.Maybe Prelude.Text)
nFSFileShareDefaults_directoryMode :: (Maybe Text -> f (Maybe Text))
-> NFSFileShareDefaults -> f NFSFileShareDefaults
nFSFileShareDefaults_directoryMode = (NFSFileShareDefaults -> Maybe Text)
-> (NFSFileShareDefaults -> Maybe Text -> NFSFileShareDefaults)
-> Lens
     NFSFileShareDefaults NFSFileShareDefaults (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NFSFileShareDefaults' {Maybe Text
directoryMode :: Maybe Text
$sel:directoryMode:NFSFileShareDefaults' :: NFSFileShareDefaults -> Maybe Text
directoryMode} -> Maybe Text
directoryMode) (\s :: NFSFileShareDefaults
s@NFSFileShareDefaults' {} Maybe Text
a -> NFSFileShareDefaults
s {$sel:directoryMode:NFSFileShareDefaults' :: Maybe Text
directoryMode = Maybe Text
a} :: NFSFileShareDefaults)

-- | The default group ID for the file share (unless the files have another
-- group ID specified). The default value is @nfsnobody@.
nFSFileShareDefaults_groupId :: Lens.Lens' NFSFileShareDefaults (Prelude.Maybe Prelude.Natural)
nFSFileShareDefaults_groupId :: (Maybe Natural -> f (Maybe Natural))
-> NFSFileShareDefaults -> f NFSFileShareDefaults
nFSFileShareDefaults_groupId = (NFSFileShareDefaults -> Maybe Natural)
-> (NFSFileShareDefaults -> Maybe Natural -> NFSFileShareDefaults)
-> Lens
     NFSFileShareDefaults
     NFSFileShareDefaults
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NFSFileShareDefaults' {Maybe Natural
groupId :: Maybe Natural
$sel:groupId:NFSFileShareDefaults' :: NFSFileShareDefaults -> Maybe Natural
groupId} -> Maybe Natural
groupId) (\s :: NFSFileShareDefaults
s@NFSFileShareDefaults' {} Maybe Natural
a -> NFSFileShareDefaults
s {$sel:groupId:NFSFileShareDefaults' :: Maybe Natural
groupId = Maybe Natural
a} :: NFSFileShareDefaults)

instance Core.FromJSON NFSFileShareDefaults where
  parseJSON :: Value -> Parser NFSFileShareDefaults
parseJSON =
    String
-> (Object -> Parser NFSFileShareDefaults)
-> Value
-> Parser NFSFileShareDefaults
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"NFSFileShareDefaults"
      ( \Object
x ->
          Maybe Text
-> Maybe Natural
-> Maybe Text
-> Maybe Natural
-> NFSFileShareDefaults
NFSFileShareDefaults'
            (Maybe Text
 -> Maybe Natural
 -> Maybe Text
 -> Maybe Natural
 -> NFSFileShareDefaults)
-> Parser (Maybe Text)
-> Parser
     (Maybe Natural
      -> Maybe Text -> Maybe Natural -> NFSFileShareDefaults)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"FileMode")
            Parser
  (Maybe Natural
   -> Maybe Text -> Maybe Natural -> NFSFileShareDefaults)
-> Parser (Maybe Natural)
-> Parser (Maybe Text -> Maybe Natural -> NFSFileShareDefaults)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"OwnerId")
            Parser (Maybe Text -> Maybe Natural -> NFSFileShareDefaults)
-> Parser (Maybe Text)
-> Parser (Maybe Natural -> NFSFileShareDefaults)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DirectoryMode")
            Parser (Maybe Natural -> NFSFileShareDefaults)
-> Parser (Maybe Natural) -> Parser NFSFileShareDefaults
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"GroupId")
      )

instance Prelude.Hashable NFSFileShareDefaults

instance Prelude.NFData NFSFileShareDefaults

instance Core.ToJSON NFSFileShareDefaults where
  toJSON :: NFSFileShareDefaults -> Value
toJSON NFSFileShareDefaults' {Maybe Natural
Maybe Text
groupId :: Maybe Natural
directoryMode :: Maybe Text
ownerId :: Maybe Natural
fileMode :: Maybe Text
$sel:groupId:NFSFileShareDefaults' :: NFSFileShareDefaults -> Maybe Natural
$sel:directoryMode:NFSFileShareDefaults' :: NFSFileShareDefaults -> Maybe Text
$sel:ownerId:NFSFileShareDefaults' :: NFSFileShareDefaults -> Maybe Natural
$sel:fileMode:NFSFileShareDefaults' :: NFSFileShareDefaults -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"FileMode" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
fileMode,
            (Text
"OwnerId" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
ownerId,
            (Text
"DirectoryMode" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
directoryMode,
            (Text
"GroupId" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
groupId
          ]
      )