{-# 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.EFS.Types.FileSystemPolicyDescription
-- 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.EFS.Types.FileSystemPolicyDescription where

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

-- | /See:/ 'newFileSystemPolicyDescription' smart constructor.
data FileSystemPolicyDescription = FileSystemPolicyDescription'
  { -- | Specifies the EFS file system to which the @FileSystemPolicy@ applies.
    FileSystemPolicyDescription -> Maybe Text
fileSystemId :: Prelude.Maybe Prelude.Text,
    -- | The JSON formatted @FileSystemPolicy@ for the EFS file system.
    FileSystemPolicyDescription -> Maybe Text
policy :: Prelude.Maybe Prelude.Text
  }
  deriving (FileSystemPolicyDescription -> FileSystemPolicyDescription -> Bool
(FileSystemPolicyDescription
 -> FileSystemPolicyDescription -> Bool)
-> (FileSystemPolicyDescription
    -> FileSystemPolicyDescription -> Bool)
-> Eq FileSystemPolicyDescription
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FileSystemPolicyDescription -> FileSystemPolicyDescription -> Bool
$c/= :: FileSystemPolicyDescription -> FileSystemPolicyDescription -> Bool
== :: FileSystemPolicyDescription -> FileSystemPolicyDescription -> Bool
$c== :: FileSystemPolicyDescription -> FileSystemPolicyDescription -> Bool
Prelude.Eq, ReadPrec [FileSystemPolicyDescription]
ReadPrec FileSystemPolicyDescription
Int -> ReadS FileSystemPolicyDescription
ReadS [FileSystemPolicyDescription]
(Int -> ReadS FileSystemPolicyDescription)
-> ReadS [FileSystemPolicyDescription]
-> ReadPrec FileSystemPolicyDescription
-> ReadPrec [FileSystemPolicyDescription]
-> Read FileSystemPolicyDescription
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FileSystemPolicyDescription]
$creadListPrec :: ReadPrec [FileSystemPolicyDescription]
readPrec :: ReadPrec FileSystemPolicyDescription
$creadPrec :: ReadPrec FileSystemPolicyDescription
readList :: ReadS [FileSystemPolicyDescription]
$creadList :: ReadS [FileSystemPolicyDescription]
readsPrec :: Int -> ReadS FileSystemPolicyDescription
$creadsPrec :: Int -> ReadS FileSystemPolicyDescription
Prelude.Read, Int -> FileSystemPolicyDescription -> ShowS
[FileSystemPolicyDescription] -> ShowS
FileSystemPolicyDescription -> String
(Int -> FileSystemPolicyDescription -> ShowS)
-> (FileSystemPolicyDescription -> String)
-> ([FileSystemPolicyDescription] -> ShowS)
-> Show FileSystemPolicyDescription
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FileSystemPolicyDescription] -> ShowS
$cshowList :: [FileSystemPolicyDescription] -> ShowS
show :: FileSystemPolicyDescription -> String
$cshow :: FileSystemPolicyDescription -> String
showsPrec :: Int -> FileSystemPolicyDescription -> ShowS
$cshowsPrec :: Int -> FileSystemPolicyDescription -> ShowS
Prelude.Show, (forall x.
 FileSystemPolicyDescription -> Rep FileSystemPolicyDescription x)
-> (forall x.
    Rep FileSystemPolicyDescription x -> FileSystemPolicyDescription)
-> Generic FileSystemPolicyDescription
forall x.
Rep FileSystemPolicyDescription x -> FileSystemPolicyDescription
forall x.
FileSystemPolicyDescription -> Rep FileSystemPolicyDescription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep FileSystemPolicyDescription x -> FileSystemPolicyDescription
$cfrom :: forall x.
FileSystemPolicyDescription -> Rep FileSystemPolicyDescription x
Prelude.Generic)

-- |
-- Create a value of 'FileSystemPolicyDescription' 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:
--
-- 'fileSystemId', 'fileSystemPolicyDescription_fileSystemId' - Specifies the EFS file system to which the @FileSystemPolicy@ applies.
--
-- 'policy', 'fileSystemPolicyDescription_policy' - The JSON formatted @FileSystemPolicy@ for the EFS file system.
newFileSystemPolicyDescription ::
  FileSystemPolicyDescription
newFileSystemPolicyDescription :: FileSystemPolicyDescription
newFileSystemPolicyDescription =
  FileSystemPolicyDescription' :: Maybe Text -> Maybe Text -> FileSystemPolicyDescription
FileSystemPolicyDescription'
    { $sel:fileSystemId:FileSystemPolicyDescription' :: Maybe Text
fileSystemId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:policy:FileSystemPolicyDescription' :: Maybe Text
policy = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Specifies the EFS file system to which the @FileSystemPolicy@ applies.
fileSystemPolicyDescription_fileSystemId :: Lens.Lens' FileSystemPolicyDescription (Prelude.Maybe Prelude.Text)
fileSystemPolicyDescription_fileSystemId :: (Maybe Text -> f (Maybe Text))
-> FileSystemPolicyDescription -> f FileSystemPolicyDescription
fileSystemPolicyDescription_fileSystemId = (FileSystemPolicyDescription -> Maybe Text)
-> (FileSystemPolicyDescription
    -> Maybe Text -> FileSystemPolicyDescription)
-> Lens
     FileSystemPolicyDescription
     FileSystemPolicyDescription
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FileSystemPolicyDescription' {Maybe Text
fileSystemId :: Maybe Text
$sel:fileSystemId:FileSystemPolicyDescription' :: FileSystemPolicyDescription -> Maybe Text
fileSystemId} -> Maybe Text
fileSystemId) (\s :: FileSystemPolicyDescription
s@FileSystemPolicyDescription' {} Maybe Text
a -> FileSystemPolicyDescription
s {$sel:fileSystemId:FileSystemPolicyDescription' :: Maybe Text
fileSystemId = Maybe Text
a} :: FileSystemPolicyDescription)

-- | The JSON formatted @FileSystemPolicy@ for the EFS file system.
fileSystemPolicyDescription_policy :: Lens.Lens' FileSystemPolicyDescription (Prelude.Maybe Prelude.Text)
fileSystemPolicyDescription_policy :: (Maybe Text -> f (Maybe Text))
-> FileSystemPolicyDescription -> f FileSystemPolicyDescription
fileSystemPolicyDescription_policy = (FileSystemPolicyDescription -> Maybe Text)
-> (FileSystemPolicyDescription
    -> Maybe Text -> FileSystemPolicyDescription)
-> Lens
     FileSystemPolicyDescription
     FileSystemPolicyDescription
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FileSystemPolicyDescription' {Maybe Text
policy :: Maybe Text
$sel:policy:FileSystemPolicyDescription' :: FileSystemPolicyDescription -> Maybe Text
policy} -> Maybe Text
policy) (\s :: FileSystemPolicyDescription
s@FileSystemPolicyDescription' {} Maybe Text
a -> FileSystemPolicyDescription
s {$sel:policy:FileSystemPolicyDescription' :: Maybe Text
policy = Maybe Text
a} :: FileSystemPolicyDescription)

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

instance Prelude.Hashable FileSystemPolicyDescription

instance Prelude.NFData FileSystemPolicyDescription