{-# 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.UpdateAccelerator
(
UpdateAccelerator (..),
newUpdateAccelerator,
updateAccelerator_enabled,
updateAccelerator_ipAddressType,
updateAccelerator_name,
updateAccelerator_acceleratorArn,
UpdateAcceleratorResponse (..),
newUpdateAcceleratorResponse,
updateAcceleratorResponse_accelerator,
updateAcceleratorResponse_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 UpdateAccelerator = UpdateAccelerator'
{
UpdateAccelerator -> Maybe Bool
enabled :: Prelude.Maybe Prelude.Bool,
UpdateAccelerator -> Maybe IpAddressType
ipAddressType :: Prelude.Maybe IpAddressType,
UpdateAccelerator -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
UpdateAccelerator -> Text
acceleratorArn :: Prelude.Text
}
deriving (UpdateAccelerator -> UpdateAccelerator -> Bool
(UpdateAccelerator -> UpdateAccelerator -> Bool)
-> (UpdateAccelerator -> UpdateAccelerator -> Bool)
-> Eq UpdateAccelerator
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateAccelerator -> UpdateAccelerator -> Bool
$c/= :: UpdateAccelerator -> UpdateAccelerator -> Bool
== :: UpdateAccelerator -> UpdateAccelerator -> Bool
$c== :: UpdateAccelerator -> UpdateAccelerator -> Bool
Prelude.Eq, ReadPrec [UpdateAccelerator]
ReadPrec UpdateAccelerator
Int -> ReadS UpdateAccelerator
ReadS [UpdateAccelerator]
(Int -> ReadS UpdateAccelerator)
-> ReadS [UpdateAccelerator]
-> ReadPrec UpdateAccelerator
-> ReadPrec [UpdateAccelerator]
-> Read UpdateAccelerator
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateAccelerator]
$creadListPrec :: ReadPrec [UpdateAccelerator]
readPrec :: ReadPrec UpdateAccelerator
$creadPrec :: ReadPrec UpdateAccelerator
readList :: ReadS [UpdateAccelerator]
$creadList :: ReadS [UpdateAccelerator]
readsPrec :: Int -> ReadS UpdateAccelerator
$creadsPrec :: Int -> ReadS UpdateAccelerator
Prelude.Read, Int -> UpdateAccelerator -> ShowS
[UpdateAccelerator] -> ShowS
UpdateAccelerator -> String
(Int -> UpdateAccelerator -> ShowS)
-> (UpdateAccelerator -> String)
-> ([UpdateAccelerator] -> ShowS)
-> Show UpdateAccelerator
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateAccelerator] -> ShowS
$cshowList :: [UpdateAccelerator] -> ShowS
show :: UpdateAccelerator -> String
$cshow :: UpdateAccelerator -> String
showsPrec :: Int -> UpdateAccelerator -> ShowS
$cshowsPrec :: Int -> UpdateAccelerator -> ShowS
Prelude.Show, (forall x. UpdateAccelerator -> Rep UpdateAccelerator x)
-> (forall x. Rep UpdateAccelerator x -> UpdateAccelerator)
-> Generic UpdateAccelerator
forall x. Rep UpdateAccelerator x -> UpdateAccelerator
forall x. UpdateAccelerator -> Rep UpdateAccelerator x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateAccelerator x -> UpdateAccelerator
$cfrom :: forall x. UpdateAccelerator -> Rep UpdateAccelerator x
Prelude.Generic)
newUpdateAccelerator ::
Prelude.Text ->
UpdateAccelerator
newUpdateAccelerator :: Text -> UpdateAccelerator
newUpdateAccelerator Text
pAcceleratorArn_ =
UpdateAccelerator' :: Maybe Bool
-> Maybe IpAddressType -> Maybe Text -> Text -> UpdateAccelerator
UpdateAccelerator'
{ $sel:enabled:UpdateAccelerator' :: Maybe Bool
enabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:ipAddressType:UpdateAccelerator' :: Maybe IpAddressType
ipAddressType = Maybe IpAddressType
forall a. Maybe a
Prelude.Nothing,
$sel:name:UpdateAccelerator' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:acceleratorArn:UpdateAccelerator' :: Text
acceleratorArn = Text
pAcceleratorArn_
}
updateAccelerator_enabled :: Lens.Lens' UpdateAccelerator (Prelude.Maybe Prelude.Bool)
updateAccelerator_enabled :: (Maybe Bool -> f (Maybe Bool))
-> UpdateAccelerator -> f UpdateAccelerator
updateAccelerator_enabled = (UpdateAccelerator -> Maybe Bool)
-> (UpdateAccelerator -> Maybe Bool -> UpdateAccelerator)
-> Lens
UpdateAccelerator UpdateAccelerator (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAccelerator' {Maybe Bool
enabled :: Maybe Bool
$sel:enabled:UpdateAccelerator' :: UpdateAccelerator -> Maybe Bool
enabled} -> Maybe Bool
enabled) (\s :: UpdateAccelerator
s@UpdateAccelerator' {} Maybe Bool
a -> UpdateAccelerator
s {$sel:enabled:UpdateAccelerator' :: Maybe Bool
enabled = Maybe Bool
a} :: UpdateAccelerator)
updateAccelerator_ipAddressType :: Lens.Lens' UpdateAccelerator (Prelude.Maybe IpAddressType)
updateAccelerator_ipAddressType :: (Maybe IpAddressType -> f (Maybe IpAddressType))
-> UpdateAccelerator -> f UpdateAccelerator
updateAccelerator_ipAddressType = (UpdateAccelerator -> Maybe IpAddressType)
-> (UpdateAccelerator -> Maybe IpAddressType -> UpdateAccelerator)
-> Lens
UpdateAccelerator
UpdateAccelerator
(Maybe IpAddressType)
(Maybe IpAddressType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAccelerator' {Maybe IpAddressType
ipAddressType :: Maybe IpAddressType
$sel:ipAddressType:UpdateAccelerator' :: UpdateAccelerator -> Maybe IpAddressType
ipAddressType} -> Maybe IpAddressType
ipAddressType) (\s :: UpdateAccelerator
s@UpdateAccelerator' {} Maybe IpAddressType
a -> UpdateAccelerator
s {$sel:ipAddressType:UpdateAccelerator' :: Maybe IpAddressType
ipAddressType = Maybe IpAddressType
a} :: UpdateAccelerator)
updateAccelerator_name :: Lens.Lens' UpdateAccelerator (Prelude.Maybe Prelude.Text)
updateAccelerator_name :: (Maybe Text -> f (Maybe Text))
-> UpdateAccelerator -> f UpdateAccelerator
updateAccelerator_name = (UpdateAccelerator -> Maybe Text)
-> (UpdateAccelerator -> Maybe Text -> UpdateAccelerator)
-> Lens
UpdateAccelerator UpdateAccelerator (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAccelerator' {Maybe Text
name :: Maybe Text
$sel:name:UpdateAccelerator' :: UpdateAccelerator -> Maybe Text
name} -> Maybe Text
name) (\s :: UpdateAccelerator
s@UpdateAccelerator' {} Maybe Text
a -> UpdateAccelerator
s {$sel:name:UpdateAccelerator' :: Maybe Text
name = Maybe Text
a} :: UpdateAccelerator)
updateAccelerator_acceleratorArn :: Lens.Lens' UpdateAccelerator Prelude.Text
updateAccelerator_acceleratorArn :: (Text -> f Text) -> UpdateAccelerator -> f UpdateAccelerator
updateAccelerator_acceleratorArn = (UpdateAccelerator -> Text)
-> (UpdateAccelerator -> Text -> UpdateAccelerator)
-> Lens UpdateAccelerator UpdateAccelerator Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAccelerator' {Text
acceleratorArn :: Text
$sel:acceleratorArn:UpdateAccelerator' :: UpdateAccelerator -> Text
acceleratorArn} -> Text
acceleratorArn) (\s :: UpdateAccelerator
s@UpdateAccelerator' {} Text
a -> UpdateAccelerator
s {$sel:acceleratorArn:UpdateAccelerator' :: Text
acceleratorArn = Text
a} :: UpdateAccelerator)
instance Core.AWSRequest UpdateAccelerator where
type
AWSResponse UpdateAccelerator =
UpdateAcceleratorResponse
request :: UpdateAccelerator -> Request UpdateAccelerator
request = Service -> UpdateAccelerator -> Request UpdateAccelerator
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateAccelerator
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateAccelerator)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateAccelerator))
-> Logger
-> Service
-> Proxy UpdateAccelerator
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateAccelerator)))
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 Accelerator -> Int -> UpdateAcceleratorResponse
UpdateAcceleratorResponse'
(Maybe Accelerator -> Int -> UpdateAcceleratorResponse)
-> Either String (Maybe Accelerator)
-> Either String (Int -> UpdateAcceleratorResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Accelerator)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Accelerator")
Either String (Int -> UpdateAcceleratorResponse)
-> Either String Int -> Either String UpdateAcceleratorResponse
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 UpdateAccelerator
instance Prelude.NFData UpdateAccelerator
instance Core.ToHeaders UpdateAccelerator where
toHeaders :: UpdateAccelerator -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateAccelerator -> 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.UpdateAccelerator" ::
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 UpdateAccelerator where
toJSON :: UpdateAccelerator -> Value
toJSON UpdateAccelerator' {Maybe Bool
Maybe Text
Maybe IpAddressType
Text
acceleratorArn :: Text
name :: Maybe Text
ipAddressType :: Maybe IpAddressType
enabled :: Maybe Bool
$sel:acceleratorArn:UpdateAccelerator' :: UpdateAccelerator -> Text
$sel:name:UpdateAccelerator' :: UpdateAccelerator -> Maybe Text
$sel:ipAddressType:UpdateAccelerator' :: UpdateAccelerator -> Maybe IpAddressType
$sel:enabled:UpdateAccelerator' :: UpdateAccelerator -> Maybe Bool
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Enabled" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
enabled,
(Text
"IpAddressType" Text -> IpAddressType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (IpAddressType -> Pair) -> Maybe IpAddressType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe IpAddressType
ipAddressType,
(Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
name,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"AcceleratorArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
acceleratorArn)
]
)
instance Core.ToPath UpdateAccelerator where
toPath :: UpdateAccelerator -> ByteString
toPath = ByteString -> UpdateAccelerator -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery UpdateAccelerator where
toQuery :: UpdateAccelerator -> QueryString
toQuery = QueryString -> UpdateAccelerator -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateAcceleratorResponse = UpdateAcceleratorResponse'
{
UpdateAcceleratorResponse -> Maybe Accelerator
accelerator :: Prelude.Maybe Accelerator,
UpdateAcceleratorResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateAcceleratorResponse -> UpdateAcceleratorResponse -> Bool
(UpdateAcceleratorResponse -> UpdateAcceleratorResponse -> Bool)
-> (UpdateAcceleratorResponse -> UpdateAcceleratorResponse -> Bool)
-> Eq UpdateAcceleratorResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateAcceleratorResponse -> UpdateAcceleratorResponse -> Bool
$c/= :: UpdateAcceleratorResponse -> UpdateAcceleratorResponse -> Bool
== :: UpdateAcceleratorResponse -> UpdateAcceleratorResponse -> Bool
$c== :: UpdateAcceleratorResponse -> UpdateAcceleratorResponse -> Bool
Prelude.Eq, ReadPrec [UpdateAcceleratorResponse]
ReadPrec UpdateAcceleratorResponse
Int -> ReadS UpdateAcceleratorResponse
ReadS [UpdateAcceleratorResponse]
(Int -> ReadS UpdateAcceleratorResponse)
-> ReadS [UpdateAcceleratorResponse]
-> ReadPrec UpdateAcceleratorResponse
-> ReadPrec [UpdateAcceleratorResponse]
-> Read UpdateAcceleratorResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateAcceleratorResponse]
$creadListPrec :: ReadPrec [UpdateAcceleratorResponse]
readPrec :: ReadPrec UpdateAcceleratorResponse
$creadPrec :: ReadPrec UpdateAcceleratorResponse
readList :: ReadS [UpdateAcceleratorResponse]
$creadList :: ReadS [UpdateAcceleratorResponse]
readsPrec :: Int -> ReadS UpdateAcceleratorResponse
$creadsPrec :: Int -> ReadS UpdateAcceleratorResponse
Prelude.Read, Int -> UpdateAcceleratorResponse -> ShowS
[UpdateAcceleratorResponse] -> ShowS
UpdateAcceleratorResponse -> String
(Int -> UpdateAcceleratorResponse -> ShowS)
-> (UpdateAcceleratorResponse -> String)
-> ([UpdateAcceleratorResponse] -> ShowS)
-> Show UpdateAcceleratorResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateAcceleratorResponse] -> ShowS
$cshowList :: [UpdateAcceleratorResponse] -> ShowS
show :: UpdateAcceleratorResponse -> String
$cshow :: UpdateAcceleratorResponse -> String
showsPrec :: Int -> UpdateAcceleratorResponse -> ShowS
$cshowsPrec :: Int -> UpdateAcceleratorResponse -> ShowS
Prelude.Show, (forall x.
UpdateAcceleratorResponse -> Rep UpdateAcceleratorResponse x)
-> (forall x.
Rep UpdateAcceleratorResponse x -> UpdateAcceleratorResponse)
-> Generic UpdateAcceleratorResponse
forall x.
Rep UpdateAcceleratorResponse x -> UpdateAcceleratorResponse
forall x.
UpdateAcceleratorResponse -> Rep UpdateAcceleratorResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateAcceleratorResponse x -> UpdateAcceleratorResponse
$cfrom :: forall x.
UpdateAcceleratorResponse -> Rep UpdateAcceleratorResponse x
Prelude.Generic)
newUpdateAcceleratorResponse ::
Prelude.Int ->
UpdateAcceleratorResponse
newUpdateAcceleratorResponse :: Int -> UpdateAcceleratorResponse
newUpdateAcceleratorResponse Int
pHttpStatus_ =
UpdateAcceleratorResponse' :: Maybe Accelerator -> Int -> UpdateAcceleratorResponse
UpdateAcceleratorResponse'
{ $sel:accelerator:UpdateAcceleratorResponse' :: Maybe Accelerator
accelerator =
Maybe Accelerator
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateAcceleratorResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateAcceleratorResponse_accelerator :: Lens.Lens' UpdateAcceleratorResponse (Prelude.Maybe Accelerator)
updateAcceleratorResponse_accelerator :: (Maybe Accelerator -> f (Maybe Accelerator))
-> UpdateAcceleratorResponse -> f UpdateAcceleratorResponse
updateAcceleratorResponse_accelerator = (UpdateAcceleratorResponse -> Maybe Accelerator)
-> (UpdateAcceleratorResponse
-> Maybe Accelerator -> UpdateAcceleratorResponse)
-> Lens
UpdateAcceleratorResponse
UpdateAcceleratorResponse
(Maybe Accelerator)
(Maybe Accelerator)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAcceleratorResponse' {Maybe Accelerator
accelerator :: Maybe Accelerator
$sel:accelerator:UpdateAcceleratorResponse' :: UpdateAcceleratorResponse -> Maybe Accelerator
accelerator} -> Maybe Accelerator
accelerator) (\s :: UpdateAcceleratorResponse
s@UpdateAcceleratorResponse' {} Maybe Accelerator
a -> UpdateAcceleratorResponse
s {$sel:accelerator:UpdateAcceleratorResponse' :: Maybe Accelerator
accelerator = Maybe Accelerator
a} :: UpdateAcceleratorResponse)
updateAcceleratorResponse_httpStatus :: Lens.Lens' UpdateAcceleratorResponse Prelude.Int
updateAcceleratorResponse_httpStatus :: (Int -> f Int)
-> UpdateAcceleratorResponse -> f UpdateAcceleratorResponse
updateAcceleratorResponse_httpStatus = (UpdateAcceleratorResponse -> Int)
-> (UpdateAcceleratorResponse -> Int -> UpdateAcceleratorResponse)
-> Lens UpdateAcceleratorResponse UpdateAcceleratorResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAcceleratorResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateAcceleratorResponse' :: UpdateAcceleratorResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateAcceleratorResponse
s@UpdateAcceleratorResponse' {} Int
a -> UpdateAcceleratorResponse
s {$sel:httpStatus:UpdateAcceleratorResponse' :: Int
httpStatus = Int
a} :: UpdateAcceleratorResponse)
instance Prelude.NFData UpdateAcceleratorResponse