{-# 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.Lens as Lens
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
(CreateDomainEntry -> CreateDomainEntry -> Bool)
-> (CreateDomainEntry -> CreateDomainEntry -> Bool)
-> Eq CreateDomainEntry
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]
(Int -> ReadS CreateDomainEntry)
-> ReadS [CreateDomainEntry]
-> ReadPrec CreateDomainEntry
-> ReadPrec [CreateDomainEntry]
-> Read 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
(Int -> CreateDomainEntry -> ShowS)
-> (CreateDomainEntry -> String)
-> ([CreateDomainEntry] -> ShowS)
-> Show CreateDomainEntry
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. CreateDomainEntry -> Rep CreateDomainEntry x)
-> (forall x. Rep CreateDomainEntry x -> CreateDomainEntry)
-> Generic CreateDomainEntry
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' :: Text -> DomainEntry -> CreateDomainEntry
CreateDomainEntry'
{ $sel:domainName:CreateDomainEntry' :: Text
domainName = Text
pDomainName_,
$sel:domainEntry:CreateDomainEntry' :: DomainEntry
domainEntry = DomainEntry
pDomainEntry_
}
createDomainEntry_domainName :: Lens.Lens' CreateDomainEntry Prelude.Text
createDomainEntry_domainName :: (Text -> f Text) -> CreateDomainEntry -> f CreateDomainEntry
createDomainEntry_domainName = (CreateDomainEntry -> Text)
-> (CreateDomainEntry -> Text -> CreateDomainEntry)
-> Lens CreateDomainEntry CreateDomainEntry Text Text
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 :: (DomainEntry -> f DomainEntry)
-> CreateDomainEntry -> f CreateDomainEntry
createDomainEntry_domainEntry = (CreateDomainEntry -> DomainEntry)
-> (CreateDomainEntry -> DomainEntry -> CreateDomainEntry)
-> Lens CreateDomainEntry CreateDomainEntry DomainEntry 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 :: CreateDomainEntry -> Request CreateDomainEntry
request = Service -> CreateDomainEntry -> Request CreateDomainEntry
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateDomainEntry
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateDomainEntry)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateDomainEntry))
-> Logger
-> Service
-> Proxy CreateDomainEntry
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateDomainEntry)))
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 Operation -> Int -> CreateDomainEntryResponse
CreateDomainEntryResponse'
(Maybe Operation -> Int -> CreateDomainEntryResponse)
-> Either String (Maybe Operation)
-> Either String (Int -> CreateDomainEntryResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Operation)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"operation")
Either String (Int -> CreateDomainEntryResponse)
-> Either String Int -> Either String CreateDomainEntryResponse
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 CreateDomainEntry
instance Prelude.NFData CreateDomainEntry
instance Core.ToHeaders CreateDomainEntry where
toHeaders :: CreateDomainEntry -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateDomainEntry -> 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
"Lightsail_20161128.CreateDomainEntry" ::
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 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
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"domainName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
domainName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"domainEntry" Text -> DomainEntry -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= DomainEntry
domainEntry)
]
)
instance Core.ToPath CreateDomainEntry where
toPath :: CreateDomainEntry -> ByteString
toPath = ByteString -> CreateDomainEntry -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateDomainEntry where
toQuery :: CreateDomainEntry -> QueryString
toQuery = QueryString -> CreateDomainEntry -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(CreateDomainEntryResponse -> CreateDomainEntryResponse -> Bool)
-> (CreateDomainEntryResponse -> CreateDomainEntryResponse -> Bool)
-> Eq CreateDomainEntryResponse
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]
(Int -> ReadS CreateDomainEntryResponse)
-> ReadS [CreateDomainEntryResponse]
-> ReadPrec CreateDomainEntryResponse
-> ReadPrec [CreateDomainEntryResponse]
-> Read 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
(Int -> CreateDomainEntryResponse -> ShowS)
-> (CreateDomainEntryResponse -> String)
-> ([CreateDomainEntryResponse] -> ShowS)
-> Show CreateDomainEntryResponse
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.
CreateDomainEntryResponse -> Rep CreateDomainEntryResponse x)
-> (forall x.
Rep CreateDomainEntryResponse x -> CreateDomainEntryResponse)
-> Generic CreateDomainEntryResponse
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' :: Maybe Operation -> Int -> CreateDomainEntryResponse
CreateDomainEntryResponse'
{ $sel:operation:CreateDomainEntryResponse' :: Maybe Operation
operation =
Maybe Operation
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateDomainEntryResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createDomainEntryResponse_operation :: Lens.Lens' CreateDomainEntryResponse (Prelude.Maybe Operation)
createDomainEntryResponse_operation :: (Maybe Operation -> f (Maybe Operation))
-> CreateDomainEntryResponse -> f CreateDomainEntryResponse
createDomainEntryResponse_operation = (CreateDomainEntryResponse -> Maybe Operation)
-> (CreateDomainEntryResponse
-> Maybe Operation -> CreateDomainEntryResponse)
-> Lens
CreateDomainEntryResponse
CreateDomainEntryResponse
(Maybe Operation)
(Maybe 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 :: (Int -> f Int)
-> CreateDomainEntryResponse -> f CreateDomainEntryResponse
createDomainEntryResponse_httpStatus = (CreateDomainEntryResponse -> Int)
-> (CreateDomainEntryResponse -> Int -> CreateDomainEntryResponse)
-> Lens CreateDomainEntryResponse CreateDomainEntryResponse Int Int
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