{-# 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.UpdateDomainEntry
(
UpdateDomainEntry (..),
newUpdateDomainEntry,
updateDomainEntry_domainName,
updateDomainEntry_domainEntry,
UpdateDomainEntryResponse (..),
newUpdateDomainEntryResponse,
updateDomainEntryResponse_operations,
updateDomainEntryResponse_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 UpdateDomainEntry = UpdateDomainEntry'
{
UpdateDomainEntry -> Text
domainName :: Prelude.Text,
UpdateDomainEntry -> DomainEntry
domainEntry :: DomainEntry
}
deriving (UpdateDomainEntry -> UpdateDomainEntry -> Bool
(UpdateDomainEntry -> UpdateDomainEntry -> Bool)
-> (UpdateDomainEntry -> UpdateDomainEntry -> Bool)
-> Eq UpdateDomainEntry
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateDomainEntry -> UpdateDomainEntry -> Bool
$c/= :: UpdateDomainEntry -> UpdateDomainEntry -> Bool
== :: UpdateDomainEntry -> UpdateDomainEntry -> Bool
$c== :: UpdateDomainEntry -> UpdateDomainEntry -> Bool
Prelude.Eq, ReadPrec [UpdateDomainEntry]
ReadPrec UpdateDomainEntry
Int -> ReadS UpdateDomainEntry
ReadS [UpdateDomainEntry]
(Int -> ReadS UpdateDomainEntry)
-> ReadS [UpdateDomainEntry]
-> ReadPrec UpdateDomainEntry
-> ReadPrec [UpdateDomainEntry]
-> Read UpdateDomainEntry
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateDomainEntry]
$creadListPrec :: ReadPrec [UpdateDomainEntry]
readPrec :: ReadPrec UpdateDomainEntry
$creadPrec :: ReadPrec UpdateDomainEntry
readList :: ReadS [UpdateDomainEntry]
$creadList :: ReadS [UpdateDomainEntry]
readsPrec :: Int -> ReadS UpdateDomainEntry
$creadsPrec :: Int -> ReadS UpdateDomainEntry
Prelude.Read, Int -> UpdateDomainEntry -> ShowS
[UpdateDomainEntry] -> ShowS
UpdateDomainEntry -> String
(Int -> UpdateDomainEntry -> ShowS)
-> (UpdateDomainEntry -> String)
-> ([UpdateDomainEntry] -> ShowS)
-> Show UpdateDomainEntry
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateDomainEntry] -> ShowS
$cshowList :: [UpdateDomainEntry] -> ShowS
show :: UpdateDomainEntry -> String
$cshow :: UpdateDomainEntry -> String
showsPrec :: Int -> UpdateDomainEntry -> ShowS
$cshowsPrec :: Int -> UpdateDomainEntry -> ShowS
Prelude.Show, (forall x. UpdateDomainEntry -> Rep UpdateDomainEntry x)
-> (forall x. Rep UpdateDomainEntry x -> UpdateDomainEntry)
-> Generic UpdateDomainEntry
forall x. Rep UpdateDomainEntry x -> UpdateDomainEntry
forall x. UpdateDomainEntry -> Rep UpdateDomainEntry x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateDomainEntry x -> UpdateDomainEntry
$cfrom :: forall x. UpdateDomainEntry -> Rep UpdateDomainEntry x
Prelude.Generic)
newUpdateDomainEntry ::
Prelude.Text ->
DomainEntry ->
UpdateDomainEntry
newUpdateDomainEntry :: Text -> DomainEntry -> UpdateDomainEntry
newUpdateDomainEntry Text
pDomainName_ DomainEntry
pDomainEntry_ =
UpdateDomainEntry' :: Text -> DomainEntry -> UpdateDomainEntry
UpdateDomainEntry'
{ $sel:domainName:UpdateDomainEntry' :: Text
domainName = Text
pDomainName_,
$sel:domainEntry:UpdateDomainEntry' :: DomainEntry
domainEntry = DomainEntry
pDomainEntry_
}
updateDomainEntry_domainName :: Lens.Lens' UpdateDomainEntry Prelude.Text
updateDomainEntry_domainName :: (Text -> f Text) -> UpdateDomainEntry -> f UpdateDomainEntry
updateDomainEntry_domainName = (UpdateDomainEntry -> Text)
-> (UpdateDomainEntry -> Text -> UpdateDomainEntry)
-> Lens UpdateDomainEntry UpdateDomainEntry Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDomainEntry' {Text
domainName :: Text
$sel:domainName:UpdateDomainEntry' :: UpdateDomainEntry -> Text
domainName} -> Text
domainName) (\s :: UpdateDomainEntry
s@UpdateDomainEntry' {} Text
a -> UpdateDomainEntry
s {$sel:domainName:UpdateDomainEntry' :: Text
domainName = Text
a} :: UpdateDomainEntry)
updateDomainEntry_domainEntry :: Lens.Lens' UpdateDomainEntry DomainEntry
updateDomainEntry_domainEntry :: (DomainEntry -> f DomainEntry)
-> UpdateDomainEntry -> f UpdateDomainEntry
updateDomainEntry_domainEntry = (UpdateDomainEntry -> DomainEntry)
-> (UpdateDomainEntry -> DomainEntry -> UpdateDomainEntry)
-> Lens UpdateDomainEntry UpdateDomainEntry DomainEntry DomainEntry
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDomainEntry' {DomainEntry
domainEntry :: DomainEntry
$sel:domainEntry:UpdateDomainEntry' :: UpdateDomainEntry -> DomainEntry
domainEntry} -> DomainEntry
domainEntry) (\s :: UpdateDomainEntry
s@UpdateDomainEntry' {} DomainEntry
a -> UpdateDomainEntry
s {$sel:domainEntry:UpdateDomainEntry' :: DomainEntry
domainEntry = DomainEntry
a} :: UpdateDomainEntry)
instance Core.AWSRequest UpdateDomainEntry where
type
AWSResponse UpdateDomainEntry =
UpdateDomainEntryResponse
request :: UpdateDomainEntry -> Request UpdateDomainEntry
request = Service -> UpdateDomainEntry -> Request UpdateDomainEntry
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateDomainEntry
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateDomainEntry)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateDomainEntry))
-> Logger
-> Service
-> Proxy UpdateDomainEntry
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateDomainEntry)))
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 -> UpdateDomainEntryResponse
UpdateDomainEntryResponse'
(Maybe [Operation] -> Int -> UpdateDomainEntryResponse)
-> Either String (Maybe [Operation])
-> Either String (Int -> UpdateDomainEntryResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [Operation]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"operations" Either String (Maybe (Maybe [Operation]))
-> Maybe [Operation] -> Either String (Maybe [Operation])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Operation]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> UpdateDomainEntryResponse)
-> Either String Int -> Either String UpdateDomainEntryResponse
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 UpdateDomainEntry
instance Prelude.NFData UpdateDomainEntry
instance Core.ToHeaders UpdateDomainEntry where
toHeaders :: UpdateDomainEntry -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateDomainEntry -> 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.UpdateDomainEntry" ::
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 UpdateDomainEntry where
toJSON :: UpdateDomainEntry -> Value
toJSON UpdateDomainEntry' {Text
DomainEntry
domainEntry :: DomainEntry
domainName :: Text
$sel:domainEntry:UpdateDomainEntry' :: UpdateDomainEntry -> DomainEntry
$sel:domainName:UpdateDomainEntry' :: UpdateDomainEntry -> 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 UpdateDomainEntry where
toPath :: UpdateDomainEntry -> ByteString
toPath = ByteString -> UpdateDomainEntry -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery UpdateDomainEntry where
toQuery :: UpdateDomainEntry -> QueryString
toQuery = QueryString -> UpdateDomainEntry -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateDomainEntryResponse = UpdateDomainEntryResponse'
{
UpdateDomainEntryResponse -> Maybe [Operation]
operations :: Prelude.Maybe [Operation],
UpdateDomainEntryResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateDomainEntryResponse -> UpdateDomainEntryResponse -> Bool
(UpdateDomainEntryResponse -> UpdateDomainEntryResponse -> Bool)
-> (UpdateDomainEntryResponse -> UpdateDomainEntryResponse -> Bool)
-> Eq UpdateDomainEntryResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateDomainEntryResponse -> UpdateDomainEntryResponse -> Bool
$c/= :: UpdateDomainEntryResponse -> UpdateDomainEntryResponse -> Bool
== :: UpdateDomainEntryResponse -> UpdateDomainEntryResponse -> Bool
$c== :: UpdateDomainEntryResponse -> UpdateDomainEntryResponse -> Bool
Prelude.Eq, ReadPrec [UpdateDomainEntryResponse]
ReadPrec UpdateDomainEntryResponse
Int -> ReadS UpdateDomainEntryResponse
ReadS [UpdateDomainEntryResponse]
(Int -> ReadS UpdateDomainEntryResponse)
-> ReadS [UpdateDomainEntryResponse]
-> ReadPrec UpdateDomainEntryResponse
-> ReadPrec [UpdateDomainEntryResponse]
-> Read UpdateDomainEntryResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateDomainEntryResponse]
$creadListPrec :: ReadPrec [UpdateDomainEntryResponse]
readPrec :: ReadPrec UpdateDomainEntryResponse
$creadPrec :: ReadPrec UpdateDomainEntryResponse
readList :: ReadS [UpdateDomainEntryResponse]
$creadList :: ReadS [UpdateDomainEntryResponse]
readsPrec :: Int -> ReadS UpdateDomainEntryResponse
$creadsPrec :: Int -> ReadS UpdateDomainEntryResponse
Prelude.Read, Int -> UpdateDomainEntryResponse -> ShowS
[UpdateDomainEntryResponse] -> ShowS
UpdateDomainEntryResponse -> String
(Int -> UpdateDomainEntryResponse -> ShowS)
-> (UpdateDomainEntryResponse -> String)
-> ([UpdateDomainEntryResponse] -> ShowS)
-> Show UpdateDomainEntryResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateDomainEntryResponse] -> ShowS
$cshowList :: [UpdateDomainEntryResponse] -> ShowS
show :: UpdateDomainEntryResponse -> String
$cshow :: UpdateDomainEntryResponse -> String
showsPrec :: Int -> UpdateDomainEntryResponse -> ShowS
$cshowsPrec :: Int -> UpdateDomainEntryResponse -> ShowS
Prelude.Show, (forall x.
UpdateDomainEntryResponse -> Rep UpdateDomainEntryResponse x)
-> (forall x.
Rep UpdateDomainEntryResponse x -> UpdateDomainEntryResponse)
-> Generic UpdateDomainEntryResponse
forall x.
Rep UpdateDomainEntryResponse x -> UpdateDomainEntryResponse
forall x.
UpdateDomainEntryResponse -> Rep UpdateDomainEntryResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateDomainEntryResponse x -> UpdateDomainEntryResponse
$cfrom :: forall x.
UpdateDomainEntryResponse -> Rep UpdateDomainEntryResponse x
Prelude.Generic)
newUpdateDomainEntryResponse ::
Prelude.Int ->
UpdateDomainEntryResponse
newUpdateDomainEntryResponse :: Int -> UpdateDomainEntryResponse
newUpdateDomainEntryResponse Int
pHttpStatus_ =
UpdateDomainEntryResponse' :: Maybe [Operation] -> Int -> UpdateDomainEntryResponse
UpdateDomainEntryResponse'
{ $sel:operations:UpdateDomainEntryResponse' :: Maybe [Operation]
operations =
Maybe [Operation]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateDomainEntryResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateDomainEntryResponse_operations :: Lens.Lens' UpdateDomainEntryResponse (Prelude.Maybe [Operation])
updateDomainEntryResponse_operations :: (Maybe [Operation] -> f (Maybe [Operation]))
-> UpdateDomainEntryResponse -> f UpdateDomainEntryResponse
updateDomainEntryResponse_operations = (UpdateDomainEntryResponse -> Maybe [Operation])
-> (UpdateDomainEntryResponse
-> Maybe [Operation] -> UpdateDomainEntryResponse)
-> Lens
UpdateDomainEntryResponse
UpdateDomainEntryResponse
(Maybe [Operation])
(Maybe [Operation])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDomainEntryResponse' {Maybe [Operation]
operations :: Maybe [Operation]
$sel:operations:UpdateDomainEntryResponse' :: UpdateDomainEntryResponse -> Maybe [Operation]
operations} -> Maybe [Operation]
operations) (\s :: UpdateDomainEntryResponse
s@UpdateDomainEntryResponse' {} Maybe [Operation]
a -> UpdateDomainEntryResponse
s {$sel:operations:UpdateDomainEntryResponse' :: Maybe [Operation]
operations = Maybe [Operation]
a} :: UpdateDomainEntryResponse) ((Maybe [Operation] -> f (Maybe [Operation]))
-> UpdateDomainEntryResponse -> f UpdateDomainEntryResponse)
-> ((Maybe [Operation] -> f (Maybe [Operation]))
-> Maybe [Operation] -> f (Maybe [Operation]))
-> (Maybe [Operation] -> f (Maybe [Operation]))
-> UpdateDomainEntryResponse
-> f UpdateDomainEntryResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Operation] [Operation] [Operation] [Operation]
-> Iso
(Maybe [Operation])
(Maybe [Operation])
(Maybe [Operation])
(Maybe [Operation])
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 [Operation] [Operation] [Operation] [Operation]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
updateDomainEntryResponse_httpStatus :: Lens.Lens' UpdateDomainEntryResponse Prelude.Int
updateDomainEntryResponse_httpStatus :: (Int -> f Int)
-> UpdateDomainEntryResponse -> f UpdateDomainEntryResponse
updateDomainEntryResponse_httpStatus = (UpdateDomainEntryResponse -> Int)
-> (UpdateDomainEntryResponse -> Int -> UpdateDomainEntryResponse)
-> Lens UpdateDomainEntryResponse UpdateDomainEntryResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDomainEntryResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateDomainEntryResponse' :: UpdateDomainEntryResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateDomainEntryResponse
s@UpdateDomainEntryResponse' {} Int
a -> UpdateDomainEntryResponse
s {$sel:httpStatus:UpdateDomainEntryResponse' :: Int
httpStatus = Int
a} :: UpdateDomainEntryResponse)
instance Prelude.NFData UpdateDomainEntryResponse