{-# 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.Config.PutConfigRule
(
PutConfigRule (..),
newPutConfigRule,
putConfigRule_tags,
putConfigRule_configRule,
PutConfigRuleResponse (..),
newPutConfigRuleResponse,
)
where
import Amazonka.Config.Types
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
data PutConfigRule = PutConfigRule'
{
PutConfigRule -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
PutConfigRule -> ConfigRule
configRule :: ConfigRule
}
deriving (PutConfigRule -> PutConfigRule -> Bool
(PutConfigRule -> PutConfigRule -> Bool)
-> (PutConfigRule -> PutConfigRule -> Bool) -> Eq PutConfigRule
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutConfigRule -> PutConfigRule -> Bool
$c/= :: PutConfigRule -> PutConfigRule -> Bool
== :: PutConfigRule -> PutConfigRule -> Bool
$c== :: PutConfigRule -> PutConfigRule -> Bool
Prelude.Eq, ReadPrec [PutConfigRule]
ReadPrec PutConfigRule
Int -> ReadS PutConfigRule
ReadS [PutConfigRule]
(Int -> ReadS PutConfigRule)
-> ReadS [PutConfigRule]
-> ReadPrec PutConfigRule
-> ReadPrec [PutConfigRule]
-> Read PutConfigRule
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutConfigRule]
$creadListPrec :: ReadPrec [PutConfigRule]
readPrec :: ReadPrec PutConfigRule
$creadPrec :: ReadPrec PutConfigRule
readList :: ReadS [PutConfigRule]
$creadList :: ReadS [PutConfigRule]
readsPrec :: Int -> ReadS PutConfigRule
$creadsPrec :: Int -> ReadS PutConfigRule
Prelude.Read, Int -> PutConfigRule -> ShowS
[PutConfigRule] -> ShowS
PutConfigRule -> String
(Int -> PutConfigRule -> ShowS)
-> (PutConfigRule -> String)
-> ([PutConfigRule] -> ShowS)
-> Show PutConfigRule
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutConfigRule] -> ShowS
$cshowList :: [PutConfigRule] -> ShowS
show :: PutConfigRule -> String
$cshow :: PutConfigRule -> String
showsPrec :: Int -> PutConfigRule -> ShowS
$cshowsPrec :: Int -> PutConfigRule -> ShowS
Prelude.Show, (forall x. PutConfigRule -> Rep PutConfigRule x)
-> (forall x. Rep PutConfigRule x -> PutConfigRule)
-> Generic PutConfigRule
forall x. Rep PutConfigRule x -> PutConfigRule
forall x. PutConfigRule -> Rep PutConfigRule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutConfigRule x -> PutConfigRule
$cfrom :: forall x. PutConfigRule -> Rep PutConfigRule x
Prelude.Generic)
newPutConfigRule ::
ConfigRule ->
PutConfigRule
newPutConfigRule :: ConfigRule -> PutConfigRule
newPutConfigRule ConfigRule
pConfigRule_ =
PutConfigRule' :: Maybe [Tag] -> ConfigRule -> PutConfigRule
PutConfigRule'
{ $sel:tags:PutConfigRule' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
$sel:configRule:PutConfigRule' :: ConfigRule
configRule = ConfigRule
pConfigRule_
}
putConfigRule_tags :: Lens.Lens' PutConfigRule (Prelude.Maybe [Tag])
putConfigRule_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> PutConfigRule -> f PutConfigRule
putConfigRule_tags = (PutConfigRule -> Maybe [Tag])
-> (PutConfigRule -> Maybe [Tag] -> PutConfigRule)
-> Lens PutConfigRule PutConfigRule (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutConfigRule' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:PutConfigRule' :: PutConfigRule -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: PutConfigRule
s@PutConfigRule' {} Maybe [Tag]
a -> PutConfigRule
s {$sel:tags:PutConfigRule' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: PutConfigRule) ((Maybe [Tag] -> f (Maybe [Tag]))
-> PutConfigRule -> f PutConfigRule)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
-> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> PutConfigRule
-> f PutConfigRule
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
putConfigRule_configRule :: Lens.Lens' PutConfigRule ConfigRule
putConfigRule_configRule :: (ConfigRule -> f ConfigRule) -> PutConfigRule -> f PutConfigRule
putConfigRule_configRule = (PutConfigRule -> ConfigRule)
-> (PutConfigRule -> ConfigRule -> PutConfigRule)
-> Lens PutConfigRule PutConfigRule ConfigRule ConfigRule
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutConfigRule' {ConfigRule
configRule :: ConfigRule
$sel:configRule:PutConfigRule' :: PutConfigRule -> ConfigRule
configRule} -> ConfigRule
configRule) (\s :: PutConfigRule
s@PutConfigRule' {} ConfigRule
a -> PutConfigRule
s {$sel:configRule:PutConfigRule' :: ConfigRule
configRule = ConfigRule
a} :: PutConfigRule)
instance Core.AWSRequest PutConfigRule where
type
AWSResponse PutConfigRule =
PutConfigRuleResponse
request :: PutConfigRule -> Request PutConfigRule
request = Service -> PutConfigRule -> Request PutConfigRule
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy PutConfigRule
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PutConfigRule)))
response =
AWSResponse PutConfigRule
-> Logger
-> Service
-> Proxy PutConfigRule
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PutConfigRule)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse PutConfigRule
PutConfigRuleResponse
PutConfigRuleResponse'
instance Prelude.Hashable PutConfigRule
instance Prelude.NFData PutConfigRule
instance Core.ToHeaders PutConfigRule where
toHeaders :: PutConfigRule -> [Header]
toHeaders =
[Header] -> PutConfigRule -> [Header]
forall a b. a -> b -> a
Prelude.const
( [[Header]] -> [Header]
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"StarlingDoveService.PutConfigRule" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON PutConfigRule where
toJSON :: PutConfigRule -> Value
toJSON PutConfigRule' {Maybe [Tag]
ConfigRule
configRule :: ConfigRule
tags :: Maybe [Tag]
$sel:configRule:PutConfigRule' :: PutConfigRule -> ConfigRule
$sel:tags:PutConfigRule' :: PutConfigRule -> Maybe [Tag]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Tags" Text -> [Tag] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Tag] -> Pair) -> Maybe [Tag] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ConfigRule" Text -> ConfigRule -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ConfigRule
configRule)
]
)
instance Core.ToPath PutConfigRule where
toPath :: PutConfigRule -> ByteString
toPath = ByteString -> PutConfigRule -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery PutConfigRule where
toQuery :: PutConfigRule -> QueryString
toQuery = QueryString -> PutConfigRule -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data PutConfigRuleResponse = PutConfigRuleResponse'
{
}
deriving (PutConfigRuleResponse -> PutConfigRuleResponse -> Bool
(PutConfigRuleResponse -> PutConfigRuleResponse -> Bool)
-> (PutConfigRuleResponse -> PutConfigRuleResponse -> Bool)
-> Eq PutConfigRuleResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutConfigRuleResponse -> PutConfigRuleResponse -> Bool
$c/= :: PutConfigRuleResponse -> PutConfigRuleResponse -> Bool
== :: PutConfigRuleResponse -> PutConfigRuleResponse -> Bool
$c== :: PutConfigRuleResponse -> PutConfigRuleResponse -> Bool
Prelude.Eq, ReadPrec [PutConfigRuleResponse]
ReadPrec PutConfigRuleResponse
Int -> ReadS PutConfigRuleResponse
ReadS [PutConfigRuleResponse]
(Int -> ReadS PutConfigRuleResponse)
-> ReadS [PutConfigRuleResponse]
-> ReadPrec PutConfigRuleResponse
-> ReadPrec [PutConfigRuleResponse]
-> Read PutConfigRuleResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutConfigRuleResponse]
$creadListPrec :: ReadPrec [PutConfigRuleResponse]
readPrec :: ReadPrec PutConfigRuleResponse
$creadPrec :: ReadPrec PutConfigRuleResponse
readList :: ReadS [PutConfigRuleResponse]
$creadList :: ReadS [PutConfigRuleResponse]
readsPrec :: Int -> ReadS PutConfigRuleResponse
$creadsPrec :: Int -> ReadS PutConfigRuleResponse
Prelude.Read, Int -> PutConfigRuleResponse -> ShowS
[PutConfigRuleResponse] -> ShowS
PutConfigRuleResponse -> String
(Int -> PutConfigRuleResponse -> ShowS)
-> (PutConfigRuleResponse -> String)
-> ([PutConfigRuleResponse] -> ShowS)
-> Show PutConfigRuleResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutConfigRuleResponse] -> ShowS
$cshowList :: [PutConfigRuleResponse] -> ShowS
show :: PutConfigRuleResponse -> String
$cshow :: PutConfigRuleResponse -> String
showsPrec :: Int -> PutConfigRuleResponse -> ShowS
$cshowsPrec :: Int -> PutConfigRuleResponse -> ShowS
Prelude.Show, (forall x. PutConfigRuleResponse -> Rep PutConfigRuleResponse x)
-> (forall x. Rep PutConfigRuleResponse x -> PutConfigRuleResponse)
-> Generic PutConfigRuleResponse
forall x. Rep PutConfigRuleResponse x -> PutConfigRuleResponse
forall x. PutConfigRuleResponse -> Rep PutConfigRuleResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutConfigRuleResponse x -> PutConfigRuleResponse
$cfrom :: forall x. PutConfigRuleResponse -> Rep PutConfigRuleResponse x
Prelude.Generic)
newPutConfigRuleResponse ::
PutConfigRuleResponse
newPutConfigRuleResponse :: PutConfigRuleResponse
newPutConfigRuleResponse = PutConfigRuleResponse
PutConfigRuleResponse'
instance Prelude.NFData PutConfigRuleResponse