{-# 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.CreateMountTarget
(
CreateMountTarget (..),
newCreateMountTarget,
createMountTarget_ipAddress,
createMountTarget_securityGroups,
createMountTarget_fileSystemId,
createMountTarget_subnetId,
MountTargetDescription (..),
newMountTargetDescription,
mountTargetDescription_ipAddress,
mountTargetDescription_availabilityZoneId,
mountTargetDescription_vpcId,
mountTargetDescription_availabilityZoneName,
mountTargetDescription_networkInterfaceId,
mountTargetDescription_ownerId,
mountTargetDescription_mountTargetId,
mountTargetDescription_fileSystemId,
mountTargetDescription_subnetId,
mountTargetDescription_lifeCycleState,
)
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 CreateMountTarget = CreateMountTarget'
{
CreateMountTarget -> Maybe Text
ipAddress :: Prelude.Maybe Prelude.Text,
CreateMountTarget -> Maybe [Text]
securityGroups :: Prelude.Maybe [Prelude.Text],
CreateMountTarget -> Text
fileSystemId :: Prelude.Text,
CreateMountTarget -> Text
subnetId :: Prelude.Text
}
deriving (CreateMountTarget -> CreateMountTarget -> Bool
(CreateMountTarget -> CreateMountTarget -> Bool)
-> (CreateMountTarget -> CreateMountTarget -> Bool)
-> Eq CreateMountTarget
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateMountTarget -> CreateMountTarget -> Bool
$c/= :: CreateMountTarget -> CreateMountTarget -> Bool
== :: CreateMountTarget -> CreateMountTarget -> Bool
$c== :: CreateMountTarget -> CreateMountTarget -> Bool
Prelude.Eq, ReadPrec [CreateMountTarget]
ReadPrec CreateMountTarget
Int -> ReadS CreateMountTarget
ReadS [CreateMountTarget]
(Int -> ReadS CreateMountTarget)
-> ReadS [CreateMountTarget]
-> ReadPrec CreateMountTarget
-> ReadPrec [CreateMountTarget]
-> Read CreateMountTarget
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateMountTarget]
$creadListPrec :: ReadPrec [CreateMountTarget]
readPrec :: ReadPrec CreateMountTarget
$creadPrec :: ReadPrec CreateMountTarget
readList :: ReadS [CreateMountTarget]
$creadList :: ReadS [CreateMountTarget]
readsPrec :: Int -> ReadS CreateMountTarget
$creadsPrec :: Int -> ReadS CreateMountTarget
Prelude.Read, Int -> CreateMountTarget -> ShowS
[CreateMountTarget] -> ShowS
CreateMountTarget -> String
(Int -> CreateMountTarget -> ShowS)
-> (CreateMountTarget -> String)
-> ([CreateMountTarget] -> ShowS)
-> Show CreateMountTarget
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateMountTarget] -> ShowS
$cshowList :: [CreateMountTarget] -> ShowS
show :: CreateMountTarget -> String
$cshow :: CreateMountTarget -> String
showsPrec :: Int -> CreateMountTarget -> ShowS
$cshowsPrec :: Int -> CreateMountTarget -> ShowS
Prelude.Show, (forall x. CreateMountTarget -> Rep CreateMountTarget x)
-> (forall x. Rep CreateMountTarget x -> CreateMountTarget)
-> Generic CreateMountTarget
forall x. Rep CreateMountTarget x -> CreateMountTarget
forall x. CreateMountTarget -> Rep CreateMountTarget x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateMountTarget x -> CreateMountTarget
$cfrom :: forall x. CreateMountTarget -> Rep CreateMountTarget x
Prelude.Generic)
newCreateMountTarget ::
Prelude.Text ->
Prelude.Text ->
CreateMountTarget
newCreateMountTarget :: Text -> Text -> CreateMountTarget
newCreateMountTarget Text
pFileSystemId_ Text
pSubnetId_ =
CreateMountTarget' :: Maybe Text -> Maybe [Text] -> Text -> Text -> CreateMountTarget
CreateMountTarget'
{ $sel:ipAddress:CreateMountTarget' :: Maybe Text
ipAddress = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:securityGroups:CreateMountTarget' :: Maybe [Text]
securityGroups = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
$sel:fileSystemId:CreateMountTarget' :: Text
fileSystemId = Text
pFileSystemId_,
$sel:subnetId:CreateMountTarget' :: Text
subnetId = Text
pSubnetId_
}
createMountTarget_ipAddress :: Lens.Lens' CreateMountTarget (Prelude.Maybe Prelude.Text)
createMountTarget_ipAddress :: (Maybe Text -> f (Maybe Text))
-> CreateMountTarget -> f CreateMountTarget
createMountTarget_ipAddress = (CreateMountTarget -> Maybe Text)
-> (CreateMountTarget -> Maybe Text -> CreateMountTarget)
-> Lens
CreateMountTarget CreateMountTarget (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMountTarget' {Maybe Text
ipAddress :: Maybe Text
$sel:ipAddress:CreateMountTarget' :: CreateMountTarget -> Maybe Text
ipAddress} -> Maybe Text
ipAddress) (\s :: CreateMountTarget
s@CreateMountTarget' {} Maybe Text
a -> CreateMountTarget
s {$sel:ipAddress:CreateMountTarget' :: Maybe Text
ipAddress = Maybe Text
a} :: CreateMountTarget)
createMountTarget_securityGroups :: Lens.Lens' CreateMountTarget (Prelude.Maybe [Prelude.Text])
createMountTarget_securityGroups :: (Maybe [Text] -> f (Maybe [Text]))
-> CreateMountTarget -> f CreateMountTarget
createMountTarget_securityGroups = (CreateMountTarget -> Maybe [Text])
-> (CreateMountTarget -> Maybe [Text] -> CreateMountTarget)
-> Lens
CreateMountTarget CreateMountTarget (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMountTarget' {Maybe [Text]
securityGroups :: Maybe [Text]
$sel:securityGroups:CreateMountTarget' :: CreateMountTarget -> Maybe [Text]
securityGroups} -> Maybe [Text]
securityGroups) (\s :: CreateMountTarget
s@CreateMountTarget' {} Maybe [Text]
a -> CreateMountTarget
s {$sel:securityGroups:CreateMountTarget' :: Maybe [Text]
securityGroups = Maybe [Text]
a} :: CreateMountTarget) ((Maybe [Text] -> f (Maybe [Text]))
-> CreateMountTarget -> f CreateMountTarget)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> CreateMountTarget
-> f CreateMountTarget
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createMountTarget_fileSystemId :: Lens.Lens' CreateMountTarget Prelude.Text
createMountTarget_fileSystemId :: (Text -> f Text) -> CreateMountTarget -> f CreateMountTarget
createMountTarget_fileSystemId = (CreateMountTarget -> Text)
-> (CreateMountTarget -> Text -> CreateMountTarget)
-> Lens CreateMountTarget CreateMountTarget Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMountTarget' {Text
fileSystemId :: Text
$sel:fileSystemId:CreateMountTarget' :: CreateMountTarget -> Text
fileSystemId} -> Text
fileSystemId) (\s :: CreateMountTarget
s@CreateMountTarget' {} Text
a -> CreateMountTarget
s {$sel:fileSystemId:CreateMountTarget' :: Text
fileSystemId = Text
a} :: CreateMountTarget)
createMountTarget_subnetId :: Lens.Lens' CreateMountTarget Prelude.Text
createMountTarget_subnetId :: (Text -> f Text) -> CreateMountTarget -> f CreateMountTarget
createMountTarget_subnetId = (CreateMountTarget -> Text)
-> (CreateMountTarget -> Text -> CreateMountTarget)
-> Lens CreateMountTarget CreateMountTarget Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMountTarget' {Text
subnetId :: Text
$sel:subnetId:CreateMountTarget' :: CreateMountTarget -> Text
subnetId} -> Text
subnetId) (\s :: CreateMountTarget
s@CreateMountTarget' {} Text
a -> CreateMountTarget
s {$sel:subnetId:CreateMountTarget' :: Text
subnetId = Text
a} :: CreateMountTarget)
instance Core.AWSRequest CreateMountTarget where
type
AWSResponse CreateMountTarget =
MountTargetDescription
request :: CreateMountTarget -> Request CreateMountTarget
request = Service -> CreateMountTarget -> Request CreateMountTarget
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateMountTarget
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateMountTarget)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateMountTarget))
-> Logger
-> Service
-> Proxy CreateMountTarget
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateMountTarget)))
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 MountTargetDescription
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
instance Prelude.Hashable CreateMountTarget
instance Prelude.NFData CreateMountTarget
instance Core.ToHeaders CreateMountTarget where
toHeaders :: CreateMountTarget -> ResponseHeaders
toHeaders = ResponseHeaders -> CreateMountTarget -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToJSON CreateMountTarget where
toJSON :: CreateMountTarget -> Value
toJSON CreateMountTarget' {Maybe [Text]
Maybe Text
Text
subnetId :: Text
fileSystemId :: Text
securityGroups :: Maybe [Text]
ipAddress :: Maybe Text
$sel:subnetId:CreateMountTarget' :: CreateMountTarget -> Text
$sel:fileSystemId:CreateMountTarget' :: CreateMountTarget -> Text
$sel:securityGroups:CreateMountTarget' :: CreateMountTarget -> Maybe [Text]
$sel:ipAddress:CreateMountTarget' :: CreateMountTarget -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"IpAddress" 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
ipAddress,
(Text
"SecurityGroups" 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]
securityGroups,
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),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"SubnetId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
subnetId)
]
)
instance Core.ToPath CreateMountTarget where
toPath :: CreateMountTarget -> ByteString
toPath = ByteString -> CreateMountTarget -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/2015-02-01/mount-targets"
instance Core.ToQuery CreateMountTarget where
toQuery :: CreateMountTarget -> QueryString
toQuery = QueryString -> CreateMountTarget -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty