{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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'
  { -- | 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,
    -- | 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 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 location in the container where you mount the file system.
    ProjectFileSystemLocation -> Maybe Text
mountPoint :: Prelude.Maybe Prelude.Text,
    -- | The type of the file system. The one supported type is @EFS@.
    ProjectFileSystemLocation -> Maybe FileSystemType
type' :: Prelude.Maybe FileSystemType
  }
  deriving (ProjectFileSystemLocation -> ProjectFileSystemLocation -> Bool
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]
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
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.
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:
--
-- '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.
--
-- '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.
--
-- '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>.
--
-- 'mountPoint', 'projectFileSystemLocation_mountPoint' - The location in the container where you mount the file system.
--
-- 'type'', 'projectFileSystemLocation_type' - The type of the file system. The one supported type is @EFS@.
newProjectFileSystemLocation ::
  ProjectFileSystemLocation
newProjectFileSystemLocation :: ProjectFileSystemLocation
newProjectFileSystemLocation =
  ProjectFileSystemLocation'
    { $sel:identifier:ProjectFileSystemLocation' :: Maybe Text
identifier =
        forall a. Maybe a
Prelude.Nothing,
      $sel:location:ProjectFileSystemLocation' :: Maybe Text
location = forall a. Maybe a
Prelude.Nothing,
      $sel:mountOptions:ProjectFileSystemLocation' :: Maybe Text
mountOptions = forall a. Maybe a
Prelude.Nothing,
      $sel:mountPoint:ProjectFileSystemLocation' :: Maybe Text
mountPoint = forall a. Maybe a
Prelude.Nothing,
      $sel:type':ProjectFileSystemLocation' :: Maybe FileSystemType
type' = forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: Lens' ProjectFileSystemLocation (Maybe Text)
projectFileSystemLocation_identifier = 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)

-- | 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 :: Lens' ProjectFileSystemLocation (Maybe Text)
projectFileSystemLocation_location = 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 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 :: Lens' ProjectFileSystemLocation (Maybe Text)
projectFileSystemLocation_mountOptions = 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 location in the container where you mount the file system.
projectFileSystemLocation_mountPoint :: Lens.Lens' ProjectFileSystemLocation (Prelude.Maybe Prelude.Text)
projectFileSystemLocation_mountPoint :: Lens' ProjectFileSystemLocation (Maybe Text)
projectFileSystemLocation_mountPoint = 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)

-- | The type of the file system. The one supported type is @EFS@.
projectFileSystemLocation_type :: Lens.Lens' ProjectFileSystemLocation (Prelude.Maybe FileSystemType)
projectFileSystemLocation_type :: Lens' ProjectFileSystemLocation (Maybe FileSystemType)
projectFileSystemLocation_type = 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)

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

instance Prelude.Hashable ProjectFileSystemLocation where
  hashWithSalt :: Int -> ProjectFileSystemLocation -> Int
hashWithSalt Int
_salt ProjectFileSystemLocation' {Maybe Text
Maybe FileSystemType
type' :: Maybe FileSystemType
mountPoint :: Maybe Text
mountOptions :: Maybe Text
location :: Maybe Text
identifier :: Maybe Text
$sel:type':ProjectFileSystemLocation' :: ProjectFileSystemLocation -> Maybe FileSystemType
$sel:mountPoint:ProjectFileSystemLocation' :: ProjectFileSystemLocation -> Maybe Text
$sel:mountOptions:ProjectFileSystemLocation' :: ProjectFileSystemLocation -> Maybe Text
$sel:location:ProjectFileSystemLocation' :: ProjectFileSystemLocation -> Maybe Text
$sel:identifier:ProjectFileSystemLocation' :: ProjectFileSystemLocation -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
identifier
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
location
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
mountOptions
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
mountPoint
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe FileSystemType
type'

instance Prelude.NFData ProjectFileSystemLocation where
  rnf :: ProjectFileSystemLocation -> ()
rnf ProjectFileSystemLocation' {Maybe Text
Maybe FileSystemType
type' :: Maybe FileSystemType
mountPoint :: Maybe Text
mountOptions :: Maybe Text
location :: Maybe Text
identifier :: Maybe Text
$sel:type':ProjectFileSystemLocation' :: ProjectFileSystemLocation -> Maybe FileSystemType
$sel:mountPoint:ProjectFileSystemLocation' :: ProjectFileSystemLocation -> Maybe Text
$sel:mountOptions:ProjectFileSystemLocation' :: ProjectFileSystemLocation -> Maybe Text
$sel:location:ProjectFileSystemLocation' :: ProjectFileSystemLocation -> Maybe Text
$sel:identifier:ProjectFileSystemLocation' :: ProjectFileSystemLocation -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
identifier
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
location
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
mountOptions
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
mountPoint
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe FileSystemType
type'

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