{-# 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.WorkSpaces.CreateConnectionAlias
(
CreateConnectionAlias (..),
newCreateConnectionAlias,
createConnectionAlias_tags,
createConnectionAlias_connectionString,
CreateConnectionAliasResponse (..),
newCreateConnectionAliasResponse,
createConnectionAliasResponse_aliasId,
createConnectionAliasResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.WorkSpaces.Types
data CreateConnectionAlias = CreateConnectionAlias'
{
CreateConnectionAlias -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
CreateConnectionAlias -> Text
connectionString :: Prelude.Text
}
deriving (CreateConnectionAlias -> CreateConnectionAlias -> Bool
(CreateConnectionAlias -> CreateConnectionAlias -> Bool)
-> (CreateConnectionAlias -> CreateConnectionAlias -> Bool)
-> Eq CreateConnectionAlias
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateConnectionAlias -> CreateConnectionAlias -> Bool
$c/= :: CreateConnectionAlias -> CreateConnectionAlias -> Bool
== :: CreateConnectionAlias -> CreateConnectionAlias -> Bool
$c== :: CreateConnectionAlias -> CreateConnectionAlias -> Bool
Prelude.Eq, ReadPrec [CreateConnectionAlias]
ReadPrec CreateConnectionAlias
Int -> ReadS CreateConnectionAlias
ReadS [CreateConnectionAlias]
(Int -> ReadS CreateConnectionAlias)
-> ReadS [CreateConnectionAlias]
-> ReadPrec CreateConnectionAlias
-> ReadPrec [CreateConnectionAlias]
-> Read CreateConnectionAlias
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateConnectionAlias]
$creadListPrec :: ReadPrec [CreateConnectionAlias]
readPrec :: ReadPrec CreateConnectionAlias
$creadPrec :: ReadPrec CreateConnectionAlias
readList :: ReadS [CreateConnectionAlias]
$creadList :: ReadS [CreateConnectionAlias]
readsPrec :: Int -> ReadS CreateConnectionAlias
$creadsPrec :: Int -> ReadS CreateConnectionAlias
Prelude.Read, Int -> CreateConnectionAlias -> ShowS
[CreateConnectionAlias] -> ShowS
CreateConnectionAlias -> String
(Int -> CreateConnectionAlias -> ShowS)
-> (CreateConnectionAlias -> String)
-> ([CreateConnectionAlias] -> ShowS)
-> Show CreateConnectionAlias
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateConnectionAlias] -> ShowS
$cshowList :: [CreateConnectionAlias] -> ShowS
show :: CreateConnectionAlias -> String
$cshow :: CreateConnectionAlias -> String
showsPrec :: Int -> CreateConnectionAlias -> ShowS
$cshowsPrec :: Int -> CreateConnectionAlias -> ShowS
Prelude.Show, (forall x. CreateConnectionAlias -> Rep CreateConnectionAlias x)
-> (forall x. Rep CreateConnectionAlias x -> CreateConnectionAlias)
-> Generic CreateConnectionAlias
forall x. Rep CreateConnectionAlias x -> CreateConnectionAlias
forall x. CreateConnectionAlias -> Rep CreateConnectionAlias x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateConnectionAlias x -> CreateConnectionAlias
$cfrom :: forall x. CreateConnectionAlias -> Rep CreateConnectionAlias x
Prelude.Generic)
newCreateConnectionAlias ::
Prelude.Text ->
CreateConnectionAlias
newCreateConnectionAlias :: Text -> CreateConnectionAlias
newCreateConnectionAlias Text
pConnectionString_ =
CreateConnectionAlias' :: Maybe [Tag] -> Text -> CreateConnectionAlias
CreateConnectionAlias'
{ $sel:tags:CreateConnectionAlias' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
$sel:connectionString:CreateConnectionAlias' :: Text
connectionString = Text
pConnectionString_
}
createConnectionAlias_tags :: Lens.Lens' CreateConnectionAlias (Prelude.Maybe [Tag])
createConnectionAlias_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateConnectionAlias -> f CreateConnectionAlias
createConnectionAlias_tags = (CreateConnectionAlias -> Maybe [Tag])
-> (CreateConnectionAlias -> Maybe [Tag] -> CreateConnectionAlias)
-> Lens
CreateConnectionAlias
CreateConnectionAlias
(Maybe [Tag])
(Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateConnectionAlias' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateConnectionAlias' :: CreateConnectionAlias -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateConnectionAlias
s@CreateConnectionAlias' {} Maybe [Tag]
a -> CreateConnectionAlias
s {$sel:tags:CreateConnectionAlias' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateConnectionAlias) ((Maybe [Tag] -> f (Maybe [Tag]))
-> CreateConnectionAlias -> f CreateConnectionAlias)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
-> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateConnectionAlias
-> f CreateConnectionAlias
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
createConnectionAlias_connectionString :: Lens.Lens' CreateConnectionAlias Prelude.Text
createConnectionAlias_connectionString :: (Text -> f Text)
-> CreateConnectionAlias -> f CreateConnectionAlias
createConnectionAlias_connectionString = (CreateConnectionAlias -> Text)
-> (CreateConnectionAlias -> Text -> CreateConnectionAlias)
-> Lens CreateConnectionAlias CreateConnectionAlias Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateConnectionAlias' {Text
connectionString :: Text
$sel:connectionString:CreateConnectionAlias' :: CreateConnectionAlias -> Text
connectionString} -> Text
connectionString) (\s :: CreateConnectionAlias
s@CreateConnectionAlias' {} Text
a -> CreateConnectionAlias
s {$sel:connectionString:CreateConnectionAlias' :: Text
connectionString = Text
a} :: CreateConnectionAlias)
instance Core.AWSRequest CreateConnectionAlias where
type
AWSResponse CreateConnectionAlias =
CreateConnectionAliasResponse
request :: CreateConnectionAlias -> Request CreateConnectionAlias
request = Service -> CreateConnectionAlias -> Request CreateConnectionAlias
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateConnectionAlias
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateConnectionAlias)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateConnectionAlias))
-> Logger
-> Service
-> Proxy CreateConnectionAlias
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateConnectionAlias)))
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 ->
Maybe Text -> Int -> CreateConnectionAliasResponse
CreateConnectionAliasResponse'
(Maybe Text -> Int -> CreateConnectionAliasResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateConnectionAliasResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"AliasId")
Either String (Int -> CreateConnectionAliasResponse)
-> Either String Int -> Either String CreateConnectionAliasResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable CreateConnectionAlias
instance Prelude.NFData CreateConnectionAlias
instance Core.ToHeaders CreateConnectionAlias where
toHeaders :: CreateConnectionAlias -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateConnectionAlias -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"WorkspacesService.CreateConnectionAlias" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON CreateConnectionAlias where
toJSON :: CreateConnectionAlias -> Value
toJSON CreateConnectionAlias' {Maybe [Tag]
Text
connectionString :: Text
tags :: Maybe [Tag]
$sel:connectionString:CreateConnectionAlias' :: CreateConnectionAlias -> Text
$sel:tags:CreateConnectionAlias' :: CreateConnectionAlias -> Maybe [Tag]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (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
"ConnectionString" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
connectionString)
]
)
instance Core.ToPath CreateConnectionAlias where
toPath :: CreateConnectionAlias -> ByteString
toPath = ByteString -> CreateConnectionAlias -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateConnectionAlias where
toQuery :: CreateConnectionAlias -> QueryString
toQuery = QueryString -> CreateConnectionAlias -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateConnectionAliasResponse = CreateConnectionAliasResponse'
{
CreateConnectionAliasResponse -> Maybe Text
aliasId :: Prelude.Maybe Prelude.Text,
CreateConnectionAliasResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateConnectionAliasResponse
-> CreateConnectionAliasResponse -> Bool
(CreateConnectionAliasResponse
-> CreateConnectionAliasResponse -> Bool)
-> (CreateConnectionAliasResponse
-> CreateConnectionAliasResponse -> Bool)
-> Eq CreateConnectionAliasResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateConnectionAliasResponse
-> CreateConnectionAliasResponse -> Bool
$c/= :: CreateConnectionAliasResponse
-> CreateConnectionAliasResponse -> Bool
== :: CreateConnectionAliasResponse
-> CreateConnectionAliasResponse -> Bool
$c== :: CreateConnectionAliasResponse
-> CreateConnectionAliasResponse -> Bool
Prelude.Eq, ReadPrec [CreateConnectionAliasResponse]
ReadPrec CreateConnectionAliasResponse
Int -> ReadS CreateConnectionAliasResponse
ReadS [CreateConnectionAliasResponse]
(Int -> ReadS CreateConnectionAliasResponse)
-> ReadS [CreateConnectionAliasResponse]
-> ReadPrec CreateConnectionAliasResponse
-> ReadPrec [CreateConnectionAliasResponse]
-> Read CreateConnectionAliasResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateConnectionAliasResponse]
$creadListPrec :: ReadPrec [CreateConnectionAliasResponse]
readPrec :: ReadPrec CreateConnectionAliasResponse
$creadPrec :: ReadPrec CreateConnectionAliasResponse
readList :: ReadS [CreateConnectionAliasResponse]
$creadList :: ReadS [CreateConnectionAliasResponse]
readsPrec :: Int -> ReadS CreateConnectionAliasResponse
$creadsPrec :: Int -> ReadS CreateConnectionAliasResponse
Prelude.Read, Int -> CreateConnectionAliasResponse -> ShowS
[CreateConnectionAliasResponse] -> ShowS
CreateConnectionAliasResponse -> String
(Int -> CreateConnectionAliasResponse -> ShowS)
-> (CreateConnectionAliasResponse -> String)
-> ([CreateConnectionAliasResponse] -> ShowS)
-> Show CreateConnectionAliasResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateConnectionAliasResponse] -> ShowS
$cshowList :: [CreateConnectionAliasResponse] -> ShowS
show :: CreateConnectionAliasResponse -> String
$cshow :: CreateConnectionAliasResponse -> String
showsPrec :: Int -> CreateConnectionAliasResponse -> ShowS
$cshowsPrec :: Int -> CreateConnectionAliasResponse -> ShowS
Prelude.Show, (forall x.
CreateConnectionAliasResponse
-> Rep CreateConnectionAliasResponse x)
-> (forall x.
Rep CreateConnectionAliasResponse x
-> CreateConnectionAliasResponse)
-> Generic CreateConnectionAliasResponse
forall x.
Rep CreateConnectionAliasResponse x
-> CreateConnectionAliasResponse
forall x.
CreateConnectionAliasResponse
-> Rep CreateConnectionAliasResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateConnectionAliasResponse x
-> CreateConnectionAliasResponse
$cfrom :: forall x.
CreateConnectionAliasResponse
-> Rep CreateConnectionAliasResponse x
Prelude.Generic)
newCreateConnectionAliasResponse ::
Prelude.Int ->
CreateConnectionAliasResponse
newCreateConnectionAliasResponse :: Int -> CreateConnectionAliasResponse
newCreateConnectionAliasResponse Int
pHttpStatus_ =
CreateConnectionAliasResponse' :: Maybe Text -> Int -> CreateConnectionAliasResponse
CreateConnectionAliasResponse'
{ $sel:aliasId:CreateConnectionAliasResponse' :: Maybe Text
aliasId =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateConnectionAliasResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createConnectionAliasResponse_aliasId :: Lens.Lens' CreateConnectionAliasResponse (Prelude.Maybe Prelude.Text)
createConnectionAliasResponse_aliasId :: (Maybe Text -> f (Maybe Text))
-> CreateConnectionAliasResponse -> f CreateConnectionAliasResponse
createConnectionAliasResponse_aliasId = (CreateConnectionAliasResponse -> Maybe Text)
-> (CreateConnectionAliasResponse
-> Maybe Text -> CreateConnectionAliasResponse)
-> Lens
CreateConnectionAliasResponse
CreateConnectionAliasResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateConnectionAliasResponse' {Maybe Text
aliasId :: Maybe Text
$sel:aliasId:CreateConnectionAliasResponse' :: CreateConnectionAliasResponse -> Maybe Text
aliasId} -> Maybe Text
aliasId) (\s :: CreateConnectionAliasResponse
s@CreateConnectionAliasResponse' {} Maybe Text
a -> CreateConnectionAliasResponse
s {$sel:aliasId:CreateConnectionAliasResponse' :: Maybe Text
aliasId = Maybe Text
a} :: CreateConnectionAliasResponse)
createConnectionAliasResponse_httpStatus :: Lens.Lens' CreateConnectionAliasResponse Prelude.Int
createConnectionAliasResponse_httpStatus :: (Int -> f Int)
-> CreateConnectionAliasResponse -> f CreateConnectionAliasResponse
createConnectionAliasResponse_httpStatus = (CreateConnectionAliasResponse -> Int)
-> (CreateConnectionAliasResponse
-> Int -> CreateConnectionAliasResponse)
-> Lens
CreateConnectionAliasResponse CreateConnectionAliasResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateConnectionAliasResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateConnectionAliasResponse' :: CreateConnectionAliasResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateConnectionAliasResponse
s@CreateConnectionAliasResponse' {} Int
a -> CreateConnectionAliasResponse
s {$sel:httpStatus:CreateConnectionAliasResponse' :: Int
httpStatus = Int
a} :: CreateConnectionAliasResponse)
instance Prelude.NFData CreateConnectionAliasResponse