{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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'
{ $sel:tags:PutConfigRule' :: Maybe [Tag]
tags = forall a. Maybe a
Prelude.Nothing,
$sel:configRule:PutConfigRule' :: ConfigRule
configRule = ConfigRule
pConfigRule_
}
putConfigRule_tags :: Lens.Lens' PutConfigRule (Prelude.Maybe [Tag])
putConfigRule_tags :: Lens' PutConfigRule (Maybe [Tag])
putConfigRule_tags = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 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 :: Lens' PutConfigRule ConfigRule
putConfigRule_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 :: (Service -> Service) -> PutConfigRule -> Request PutConfigRule
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy PutConfigRule
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PutConfigRule)))
response =
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull PutConfigRuleResponse
PutConfigRuleResponse'
instance Prelude.Hashable PutConfigRule where
hashWithSalt :: Int -> PutConfigRule -> Int
hashWithSalt Int
_salt PutConfigRule' {Maybe [Tag]
ConfigRule
configRule :: ConfigRule
tags :: Maybe [Tag]
$sel:configRule:PutConfigRule' :: PutConfigRule -> ConfigRule
$sel:tags:PutConfigRule' :: PutConfigRule -> Maybe [Tag]
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Tag]
tags
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ConfigRule
configRule
instance Prelude.NFData PutConfigRule where
rnf :: PutConfigRule -> ()
rnf PutConfigRule' {Maybe [Tag]
ConfigRule
configRule :: ConfigRule
tags :: Maybe [Tag]
$sel:configRule:PutConfigRule' :: PutConfigRule -> ConfigRule
$sel:tags:PutConfigRule' :: PutConfigRule -> Maybe [Tag]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [Tag]
tags
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ConfigRule
configRule
instance Data.ToHeaders PutConfigRule where
toHeaders :: PutConfigRule -> [Header]
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> [Header]
Data.=# ( ByteString
"StarlingDoveService.PutConfigRule" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> [Header]
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.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
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"Tags" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
forall a. a -> Maybe a
Prelude.Just (Key
"ConfigRule" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= ConfigRule
configRule)
]
)
instance Data.ToPath PutConfigRule where
toPath :: PutConfigRule -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery PutConfigRule where
toQuery :: PutConfigRule -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data PutConfigRuleResponse = PutConfigRuleResponse'
{
}
deriving (PutConfigRuleResponse -> PutConfigRuleResponse -> Bool
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]
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
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. 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 where
rnf :: PutConfigRuleResponse -> ()
rnf PutConfigRuleResponse
_ = ()