{-# 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.RedshiftServerLess.CreateEndpointAccess
(
CreateEndpointAccess (..),
newCreateEndpointAccess,
createEndpointAccess_vpcSecurityGroupIds,
createEndpointAccess_endpointName,
createEndpointAccess_subnetIds,
createEndpointAccess_workgroupName,
CreateEndpointAccessResponse (..),
newCreateEndpointAccessResponse,
createEndpointAccessResponse_endpoint,
createEndpointAccessResponse_httpStatus,
)
where
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
import Amazonka.RedshiftServerLess.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data CreateEndpointAccess = CreateEndpointAccess'
{
CreateEndpointAccess -> Maybe [Text]
vpcSecurityGroupIds :: Prelude.Maybe [Prelude.Text],
CreateEndpointAccess -> Text
endpointName :: Prelude.Text,
CreateEndpointAccess -> [Text]
subnetIds :: [Prelude.Text],
CreateEndpointAccess -> Text
workgroupName :: Prelude.Text
}
deriving (CreateEndpointAccess -> CreateEndpointAccess -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateEndpointAccess -> CreateEndpointAccess -> Bool
$c/= :: CreateEndpointAccess -> CreateEndpointAccess -> Bool
== :: CreateEndpointAccess -> CreateEndpointAccess -> Bool
$c== :: CreateEndpointAccess -> CreateEndpointAccess -> Bool
Prelude.Eq, ReadPrec [CreateEndpointAccess]
ReadPrec CreateEndpointAccess
Int -> ReadS CreateEndpointAccess
ReadS [CreateEndpointAccess]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateEndpointAccess]
$creadListPrec :: ReadPrec [CreateEndpointAccess]
readPrec :: ReadPrec CreateEndpointAccess
$creadPrec :: ReadPrec CreateEndpointAccess
readList :: ReadS [CreateEndpointAccess]
$creadList :: ReadS [CreateEndpointAccess]
readsPrec :: Int -> ReadS CreateEndpointAccess
$creadsPrec :: Int -> ReadS CreateEndpointAccess
Prelude.Read, Int -> CreateEndpointAccess -> ShowS
[CreateEndpointAccess] -> ShowS
CreateEndpointAccess -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateEndpointAccess] -> ShowS
$cshowList :: [CreateEndpointAccess] -> ShowS
show :: CreateEndpointAccess -> String
$cshow :: CreateEndpointAccess -> String
showsPrec :: Int -> CreateEndpointAccess -> ShowS
$cshowsPrec :: Int -> CreateEndpointAccess -> ShowS
Prelude.Show, forall x. Rep CreateEndpointAccess x -> CreateEndpointAccess
forall x. CreateEndpointAccess -> Rep CreateEndpointAccess x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateEndpointAccess x -> CreateEndpointAccess
$cfrom :: forall x. CreateEndpointAccess -> Rep CreateEndpointAccess x
Prelude.Generic)
newCreateEndpointAccess ::
Prelude.Text ->
Prelude.Text ->
CreateEndpointAccess
newCreateEndpointAccess :: Text -> Text -> CreateEndpointAccess
newCreateEndpointAccess
Text
pEndpointName_
Text
pWorkgroupName_ =
CreateEndpointAccess'
{ $sel:vpcSecurityGroupIds:CreateEndpointAccess' :: Maybe [Text]
vpcSecurityGroupIds =
forall a. Maybe a
Prelude.Nothing,
$sel:endpointName:CreateEndpointAccess' :: Text
endpointName = Text
pEndpointName_,
$sel:subnetIds:CreateEndpointAccess' :: [Text]
subnetIds = forall a. Monoid a => a
Prelude.mempty,
$sel:workgroupName:CreateEndpointAccess' :: Text
workgroupName = Text
pWorkgroupName_
}
createEndpointAccess_vpcSecurityGroupIds :: Lens.Lens' CreateEndpointAccess (Prelude.Maybe [Prelude.Text])
createEndpointAccess_vpcSecurityGroupIds :: Lens' CreateEndpointAccess (Maybe [Text])
createEndpointAccess_vpcSecurityGroupIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEndpointAccess' {Maybe [Text]
vpcSecurityGroupIds :: Maybe [Text]
$sel:vpcSecurityGroupIds:CreateEndpointAccess' :: CreateEndpointAccess -> Maybe [Text]
vpcSecurityGroupIds} -> Maybe [Text]
vpcSecurityGroupIds) (\s :: CreateEndpointAccess
s@CreateEndpointAccess' {} Maybe [Text]
a -> CreateEndpointAccess
s {$sel:vpcSecurityGroupIds:CreateEndpointAccess' :: Maybe [Text]
vpcSecurityGroupIds = Maybe [Text]
a} :: CreateEndpointAccess) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createEndpointAccess_endpointName :: Lens.Lens' CreateEndpointAccess Prelude.Text
createEndpointAccess_endpointName :: Lens' CreateEndpointAccess Text
createEndpointAccess_endpointName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEndpointAccess' {Text
endpointName :: Text
$sel:endpointName:CreateEndpointAccess' :: CreateEndpointAccess -> Text
endpointName} -> Text
endpointName) (\s :: CreateEndpointAccess
s@CreateEndpointAccess' {} Text
a -> CreateEndpointAccess
s {$sel:endpointName:CreateEndpointAccess' :: Text
endpointName = Text
a} :: CreateEndpointAccess)
createEndpointAccess_subnetIds :: Lens.Lens' CreateEndpointAccess [Prelude.Text]
createEndpointAccess_subnetIds :: Lens' CreateEndpointAccess [Text]
createEndpointAccess_subnetIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEndpointAccess' {[Text]
subnetIds :: [Text]
$sel:subnetIds:CreateEndpointAccess' :: CreateEndpointAccess -> [Text]
subnetIds} -> [Text]
subnetIds) (\s :: CreateEndpointAccess
s@CreateEndpointAccess' {} [Text]
a -> CreateEndpointAccess
s {$sel:subnetIds:CreateEndpointAccess' :: [Text]
subnetIds = [Text]
a} :: CreateEndpointAccess) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createEndpointAccess_workgroupName :: Lens.Lens' CreateEndpointAccess Prelude.Text
createEndpointAccess_workgroupName :: Lens' CreateEndpointAccess Text
createEndpointAccess_workgroupName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEndpointAccess' {Text
workgroupName :: Text
$sel:workgroupName:CreateEndpointAccess' :: CreateEndpointAccess -> Text
workgroupName} -> Text
workgroupName) (\s :: CreateEndpointAccess
s@CreateEndpointAccess' {} Text
a -> CreateEndpointAccess
s {$sel:workgroupName:CreateEndpointAccess' :: Text
workgroupName = Text
a} :: CreateEndpointAccess)
instance Core.AWSRequest CreateEndpointAccess where
type
AWSResponse CreateEndpointAccess =
CreateEndpointAccessResponse
request :: (Service -> Service)
-> CreateEndpointAccess -> Request CreateEndpointAccess
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreateEndpointAccess
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateEndpointAccess)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe EndpointAccess -> Int -> CreateEndpointAccessResponse
CreateEndpointAccessResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"endpoint")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable CreateEndpointAccess where
hashWithSalt :: Int -> CreateEndpointAccess -> Int
hashWithSalt Int
_salt CreateEndpointAccess' {[Text]
Maybe [Text]
Text
workgroupName :: Text
subnetIds :: [Text]
endpointName :: Text
vpcSecurityGroupIds :: Maybe [Text]
$sel:workgroupName:CreateEndpointAccess' :: CreateEndpointAccess -> Text
$sel:subnetIds:CreateEndpointAccess' :: CreateEndpointAccess -> [Text]
$sel:endpointName:CreateEndpointAccess' :: CreateEndpointAccess -> Text
$sel:vpcSecurityGroupIds:CreateEndpointAccess' :: CreateEndpointAccess -> Maybe [Text]
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
vpcSecurityGroupIds
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
endpointName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [Text]
subnetIds
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
workgroupName
instance Prelude.NFData CreateEndpointAccess where
rnf :: CreateEndpointAccess -> ()
rnf CreateEndpointAccess' {[Text]
Maybe [Text]
Text
workgroupName :: Text
subnetIds :: [Text]
endpointName :: Text
vpcSecurityGroupIds :: Maybe [Text]
$sel:workgroupName:CreateEndpointAccess' :: CreateEndpointAccess -> Text
$sel:subnetIds:CreateEndpointAccess' :: CreateEndpointAccess -> [Text]
$sel:endpointName:CreateEndpointAccess' :: CreateEndpointAccess -> Text
$sel:vpcSecurityGroupIds:CreateEndpointAccess' :: CreateEndpointAccess -> Maybe [Text]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
vpcSecurityGroupIds
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
endpointName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [Text]
subnetIds
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
workgroupName
instance Data.ToHeaders CreateEndpointAccess where
toHeaders :: CreateEndpointAccess -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"RedshiftServerless.CreateEndpointAccess" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON CreateEndpointAccess where
toJSON :: CreateEndpointAccess -> Value
toJSON CreateEndpointAccess' {[Text]
Maybe [Text]
Text
workgroupName :: Text
subnetIds :: [Text]
endpointName :: Text
vpcSecurityGroupIds :: Maybe [Text]
$sel:workgroupName:CreateEndpointAccess' :: CreateEndpointAccess -> Text
$sel:subnetIds:CreateEndpointAccess' :: CreateEndpointAccess -> [Text]
$sel:endpointName:CreateEndpointAccess' :: CreateEndpointAccess -> Text
$sel:vpcSecurityGroupIds:CreateEndpointAccess' :: CreateEndpointAccess -> Maybe [Text]
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"vpcSecurityGroupIds" 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]
vpcSecurityGroupIds,
forall a. a -> Maybe a
Prelude.Just (Key
"endpointName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
endpointName),
forall a. a -> Maybe a
Prelude.Just (Key
"subnetIds" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [Text]
subnetIds),
forall a. a -> Maybe a
Prelude.Just
(Key
"workgroupName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
workgroupName)
]
)
instance Data.ToPath CreateEndpointAccess where
toPath :: CreateEndpointAccess -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery CreateEndpointAccess where
toQuery :: CreateEndpointAccess -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data CreateEndpointAccessResponse = CreateEndpointAccessResponse'
{
CreateEndpointAccessResponse -> Maybe EndpointAccess
endpoint :: Prelude.Maybe EndpointAccess,
CreateEndpointAccessResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateEndpointAccessResponse
-> CreateEndpointAccessResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateEndpointAccessResponse
-> CreateEndpointAccessResponse -> Bool
$c/= :: CreateEndpointAccessResponse
-> CreateEndpointAccessResponse -> Bool
== :: CreateEndpointAccessResponse
-> CreateEndpointAccessResponse -> Bool
$c== :: CreateEndpointAccessResponse
-> CreateEndpointAccessResponse -> Bool
Prelude.Eq, ReadPrec [CreateEndpointAccessResponse]
ReadPrec CreateEndpointAccessResponse
Int -> ReadS CreateEndpointAccessResponse
ReadS [CreateEndpointAccessResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateEndpointAccessResponse]
$creadListPrec :: ReadPrec [CreateEndpointAccessResponse]
readPrec :: ReadPrec CreateEndpointAccessResponse
$creadPrec :: ReadPrec CreateEndpointAccessResponse
readList :: ReadS [CreateEndpointAccessResponse]
$creadList :: ReadS [CreateEndpointAccessResponse]
readsPrec :: Int -> ReadS CreateEndpointAccessResponse
$creadsPrec :: Int -> ReadS CreateEndpointAccessResponse
Prelude.Read, Int -> CreateEndpointAccessResponse -> ShowS
[CreateEndpointAccessResponse] -> ShowS
CreateEndpointAccessResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateEndpointAccessResponse] -> ShowS
$cshowList :: [CreateEndpointAccessResponse] -> ShowS
show :: CreateEndpointAccessResponse -> String
$cshow :: CreateEndpointAccessResponse -> String
showsPrec :: Int -> CreateEndpointAccessResponse -> ShowS
$cshowsPrec :: Int -> CreateEndpointAccessResponse -> ShowS
Prelude.Show, forall x.
Rep CreateEndpointAccessResponse x -> CreateEndpointAccessResponse
forall x.
CreateEndpointAccessResponse -> Rep CreateEndpointAccessResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateEndpointAccessResponse x -> CreateEndpointAccessResponse
$cfrom :: forall x.
CreateEndpointAccessResponse -> Rep CreateEndpointAccessResponse x
Prelude.Generic)
newCreateEndpointAccessResponse ::
Prelude.Int ->
CreateEndpointAccessResponse
newCreateEndpointAccessResponse :: Int -> CreateEndpointAccessResponse
newCreateEndpointAccessResponse Int
pHttpStatus_ =
CreateEndpointAccessResponse'
{ $sel:endpoint:CreateEndpointAccessResponse' :: Maybe EndpointAccess
endpoint =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateEndpointAccessResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createEndpointAccessResponse_endpoint :: Lens.Lens' CreateEndpointAccessResponse (Prelude.Maybe EndpointAccess)
createEndpointAccessResponse_endpoint :: Lens' CreateEndpointAccessResponse (Maybe EndpointAccess)
createEndpointAccessResponse_endpoint = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEndpointAccessResponse' {Maybe EndpointAccess
endpoint :: Maybe EndpointAccess
$sel:endpoint:CreateEndpointAccessResponse' :: CreateEndpointAccessResponse -> Maybe EndpointAccess
endpoint} -> Maybe EndpointAccess
endpoint) (\s :: CreateEndpointAccessResponse
s@CreateEndpointAccessResponse' {} Maybe EndpointAccess
a -> CreateEndpointAccessResponse
s {$sel:endpoint:CreateEndpointAccessResponse' :: Maybe EndpointAccess
endpoint = Maybe EndpointAccess
a} :: CreateEndpointAccessResponse)
createEndpointAccessResponse_httpStatus :: Lens.Lens' CreateEndpointAccessResponse Prelude.Int
createEndpointAccessResponse_httpStatus :: Lens' CreateEndpointAccessResponse Int
createEndpointAccessResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEndpointAccessResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateEndpointAccessResponse' :: CreateEndpointAccessResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateEndpointAccessResponse
s@CreateEndpointAccessResponse' {} Int
a -> CreateEndpointAccessResponse
s {$sel:httpStatus:CreateEndpointAccessResponse' :: Int
httpStatus = Int
a} :: CreateEndpointAccessResponse)
instance Prelude.NFData CreateEndpointAccessResponse where
rnf :: CreateEndpointAccessResponse -> ()
rnf CreateEndpointAccessResponse' {Int
Maybe EndpointAccess
httpStatus :: Int
endpoint :: Maybe EndpointAccess
$sel:httpStatus:CreateEndpointAccessResponse' :: CreateEndpointAccessResponse -> Int
$sel:endpoint:CreateEndpointAccessResponse' :: CreateEndpointAccessResponse -> Maybe EndpointAccess
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe EndpointAccess
endpoint
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus