{-# 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.CodeBuild.Types.ProjectFileSystemLocation
-- 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.CodeBuild.Types.ProjectFileSystemLocation where

import Amazonka.CodeBuild.Types.FileSystemType
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Information about a file system created by Amazon Elastic File System
-- (EFS). For more information, see
-- <https://docs.aws.amazon.com/efs/latest/ug/whatisefs.html What Is Amazon Elastic File System?>
--
-- /See:/ 'newProjectFileSystemLocation' smart constructor.
data ProjectFileSystemLocation = ProjectFileSystemLocation'
  { -- | A string that specifies the location of the file system created by
    -- Amazon EFS. Its format is @efs-dns-name:\/directory-path@. You can find
    -- the DNS name of file system when you view it in the Amazon EFS console.
    -- The directory path is a path to a directory in the file system that
    -- CodeBuild mounts. For example, if the DNS name of a file system is
    -- @fs-abcd1234.efs.us-west-2.amazonaws.com@, and its mount directory is
    -- @my-efs-mount-directory@, then the @location@ is
    -- @fs-abcd1234.efs.us-west-2.amazonaws.com:\/my-efs-mount-directory@.
    --
    -- The directory path in the format @efs-dns-name:\/directory-path@ is
    -- optional. If you do not specify a directory path, the location is only
    -- the DNS name and CodeBuild mounts the entire file system.
    ProjectFileSystemLocation -> Maybe Text
location :: Prelude.Maybe Prelude.Text,
    -- | The name used to access a file system created by Amazon EFS. CodeBuild
    -- creates an environment variable by appending the @identifier@ in all
    -- capital letters to @CODEBUILD_@. For example, if you specify @my_efs@
    -- for @identifier@, a new environment variable is create named
    -- @CODEBUILD_MY_EFS@.
    --
    -- The @identifier@ is used to mount your file system.
    ProjectFileSystemLocation -> Maybe Text
identifier :: Prelude.Maybe Prelude.Text,
    -- | The mount options for a file system created by Amazon EFS. The default
    -- mount options used by CodeBuild are
    -- @nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2@. For
    -- more information, see
    -- <https://docs.aws.amazon.com/efs/latest/ug/mounting-fs-nfs-mount-settings.html Recommended NFS Mount Options>.
    ProjectFileSystemLocation -> Maybe Text
mountOptions :: Prelude.Maybe Prelude.Text,
    -- | The type of the file system. The one supported type is @EFS@.
    ProjectFileSystemLocation -> Maybe FileSystemType
type' :: Prelude.Maybe FileSystemType,
    -- | The location in the container where you mount the file system.
    ProjectFileSystemLocation -> Maybe Text
mountPoint :: Prelude.Maybe Prelude.Text
  }
  deriving (ProjectFileSystemLocation -> ProjectFileSystemLocation -> Bool
(ProjectFileSystemLocation -> ProjectFileSystemLocation -> Bool)
-> (ProjectFileSystemLocation -> ProjectFileSystemLocation -> Bool)
-> Eq ProjectFileSystemLocation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProjectFileSystemLocation -> ProjectFileSystemLocation -> Bool
$c/= :: ProjectFileSystemLocation -> ProjectFileSystemLocation -> Bool
== :: ProjectFileSystemLocation -> ProjectFileSystemLocation -> Bool
$c== :: ProjectFileSystemLocation -> ProjectFileSystemLocation -> Bool
Prelude.Eq, ReadPrec [ProjectFileSystemLocation]
ReadPrec ProjectFileSystemLocation
Int -> ReadS ProjectFileSystemLocation
ReadS [ProjectFileSystemLocation]
(Int -> ReadS ProjectFileSystemLocation)
-> ReadS [ProjectFileSystemLocation]
-> ReadPrec ProjectFileSystemLocation
-> ReadPrec [ProjectFileSystemLocation]
-> Read ProjectFileSystemLocation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ProjectFileSystemLocation]
$creadListPrec :: ReadPrec [ProjectFileSystemLocation]
readPrec :: ReadPrec ProjectFileSystemLocation
$creadPrec :: ReadPrec ProjectFileSystemLocation
readList :: ReadS [ProjectFileSystemLocation]
$creadList :: ReadS [ProjectFileSystemLocation]
readsPrec :: Int -> ReadS ProjectFileSystemLocation
$creadsPrec :: Int -> ReadS ProjectFileSystemLocation
Prelude.Read, Int -> ProjectFileSystemLocation -> ShowS
[ProjectFileSystemLocation] -> ShowS
ProjectFileSystemLocation -> String
(Int -> ProjectFileSystemLocation -> ShowS)
-> (ProjectFileSystemLocation -> String)
-> ([ProjectFileSystemLocation] -> ShowS)
-> Show ProjectFileSystemLocation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProjectFileSystemLocation] -> ShowS
$cshowList :: [ProjectFileSystemLocation] -> ShowS
show :: ProjectFileSystemLocation -> String
$cshow :: ProjectFileSystemLocation -> String
showsPrec :: Int -> ProjectFileSystemLocation -> ShowS
$cshowsPrec :: Int -> ProjectFileSystemLocation -> ShowS
Prelude.Show, (forall x.
 ProjectFileSystemLocation -> Rep ProjectFileSystemLocation x)
-> (forall x.
    Rep ProjectFileSystemLocation x -> ProjectFileSystemLocation)
-> Generic ProjectFileSystemLocation
forall x.
Rep ProjectFileSystemLocation x -> ProjectFileSystemLocation
forall x.
ProjectFileSystemLocation -> Rep ProjectFileSystemLocation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ProjectFileSystemLocation x -> ProjectFileSystemLocation
$cfrom :: forall x.
ProjectFileSystemLocation -> Rep ProjectFileSystemLocation x
Prelude.Generic)

-- |
-- Create a value of 'ProjectFileSystemLocation' 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:
--
-- 'location', 'projectFileSystemLocation_location' - A string that specifies the location of the file system created by
-- Amazon EFS. Its format is @efs-dns-name:\/directory-path@. You can find
-- the DNS name of file system when you view it in the Amazon EFS console.
-- The directory path is a path to a directory in the file system that
-- CodeBuild mounts. For example, if the DNS name of a file system is
-- @fs-abcd1234.efs.us-west-2.amazonaws.com@, and its mount directory is
-- @my-efs-mount-directory@, then the @location@ is
-- @fs-abcd1234.efs.us-west-2.amazonaws.com:\/my-efs-mount-directory@.
--
-- The directory path in the format @efs-dns-name:\/directory-path@ is
-- optional. If you do not specify a directory path, the location is only
-- the DNS name and CodeBuild mounts the entire file system.
--
-- 'identifier', 'projectFileSystemLocation_identifier' - The name used to access a file system created by Amazon EFS. CodeBuild
-- creates an environment variable by appending the @identifier@ in all
-- capital letters to @CODEBUILD_@. For example, if you specify @my_efs@
-- for @identifier@, a new environment variable is create named
-- @CODEBUILD_MY_EFS@.
--
-- The @identifier@ is used to mount your file system.
--
-- 'mountOptions', 'projectFileSystemLocation_mountOptions' - The mount options for a file system created by Amazon EFS. The default
-- mount options used by CodeBuild are
-- @nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2@. For
-- more information, see
-- <https://docs.aws.amazon.com/efs/latest/ug/mounting-fs-nfs-mount-settings.html Recommended NFS Mount Options>.
--
-- 'type'', 'projectFileSystemLocation_type' - The type of the file system. The one supported type is @EFS@.
--
-- 'mountPoint', 'projectFileSystemLocation_mountPoint' - The location in the container where you mount the file system.
newProjectFileSystemLocation ::
  ProjectFileSystemLocation
newProjectFileSystemLocation :: ProjectFileSystemLocation
newProjectFileSystemLocation =
  ProjectFileSystemLocation' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe FileSystemType
-> Maybe Text
-> ProjectFileSystemLocation
ProjectFileSystemLocation'
    { $sel:location:ProjectFileSystemLocation' :: Maybe Text
location =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:identifier:ProjectFileSystemLocation' :: Maybe Text
identifier = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:mountOptions:ProjectFileSystemLocation' :: Maybe Text
mountOptions = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:type':ProjectFileSystemLocation' :: Maybe FileSystemType
type' = Maybe FileSystemType
forall a. Maybe a
Prelude.Nothing,
      $sel:mountPoint:ProjectFileSystemLocation' :: Maybe Text
mountPoint = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | A string that specifies the location of the file system created by
-- Amazon EFS. Its format is @efs-dns-name:\/directory-path@. You can find
-- the DNS name of file system when you view it in the Amazon EFS console.
-- The directory path is a path to a directory in the file system that
-- CodeBuild mounts. For example, if the DNS name of a file system is
-- @fs-abcd1234.efs.us-west-2.amazonaws.com@, and its mount directory is
-- @my-efs-mount-directory@, then the @location@ is
-- @fs-abcd1234.efs.us-west-2.amazonaws.com:\/my-efs-mount-directory@.
--
-- The directory path in the format @efs-dns-name:\/directory-path@ is
-- optional. If you do not specify a directory path, the location is only
-- the DNS name and CodeBuild mounts the entire file system.
projectFileSystemLocation_location :: Lens.Lens' ProjectFileSystemLocation (Prelude.Maybe Prelude.Text)
projectFileSystemLocation_location :: (Maybe Text -> f (Maybe Text))
-> ProjectFileSystemLocation -> f ProjectFileSystemLocation
projectFileSystemLocation_location = (ProjectFileSystemLocation -> Maybe Text)
-> (ProjectFileSystemLocation
    -> Maybe Text -> ProjectFileSystemLocation)
-> Lens
     ProjectFileSystemLocation
     ProjectFileSystemLocation
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProjectFileSystemLocation' {Maybe Text
location :: Maybe Text
$sel:location:ProjectFileSystemLocation' :: ProjectFileSystemLocation -> Maybe Text
location} -> Maybe Text
location) (\s :: ProjectFileSystemLocation
s@ProjectFileSystemLocation' {} Maybe Text
a -> ProjectFileSystemLocation
s {$sel:location:ProjectFileSystemLocation' :: Maybe Text
location = Maybe Text
a} :: ProjectFileSystemLocation)

-- | The name used to access a file system created by Amazon EFS. CodeBuild
-- creates an environment variable by appending the @identifier@ in all
-- capital letters to @CODEBUILD_@. For example, if you specify @my_efs@
-- for @identifier@, a new environment variable is create named
-- @CODEBUILD_MY_EFS@.
--
-- The @identifier@ is used to mount your file system.
projectFileSystemLocation_identifier :: Lens.Lens' ProjectFileSystemLocation (Prelude.Maybe Prelude.Text)
projectFileSystemLocation_identifier :: (Maybe Text -> f (Maybe Text))
-> ProjectFileSystemLocation -> f ProjectFileSystemLocation
projectFileSystemLocation_identifier = (ProjectFileSystemLocation -> Maybe Text)
-> (ProjectFileSystemLocation
    -> Maybe Text -> ProjectFileSystemLocation)
-> Lens
     ProjectFileSystemLocation
     ProjectFileSystemLocation
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProjectFileSystemLocation' {Maybe Text
identifier :: Maybe Text
$sel:identifier:ProjectFileSystemLocation' :: ProjectFileSystemLocation -> Maybe Text
identifier} -> Maybe Text
identifier) (\s :: ProjectFileSystemLocation
s@ProjectFileSystemLocation' {} Maybe Text
a -> ProjectFileSystemLocation
s {$sel:identifier:ProjectFileSystemLocation' :: Maybe Text
identifier = Maybe Text
a} :: ProjectFileSystemLocation)

-- | The mount options for a file system created by Amazon EFS. The default
-- mount options used by CodeBuild are
-- @nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2@. For
-- more information, see
-- <https://docs.aws.amazon.com/efs/latest/ug/mounting-fs-nfs-mount-settings.html Recommended NFS Mount Options>.
projectFileSystemLocation_mountOptions :: Lens.Lens' ProjectFileSystemLocation (Prelude.Maybe Prelude.Text)
projectFileSystemLocation_mountOptions :: (Maybe Text -> f (Maybe Text))
-> ProjectFileSystemLocation -> f ProjectFileSystemLocation
projectFileSystemLocation_mountOptions = (ProjectFileSystemLocation -> Maybe Text)
-> (ProjectFileSystemLocation
    -> Maybe Text -> ProjectFileSystemLocation)
-> Lens
     ProjectFileSystemLocation
     ProjectFileSystemLocation
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProjectFileSystemLocation' {Maybe Text
mountOptions :: Maybe Text
$sel:mountOptions:ProjectFileSystemLocation' :: ProjectFileSystemLocation -> Maybe Text
mountOptions} -> Maybe Text
mountOptions) (\s :: ProjectFileSystemLocation
s@ProjectFileSystemLocation' {} Maybe Text
a -> ProjectFileSystemLocation
s {$sel:mountOptions:ProjectFileSystemLocation' :: Maybe Text
mountOptions = Maybe Text
a} :: ProjectFileSystemLocation)

-- | The type of the file system. The one supported type is @EFS@.
projectFileSystemLocation_type :: Lens.Lens' ProjectFileSystemLocation (Prelude.Maybe FileSystemType)
projectFileSystemLocation_type :: (Maybe FileSystemType -> f (Maybe FileSystemType))
-> ProjectFileSystemLocation -> f ProjectFileSystemLocation
projectFileSystemLocation_type = (ProjectFileSystemLocation -> Maybe FileSystemType)
-> (ProjectFileSystemLocation
    -> Maybe FileSystemType -> ProjectFileSystemLocation)
-> Lens
     ProjectFileSystemLocation
     ProjectFileSystemLocation
     (Maybe FileSystemType)
     (Maybe FileSystemType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProjectFileSystemLocation' {Maybe FileSystemType
type' :: Maybe FileSystemType
$sel:type':ProjectFileSystemLocation' :: ProjectFileSystemLocation -> Maybe FileSystemType
type'} -> Maybe FileSystemType
type') (\s :: ProjectFileSystemLocation
s@ProjectFileSystemLocation' {} Maybe FileSystemType
a -> ProjectFileSystemLocation
s {$sel:type':ProjectFileSystemLocation' :: Maybe FileSystemType
type' = Maybe FileSystemType
a} :: ProjectFileSystemLocation)

-- | The location in the container where you mount the file system.
projectFileSystemLocation_mountPoint :: Lens.Lens' ProjectFileSystemLocation (Prelude.Maybe Prelude.Text)
projectFileSystemLocation_mountPoint :: (Maybe Text -> f (Maybe Text))
-> ProjectFileSystemLocation -> f ProjectFileSystemLocation
projectFileSystemLocation_mountPoint = (ProjectFileSystemLocation -> Maybe Text)
-> (ProjectFileSystemLocation
    -> Maybe Text -> ProjectFileSystemLocation)
-> Lens
     ProjectFileSystemLocation
     ProjectFileSystemLocation
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProjectFileSystemLocation' {Maybe Text
mountPoint :: Maybe Text
$sel:mountPoint:ProjectFileSystemLocation' :: ProjectFileSystemLocation -> Maybe Text
mountPoint} -> Maybe Text
mountPoint) (\s :: ProjectFileSystemLocation
s@ProjectFileSystemLocation' {} Maybe Text
a -> ProjectFileSystemLocation
s {$sel:mountPoint:ProjectFileSystemLocation' :: Maybe Text
mountPoint = Maybe Text
a} :: ProjectFileSystemLocation)

instance Core.FromJSON ProjectFileSystemLocation where
  parseJSON :: Value -> Parser ProjectFileSystemLocation
parseJSON =
    String
-> (Object -> Parser ProjectFileSystemLocation)
-> Value
-> Parser ProjectFileSystemLocation
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ProjectFileSystemLocation"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe FileSystemType
-> Maybe Text
-> ProjectFileSystemLocation
ProjectFileSystemLocation'
            (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe FileSystemType
 -> Maybe Text
 -> ProjectFileSystemLocation)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe FileSystemType
      -> Maybe Text
      -> ProjectFileSystemLocation)
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
"location")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe FileSystemType
   -> Maybe Text
   -> ProjectFileSystemLocation)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe FileSystemType -> Maybe Text -> ProjectFileSystemLocation)
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
"identifier")
            Parser
  (Maybe Text
   -> Maybe FileSystemType -> Maybe Text -> ProjectFileSystemLocation)
-> Parser (Maybe Text)
-> Parser
     (Maybe FileSystemType -> Maybe Text -> ProjectFileSystemLocation)
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
"mountOptions")
            Parser
  (Maybe FileSystemType -> Maybe Text -> ProjectFileSystemLocation)
-> Parser (Maybe FileSystemType)
-> Parser (Maybe Text -> ProjectFileSystemLocation)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe FileSystemType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"type")
            Parser (Maybe Text -> ProjectFileSystemLocation)
-> Parser (Maybe Text) -> Parser ProjectFileSystemLocation
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
"mountPoint")
      )

instance Prelude.Hashable ProjectFileSystemLocation

instance Prelude.NFData ProjectFileSystemLocation

instance Core.ToJSON ProjectFileSystemLocation where
  toJSON :: ProjectFileSystemLocation -> Value
toJSON ProjectFileSystemLocation' {Maybe Text
Maybe FileSystemType
mountPoint :: Maybe Text
type' :: Maybe FileSystemType
mountOptions :: Maybe Text
identifier :: Maybe Text
location :: Maybe Text
$sel:mountPoint:ProjectFileSystemLocation' :: ProjectFileSystemLocation -> Maybe Text
$sel:type':ProjectFileSystemLocation' :: ProjectFileSystemLocation -> Maybe FileSystemType
$sel:mountOptions:ProjectFileSystemLocation' :: ProjectFileSystemLocation -> Maybe Text
$sel:identifier:ProjectFileSystemLocation' :: ProjectFileSystemLocation -> Maybe Text
$sel:location:ProjectFileSystemLocation' :: ProjectFileSystemLocation -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"location" 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
location,
            (Text
"identifier" 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
identifier,
            (Text
"mountOptions" 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
mountOptions,
            (Text
"type" Text -> FileSystemType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (FileSystemType -> Pair) -> Maybe FileSystemType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe FileSystemType
type',
            (Text
"mountPoint" 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
mountPoint
          ]
      )