{-# 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.Route53Resolver.UpdateFirewallConfig
(
UpdateFirewallConfig (..),
newUpdateFirewallConfig,
updateFirewallConfig_resourceId,
updateFirewallConfig_firewallFailOpen,
UpdateFirewallConfigResponse (..),
newUpdateFirewallConfigResponse,
updateFirewallConfigResponse_firewallConfig,
updateFirewallConfigResponse_httpStatus,
)
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.Route53Resolver.Types
data UpdateFirewallConfig = UpdateFirewallConfig'
{
UpdateFirewallConfig -> Text
resourceId :: Prelude.Text,
UpdateFirewallConfig -> FirewallFailOpenStatus
firewallFailOpen :: FirewallFailOpenStatus
}
deriving (UpdateFirewallConfig -> UpdateFirewallConfig -> Bool
(UpdateFirewallConfig -> UpdateFirewallConfig -> Bool)
-> (UpdateFirewallConfig -> UpdateFirewallConfig -> Bool)
-> Eq UpdateFirewallConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateFirewallConfig -> UpdateFirewallConfig -> Bool
$c/= :: UpdateFirewallConfig -> UpdateFirewallConfig -> Bool
== :: UpdateFirewallConfig -> UpdateFirewallConfig -> Bool
$c== :: UpdateFirewallConfig -> UpdateFirewallConfig -> Bool
Prelude.Eq, ReadPrec [UpdateFirewallConfig]
ReadPrec UpdateFirewallConfig
Int -> ReadS UpdateFirewallConfig
ReadS [UpdateFirewallConfig]
(Int -> ReadS UpdateFirewallConfig)
-> ReadS [UpdateFirewallConfig]
-> ReadPrec UpdateFirewallConfig
-> ReadPrec [UpdateFirewallConfig]
-> Read UpdateFirewallConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateFirewallConfig]
$creadListPrec :: ReadPrec [UpdateFirewallConfig]
readPrec :: ReadPrec UpdateFirewallConfig
$creadPrec :: ReadPrec UpdateFirewallConfig
readList :: ReadS [UpdateFirewallConfig]
$creadList :: ReadS [UpdateFirewallConfig]
readsPrec :: Int -> ReadS UpdateFirewallConfig
$creadsPrec :: Int -> ReadS UpdateFirewallConfig
Prelude.Read, Int -> UpdateFirewallConfig -> ShowS
[UpdateFirewallConfig] -> ShowS
UpdateFirewallConfig -> String
(Int -> UpdateFirewallConfig -> ShowS)
-> (UpdateFirewallConfig -> String)
-> ([UpdateFirewallConfig] -> ShowS)
-> Show UpdateFirewallConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateFirewallConfig] -> ShowS
$cshowList :: [UpdateFirewallConfig] -> ShowS
show :: UpdateFirewallConfig -> String
$cshow :: UpdateFirewallConfig -> String
showsPrec :: Int -> UpdateFirewallConfig -> ShowS
$cshowsPrec :: Int -> UpdateFirewallConfig -> ShowS
Prelude.Show, (forall x. UpdateFirewallConfig -> Rep UpdateFirewallConfig x)
-> (forall x. Rep UpdateFirewallConfig x -> UpdateFirewallConfig)
-> Generic UpdateFirewallConfig
forall x. Rep UpdateFirewallConfig x -> UpdateFirewallConfig
forall x. UpdateFirewallConfig -> Rep UpdateFirewallConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateFirewallConfig x -> UpdateFirewallConfig
$cfrom :: forall x. UpdateFirewallConfig -> Rep UpdateFirewallConfig x
Prelude.Generic)
newUpdateFirewallConfig ::
Prelude.Text ->
FirewallFailOpenStatus ->
UpdateFirewallConfig
newUpdateFirewallConfig :: Text -> FirewallFailOpenStatus -> UpdateFirewallConfig
newUpdateFirewallConfig
Text
pResourceId_
FirewallFailOpenStatus
pFirewallFailOpen_ =
UpdateFirewallConfig' :: Text -> FirewallFailOpenStatus -> UpdateFirewallConfig
UpdateFirewallConfig'
{ $sel:resourceId:UpdateFirewallConfig' :: Text
resourceId = Text
pResourceId_,
$sel:firewallFailOpen:UpdateFirewallConfig' :: FirewallFailOpenStatus
firewallFailOpen = FirewallFailOpenStatus
pFirewallFailOpen_
}
updateFirewallConfig_resourceId :: Lens.Lens' UpdateFirewallConfig Prelude.Text
updateFirewallConfig_resourceId :: (Text -> f Text) -> UpdateFirewallConfig -> f UpdateFirewallConfig
updateFirewallConfig_resourceId = (UpdateFirewallConfig -> Text)
-> (UpdateFirewallConfig -> Text -> UpdateFirewallConfig)
-> Lens UpdateFirewallConfig UpdateFirewallConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFirewallConfig' {Text
resourceId :: Text
$sel:resourceId:UpdateFirewallConfig' :: UpdateFirewallConfig -> Text
resourceId} -> Text
resourceId) (\s :: UpdateFirewallConfig
s@UpdateFirewallConfig' {} Text
a -> UpdateFirewallConfig
s {$sel:resourceId:UpdateFirewallConfig' :: Text
resourceId = Text
a} :: UpdateFirewallConfig)
updateFirewallConfig_firewallFailOpen :: Lens.Lens' UpdateFirewallConfig FirewallFailOpenStatus
updateFirewallConfig_firewallFailOpen :: (FirewallFailOpenStatus -> f FirewallFailOpenStatus)
-> UpdateFirewallConfig -> f UpdateFirewallConfig
updateFirewallConfig_firewallFailOpen = (UpdateFirewallConfig -> FirewallFailOpenStatus)
-> (UpdateFirewallConfig
-> FirewallFailOpenStatus -> UpdateFirewallConfig)
-> Lens
UpdateFirewallConfig
UpdateFirewallConfig
FirewallFailOpenStatus
FirewallFailOpenStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFirewallConfig' {FirewallFailOpenStatus
firewallFailOpen :: FirewallFailOpenStatus
$sel:firewallFailOpen:UpdateFirewallConfig' :: UpdateFirewallConfig -> FirewallFailOpenStatus
firewallFailOpen} -> FirewallFailOpenStatus
firewallFailOpen) (\s :: UpdateFirewallConfig
s@UpdateFirewallConfig' {} FirewallFailOpenStatus
a -> UpdateFirewallConfig
s {$sel:firewallFailOpen:UpdateFirewallConfig' :: FirewallFailOpenStatus
firewallFailOpen = FirewallFailOpenStatus
a} :: UpdateFirewallConfig)
instance Core.AWSRequest UpdateFirewallConfig where
type
AWSResponse UpdateFirewallConfig =
UpdateFirewallConfigResponse
request :: UpdateFirewallConfig -> Request UpdateFirewallConfig
request = Service -> UpdateFirewallConfig -> Request UpdateFirewallConfig
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateFirewallConfig
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateFirewallConfig)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateFirewallConfig))
-> Logger
-> Service
-> Proxy UpdateFirewallConfig
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateFirewallConfig)))
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 FirewallConfig -> Int -> UpdateFirewallConfigResponse
UpdateFirewallConfigResponse'
(Maybe FirewallConfig -> Int -> UpdateFirewallConfigResponse)
-> Either String (Maybe FirewallConfig)
-> Either String (Int -> UpdateFirewallConfigResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe FirewallConfig)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"FirewallConfig")
Either String (Int -> UpdateFirewallConfigResponse)
-> Either String Int -> Either String UpdateFirewallConfigResponse
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 UpdateFirewallConfig
instance Prelude.NFData UpdateFirewallConfig
instance Core.ToHeaders UpdateFirewallConfig where
toHeaders :: UpdateFirewallConfig -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateFirewallConfig -> 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
"Route53Resolver.UpdateFirewallConfig" ::
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 UpdateFirewallConfig where
toJSON :: UpdateFirewallConfig -> Value
toJSON UpdateFirewallConfig' {Text
FirewallFailOpenStatus
firewallFailOpen :: FirewallFailOpenStatus
resourceId :: Text
$sel:firewallFailOpen:UpdateFirewallConfig' :: UpdateFirewallConfig -> FirewallFailOpenStatus
$sel:resourceId:UpdateFirewallConfig' :: UpdateFirewallConfig -> 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
"ResourceId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
resourceId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"FirewallFailOpen" Text -> FirewallFailOpenStatus -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= FirewallFailOpenStatus
firewallFailOpen)
]
)
instance Core.ToPath UpdateFirewallConfig where
toPath :: UpdateFirewallConfig -> ByteString
toPath = ByteString -> UpdateFirewallConfig -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery UpdateFirewallConfig where
toQuery :: UpdateFirewallConfig -> QueryString
toQuery = QueryString -> UpdateFirewallConfig -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateFirewallConfigResponse = UpdateFirewallConfigResponse'
{
UpdateFirewallConfigResponse -> Maybe FirewallConfig
firewallConfig :: Prelude.Maybe FirewallConfig,
UpdateFirewallConfigResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateFirewallConfigResponse
-> UpdateFirewallConfigResponse -> Bool
(UpdateFirewallConfigResponse
-> UpdateFirewallConfigResponse -> Bool)
-> (UpdateFirewallConfigResponse
-> UpdateFirewallConfigResponse -> Bool)
-> Eq UpdateFirewallConfigResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateFirewallConfigResponse
-> UpdateFirewallConfigResponse -> Bool
$c/= :: UpdateFirewallConfigResponse
-> UpdateFirewallConfigResponse -> Bool
== :: UpdateFirewallConfigResponse
-> UpdateFirewallConfigResponse -> Bool
$c== :: UpdateFirewallConfigResponse
-> UpdateFirewallConfigResponse -> Bool
Prelude.Eq, ReadPrec [UpdateFirewallConfigResponse]
ReadPrec UpdateFirewallConfigResponse
Int -> ReadS UpdateFirewallConfigResponse
ReadS [UpdateFirewallConfigResponse]
(Int -> ReadS UpdateFirewallConfigResponse)
-> ReadS [UpdateFirewallConfigResponse]
-> ReadPrec UpdateFirewallConfigResponse
-> ReadPrec [UpdateFirewallConfigResponse]
-> Read UpdateFirewallConfigResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateFirewallConfigResponse]
$creadListPrec :: ReadPrec [UpdateFirewallConfigResponse]
readPrec :: ReadPrec UpdateFirewallConfigResponse
$creadPrec :: ReadPrec UpdateFirewallConfigResponse
readList :: ReadS [UpdateFirewallConfigResponse]
$creadList :: ReadS [UpdateFirewallConfigResponse]
readsPrec :: Int -> ReadS UpdateFirewallConfigResponse
$creadsPrec :: Int -> ReadS UpdateFirewallConfigResponse
Prelude.Read, Int -> UpdateFirewallConfigResponse -> ShowS
[UpdateFirewallConfigResponse] -> ShowS
UpdateFirewallConfigResponse -> String
(Int -> UpdateFirewallConfigResponse -> ShowS)
-> (UpdateFirewallConfigResponse -> String)
-> ([UpdateFirewallConfigResponse] -> ShowS)
-> Show UpdateFirewallConfigResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateFirewallConfigResponse] -> ShowS
$cshowList :: [UpdateFirewallConfigResponse] -> ShowS
show :: UpdateFirewallConfigResponse -> String
$cshow :: UpdateFirewallConfigResponse -> String
showsPrec :: Int -> UpdateFirewallConfigResponse -> ShowS
$cshowsPrec :: Int -> UpdateFirewallConfigResponse -> ShowS
Prelude.Show, (forall x.
UpdateFirewallConfigResponse -> Rep UpdateFirewallConfigResponse x)
-> (forall x.
Rep UpdateFirewallConfigResponse x -> UpdateFirewallConfigResponse)
-> Generic UpdateFirewallConfigResponse
forall x.
Rep UpdateFirewallConfigResponse x -> UpdateFirewallConfigResponse
forall x.
UpdateFirewallConfigResponse -> Rep UpdateFirewallConfigResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateFirewallConfigResponse x -> UpdateFirewallConfigResponse
$cfrom :: forall x.
UpdateFirewallConfigResponse -> Rep UpdateFirewallConfigResponse x
Prelude.Generic)
newUpdateFirewallConfigResponse ::
Prelude.Int ->
UpdateFirewallConfigResponse
newUpdateFirewallConfigResponse :: Int -> UpdateFirewallConfigResponse
newUpdateFirewallConfigResponse Int
pHttpStatus_ =
UpdateFirewallConfigResponse' :: Maybe FirewallConfig -> Int -> UpdateFirewallConfigResponse
UpdateFirewallConfigResponse'
{ $sel:firewallConfig:UpdateFirewallConfigResponse' :: Maybe FirewallConfig
firewallConfig =
Maybe FirewallConfig
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateFirewallConfigResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateFirewallConfigResponse_firewallConfig :: Lens.Lens' UpdateFirewallConfigResponse (Prelude.Maybe FirewallConfig)
updateFirewallConfigResponse_firewallConfig :: (Maybe FirewallConfig -> f (Maybe FirewallConfig))
-> UpdateFirewallConfigResponse -> f UpdateFirewallConfigResponse
updateFirewallConfigResponse_firewallConfig = (UpdateFirewallConfigResponse -> Maybe FirewallConfig)
-> (UpdateFirewallConfigResponse
-> Maybe FirewallConfig -> UpdateFirewallConfigResponse)
-> Lens
UpdateFirewallConfigResponse
UpdateFirewallConfigResponse
(Maybe FirewallConfig)
(Maybe FirewallConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFirewallConfigResponse' {Maybe FirewallConfig
firewallConfig :: Maybe FirewallConfig
$sel:firewallConfig:UpdateFirewallConfigResponse' :: UpdateFirewallConfigResponse -> Maybe FirewallConfig
firewallConfig} -> Maybe FirewallConfig
firewallConfig) (\s :: UpdateFirewallConfigResponse
s@UpdateFirewallConfigResponse' {} Maybe FirewallConfig
a -> UpdateFirewallConfigResponse
s {$sel:firewallConfig:UpdateFirewallConfigResponse' :: Maybe FirewallConfig
firewallConfig = Maybe FirewallConfig
a} :: UpdateFirewallConfigResponse)
updateFirewallConfigResponse_httpStatus :: Lens.Lens' UpdateFirewallConfigResponse Prelude.Int
updateFirewallConfigResponse_httpStatus :: (Int -> f Int)
-> UpdateFirewallConfigResponse -> f UpdateFirewallConfigResponse
updateFirewallConfigResponse_httpStatus = (UpdateFirewallConfigResponse -> Int)
-> (UpdateFirewallConfigResponse
-> Int -> UpdateFirewallConfigResponse)
-> Lens
UpdateFirewallConfigResponse UpdateFirewallConfigResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFirewallConfigResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateFirewallConfigResponse' :: UpdateFirewallConfigResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateFirewallConfigResponse
s@UpdateFirewallConfigResponse' {} Int
a -> UpdateFirewallConfigResponse
s {$sel:httpStatus:UpdateFirewallConfigResponse' :: Int
httpStatus = Int
a} :: UpdateFirewallConfigResponse)
instance Prelude.NFData UpdateFirewallConfigResponse