{-# 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 #-}
module Amazonka.AppStream.Types.AccessEndpoint where
import Amazonka.AppStream.Types.AccessEndpointType
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data AccessEndpoint = AccessEndpoint'
{
AccessEndpoint -> Maybe Text
vpceId :: Prelude.Maybe Prelude.Text,
AccessEndpoint -> AccessEndpointType
endpointType :: AccessEndpointType
}
deriving (AccessEndpoint -> AccessEndpoint -> Bool
(AccessEndpoint -> AccessEndpoint -> Bool)
-> (AccessEndpoint -> AccessEndpoint -> Bool) -> Eq AccessEndpoint
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AccessEndpoint -> AccessEndpoint -> Bool
$c/= :: AccessEndpoint -> AccessEndpoint -> Bool
== :: AccessEndpoint -> AccessEndpoint -> Bool
$c== :: AccessEndpoint -> AccessEndpoint -> Bool
Prelude.Eq, ReadPrec [AccessEndpoint]
ReadPrec AccessEndpoint
Int -> ReadS AccessEndpoint
ReadS [AccessEndpoint]
(Int -> ReadS AccessEndpoint)
-> ReadS [AccessEndpoint]
-> ReadPrec AccessEndpoint
-> ReadPrec [AccessEndpoint]
-> Read AccessEndpoint
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AccessEndpoint]
$creadListPrec :: ReadPrec [AccessEndpoint]
readPrec :: ReadPrec AccessEndpoint
$creadPrec :: ReadPrec AccessEndpoint
readList :: ReadS [AccessEndpoint]
$creadList :: ReadS [AccessEndpoint]
readsPrec :: Int -> ReadS AccessEndpoint
$creadsPrec :: Int -> ReadS AccessEndpoint
Prelude.Read, Int -> AccessEndpoint -> ShowS
[AccessEndpoint] -> ShowS
AccessEndpoint -> String
(Int -> AccessEndpoint -> ShowS)
-> (AccessEndpoint -> String)
-> ([AccessEndpoint] -> ShowS)
-> Show AccessEndpoint
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AccessEndpoint] -> ShowS
$cshowList :: [AccessEndpoint] -> ShowS
show :: AccessEndpoint -> String
$cshow :: AccessEndpoint -> String
showsPrec :: Int -> AccessEndpoint -> ShowS
$cshowsPrec :: Int -> AccessEndpoint -> ShowS
Prelude.Show, (forall x. AccessEndpoint -> Rep AccessEndpoint x)
-> (forall x. Rep AccessEndpoint x -> AccessEndpoint)
-> Generic AccessEndpoint
forall x. Rep AccessEndpoint x -> AccessEndpoint
forall x. AccessEndpoint -> Rep AccessEndpoint x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AccessEndpoint x -> AccessEndpoint
$cfrom :: forall x. AccessEndpoint -> Rep AccessEndpoint x
Prelude.Generic)
newAccessEndpoint ::
AccessEndpointType ->
AccessEndpoint
newAccessEndpoint :: AccessEndpointType -> AccessEndpoint
newAccessEndpoint AccessEndpointType
pEndpointType_ =
AccessEndpoint' :: Maybe Text -> AccessEndpointType -> AccessEndpoint
AccessEndpoint'
{ $sel:vpceId:AccessEndpoint' :: Maybe Text
vpceId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:endpointType:AccessEndpoint' :: AccessEndpointType
endpointType = AccessEndpointType
pEndpointType_
}
accessEndpoint_vpceId :: Lens.Lens' AccessEndpoint (Prelude.Maybe Prelude.Text)
accessEndpoint_vpceId :: (Maybe Text -> f (Maybe Text))
-> AccessEndpoint -> f AccessEndpoint
accessEndpoint_vpceId = (AccessEndpoint -> Maybe Text)
-> (AccessEndpoint -> Maybe Text -> AccessEndpoint)
-> Lens AccessEndpoint AccessEndpoint (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccessEndpoint' {Maybe Text
vpceId :: Maybe Text
$sel:vpceId:AccessEndpoint' :: AccessEndpoint -> Maybe Text
vpceId} -> Maybe Text
vpceId) (\s :: AccessEndpoint
s@AccessEndpoint' {} Maybe Text
a -> AccessEndpoint
s {$sel:vpceId:AccessEndpoint' :: Maybe Text
vpceId = Maybe Text
a} :: AccessEndpoint)
accessEndpoint_endpointType :: Lens.Lens' AccessEndpoint AccessEndpointType
accessEndpoint_endpointType :: (AccessEndpointType -> f AccessEndpointType)
-> AccessEndpoint -> f AccessEndpoint
accessEndpoint_endpointType = (AccessEndpoint -> AccessEndpointType)
-> (AccessEndpoint -> AccessEndpointType -> AccessEndpoint)
-> Lens
AccessEndpoint AccessEndpoint AccessEndpointType AccessEndpointType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccessEndpoint' {AccessEndpointType
endpointType :: AccessEndpointType
$sel:endpointType:AccessEndpoint' :: AccessEndpoint -> AccessEndpointType
endpointType} -> AccessEndpointType
endpointType) (\s :: AccessEndpoint
s@AccessEndpoint' {} AccessEndpointType
a -> AccessEndpoint
s {$sel:endpointType:AccessEndpoint' :: AccessEndpointType
endpointType = AccessEndpointType
a} :: AccessEndpoint)
instance Core.FromJSON AccessEndpoint where
parseJSON :: Value -> Parser AccessEndpoint
parseJSON =
String
-> (Object -> Parser AccessEndpoint)
-> Value
-> Parser AccessEndpoint
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"AccessEndpoint"
( \Object
x ->
Maybe Text -> AccessEndpointType -> AccessEndpoint
AccessEndpoint'
(Maybe Text -> AccessEndpointType -> AccessEndpoint)
-> Parser (Maybe Text)
-> Parser (AccessEndpointType -> AccessEndpoint)
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
"VpceId")
Parser (AccessEndpointType -> AccessEndpoint)
-> Parser AccessEndpointType -> Parser AccessEndpoint
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser AccessEndpointType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"EndpointType")
)
instance Prelude.Hashable AccessEndpoint
instance Prelude.NFData AccessEndpoint
instance Core.ToJSON AccessEndpoint where
toJSON :: AccessEndpoint -> Value
toJSON AccessEndpoint' {Maybe Text
AccessEndpointType
endpointType :: AccessEndpointType
vpceId :: Maybe Text
$sel:endpointType:AccessEndpoint' :: AccessEndpoint -> AccessEndpointType
$sel:vpceId:AccessEndpoint' :: AccessEndpoint -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"VpceId" 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
vpceId,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"EndpointType" Text -> AccessEndpointType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= AccessEndpointType
endpointType)
]
)