{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.EFS.CreateAccessPoint
(
CreateAccessPoint (..),
newCreateAccessPoint,
createAccessPoint_posixUser,
createAccessPoint_rootDirectory,
createAccessPoint_tags,
createAccessPoint_clientToken,
createAccessPoint_fileSystemId,
AccessPointDescription (..),
newAccessPointDescription,
accessPointDescription_posixUser,
accessPointDescription_rootDirectory,
accessPointDescription_clientToken,
accessPointDescription_accessPointId,
accessPointDescription_fileSystemId,
accessPointDescription_ownerId,
accessPointDescription_name,
accessPointDescription_accessPointArn,
accessPointDescription_lifeCycleState,
accessPointDescription_tags,
)
where
import qualified Amazonka.Core as Core
import Amazonka.EFS.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data CreateAccessPoint = CreateAccessPoint'
{
CreateAccessPoint -> Maybe PosixUser
posixUser :: Prelude.Maybe PosixUser,
CreateAccessPoint -> Maybe RootDirectory
rootDirectory :: Prelude.Maybe RootDirectory,
CreateAccessPoint -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
CreateAccessPoint -> Text
clientToken :: Prelude.Text,
CreateAccessPoint -> Text
fileSystemId :: Prelude.Text
}
deriving (CreateAccessPoint -> CreateAccessPoint -> Bool
(CreateAccessPoint -> CreateAccessPoint -> Bool)
-> (CreateAccessPoint -> CreateAccessPoint -> Bool)
-> Eq CreateAccessPoint
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateAccessPoint -> CreateAccessPoint -> Bool
$c/= :: CreateAccessPoint -> CreateAccessPoint -> Bool
== :: CreateAccessPoint -> CreateAccessPoint -> Bool
$c== :: CreateAccessPoint -> CreateAccessPoint -> Bool
Prelude.Eq, ReadPrec [CreateAccessPoint]
ReadPrec CreateAccessPoint
Int -> ReadS CreateAccessPoint
ReadS [CreateAccessPoint]
(Int -> ReadS CreateAccessPoint)
-> ReadS [CreateAccessPoint]
-> ReadPrec CreateAccessPoint
-> ReadPrec [CreateAccessPoint]
-> Read CreateAccessPoint
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateAccessPoint]
$creadListPrec :: ReadPrec [CreateAccessPoint]
readPrec :: ReadPrec CreateAccessPoint
$creadPrec :: ReadPrec CreateAccessPoint
readList :: ReadS [CreateAccessPoint]
$creadList :: ReadS [CreateAccessPoint]
readsPrec :: Int -> ReadS CreateAccessPoint
$creadsPrec :: Int -> ReadS CreateAccessPoint
Prelude.Read, Int -> CreateAccessPoint -> ShowS
[CreateAccessPoint] -> ShowS
CreateAccessPoint -> String
(Int -> CreateAccessPoint -> ShowS)
-> (CreateAccessPoint -> String)
-> ([CreateAccessPoint] -> ShowS)
-> Show CreateAccessPoint
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateAccessPoint] -> ShowS
$cshowList :: [CreateAccessPoint] -> ShowS
show :: CreateAccessPoint -> String
$cshow :: CreateAccessPoint -> String
showsPrec :: Int -> CreateAccessPoint -> ShowS
$cshowsPrec :: Int -> CreateAccessPoint -> ShowS
Prelude.Show, (forall x. CreateAccessPoint -> Rep CreateAccessPoint x)
-> (forall x. Rep CreateAccessPoint x -> CreateAccessPoint)
-> Generic CreateAccessPoint
forall x. Rep CreateAccessPoint x -> CreateAccessPoint
forall x. CreateAccessPoint -> Rep CreateAccessPoint x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateAccessPoint x -> CreateAccessPoint
$cfrom :: forall x. CreateAccessPoint -> Rep CreateAccessPoint x
Prelude.Generic)
newCreateAccessPoint ::
Prelude.Text ->
Prelude.Text ->
CreateAccessPoint
newCreateAccessPoint :: Text -> Text -> CreateAccessPoint
newCreateAccessPoint Text
pClientToken_ Text
pFileSystemId_ =
CreateAccessPoint' :: Maybe PosixUser
-> Maybe RootDirectory
-> Maybe [Tag]
-> Text
-> Text
-> CreateAccessPoint
CreateAccessPoint'
{ $sel:posixUser:CreateAccessPoint' :: Maybe PosixUser
posixUser = Maybe PosixUser
forall a. Maybe a
Prelude.Nothing,
$sel:rootDirectory:CreateAccessPoint' :: Maybe RootDirectory
rootDirectory = Maybe RootDirectory
forall a. Maybe a
Prelude.Nothing,
$sel:tags:CreateAccessPoint' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
$sel:clientToken:CreateAccessPoint' :: Text
clientToken = Text
pClientToken_,
$sel:fileSystemId:CreateAccessPoint' :: Text
fileSystemId = Text
pFileSystemId_
}
createAccessPoint_posixUser :: Lens.Lens' CreateAccessPoint (Prelude.Maybe PosixUser)
createAccessPoint_posixUser :: (Maybe PosixUser -> f (Maybe PosixUser))
-> CreateAccessPoint -> f CreateAccessPoint
createAccessPoint_posixUser = (CreateAccessPoint -> Maybe PosixUser)
-> (CreateAccessPoint -> Maybe PosixUser -> CreateAccessPoint)
-> Lens
CreateAccessPoint
CreateAccessPoint
(Maybe PosixUser)
(Maybe PosixUser)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAccessPoint' {Maybe PosixUser
posixUser :: Maybe PosixUser
$sel:posixUser:CreateAccessPoint' :: CreateAccessPoint -> Maybe PosixUser
posixUser} -> Maybe PosixUser
posixUser) (\s :: CreateAccessPoint
s@CreateAccessPoint' {} Maybe PosixUser
a -> CreateAccessPoint
s {$sel:posixUser:CreateAccessPoint' :: Maybe PosixUser
posixUser = Maybe PosixUser
a} :: CreateAccessPoint)
createAccessPoint_rootDirectory :: Lens.Lens' CreateAccessPoint (Prelude.Maybe RootDirectory)
createAccessPoint_rootDirectory :: (Maybe RootDirectory -> f (Maybe RootDirectory))
-> CreateAccessPoint -> f CreateAccessPoint
createAccessPoint_rootDirectory = (CreateAccessPoint -> Maybe RootDirectory)
-> (CreateAccessPoint -> Maybe RootDirectory -> CreateAccessPoint)
-> Lens
CreateAccessPoint
CreateAccessPoint
(Maybe RootDirectory)
(Maybe RootDirectory)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAccessPoint' {Maybe RootDirectory
rootDirectory :: Maybe RootDirectory
$sel:rootDirectory:CreateAccessPoint' :: CreateAccessPoint -> Maybe RootDirectory
rootDirectory} -> Maybe RootDirectory
rootDirectory) (\s :: CreateAccessPoint
s@CreateAccessPoint' {} Maybe RootDirectory
a -> CreateAccessPoint
s {$sel:rootDirectory:CreateAccessPoint' :: Maybe RootDirectory
rootDirectory = Maybe RootDirectory
a} :: CreateAccessPoint)
createAccessPoint_tags :: Lens.Lens' CreateAccessPoint (Prelude.Maybe [Tag])
createAccessPoint_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateAccessPoint -> f CreateAccessPoint
createAccessPoint_tags = (CreateAccessPoint -> Maybe [Tag])
-> (CreateAccessPoint -> Maybe [Tag] -> CreateAccessPoint)
-> Lens
CreateAccessPoint CreateAccessPoint (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAccessPoint' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateAccessPoint' :: CreateAccessPoint -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateAccessPoint
s@CreateAccessPoint' {} Maybe [Tag]
a -> CreateAccessPoint
s {$sel:tags:CreateAccessPoint' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateAccessPoint) ((Maybe [Tag] -> f (Maybe [Tag]))
-> CreateAccessPoint -> f CreateAccessPoint)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
-> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateAccessPoint
-> f CreateAccessPoint
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createAccessPoint_clientToken :: Lens.Lens' CreateAccessPoint Prelude.Text
createAccessPoint_clientToken :: (Text -> f Text) -> CreateAccessPoint -> f CreateAccessPoint
createAccessPoint_clientToken = (CreateAccessPoint -> Text)
-> (CreateAccessPoint -> Text -> CreateAccessPoint)
-> Lens CreateAccessPoint CreateAccessPoint Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAccessPoint' {Text
clientToken :: Text
$sel:clientToken:CreateAccessPoint' :: CreateAccessPoint -> Text
clientToken} -> Text
clientToken) (\s :: CreateAccessPoint
s@CreateAccessPoint' {} Text
a -> CreateAccessPoint
s {$sel:clientToken:CreateAccessPoint' :: Text
clientToken = Text
a} :: CreateAccessPoint)
createAccessPoint_fileSystemId :: Lens.Lens' CreateAccessPoint Prelude.Text
createAccessPoint_fileSystemId :: (Text -> f Text) -> CreateAccessPoint -> f CreateAccessPoint
createAccessPoint_fileSystemId = (CreateAccessPoint -> Text)
-> (CreateAccessPoint -> Text -> CreateAccessPoint)
-> Lens CreateAccessPoint CreateAccessPoint Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAccessPoint' {Text
fileSystemId :: Text
$sel:fileSystemId:CreateAccessPoint' :: CreateAccessPoint -> Text
fileSystemId} -> Text
fileSystemId) (\s :: CreateAccessPoint
s@CreateAccessPoint' {} Text
a -> CreateAccessPoint
s {$sel:fileSystemId:CreateAccessPoint' :: Text
fileSystemId = Text
a} :: CreateAccessPoint)
instance Core.AWSRequest CreateAccessPoint where
type
AWSResponse CreateAccessPoint =
AccessPointDescription
request :: CreateAccessPoint -> Request CreateAccessPoint
request = Service -> CreateAccessPoint -> Request CreateAccessPoint
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateAccessPoint
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateAccessPoint)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateAccessPoint))
-> Logger
-> Service
-> Proxy CreateAccessPoint
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateAccessPoint)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
(\Int
s ResponseHeaders
h Object
x -> Object -> Either String AccessPointDescription
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
instance Prelude.Hashable CreateAccessPoint
instance Prelude.NFData CreateAccessPoint
instance Core.ToHeaders CreateAccessPoint where
toHeaders :: CreateAccessPoint -> ResponseHeaders
toHeaders = ResponseHeaders -> CreateAccessPoint -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToJSON CreateAccessPoint where
toJSON :: CreateAccessPoint -> Value
toJSON CreateAccessPoint' {Maybe [Tag]
Maybe PosixUser
Maybe RootDirectory
Text
fileSystemId :: Text
clientToken :: Text
tags :: Maybe [Tag]
rootDirectory :: Maybe RootDirectory
posixUser :: Maybe PosixUser
$sel:fileSystemId:CreateAccessPoint' :: CreateAccessPoint -> Text
$sel:clientToken:CreateAccessPoint' :: CreateAccessPoint -> Text
$sel:tags:CreateAccessPoint' :: CreateAccessPoint -> Maybe [Tag]
$sel:rootDirectory:CreateAccessPoint' :: CreateAccessPoint -> Maybe RootDirectory
$sel:posixUser:CreateAccessPoint' :: CreateAccessPoint -> Maybe PosixUser
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"PosixUser" Text -> PosixUser -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (PosixUser -> Pair) -> Maybe PosixUser -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe PosixUser
posixUser,
(Text
"RootDirectory" Text -> RootDirectory -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (RootDirectory -> Pair) -> Maybe RootDirectory -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe RootDirectory
rootDirectory,
(Text
"Tags" Text -> [Tag] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Tag] -> Pair) -> Maybe [Tag] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ClientToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
clientToken),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"FileSystemId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
fileSystemId)
]
)
instance Core.ToPath CreateAccessPoint where
toPath :: CreateAccessPoint -> ByteString
toPath = ByteString -> CreateAccessPoint -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/2015-02-01/access-points"
instance Core.ToQuery CreateAccessPoint where
toQuery :: CreateAccessPoint -> QueryString
toQuery = QueryString -> CreateAccessPoint -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty