{-# 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.WithdrawByoipCidr
(
WithdrawByoipCidr (..),
newWithdrawByoipCidr,
withdrawByoipCidr_cidr,
WithdrawByoipCidrResponse (..),
newWithdrawByoipCidrResponse,
withdrawByoipCidrResponse_byoipCidr,
withdrawByoipCidrResponse_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 WithdrawByoipCidr = WithdrawByoipCidr'
{
WithdrawByoipCidr -> Text
cidr :: Prelude.Text
}
deriving (WithdrawByoipCidr -> WithdrawByoipCidr -> Bool
(WithdrawByoipCidr -> WithdrawByoipCidr -> Bool)
-> (WithdrawByoipCidr -> WithdrawByoipCidr -> Bool)
-> Eq WithdrawByoipCidr
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WithdrawByoipCidr -> WithdrawByoipCidr -> Bool
$c/= :: WithdrawByoipCidr -> WithdrawByoipCidr -> Bool
== :: WithdrawByoipCidr -> WithdrawByoipCidr -> Bool
$c== :: WithdrawByoipCidr -> WithdrawByoipCidr -> Bool
Prelude.Eq, ReadPrec [WithdrawByoipCidr]
ReadPrec WithdrawByoipCidr
Int -> ReadS WithdrawByoipCidr
ReadS [WithdrawByoipCidr]
(Int -> ReadS WithdrawByoipCidr)
-> ReadS [WithdrawByoipCidr]
-> ReadPrec WithdrawByoipCidr
-> ReadPrec [WithdrawByoipCidr]
-> Read WithdrawByoipCidr
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WithdrawByoipCidr]
$creadListPrec :: ReadPrec [WithdrawByoipCidr]
readPrec :: ReadPrec WithdrawByoipCidr
$creadPrec :: ReadPrec WithdrawByoipCidr
readList :: ReadS [WithdrawByoipCidr]
$creadList :: ReadS [WithdrawByoipCidr]
readsPrec :: Int -> ReadS WithdrawByoipCidr
$creadsPrec :: Int -> ReadS WithdrawByoipCidr
Prelude.Read, Int -> WithdrawByoipCidr -> ShowS
[WithdrawByoipCidr] -> ShowS
WithdrawByoipCidr -> String
(Int -> WithdrawByoipCidr -> ShowS)
-> (WithdrawByoipCidr -> String)
-> ([WithdrawByoipCidr] -> ShowS)
-> Show WithdrawByoipCidr
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WithdrawByoipCidr] -> ShowS
$cshowList :: [WithdrawByoipCidr] -> ShowS
show :: WithdrawByoipCidr -> String
$cshow :: WithdrawByoipCidr -> String
showsPrec :: Int -> WithdrawByoipCidr -> ShowS
$cshowsPrec :: Int -> WithdrawByoipCidr -> ShowS
Prelude.Show, (forall x. WithdrawByoipCidr -> Rep WithdrawByoipCidr x)
-> (forall x. Rep WithdrawByoipCidr x -> WithdrawByoipCidr)
-> Generic WithdrawByoipCidr
forall x. Rep WithdrawByoipCidr x -> WithdrawByoipCidr
forall x. WithdrawByoipCidr -> Rep WithdrawByoipCidr x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep WithdrawByoipCidr x -> WithdrawByoipCidr
$cfrom :: forall x. WithdrawByoipCidr -> Rep WithdrawByoipCidr x
Prelude.Generic)
newWithdrawByoipCidr ::
Prelude.Text ->
WithdrawByoipCidr
newWithdrawByoipCidr :: Text -> WithdrawByoipCidr
newWithdrawByoipCidr Text
pCidr_ =
WithdrawByoipCidr' :: Text -> WithdrawByoipCidr
WithdrawByoipCidr' {$sel:cidr:WithdrawByoipCidr' :: Text
cidr = Text
pCidr_}
withdrawByoipCidr_cidr :: Lens.Lens' WithdrawByoipCidr Prelude.Text
withdrawByoipCidr_cidr :: (Text -> f Text) -> WithdrawByoipCidr -> f WithdrawByoipCidr
withdrawByoipCidr_cidr = (WithdrawByoipCidr -> Text)
-> (WithdrawByoipCidr -> Text -> WithdrawByoipCidr)
-> Lens WithdrawByoipCidr WithdrawByoipCidr Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WithdrawByoipCidr' {Text
cidr :: Text
$sel:cidr:WithdrawByoipCidr' :: WithdrawByoipCidr -> Text
cidr} -> Text
cidr) (\s :: WithdrawByoipCidr
s@WithdrawByoipCidr' {} Text
a -> WithdrawByoipCidr
s {$sel:cidr:WithdrawByoipCidr' :: Text
cidr = Text
a} :: WithdrawByoipCidr)
instance Core.AWSRequest WithdrawByoipCidr where
type
AWSResponse WithdrawByoipCidr =
WithdrawByoipCidrResponse
request :: WithdrawByoipCidr -> Request WithdrawByoipCidr
request = Service -> WithdrawByoipCidr -> Request WithdrawByoipCidr
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy WithdrawByoipCidr
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse WithdrawByoipCidr)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse WithdrawByoipCidr))
-> Logger
-> Service
-> Proxy WithdrawByoipCidr
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse WithdrawByoipCidr)))
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 -> WithdrawByoipCidrResponse
WithdrawByoipCidrResponse'
(Maybe ByoipCidr -> Int -> WithdrawByoipCidrResponse)
-> Either String (Maybe ByoipCidr)
-> Either String (Int -> WithdrawByoipCidrResponse)
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 -> WithdrawByoipCidrResponse)
-> Either String Int -> Either String WithdrawByoipCidrResponse
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 WithdrawByoipCidr
instance Prelude.NFData WithdrawByoipCidr
instance Core.ToHeaders WithdrawByoipCidr where
toHeaders :: WithdrawByoipCidr -> ResponseHeaders
toHeaders =
ResponseHeaders -> WithdrawByoipCidr -> 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.WithdrawByoipCidr" ::
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 WithdrawByoipCidr where
toJSON :: WithdrawByoipCidr -> Value
toJSON WithdrawByoipCidr' {Text
cidr :: Text
$sel:cidr:WithdrawByoipCidr' :: WithdrawByoipCidr -> 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 WithdrawByoipCidr where
toPath :: WithdrawByoipCidr -> ByteString
toPath = ByteString -> WithdrawByoipCidr -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery WithdrawByoipCidr where
toQuery :: WithdrawByoipCidr -> QueryString
toQuery = QueryString -> WithdrawByoipCidr -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data WithdrawByoipCidrResponse = WithdrawByoipCidrResponse'
{
WithdrawByoipCidrResponse -> Maybe ByoipCidr
byoipCidr :: Prelude.Maybe ByoipCidr,
WithdrawByoipCidrResponse -> Int
httpStatus :: Prelude.Int
}
deriving (WithdrawByoipCidrResponse -> WithdrawByoipCidrResponse -> Bool
(WithdrawByoipCidrResponse -> WithdrawByoipCidrResponse -> Bool)
-> (WithdrawByoipCidrResponse -> WithdrawByoipCidrResponse -> Bool)
-> Eq WithdrawByoipCidrResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WithdrawByoipCidrResponse -> WithdrawByoipCidrResponse -> Bool
$c/= :: WithdrawByoipCidrResponse -> WithdrawByoipCidrResponse -> Bool
== :: WithdrawByoipCidrResponse -> WithdrawByoipCidrResponse -> Bool
$c== :: WithdrawByoipCidrResponse -> WithdrawByoipCidrResponse -> Bool
Prelude.Eq, ReadPrec [WithdrawByoipCidrResponse]
ReadPrec WithdrawByoipCidrResponse
Int -> ReadS WithdrawByoipCidrResponse
ReadS [WithdrawByoipCidrResponse]
(Int -> ReadS WithdrawByoipCidrResponse)
-> ReadS [WithdrawByoipCidrResponse]
-> ReadPrec WithdrawByoipCidrResponse
-> ReadPrec [WithdrawByoipCidrResponse]
-> Read WithdrawByoipCidrResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WithdrawByoipCidrResponse]
$creadListPrec :: ReadPrec [WithdrawByoipCidrResponse]
readPrec :: ReadPrec WithdrawByoipCidrResponse
$creadPrec :: ReadPrec WithdrawByoipCidrResponse
readList :: ReadS [WithdrawByoipCidrResponse]
$creadList :: ReadS [WithdrawByoipCidrResponse]
readsPrec :: Int -> ReadS WithdrawByoipCidrResponse
$creadsPrec :: Int -> ReadS WithdrawByoipCidrResponse
Prelude.Read, Int -> WithdrawByoipCidrResponse -> ShowS
[WithdrawByoipCidrResponse] -> ShowS
WithdrawByoipCidrResponse -> String
(Int -> WithdrawByoipCidrResponse -> ShowS)
-> (WithdrawByoipCidrResponse -> String)
-> ([WithdrawByoipCidrResponse] -> ShowS)
-> Show WithdrawByoipCidrResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WithdrawByoipCidrResponse] -> ShowS
$cshowList :: [WithdrawByoipCidrResponse] -> ShowS
show :: WithdrawByoipCidrResponse -> String
$cshow :: WithdrawByoipCidrResponse -> String
showsPrec :: Int -> WithdrawByoipCidrResponse -> ShowS
$cshowsPrec :: Int -> WithdrawByoipCidrResponse -> ShowS
Prelude.Show, (forall x.
WithdrawByoipCidrResponse -> Rep WithdrawByoipCidrResponse x)
-> (forall x.
Rep WithdrawByoipCidrResponse x -> WithdrawByoipCidrResponse)
-> Generic WithdrawByoipCidrResponse
forall x.
Rep WithdrawByoipCidrResponse x -> WithdrawByoipCidrResponse
forall x.
WithdrawByoipCidrResponse -> Rep WithdrawByoipCidrResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep WithdrawByoipCidrResponse x -> WithdrawByoipCidrResponse
$cfrom :: forall x.
WithdrawByoipCidrResponse -> Rep WithdrawByoipCidrResponse x
Prelude.Generic)
newWithdrawByoipCidrResponse ::
Prelude.Int ->
WithdrawByoipCidrResponse
newWithdrawByoipCidrResponse :: Int -> WithdrawByoipCidrResponse
newWithdrawByoipCidrResponse Int
pHttpStatus_ =
WithdrawByoipCidrResponse' :: Maybe ByoipCidr -> Int -> WithdrawByoipCidrResponse
WithdrawByoipCidrResponse'
{ $sel:byoipCidr:WithdrawByoipCidrResponse' :: Maybe ByoipCidr
byoipCidr =
Maybe ByoipCidr
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:WithdrawByoipCidrResponse' :: Int
httpStatus = Int
pHttpStatus_
}
withdrawByoipCidrResponse_byoipCidr :: Lens.Lens' WithdrawByoipCidrResponse (Prelude.Maybe ByoipCidr)
withdrawByoipCidrResponse_byoipCidr :: (Maybe ByoipCidr -> f (Maybe ByoipCidr))
-> WithdrawByoipCidrResponse -> f WithdrawByoipCidrResponse
withdrawByoipCidrResponse_byoipCidr = (WithdrawByoipCidrResponse -> Maybe ByoipCidr)
-> (WithdrawByoipCidrResponse
-> Maybe ByoipCidr -> WithdrawByoipCidrResponse)
-> Lens
WithdrawByoipCidrResponse
WithdrawByoipCidrResponse
(Maybe ByoipCidr)
(Maybe ByoipCidr)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WithdrawByoipCidrResponse' {Maybe ByoipCidr
byoipCidr :: Maybe ByoipCidr
$sel:byoipCidr:WithdrawByoipCidrResponse' :: WithdrawByoipCidrResponse -> Maybe ByoipCidr
byoipCidr} -> Maybe ByoipCidr
byoipCidr) (\s :: WithdrawByoipCidrResponse
s@WithdrawByoipCidrResponse' {} Maybe ByoipCidr
a -> WithdrawByoipCidrResponse
s {$sel:byoipCidr:WithdrawByoipCidrResponse' :: Maybe ByoipCidr
byoipCidr = Maybe ByoipCidr
a} :: WithdrawByoipCidrResponse)
withdrawByoipCidrResponse_httpStatus :: Lens.Lens' WithdrawByoipCidrResponse Prelude.Int
withdrawByoipCidrResponse_httpStatus :: (Int -> f Int)
-> WithdrawByoipCidrResponse -> f WithdrawByoipCidrResponse
withdrawByoipCidrResponse_httpStatus = (WithdrawByoipCidrResponse -> Int)
-> (WithdrawByoipCidrResponse -> Int -> WithdrawByoipCidrResponse)
-> Lens WithdrawByoipCidrResponse WithdrawByoipCidrResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WithdrawByoipCidrResponse' {Int
httpStatus :: Int
$sel:httpStatus:WithdrawByoipCidrResponse' :: WithdrawByoipCidrResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: WithdrawByoipCidrResponse
s@WithdrawByoipCidrResponse' {} Int
a -> WithdrawByoipCidrResponse
s {$sel:httpStatus:WithdrawByoipCidrResponse' :: Int
httpStatus = Int
a} :: WithdrawByoipCidrResponse)
instance Prelude.NFData WithdrawByoipCidrResponse