{-# 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.Route53.CreateTrafficPolicy
(
CreateTrafficPolicy (..),
newCreateTrafficPolicy,
createTrafficPolicy_comment,
createTrafficPolicy_name,
createTrafficPolicy_document,
CreateTrafficPolicyResponse (..),
newCreateTrafficPolicyResponse,
createTrafficPolicyResponse_httpStatus,
createTrafficPolicyResponse_trafficPolicy,
createTrafficPolicyResponse_location,
)
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.Route53.Types
data CreateTrafficPolicy = CreateTrafficPolicy'
{
:: Prelude.Maybe Prelude.Text,
CreateTrafficPolicy -> Text
name :: Prelude.Text,
CreateTrafficPolicy -> Text
document :: Prelude.Text
}
deriving (CreateTrafficPolicy -> CreateTrafficPolicy -> Bool
(CreateTrafficPolicy -> CreateTrafficPolicy -> Bool)
-> (CreateTrafficPolicy -> CreateTrafficPolicy -> Bool)
-> Eq CreateTrafficPolicy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateTrafficPolicy -> CreateTrafficPolicy -> Bool
$c/= :: CreateTrafficPolicy -> CreateTrafficPolicy -> Bool
== :: CreateTrafficPolicy -> CreateTrafficPolicy -> Bool
$c== :: CreateTrafficPolicy -> CreateTrafficPolicy -> Bool
Prelude.Eq, ReadPrec [CreateTrafficPolicy]
ReadPrec CreateTrafficPolicy
Int -> ReadS CreateTrafficPolicy
ReadS [CreateTrafficPolicy]
(Int -> ReadS CreateTrafficPolicy)
-> ReadS [CreateTrafficPolicy]
-> ReadPrec CreateTrafficPolicy
-> ReadPrec [CreateTrafficPolicy]
-> Read CreateTrafficPolicy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateTrafficPolicy]
$creadListPrec :: ReadPrec [CreateTrafficPolicy]
readPrec :: ReadPrec CreateTrafficPolicy
$creadPrec :: ReadPrec CreateTrafficPolicy
readList :: ReadS [CreateTrafficPolicy]
$creadList :: ReadS [CreateTrafficPolicy]
readsPrec :: Int -> ReadS CreateTrafficPolicy
$creadsPrec :: Int -> ReadS CreateTrafficPolicy
Prelude.Read, Int -> CreateTrafficPolicy -> ShowS
[CreateTrafficPolicy] -> ShowS
CreateTrafficPolicy -> String
(Int -> CreateTrafficPolicy -> ShowS)
-> (CreateTrafficPolicy -> String)
-> ([CreateTrafficPolicy] -> ShowS)
-> Show CreateTrafficPolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateTrafficPolicy] -> ShowS
$cshowList :: [CreateTrafficPolicy] -> ShowS
show :: CreateTrafficPolicy -> String
$cshow :: CreateTrafficPolicy -> String
showsPrec :: Int -> CreateTrafficPolicy -> ShowS
$cshowsPrec :: Int -> CreateTrafficPolicy -> ShowS
Prelude.Show, (forall x. CreateTrafficPolicy -> Rep CreateTrafficPolicy x)
-> (forall x. Rep CreateTrafficPolicy x -> CreateTrafficPolicy)
-> Generic CreateTrafficPolicy
forall x. Rep CreateTrafficPolicy x -> CreateTrafficPolicy
forall x. CreateTrafficPolicy -> Rep CreateTrafficPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateTrafficPolicy x -> CreateTrafficPolicy
$cfrom :: forall x. CreateTrafficPolicy -> Rep CreateTrafficPolicy x
Prelude.Generic)
newCreateTrafficPolicy ::
Prelude.Text ->
Prelude.Text ->
CreateTrafficPolicy
newCreateTrafficPolicy :: Text -> Text -> CreateTrafficPolicy
newCreateTrafficPolicy Text
pName_ Text
pDocument_ =
CreateTrafficPolicy' :: Maybe Text -> Text -> Text -> CreateTrafficPolicy
CreateTrafficPolicy'
{ $sel:comment:CreateTrafficPolicy' :: Maybe Text
comment = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:name:CreateTrafficPolicy' :: Text
name = Text
pName_,
$sel:document:CreateTrafficPolicy' :: Text
document = Text
pDocument_
}
createTrafficPolicy_comment :: Lens.Lens' CreateTrafficPolicy (Prelude.Maybe Prelude.Text)
= (CreateTrafficPolicy -> Maybe Text)
-> (CreateTrafficPolicy -> Maybe Text -> CreateTrafficPolicy)
-> Lens
CreateTrafficPolicy CreateTrafficPolicy (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTrafficPolicy' {Maybe Text
comment :: Maybe Text
$sel:comment:CreateTrafficPolicy' :: CreateTrafficPolicy -> Maybe Text
comment} -> Maybe Text
comment) (\s :: CreateTrafficPolicy
s@CreateTrafficPolicy' {} Maybe Text
a -> CreateTrafficPolicy
s {$sel:comment:CreateTrafficPolicy' :: Maybe Text
comment = Maybe Text
a} :: CreateTrafficPolicy)
createTrafficPolicy_name :: Lens.Lens' CreateTrafficPolicy Prelude.Text
createTrafficPolicy_name :: (Text -> f Text) -> CreateTrafficPolicy -> f CreateTrafficPolicy
createTrafficPolicy_name = (CreateTrafficPolicy -> Text)
-> (CreateTrafficPolicy -> Text -> CreateTrafficPolicy)
-> Lens CreateTrafficPolicy CreateTrafficPolicy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTrafficPolicy' {Text
name :: Text
$sel:name:CreateTrafficPolicy' :: CreateTrafficPolicy -> Text
name} -> Text
name) (\s :: CreateTrafficPolicy
s@CreateTrafficPolicy' {} Text
a -> CreateTrafficPolicy
s {$sel:name:CreateTrafficPolicy' :: Text
name = Text
a} :: CreateTrafficPolicy)
createTrafficPolicy_document :: Lens.Lens' CreateTrafficPolicy Prelude.Text
createTrafficPolicy_document :: (Text -> f Text) -> CreateTrafficPolicy -> f CreateTrafficPolicy
createTrafficPolicy_document = (CreateTrafficPolicy -> Text)
-> (CreateTrafficPolicy -> Text -> CreateTrafficPolicy)
-> Lens CreateTrafficPolicy CreateTrafficPolicy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTrafficPolicy' {Text
document :: Text
$sel:document:CreateTrafficPolicy' :: CreateTrafficPolicy -> Text
document} -> Text
document) (\s :: CreateTrafficPolicy
s@CreateTrafficPolicy' {} Text
a -> CreateTrafficPolicy
s {$sel:document:CreateTrafficPolicy' :: Text
document = Text
a} :: CreateTrafficPolicy)
instance Core.AWSRequest CreateTrafficPolicy where
type
AWSResponse CreateTrafficPolicy =
CreateTrafficPolicyResponse
request :: CreateTrafficPolicy -> Request CreateTrafficPolicy
request = Service -> CreateTrafficPolicy -> Request CreateTrafficPolicy
forall a. (ToRequest a, ToElement a) => Service -> a -> Request a
Request.postXML Service
defaultService
response :: Logger
-> Service
-> Proxy CreateTrafficPolicy
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateTrafficPolicy)))
response =
(Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse CreateTrafficPolicy))
-> Logger
-> Service
-> Proxy CreateTrafficPolicy
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateTrafficPolicy)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXML
( \Int
s ResponseHeaders
h [Node]
x ->
Int -> TrafficPolicy -> Text -> CreateTrafficPolicyResponse
CreateTrafficPolicyResponse'
(Int -> TrafficPolicy -> Text -> CreateTrafficPolicyResponse)
-> Either String Int
-> Either
String (TrafficPolicy -> Text -> CreateTrafficPolicyResponse)
forall (f :: * -> *) a b. Functor 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))
Either
String (TrafficPolicy -> Text -> CreateTrafficPolicyResponse)
-> Either String TrafficPolicy
-> Either String (Text -> CreateTrafficPolicyResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String TrafficPolicy
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"TrafficPolicy")
Either String (Text -> CreateTrafficPolicyResponse)
-> Either String Text -> Either String CreateTrafficPolicyResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (ResponseHeaders
h ResponseHeaders -> HeaderName -> Either String Text
forall a.
FromText a =>
ResponseHeaders -> HeaderName -> Either String a
Core..# HeaderName
"Location")
)
instance Prelude.Hashable CreateTrafficPolicy
instance Prelude.NFData CreateTrafficPolicy
instance Core.ToElement CreateTrafficPolicy where
toElement :: CreateTrafficPolicy -> Element
toElement =
Name -> CreateTrafficPolicy -> Element
forall a. ToXML a => Name -> a -> Element
Core.mkElement
Name
"{https://route53.amazonaws.com/doc/2013-04-01/}CreateTrafficPolicyRequest"
instance Core.ToHeaders CreateTrafficPolicy where
toHeaders :: CreateTrafficPolicy -> ResponseHeaders
toHeaders = ResponseHeaders -> CreateTrafficPolicy -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath CreateTrafficPolicy where
toPath :: CreateTrafficPolicy -> ByteString
toPath = ByteString -> CreateTrafficPolicy -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/2013-04-01/trafficpolicy"
instance Core.ToQuery CreateTrafficPolicy where
toQuery :: CreateTrafficPolicy -> QueryString
toQuery = QueryString -> CreateTrafficPolicy -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
instance Core.ToXML CreateTrafficPolicy where
toXML :: CreateTrafficPolicy -> XML
toXML CreateTrafficPolicy' {Maybe Text
Text
document :: Text
name :: Text
comment :: Maybe Text
$sel:document:CreateTrafficPolicy' :: CreateTrafficPolicy -> Text
$sel:name:CreateTrafficPolicy' :: CreateTrafficPolicy -> Text
$sel:comment:CreateTrafficPolicy' :: CreateTrafficPolicy -> Maybe Text
..} =
[XML] -> XML
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ Name
"Comment" Name -> Maybe Text -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe Text
comment,
Name
"Name" Name -> Text -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Text
name,
Name
"Document" Name -> Text -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Text
document
]
data CreateTrafficPolicyResponse = CreateTrafficPolicyResponse'
{
CreateTrafficPolicyResponse -> Int
httpStatus :: Prelude.Int,
CreateTrafficPolicyResponse -> TrafficPolicy
trafficPolicy :: TrafficPolicy,
CreateTrafficPolicyResponse -> Text
location :: Prelude.Text
}
deriving (CreateTrafficPolicyResponse -> CreateTrafficPolicyResponse -> Bool
(CreateTrafficPolicyResponse
-> CreateTrafficPolicyResponse -> Bool)
-> (CreateTrafficPolicyResponse
-> CreateTrafficPolicyResponse -> Bool)
-> Eq CreateTrafficPolicyResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateTrafficPolicyResponse -> CreateTrafficPolicyResponse -> Bool
$c/= :: CreateTrafficPolicyResponse -> CreateTrafficPolicyResponse -> Bool
== :: CreateTrafficPolicyResponse -> CreateTrafficPolicyResponse -> Bool
$c== :: CreateTrafficPolicyResponse -> CreateTrafficPolicyResponse -> Bool
Prelude.Eq, ReadPrec [CreateTrafficPolicyResponse]
ReadPrec CreateTrafficPolicyResponse
Int -> ReadS CreateTrafficPolicyResponse
ReadS [CreateTrafficPolicyResponse]
(Int -> ReadS CreateTrafficPolicyResponse)
-> ReadS [CreateTrafficPolicyResponse]
-> ReadPrec CreateTrafficPolicyResponse
-> ReadPrec [CreateTrafficPolicyResponse]
-> Read CreateTrafficPolicyResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateTrafficPolicyResponse]
$creadListPrec :: ReadPrec [CreateTrafficPolicyResponse]
readPrec :: ReadPrec CreateTrafficPolicyResponse
$creadPrec :: ReadPrec CreateTrafficPolicyResponse
readList :: ReadS [CreateTrafficPolicyResponse]
$creadList :: ReadS [CreateTrafficPolicyResponse]
readsPrec :: Int -> ReadS CreateTrafficPolicyResponse
$creadsPrec :: Int -> ReadS CreateTrafficPolicyResponse
Prelude.Read, Int -> CreateTrafficPolicyResponse -> ShowS
[CreateTrafficPolicyResponse] -> ShowS
CreateTrafficPolicyResponse -> String
(Int -> CreateTrafficPolicyResponse -> ShowS)
-> (CreateTrafficPolicyResponse -> String)
-> ([CreateTrafficPolicyResponse] -> ShowS)
-> Show CreateTrafficPolicyResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateTrafficPolicyResponse] -> ShowS
$cshowList :: [CreateTrafficPolicyResponse] -> ShowS
show :: CreateTrafficPolicyResponse -> String
$cshow :: CreateTrafficPolicyResponse -> String
showsPrec :: Int -> CreateTrafficPolicyResponse -> ShowS
$cshowsPrec :: Int -> CreateTrafficPolicyResponse -> ShowS
Prelude.Show, (forall x.
CreateTrafficPolicyResponse -> Rep CreateTrafficPolicyResponse x)
-> (forall x.
Rep CreateTrafficPolicyResponse x -> CreateTrafficPolicyResponse)
-> Generic CreateTrafficPolicyResponse
forall x.
Rep CreateTrafficPolicyResponse x -> CreateTrafficPolicyResponse
forall x.
CreateTrafficPolicyResponse -> Rep CreateTrafficPolicyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateTrafficPolicyResponse x -> CreateTrafficPolicyResponse
$cfrom :: forall x.
CreateTrafficPolicyResponse -> Rep CreateTrafficPolicyResponse x
Prelude.Generic)
newCreateTrafficPolicyResponse ::
Prelude.Int ->
TrafficPolicy ->
Prelude.Text ->
CreateTrafficPolicyResponse
newCreateTrafficPolicyResponse :: Int -> TrafficPolicy -> Text -> CreateTrafficPolicyResponse
newCreateTrafficPolicyResponse
Int
pHttpStatus_
TrafficPolicy
pTrafficPolicy_
Text
pLocation_ =
CreateTrafficPolicyResponse' :: Int -> TrafficPolicy -> Text -> CreateTrafficPolicyResponse
CreateTrafficPolicyResponse'
{ $sel:httpStatus:CreateTrafficPolicyResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:trafficPolicy:CreateTrafficPolicyResponse' :: TrafficPolicy
trafficPolicy = TrafficPolicy
pTrafficPolicy_,
$sel:location:CreateTrafficPolicyResponse' :: Text
location = Text
pLocation_
}
createTrafficPolicyResponse_httpStatus :: Lens.Lens' CreateTrafficPolicyResponse Prelude.Int
createTrafficPolicyResponse_httpStatus :: (Int -> f Int)
-> CreateTrafficPolicyResponse -> f CreateTrafficPolicyResponse
createTrafficPolicyResponse_httpStatus = (CreateTrafficPolicyResponse -> Int)
-> (CreateTrafficPolicyResponse
-> Int -> CreateTrafficPolicyResponse)
-> Lens
CreateTrafficPolicyResponse CreateTrafficPolicyResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTrafficPolicyResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateTrafficPolicyResponse' :: CreateTrafficPolicyResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateTrafficPolicyResponse
s@CreateTrafficPolicyResponse' {} Int
a -> CreateTrafficPolicyResponse
s {$sel:httpStatus:CreateTrafficPolicyResponse' :: Int
httpStatus = Int
a} :: CreateTrafficPolicyResponse)
createTrafficPolicyResponse_trafficPolicy :: Lens.Lens' CreateTrafficPolicyResponse TrafficPolicy
createTrafficPolicyResponse_trafficPolicy :: (TrafficPolicy -> f TrafficPolicy)
-> CreateTrafficPolicyResponse -> f CreateTrafficPolicyResponse
createTrafficPolicyResponse_trafficPolicy = (CreateTrafficPolicyResponse -> TrafficPolicy)
-> (CreateTrafficPolicyResponse
-> TrafficPolicy -> CreateTrafficPolicyResponse)
-> Lens
CreateTrafficPolicyResponse
CreateTrafficPolicyResponse
TrafficPolicy
TrafficPolicy
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTrafficPolicyResponse' {TrafficPolicy
trafficPolicy :: TrafficPolicy
$sel:trafficPolicy:CreateTrafficPolicyResponse' :: CreateTrafficPolicyResponse -> TrafficPolicy
trafficPolicy} -> TrafficPolicy
trafficPolicy) (\s :: CreateTrafficPolicyResponse
s@CreateTrafficPolicyResponse' {} TrafficPolicy
a -> CreateTrafficPolicyResponse
s {$sel:trafficPolicy:CreateTrafficPolicyResponse' :: TrafficPolicy
trafficPolicy = TrafficPolicy
a} :: CreateTrafficPolicyResponse)
createTrafficPolicyResponse_location :: Lens.Lens' CreateTrafficPolicyResponse Prelude.Text
createTrafficPolicyResponse_location :: (Text -> f Text)
-> CreateTrafficPolicyResponse -> f CreateTrafficPolicyResponse
createTrafficPolicyResponse_location = (CreateTrafficPolicyResponse -> Text)
-> (CreateTrafficPolicyResponse
-> Text -> CreateTrafficPolicyResponse)
-> Lens
CreateTrafficPolicyResponse CreateTrafficPolicyResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTrafficPolicyResponse' {Text
location :: Text
$sel:location:CreateTrafficPolicyResponse' :: CreateTrafficPolicyResponse -> Text
location} -> Text
location) (\s :: CreateTrafficPolicyResponse
s@CreateTrafficPolicyResponse' {} Text
a -> CreateTrafficPolicyResponse
s {$sel:location:CreateTrafficPolicyResponse' :: Text
location = Text
a} :: CreateTrafficPolicyResponse)
instance Prelude.NFData CreateTrafficPolicyResponse