{-# 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.Lightsail.CreateDomainEntry
(
CreateDomainEntry (..),
newCreateDomainEntry,
createDomainEntry_domainName,
createDomainEntry_domainEntry,
CreateDomainEntryResponse (..),
newCreateDomainEntryResponse,
createDomainEntryResponse_operation,
createDomainEntryResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Lightsail.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data CreateDomainEntry = CreateDomainEntry'
{
CreateDomainEntry -> Text
domainName :: Prelude.Text,
CreateDomainEntry -> DomainEntry
domainEntry :: DomainEntry
}
deriving (CreateDomainEntry -> CreateDomainEntry -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateDomainEntry -> CreateDomainEntry -> Bool
$c/= :: CreateDomainEntry -> CreateDomainEntry -> Bool
== :: CreateDomainEntry -> CreateDomainEntry -> Bool
$c== :: CreateDomainEntry -> CreateDomainEntry -> Bool
Prelude.Eq, ReadPrec [CreateDomainEntry]
ReadPrec CreateDomainEntry
Int -> ReadS CreateDomainEntry
ReadS [CreateDomainEntry]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateDomainEntry]
$creadListPrec :: ReadPrec [CreateDomainEntry]
readPrec :: ReadPrec CreateDomainEntry
$creadPrec :: ReadPrec CreateDomainEntry
readList :: ReadS [CreateDomainEntry]
$creadList :: ReadS [CreateDomainEntry]
readsPrec :: Int -> ReadS CreateDomainEntry
$creadsPrec :: Int -> ReadS CreateDomainEntry
Prelude.Read, Int -> CreateDomainEntry -> ShowS
[CreateDomainEntry] -> ShowS
CreateDomainEntry -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateDomainEntry] -> ShowS
$cshowList :: [CreateDomainEntry] -> ShowS
show :: CreateDomainEntry -> String
$cshow :: CreateDomainEntry -> String
showsPrec :: Int -> CreateDomainEntry -> ShowS
$cshowsPrec :: Int -> CreateDomainEntry -> ShowS
Prelude.Show, forall x. Rep CreateDomainEntry x -> CreateDomainEntry
forall x. CreateDomainEntry -> Rep CreateDomainEntry x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateDomainEntry x -> CreateDomainEntry
$cfrom :: forall x. CreateDomainEntry -> Rep CreateDomainEntry x
Prelude.Generic)
newCreateDomainEntry ::
Prelude.Text ->
DomainEntry ->
CreateDomainEntry
newCreateDomainEntry :: Text -> DomainEntry -> CreateDomainEntry
newCreateDomainEntry Text
pDomainName_ DomainEntry
pDomainEntry_ =
CreateDomainEntry'
{ $sel:domainName:CreateDomainEntry' :: Text
domainName = Text
pDomainName_,
$sel:domainEntry:CreateDomainEntry' :: DomainEntry
domainEntry = DomainEntry
pDomainEntry_
}
createDomainEntry_domainName :: Lens.Lens' CreateDomainEntry Prelude.Text
createDomainEntry_domainName :: Lens' CreateDomainEntry Text
createDomainEntry_domainName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDomainEntry' {Text
domainName :: Text
$sel:domainName:CreateDomainEntry' :: CreateDomainEntry -> Text
domainName} -> Text
domainName) (\s :: CreateDomainEntry
s@CreateDomainEntry' {} Text
a -> CreateDomainEntry
s {$sel:domainName:CreateDomainEntry' :: Text
domainName = Text
a} :: CreateDomainEntry)
createDomainEntry_domainEntry :: Lens.Lens' CreateDomainEntry DomainEntry
createDomainEntry_domainEntry :: Lens' CreateDomainEntry DomainEntry
createDomainEntry_domainEntry = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDomainEntry' {DomainEntry
domainEntry :: DomainEntry
$sel:domainEntry:CreateDomainEntry' :: CreateDomainEntry -> DomainEntry
domainEntry} -> DomainEntry
domainEntry) (\s :: CreateDomainEntry
s@CreateDomainEntry' {} DomainEntry
a -> CreateDomainEntry
s {$sel:domainEntry:CreateDomainEntry' :: DomainEntry
domainEntry = DomainEntry
a} :: CreateDomainEntry)
instance Core.AWSRequest CreateDomainEntry where
type
AWSResponse CreateDomainEntry =
CreateDomainEntryResponse
request :: (Service -> Service)
-> CreateDomainEntry -> Request CreateDomainEntry
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 CreateDomainEntry
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateDomainEntry)))
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 Operation -> Int -> CreateDomainEntryResponse
CreateDomainEntryResponse'
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
"operation")
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 CreateDomainEntry where
hashWithSalt :: Int -> CreateDomainEntry -> Int
hashWithSalt Int
_salt CreateDomainEntry' {Text
DomainEntry
domainEntry :: DomainEntry
domainName :: Text
$sel:domainEntry:CreateDomainEntry' :: CreateDomainEntry -> DomainEntry
$sel:domainName:CreateDomainEntry' :: CreateDomainEntry -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
domainName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` DomainEntry
domainEntry
instance Prelude.NFData CreateDomainEntry where
rnf :: CreateDomainEntry -> ()
rnf CreateDomainEntry' {Text
DomainEntry
domainEntry :: DomainEntry
domainName :: Text
$sel:domainEntry:CreateDomainEntry' :: CreateDomainEntry -> DomainEntry
$sel:domainName:CreateDomainEntry' :: CreateDomainEntry -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
domainName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf DomainEntry
domainEntry
instance Data.ToHeaders CreateDomainEntry where
toHeaders :: CreateDomainEntry -> 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
"Lightsail_20161128.CreateDomainEntry" ::
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 CreateDomainEntry where
toJSON :: CreateDomainEntry -> Value
toJSON CreateDomainEntry' {Text
DomainEntry
domainEntry :: DomainEntry
domainName :: Text
$sel:domainEntry:CreateDomainEntry' :: CreateDomainEntry -> DomainEntry
$sel:domainName:CreateDomainEntry' :: CreateDomainEntry -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"domainName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
domainName),
forall a. a -> Maybe a
Prelude.Just (Key
"domainEntry" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= DomainEntry
domainEntry)
]
)
instance Data.ToPath CreateDomainEntry where
toPath :: CreateDomainEntry -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery CreateDomainEntry where
toQuery :: CreateDomainEntry -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data CreateDomainEntryResponse = CreateDomainEntryResponse'
{
CreateDomainEntryResponse -> Maybe Operation
operation :: Prelude.Maybe Operation,
CreateDomainEntryResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateDomainEntryResponse -> CreateDomainEntryResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateDomainEntryResponse -> CreateDomainEntryResponse -> Bool
$c/= :: CreateDomainEntryResponse -> CreateDomainEntryResponse -> Bool
== :: CreateDomainEntryResponse -> CreateDomainEntryResponse -> Bool
$c== :: CreateDomainEntryResponse -> CreateDomainEntryResponse -> Bool
Prelude.Eq, ReadPrec [CreateDomainEntryResponse]
ReadPrec CreateDomainEntryResponse
Int -> ReadS CreateDomainEntryResponse
ReadS [CreateDomainEntryResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateDomainEntryResponse]
$creadListPrec :: ReadPrec [CreateDomainEntryResponse]
readPrec :: ReadPrec CreateDomainEntryResponse
$creadPrec :: ReadPrec CreateDomainEntryResponse
readList :: ReadS [CreateDomainEntryResponse]
$creadList :: ReadS [CreateDomainEntryResponse]
readsPrec :: Int -> ReadS CreateDomainEntryResponse
$creadsPrec :: Int -> ReadS CreateDomainEntryResponse
Prelude.Read, Int -> CreateDomainEntryResponse -> ShowS
[CreateDomainEntryResponse] -> ShowS
CreateDomainEntryResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateDomainEntryResponse] -> ShowS
$cshowList :: [CreateDomainEntryResponse] -> ShowS
show :: CreateDomainEntryResponse -> String
$cshow :: CreateDomainEntryResponse -> String
showsPrec :: Int -> CreateDomainEntryResponse -> ShowS
$cshowsPrec :: Int -> CreateDomainEntryResponse -> ShowS
Prelude.Show, forall x.
Rep CreateDomainEntryResponse x -> CreateDomainEntryResponse
forall x.
CreateDomainEntryResponse -> Rep CreateDomainEntryResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateDomainEntryResponse x -> CreateDomainEntryResponse
$cfrom :: forall x.
CreateDomainEntryResponse -> Rep CreateDomainEntryResponse x
Prelude.Generic)
newCreateDomainEntryResponse ::
Prelude.Int ->
CreateDomainEntryResponse
newCreateDomainEntryResponse :: Int -> CreateDomainEntryResponse
newCreateDomainEntryResponse Int
pHttpStatus_ =
CreateDomainEntryResponse'
{ $sel:operation:CreateDomainEntryResponse' :: Maybe Operation
operation =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateDomainEntryResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createDomainEntryResponse_operation :: Lens.Lens' CreateDomainEntryResponse (Prelude.Maybe Operation)
createDomainEntryResponse_operation :: Lens' CreateDomainEntryResponse (Maybe Operation)
createDomainEntryResponse_operation = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDomainEntryResponse' {Maybe Operation
operation :: Maybe Operation
$sel:operation:CreateDomainEntryResponse' :: CreateDomainEntryResponse -> Maybe Operation
operation} -> Maybe Operation
operation) (\s :: CreateDomainEntryResponse
s@CreateDomainEntryResponse' {} Maybe Operation
a -> CreateDomainEntryResponse
s {$sel:operation:CreateDomainEntryResponse' :: Maybe Operation
operation = Maybe Operation
a} :: CreateDomainEntryResponse)
createDomainEntryResponse_httpStatus :: Lens.Lens' CreateDomainEntryResponse Prelude.Int
createDomainEntryResponse_httpStatus :: Lens' CreateDomainEntryResponse Int
createDomainEntryResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDomainEntryResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateDomainEntryResponse' :: CreateDomainEntryResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateDomainEntryResponse
s@CreateDomainEntryResponse' {} Int
a -> CreateDomainEntryResponse
s {$sel:httpStatus:CreateDomainEntryResponse' :: Int
httpStatus = Int
a} :: CreateDomainEntryResponse)
instance Prelude.NFData CreateDomainEntryResponse where
rnf :: CreateDomainEntryResponse -> ()
rnf CreateDomainEntryResponse' {Int
Maybe Operation
httpStatus :: Int
operation :: Maybe Operation
$sel:httpStatus:CreateDomainEntryResponse' :: CreateDomainEntryResponse -> Int
$sel:operation:CreateDomainEntryResponse' :: CreateDomainEntryResponse -> Maybe Operation
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Operation
operation
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus