{-# 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.GlobalAccelerator.AdvertiseByoipCidr
(
AdvertiseByoipCidr (..),
newAdvertiseByoipCidr,
advertiseByoipCidr_cidr,
AdvertiseByoipCidrResponse (..),
newAdvertiseByoipCidrResponse,
advertiseByoipCidrResponse_byoipCidr,
advertiseByoipCidrResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.GlobalAccelerator.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data AdvertiseByoipCidr = AdvertiseByoipCidr'
{
AdvertiseByoipCidr -> Text
cidr :: Prelude.Text
}
deriving (AdvertiseByoipCidr -> AdvertiseByoipCidr -> Bool
(AdvertiseByoipCidr -> AdvertiseByoipCidr -> Bool)
-> (AdvertiseByoipCidr -> AdvertiseByoipCidr -> Bool)
-> Eq AdvertiseByoipCidr
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AdvertiseByoipCidr -> AdvertiseByoipCidr -> Bool
$c/= :: AdvertiseByoipCidr -> AdvertiseByoipCidr -> Bool
== :: AdvertiseByoipCidr -> AdvertiseByoipCidr -> Bool
$c== :: AdvertiseByoipCidr -> AdvertiseByoipCidr -> Bool
Prelude.Eq, ReadPrec [AdvertiseByoipCidr]
ReadPrec AdvertiseByoipCidr
Int -> ReadS AdvertiseByoipCidr
ReadS [AdvertiseByoipCidr]
(Int -> ReadS AdvertiseByoipCidr)
-> ReadS [AdvertiseByoipCidr]
-> ReadPrec AdvertiseByoipCidr
-> ReadPrec [AdvertiseByoipCidr]
-> Read AdvertiseByoipCidr
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AdvertiseByoipCidr]
$creadListPrec :: ReadPrec [AdvertiseByoipCidr]
readPrec :: ReadPrec AdvertiseByoipCidr
$creadPrec :: ReadPrec AdvertiseByoipCidr
readList :: ReadS [AdvertiseByoipCidr]
$creadList :: ReadS [AdvertiseByoipCidr]
readsPrec :: Int -> ReadS AdvertiseByoipCidr
$creadsPrec :: Int -> ReadS AdvertiseByoipCidr
Prelude.Read, Int -> AdvertiseByoipCidr -> ShowS
[AdvertiseByoipCidr] -> ShowS
AdvertiseByoipCidr -> String
(Int -> AdvertiseByoipCidr -> ShowS)
-> (AdvertiseByoipCidr -> String)
-> ([AdvertiseByoipCidr] -> ShowS)
-> Show AdvertiseByoipCidr
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AdvertiseByoipCidr] -> ShowS
$cshowList :: [AdvertiseByoipCidr] -> ShowS
show :: AdvertiseByoipCidr -> String
$cshow :: AdvertiseByoipCidr -> String
showsPrec :: Int -> AdvertiseByoipCidr -> ShowS
$cshowsPrec :: Int -> AdvertiseByoipCidr -> ShowS
Prelude.Show, (forall x. AdvertiseByoipCidr -> Rep AdvertiseByoipCidr x)
-> (forall x. Rep AdvertiseByoipCidr x -> AdvertiseByoipCidr)
-> Generic AdvertiseByoipCidr
forall x. Rep AdvertiseByoipCidr x -> AdvertiseByoipCidr
forall x. AdvertiseByoipCidr -> Rep AdvertiseByoipCidr x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AdvertiseByoipCidr x -> AdvertiseByoipCidr
$cfrom :: forall x. AdvertiseByoipCidr -> Rep AdvertiseByoipCidr x
Prelude.Generic)
newAdvertiseByoipCidr ::
Prelude.Text ->
AdvertiseByoipCidr
newAdvertiseByoipCidr :: Text -> AdvertiseByoipCidr
newAdvertiseByoipCidr Text
pCidr_ =
AdvertiseByoipCidr' :: Text -> AdvertiseByoipCidr
AdvertiseByoipCidr' {$sel:cidr:AdvertiseByoipCidr' :: Text
cidr = Text
pCidr_}
advertiseByoipCidr_cidr :: Lens.Lens' AdvertiseByoipCidr Prelude.Text
advertiseByoipCidr_cidr :: (Text -> f Text) -> AdvertiseByoipCidr -> f AdvertiseByoipCidr
advertiseByoipCidr_cidr = (AdvertiseByoipCidr -> Text)
-> (AdvertiseByoipCidr -> Text -> AdvertiseByoipCidr)
-> Lens AdvertiseByoipCidr AdvertiseByoipCidr Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AdvertiseByoipCidr' {Text
cidr :: Text
$sel:cidr:AdvertiseByoipCidr' :: AdvertiseByoipCidr -> Text
cidr} -> Text
cidr) (\s :: AdvertiseByoipCidr
s@AdvertiseByoipCidr' {} Text
a -> AdvertiseByoipCidr
s {$sel:cidr:AdvertiseByoipCidr' :: Text
cidr = Text
a} :: AdvertiseByoipCidr)
instance Core.AWSRequest AdvertiseByoipCidr where
type
AWSResponse AdvertiseByoipCidr =
AdvertiseByoipCidrResponse
request :: AdvertiseByoipCidr -> Request AdvertiseByoipCidr
request = Service -> AdvertiseByoipCidr -> Request AdvertiseByoipCidr
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy AdvertiseByoipCidr
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AdvertiseByoipCidr)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse AdvertiseByoipCidr))
-> Logger
-> Service
-> Proxy AdvertiseByoipCidr
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AdvertiseByoipCidr)))
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 ByoipCidr -> Int -> AdvertiseByoipCidrResponse
AdvertiseByoipCidrResponse'
(Maybe ByoipCidr -> Int -> AdvertiseByoipCidrResponse)
-> Either String (Maybe ByoipCidr)
-> Either String (Int -> AdvertiseByoipCidrResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe ByoipCidr)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ByoipCidr")
Either String (Int -> AdvertiseByoipCidrResponse)
-> Either String Int -> Either String AdvertiseByoipCidrResponse
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 AdvertiseByoipCidr
instance Prelude.NFData AdvertiseByoipCidr
instance Core.ToHeaders AdvertiseByoipCidr where
toHeaders :: AdvertiseByoipCidr -> ResponseHeaders
toHeaders =
ResponseHeaders -> AdvertiseByoipCidr -> 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
"GlobalAccelerator_V20180706.AdvertiseByoipCidr" ::
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 AdvertiseByoipCidr where
toJSON :: AdvertiseByoipCidr -> Value
toJSON AdvertiseByoipCidr' {Text
cidr :: Text
$sel:cidr:AdvertiseByoipCidr' :: AdvertiseByoipCidr -> 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
"Cidr" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
cidr)]
)
instance Core.ToPath AdvertiseByoipCidr where
toPath :: AdvertiseByoipCidr -> ByteString
toPath = ByteString -> AdvertiseByoipCidr -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery AdvertiseByoipCidr where
toQuery :: AdvertiseByoipCidr -> QueryString
toQuery = QueryString -> AdvertiseByoipCidr -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data AdvertiseByoipCidrResponse = AdvertiseByoipCidrResponse'
{
AdvertiseByoipCidrResponse -> Maybe ByoipCidr
byoipCidr :: Prelude.Maybe ByoipCidr,
AdvertiseByoipCidrResponse -> Int
httpStatus :: Prelude.Int
}
deriving (AdvertiseByoipCidrResponse -> AdvertiseByoipCidrResponse -> Bool
(AdvertiseByoipCidrResponse -> AdvertiseByoipCidrResponse -> Bool)
-> (AdvertiseByoipCidrResponse
-> AdvertiseByoipCidrResponse -> Bool)
-> Eq AdvertiseByoipCidrResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AdvertiseByoipCidrResponse -> AdvertiseByoipCidrResponse -> Bool
$c/= :: AdvertiseByoipCidrResponse -> AdvertiseByoipCidrResponse -> Bool
== :: AdvertiseByoipCidrResponse -> AdvertiseByoipCidrResponse -> Bool
$c== :: AdvertiseByoipCidrResponse -> AdvertiseByoipCidrResponse -> Bool
Prelude.Eq, ReadPrec [AdvertiseByoipCidrResponse]
ReadPrec AdvertiseByoipCidrResponse
Int -> ReadS AdvertiseByoipCidrResponse
ReadS [AdvertiseByoipCidrResponse]
(Int -> ReadS AdvertiseByoipCidrResponse)
-> ReadS [AdvertiseByoipCidrResponse]
-> ReadPrec AdvertiseByoipCidrResponse
-> ReadPrec [AdvertiseByoipCidrResponse]
-> Read AdvertiseByoipCidrResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AdvertiseByoipCidrResponse]
$creadListPrec :: ReadPrec [AdvertiseByoipCidrResponse]
readPrec :: ReadPrec AdvertiseByoipCidrResponse
$creadPrec :: ReadPrec AdvertiseByoipCidrResponse
readList :: ReadS [AdvertiseByoipCidrResponse]
$creadList :: ReadS [AdvertiseByoipCidrResponse]
readsPrec :: Int -> ReadS AdvertiseByoipCidrResponse
$creadsPrec :: Int -> ReadS AdvertiseByoipCidrResponse
Prelude.Read, Int -> AdvertiseByoipCidrResponse -> ShowS
[AdvertiseByoipCidrResponse] -> ShowS
AdvertiseByoipCidrResponse -> String
(Int -> AdvertiseByoipCidrResponse -> ShowS)
-> (AdvertiseByoipCidrResponse -> String)
-> ([AdvertiseByoipCidrResponse] -> ShowS)
-> Show AdvertiseByoipCidrResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AdvertiseByoipCidrResponse] -> ShowS
$cshowList :: [AdvertiseByoipCidrResponse] -> ShowS
show :: AdvertiseByoipCidrResponse -> String
$cshow :: AdvertiseByoipCidrResponse -> String
showsPrec :: Int -> AdvertiseByoipCidrResponse -> ShowS
$cshowsPrec :: Int -> AdvertiseByoipCidrResponse -> ShowS
Prelude.Show, (forall x.
AdvertiseByoipCidrResponse -> Rep AdvertiseByoipCidrResponse x)
-> (forall x.
Rep AdvertiseByoipCidrResponse x -> AdvertiseByoipCidrResponse)
-> Generic AdvertiseByoipCidrResponse
forall x.
Rep AdvertiseByoipCidrResponse x -> AdvertiseByoipCidrResponse
forall x.
AdvertiseByoipCidrResponse -> Rep AdvertiseByoipCidrResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AdvertiseByoipCidrResponse x -> AdvertiseByoipCidrResponse
$cfrom :: forall x.
AdvertiseByoipCidrResponse -> Rep AdvertiseByoipCidrResponse x
Prelude.Generic)
newAdvertiseByoipCidrResponse ::
Prelude.Int ->
AdvertiseByoipCidrResponse
newAdvertiseByoipCidrResponse :: Int -> AdvertiseByoipCidrResponse
newAdvertiseByoipCidrResponse Int
pHttpStatus_ =
AdvertiseByoipCidrResponse' :: Maybe ByoipCidr -> Int -> AdvertiseByoipCidrResponse
AdvertiseByoipCidrResponse'
{ $sel:byoipCidr:AdvertiseByoipCidrResponse' :: Maybe ByoipCidr
byoipCidr =
Maybe ByoipCidr
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:AdvertiseByoipCidrResponse' :: Int
httpStatus = Int
pHttpStatus_
}
advertiseByoipCidrResponse_byoipCidr :: Lens.Lens' AdvertiseByoipCidrResponse (Prelude.Maybe ByoipCidr)
advertiseByoipCidrResponse_byoipCidr :: (Maybe ByoipCidr -> f (Maybe ByoipCidr))
-> AdvertiseByoipCidrResponse -> f AdvertiseByoipCidrResponse
advertiseByoipCidrResponse_byoipCidr = (AdvertiseByoipCidrResponse -> Maybe ByoipCidr)
-> (AdvertiseByoipCidrResponse
-> Maybe ByoipCidr -> AdvertiseByoipCidrResponse)
-> Lens
AdvertiseByoipCidrResponse
AdvertiseByoipCidrResponse
(Maybe ByoipCidr)
(Maybe ByoipCidr)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AdvertiseByoipCidrResponse' {Maybe ByoipCidr
byoipCidr :: Maybe ByoipCidr
$sel:byoipCidr:AdvertiseByoipCidrResponse' :: AdvertiseByoipCidrResponse -> Maybe ByoipCidr
byoipCidr} -> Maybe ByoipCidr
byoipCidr) (\s :: AdvertiseByoipCidrResponse
s@AdvertiseByoipCidrResponse' {} Maybe ByoipCidr
a -> AdvertiseByoipCidrResponse
s {$sel:byoipCidr:AdvertiseByoipCidrResponse' :: Maybe ByoipCidr
byoipCidr = Maybe ByoipCidr
a} :: AdvertiseByoipCidrResponse)
advertiseByoipCidrResponse_httpStatus :: Lens.Lens' AdvertiseByoipCidrResponse Prelude.Int
advertiseByoipCidrResponse_httpStatus :: (Int -> f Int)
-> AdvertiseByoipCidrResponse -> f AdvertiseByoipCidrResponse
advertiseByoipCidrResponse_httpStatus = (AdvertiseByoipCidrResponse -> Int)
-> (AdvertiseByoipCidrResponse
-> Int -> AdvertiseByoipCidrResponse)
-> Lens
AdvertiseByoipCidrResponse AdvertiseByoipCidrResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AdvertiseByoipCidrResponse' {Int
httpStatus :: Int
$sel:httpStatus:AdvertiseByoipCidrResponse' :: AdvertiseByoipCidrResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AdvertiseByoipCidrResponse
s@AdvertiseByoipCidrResponse' {} Int
a -> AdvertiseByoipCidrResponse
s {$sel:httpStatus:AdvertiseByoipCidrResponse' :: Int
httpStatus = Int
a} :: AdvertiseByoipCidrResponse)
instance Prelude.NFData AdvertiseByoipCidrResponse