{-# 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.XRay.UpdateSamplingRule
(
UpdateSamplingRule (..),
newUpdateSamplingRule,
updateSamplingRule_samplingRuleUpdate,
UpdateSamplingRuleResponse (..),
newUpdateSamplingRuleResponse,
updateSamplingRuleResponse_samplingRuleRecord,
updateSamplingRuleResponse_httpStatus,
)
where
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
import Amazonka.XRay.Types
data UpdateSamplingRule = UpdateSamplingRule'
{
UpdateSamplingRule -> SamplingRuleUpdate
samplingRuleUpdate :: SamplingRuleUpdate
}
deriving (UpdateSamplingRule -> UpdateSamplingRule -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateSamplingRule -> UpdateSamplingRule -> Bool
$c/= :: UpdateSamplingRule -> UpdateSamplingRule -> Bool
== :: UpdateSamplingRule -> UpdateSamplingRule -> Bool
$c== :: UpdateSamplingRule -> UpdateSamplingRule -> Bool
Prelude.Eq, ReadPrec [UpdateSamplingRule]
ReadPrec UpdateSamplingRule
Int -> ReadS UpdateSamplingRule
ReadS [UpdateSamplingRule]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateSamplingRule]
$creadListPrec :: ReadPrec [UpdateSamplingRule]
readPrec :: ReadPrec UpdateSamplingRule
$creadPrec :: ReadPrec UpdateSamplingRule
readList :: ReadS [UpdateSamplingRule]
$creadList :: ReadS [UpdateSamplingRule]
readsPrec :: Int -> ReadS UpdateSamplingRule
$creadsPrec :: Int -> ReadS UpdateSamplingRule
Prelude.Read, Int -> UpdateSamplingRule -> ShowS
[UpdateSamplingRule] -> ShowS
UpdateSamplingRule -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateSamplingRule] -> ShowS
$cshowList :: [UpdateSamplingRule] -> ShowS
show :: UpdateSamplingRule -> String
$cshow :: UpdateSamplingRule -> String
showsPrec :: Int -> UpdateSamplingRule -> ShowS
$cshowsPrec :: Int -> UpdateSamplingRule -> ShowS
Prelude.Show, forall x. Rep UpdateSamplingRule x -> UpdateSamplingRule
forall x. UpdateSamplingRule -> Rep UpdateSamplingRule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateSamplingRule x -> UpdateSamplingRule
$cfrom :: forall x. UpdateSamplingRule -> Rep UpdateSamplingRule x
Prelude.Generic)
newUpdateSamplingRule ::
SamplingRuleUpdate ->
UpdateSamplingRule
newUpdateSamplingRule :: SamplingRuleUpdate -> UpdateSamplingRule
newUpdateSamplingRule SamplingRuleUpdate
pSamplingRuleUpdate_ =
UpdateSamplingRule'
{ $sel:samplingRuleUpdate:UpdateSamplingRule' :: SamplingRuleUpdate
samplingRuleUpdate =
SamplingRuleUpdate
pSamplingRuleUpdate_
}
updateSamplingRule_samplingRuleUpdate :: Lens.Lens' UpdateSamplingRule SamplingRuleUpdate
updateSamplingRule_samplingRuleUpdate :: Lens' UpdateSamplingRule SamplingRuleUpdate
updateSamplingRule_samplingRuleUpdate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSamplingRule' {SamplingRuleUpdate
samplingRuleUpdate :: SamplingRuleUpdate
$sel:samplingRuleUpdate:UpdateSamplingRule' :: UpdateSamplingRule -> SamplingRuleUpdate
samplingRuleUpdate} -> SamplingRuleUpdate
samplingRuleUpdate) (\s :: UpdateSamplingRule
s@UpdateSamplingRule' {} SamplingRuleUpdate
a -> UpdateSamplingRule
s {$sel:samplingRuleUpdate:UpdateSamplingRule' :: SamplingRuleUpdate
samplingRuleUpdate = SamplingRuleUpdate
a} :: UpdateSamplingRule)
instance Core.AWSRequest UpdateSamplingRule where
type
AWSResponse UpdateSamplingRule =
UpdateSamplingRuleResponse
request :: (Service -> Service)
-> UpdateSamplingRule -> Request UpdateSamplingRule
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 UpdateSamplingRule
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateSamplingRule)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe SamplingRuleRecord -> Int -> UpdateSamplingRuleResponse
UpdateSamplingRuleResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"SamplingRuleRecord")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable UpdateSamplingRule where
hashWithSalt :: Int -> UpdateSamplingRule -> Int
hashWithSalt Int
_salt UpdateSamplingRule' {SamplingRuleUpdate
samplingRuleUpdate :: SamplingRuleUpdate
$sel:samplingRuleUpdate:UpdateSamplingRule' :: UpdateSamplingRule -> SamplingRuleUpdate
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` SamplingRuleUpdate
samplingRuleUpdate
instance Prelude.NFData UpdateSamplingRule where
rnf :: UpdateSamplingRule -> ()
rnf UpdateSamplingRule' {SamplingRuleUpdate
samplingRuleUpdate :: SamplingRuleUpdate
$sel:samplingRuleUpdate:UpdateSamplingRule' :: UpdateSamplingRule -> SamplingRuleUpdate
..} =
forall a. NFData a => a -> ()
Prelude.rnf SamplingRuleUpdate
samplingRuleUpdate
instance Data.ToHeaders UpdateSamplingRule where
toHeaders :: UpdateSamplingRule -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.ToJSON UpdateSamplingRule where
toJSON :: UpdateSamplingRule -> Value
toJSON UpdateSamplingRule' {SamplingRuleUpdate
samplingRuleUpdate :: SamplingRuleUpdate
$sel:samplingRuleUpdate:UpdateSamplingRule' :: UpdateSamplingRule -> SamplingRuleUpdate
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just
(Key
"SamplingRuleUpdate" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= SamplingRuleUpdate
samplingRuleUpdate)
]
)
instance Data.ToPath UpdateSamplingRule where
toPath :: UpdateSamplingRule -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/UpdateSamplingRule"
instance Data.ToQuery UpdateSamplingRule where
toQuery :: UpdateSamplingRule -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data UpdateSamplingRuleResponse = UpdateSamplingRuleResponse'
{
UpdateSamplingRuleResponse -> Maybe SamplingRuleRecord
samplingRuleRecord :: Prelude.Maybe SamplingRuleRecord,
UpdateSamplingRuleResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateSamplingRuleResponse -> UpdateSamplingRuleResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateSamplingRuleResponse -> UpdateSamplingRuleResponse -> Bool
$c/= :: UpdateSamplingRuleResponse -> UpdateSamplingRuleResponse -> Bool
== :: UpdateSamplingRuleResponse -> UpdateSamplingRuleResponse -> Bool
$c== :: UpdateSamplingRuleResponse -> UpdateSamplingRuleResponse -> Bool
Prelude.Eq, ReadPrec [UpdateSamplingRuleResponse]
ReadPrec UpdateSamplingRuleResponse
Int -> ReadS UpdateSamplingRuleResponse
ReadS [UpdateSamplingRuleResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateSamplingRuleResponse]
$creadListPrec :: ReadPrec [UpdateSamplingRuleResponse]
readPrec :: ReadPrec UpdateSamplingRuleResponse
$creadPrec :: ReadPrec UpdateSamplingRuleResponse
readList :: ReadS [UpdateSamplingRuleResponse]
$creadList :: ReadS [UpdateSamplingRuleResponse]
readsPrec :: Int -> ReadS UpdateSamplingRuleResponse
$creadsPrec :: Int -> ReadS UpdateSamplingRuleResponse
Prelude.Read, Int -> UpdateSamplingRuleResponse -> ShowS
[UpdateSamplingRuleResponse] -> ShowS
UpdateSamplingRuleResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateSamplingRuleResponse] -> ShowS
$cshowList :: [UpdateSamplingRuleResponse] -> ShowS
show :: UpdateSamplingRuleResponse -> String
$cshow :: UpdateSamplingRuleResponse -> String
showsPrec :: Int -> UpdateSamplingRuleResponse -> ShowS
$cshowsPrec :: Int -> UpdateSamplingRuleResponse -> ShowS
Prelude.Show, forall x.
Rep UpdateSamplingRuleResponse x -> UpdateSamplingRuleResponse
forall x.
UpdateSamplingRuleResponse -> Rep UpdateSamplingRuleResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateSamplingRuleResponse x -> UpdateSamplingRuleResponse
$cfrom :: forall x.
UpdateSamplingRuleResponse -> Rep UpdateSamplingRuleResponse x
Prelude.Generic)
newUpdateSamplingRuleResponse ::
Prelude.Int ->
UpdateSamplingRuleResponse
newUpdateSamplingRuleResponse :: Int -> UpdateSamplingRuleResponse
newUpdateSamplingRuleResponse Int
pHttpStatus_ =
UpdateSamplingRuleResponse'
{ $sel:samplingRuleRecord:UpdateSamplingRuleResponse' :: Maybe SamplingRuleRecord
samplingRuleRecord =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateSamplingRuleResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateSamplingRuleResponse_samplingRuleRecord :: Lens.Lens' UpdateSamplingRuleResponse (Prelude.Maybe SamplingRuleRecord)
updateSamplingRuleResponse_samplingRuleRecord :: Lens' UpdateSamplingRuleResponse (Maybe SamplingRuleRecord)
updateSamplingRuleResponse_samplingRuleRecord = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSamplingRuleResponse' {Maybe SamplingRuleRecord
samplingRuleRecord :: Maybe SamplingRuleRecord
$sel:samplingRuleRecord:UpdateSamplingRuleResponse' :: UpdateSamplingRuleResponse -> Maybe SamplingRuleRecord
samplingRuleRecord} -> Maybe SamplingRuleRecord
samplingRuleRecord) (\s :: UpdateSamplingRuleResponse
s@UpdateSamplingRuleResponse' {} Maybe SamplingRuleRecord
a -> UpdateSamplingRuleResponse
s {$sel:samplingRuleRecord:UpdateSamplingRuleResponse' :: Maybe SamplingRuleRecord
samplingRuleRecord = Maybe SamplingRuleRecord
a} :: UpdateSamplingRuleResponse)
updateSamplingRuleResponse_httpStatus :: Lens.Lens' UpdateSamplingRuleResponse Prelude.Int
updateSamplingRuleResponse_httpStatus :: Lens' UpdateSamplingRuleResponse Int
updateSamplingRuleResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSamplingRuleResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateSamplingRuleResponse' :: UpdateSamplingRuleResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateSamplingRuleResponse
s@UpdateSamplingRuleResponse' {} Int
a -> UpdateSamplingRuleResponse
s {$sel:httpStatus:UpdateSamplingRuleResponse' :: Int
httpStatus = Int
a} :: UpdateSamplingRuleResponse)
instance Prelude.NFData UpdateSamplingRuleResponse where
rnf :: UpdateSamplingRuleResponse -> ()
rnf UpdateSamplingRuleResponse' {Int
Maybe SamplingRuleRecord
httpStatus :: Int
samplingRuleRecord :: Maybe SamplingRuleRecord
$sel:httpStatus:UpdateSamplingRuleResponse' :: UpdateSamplingRuleResponse -> Int
$sel:samplingRuleRecord:UpdateSamplingRuleResponse' :: UpdateSamplingRuleResponse -> Maybe SamplingRuleRecord
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe SamplingRuleRecord
samplingRuleRecord
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus