{-# 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.CreateSamplingRule
(
CreateSamplingRule (..),
newCreateSamplingRule,
createSamplingRule_tags,
createSamplingRule_samplingRule,
CreateSamplingRuleResponse (..),
newCreateSamplingRuleResponse,
createSamplingRuleResponse_samplingRuleRecord,
createSamplingRuleResponse_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 CreateSamplingRule = CreateSamplingRule'
{
CreateSamplingRule -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
CreateSamplingRule -> SamplingRule
samplingRule :: SamplingRule
}
deriving (CreateSamplingRule -> CreateSamplingRule -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateSamplingRule -> CreateSamplingRule -> Bool
$c/= :: CreateSamplingRule -> CreateSamplingRule -> Bool
== :: CreateSamplingRule -> CreateSamplingRule -> Bool
$c== :: CreateSamplingRule -> CreateSamplingRule -> Bool
Prelude.Eq, ReadPrec [CreateSamplingRule]
ReadPrec CreateSamplingRule
Int -> ReadS CreateSamplingRule
ReadS [CreateSamplingRule]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateSamplingRule]
$creadListPrec :: ReadPrec [CreateSamplingRule]
readPrec :: ReadPrec CreateSamplingRule
$creadPrec :: ReadPrec CreateSamplingRule
readList :: ReadS [CreateSamplingRule]
$creadList :: ReadS [CreateSamplingRule]
readsPrec :: Int -> ReadS CreateSamplingRule
$creadsPrec :: Int -> ReadS CreateSamplingRule
Prelude.Read, Int -> CreateSamplingRule -> ShowS
[CreateSamplingRule] -> ShowS
CreateSamplingRule -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateSamplingRule] -> ShowS
$cshowList :: [CreateSamplingRule] -> ShowS
show :: CreateSamplingRule -> String
$cshow :: CreateSamplingRule -> String
showsPrec :: Int -> CreateSamplingRule -> ShowS
$cshowsPrec :: Int -> CreateSamplingRule -> ShowS
Prelude.Show, forall x. Rep CreateSamplingRule x -> CreateSamplingRule
forall x. CreateSamplingRule -> Rep CreateSamplingRule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateSamplingRule x -> CreateSamplingRule
$cfrom :: forall x. CreateSamplingRule -> Rep CreateSamplingRule x
Prelude.Generic)
newCreateSamplingRule ::
SamplingRule ->
CreateSamplingRule
newCreateSamplingRule :: SamplingRule -> CreateSamplingRule
newCreateSamplingRule SamplingRule
pSamplingRule_ =
CreateSamplingRule'
{ $sel:tags:CreateSamplingRule' :: Maybe [Tag]
tags = forall a. Maybe a
Prelude.Nothing,
$sel:samplingRule:CreateSamplingRule' :: SamplingRule
samplingRule = SamplingRule
pSamplingRule_
}
createSamplingRule_tags :: Lens.Lens' CreateSamplingRule (Prelude.Maybe [Tag])
createSamplingRule_tags :: Lens' CreateSamplingRule (Maybe [Tag])
createSamplingRule_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSamplingRule' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateSamplingRule' :: CreateSamplingRule -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateSamplingRule
s@CreateSamplingRule' {} Maybe [Tag]
a -> CreateSamplingRule
s {$sel:tags:CreateSamplingRule' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateSamplingRule) 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
createSamplingRule_samplingRule :: Lens.Lens' CreateSamplingRule SamplingRule
createSamplingRule_samplingRule :: Lens' CreateSamplingRule SamplingRule
createSamplingRule_samplingRule = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSamplingRule' {SamplingRule
samplingRule :: SamplingRule
$sel:samplingRule:CreateSamplingRule' :: CreateSamplingRule -> SamplingRule
samplingRule} -> SamplingRule
samplingRule) (\s :: CreateSamplingRule
s@CreateSamplingRule' {} SamplingRule
a -> CreateSamplingRule
s {$sel:samplingRule:CreateSamplingRule' :: SamplingRule
samplingRule = SamplingRule
a} :: CreateSamplingRule)
instance Core.AWSRequest CreateSamplingRule where
type
AWSResponse CreateSamplingRule =
CreateSamplingRuleResponse
request :: (Service -> Service)
-> CreateSamplingRule -> Request CreateSamplingRule
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 CreateSamplingRule
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateSamplingRule)))
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 -> CreateSamplingRuleResponse
CreateSamplingRuleResponse'
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 CreateSamplingRule where
hashWithSalt :: Int -> CreateSamplingRule -> Int
hashWithSalt Int
_salt CreateSamplingRule' {Maybe [Tag]
SamplingRule
samplingRule :: SamplingRule
tags :: Maybe [Tag]
$sel:samplingRule:CreateSamplingRule' :: CreateSamplingRule -> SamplingRule
$sel:tags:CreateSamplingRule' :: CreateSamplingRule -> 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` SamplingRule
samplingRule
instance Prelude.NFData CreateSamplingRule where
rnf :: CreateSamplingRule -> ()
rnf CreateSamplingRule' {Maybe [Tag]
SamplingRule
samplingRule :: SamplingRule
tags :: Maybe [Tag]
$sel:samplingRule:CreateSamplingRule' :: CreateSamplingRule -> SamplingRule
$sel:tags:CreateSamplingRule' :: CreateSamplingRule -> 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 SamplingRule
samplingRule
instance Data.ToHeaders CreateSamplingRule where
toHeaders :: CreateSamplingRule -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.ToJSON CreateSamplingRule where
toJSON :: CreateSamplingRule -> Value
toJSON CreateSamplingRule' {Maybe [Tag]
SamplingRule
samplingRule :: SamplingRule
tags :: Maybe [Tag]
$sel:samplingRule:CreateSamplingRule' :: CreateSamplingRule -> SamplingRule
$sel:tags:CreateSamplingRule' :: CreateSamplingRule -> 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
"SamplingRule" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= SamplingRule
samplingRule)
]
)
instance Data.ToPath CreateSamplingRule where
toPath :: CreateSamplingRule -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/CreateSamplingRule"
instance Data.ToQuery CreateSamplingRule where
toQuery :: CreateSamplingRule -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data CreateSamplingRuleResponse = CreateSamplingRuleResponse'
{
CreateSamplingRuleResponse -> Maybe SamplingRuleRecord
samplingRuleRecord :: Prelude.Maybe SamplingRuleRecord,
CreateSamplingRuleResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateSamplingRuleResponse -> CreateSamplingRuleResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateSamplingRuleResponse -> CreateSamplingRuleResponse -> Bool
$c/= :: CreateSamplingRuleResponse -> CreateSamplingRuleResponse -> Bool
== :: CreateSamplingRuleResponse -> CreateSamplingRuleResponse -> Bool
$c== :: CreateSamplingRuleResponse -> CreateSamplingRuleResponse -> Bool
Prelude.Eq, ReadPrec [CreateSamplingRuleResponse]
ReadPrec CreateSamplingRuleResponse
Int -> ReadS CreateSamplingRuleResponse
ReadS [CreateSamplingRuleResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateSamplingRuleResponse]
$creadListPrec :: ReadPrec [CreateSamplingRuleResponse]
readPrec :: ReadPrec CreateSamplingRuleResponse
$creadPrec :: ReadPrec CreateSamplingRuleResponse
readList :: ReadS [CreateSamplingRuleResponse]
$creadList :: ReadS [CreateSamplingRuleResponse]
readsPrec :: Int -> ReadS CreateSamplingRuleResponse
$creadsPrec :: Int -> ReadS CreateSamplingRuleResponse
Prelude.Read, Int -> CreateSamplingRuleResponse -> ShowS
[CreateSamplingRuleResponse] -> ShowS
CreateSamplingRuleResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateSamplingRuleResponse] -> ShowS
$cshowList :: [CreateSamplingRuleResponse] -> ShowS
show :: CreateSamplingRuleResponse -> String
$cshow :: CreateSamplingRuleResponse -> String
showsPrec :: Int -> CreateSamplingRuleResponse -> ShowS
$cshowsPrec :: Int -> CreateSamplingRuleResponse -> ShowS
Prelude.Show, forall x.
Rep CreateSamplingRuleResponse x -> CreateSamplingRuleResponse
forall x.
CreateSamplingRuleResponse -> Rep CreateSamplingRuleResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateSamplingRuleResponse x -> CreateSamplingRuleResponse
$cfrom :: forall x.
CreateSamplingRuleResponse -> Rep CreateSamplingRuleResponse x
Prelude.Generic)
newCreateSamplingRuleResponse ::
Prelude.Int ->
CreateSamplingRuleResponse
newCreateSamplingRuleResponse :: Int -> CreateSamplingRuleResponse
newCreateSamplingRuleResponse Int
pHttpStatus_ =
CreateSamplingRuleResponse'
{ $sel:samplingRuleRecord:CreateSamplingRuleResponse' :: Maybe SamplingRuleRecord
samplingRuleRecord =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateSamplingRuleResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createSamplingRuleResponse_samplingRuleRecord :: Lens.Lens' CreateSamplingRuleResponse (Prelude.Maybe SamplingRuleRecord)
createSamplingRuleResponse_samplingRuleRecord :: Lens' CreateSamplingRuleResponse (Maybe SamplingRuleRecord)
createSamplingRuleResponse_samplingRuleRecord = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSamplingRuleResponse' {Maybe SamplingRuleRecord
samplingRuleRecord :: Maybe SamplingRuleRecord
$sel:samplingRuleRecord:CreateSamplingRuleResponse' :: CreateSamplingRuleResponse -> Maybe SamplingRuleRecord
samplingRuleRecord} -> Maybe SamplingRuleRecord
samplingRuleRecord) (\s :: CreateSamplingRuleResponse
s@CreateSamplingRuleResponse' {} Maybe SamplingRuleRecord
a -> CreateSamplingRuleResponse
s {$sel:samplingRuleRecord:CreateSamplingRuleResponse' :: Maybe SamplingRuleRecord
samplingRuleRecord = Maybe SamplingRuleRecord
a} :: CreateSamplingRuleResponse)
createSamplingRuleResponse_httpStatus :: Lens.Lens' CreateSamplingRuleResponse Prelude.Int
createSamplingRuleResponse_httpStatus :: Lens' CreateSamplingRuleResponse Int
createSamplingRuleResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSamplingRuleResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateSamplingRuleResponse' :: CreateSamplingRuleResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateSamplingRuleResponse
s@CreateSamplingRuleResponse' {} Int
a -> CreateSamplingRuleResponse
s {$sel:httpStatus:CreateSamplingRuleResponse' :: Int
httpStatus = Int
a} :: CreateSamplingRuleResponse)
instance Prelude.NFData CreateSamplingRuleResponse where
rnf :: CreateSamplingRuleResponse -> ()
rnf CreateSamplingRuleResponse' {Int
Maybe SamplingRuleRecord
httpStatus :: Int
samplingRuleRecord :: Maybe SamplingRuleRecord
$sel:httpStatus:CreateSamplingRuleResponse' :: CreateSamplingRuleResponse -> Int
$sel:samplingRuleRecord:CreateSamplingRuleResponse' :: CreateSamplingRuleResponse -> 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