{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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'
{ $sel:vpceId:AccessEndpoint' :: Maybe Text
vpceId = forall a. Maybe a
Prelude.Nothing,
$sel:endpointType:AccessEndpoint' :: AccessEndpointType
endpointType = AccessEndpointType
pEndpointType_
}
accessEndpoint_vpceId :: Lens.Lens' AccessEndpoint (Prelude.Maybe Prelude.Text)
accessEndpoint_vpceId :: Lens' AccessEndpoint (Maybe Text)
accessEndpoint_vpceId = 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 :: Lens' AccessEndpoint AccessEndpointType
accessEndpoint_endpointType = 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 Data.FromJSON AccessEndpoint where
parseJSON :: Value -> Parser AccessEndpoint
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"AccessEndpoint"
( \Object
x ->
Maybe Text -> AccessEndpointType -> AccessEndpoint
AccessEndpoint'
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
"VpceId")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"EndpointType")
)
instance Prelude.Hashable AccessEndpoint where
hashWithSalt :: Int -> AccessEndpoint -> Int
hashWithSalt Int
_salt AccessEndpoint' {Maybe Text
AccessEndpointType
endpointType :: AccessEndpointType
vpceId :: Maybe Text
$sel:endpointType:AccessEndpoint' :: AccessEndpoint -> AccessEndpointType
$sel:vpceId:AccessEndpoint' :: AccessEndpoint -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
vpceId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` AccessEndpointType
endpointType
instance Prelude.NFData AccessEndpoint where
rnf :: AccessEndpoint -> ()
rnf AccessEndpoint' {Maybe Text
AccessEndpointType
endpointType :: AccessEndpointType
vpceId :: Maybe Text
$sel:endpointType:AccessEndpoint' :: AccessEndpoint -> AccessEndpointType
$sel:vpceId:AccessEndpoint' :: AccessEndpoint -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
vpceId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf AccessEndpointType
endpointType
instance Data.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
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"VpceId" 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
vpceId,
forall a. a -> Maybe a
Prelude.Just (Key
"EndpointType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= AccessEndpointType
endpointType)
]
)