{-# 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.ApplicationInsights.CreateLogPattern
(
CreateLogPattern (..),
newCreateLogPattern,
createLogPattern_resourceGroupName,
createLogPattern_patternSetName,
createLogPattern_patternName,
createLogPattern_pattern,
createLogPattern_rank,
CreateLogPatternResponse (..),
newCreateLogPatternResponse,
createLogPatternResponse_logPattern,
createLogPatternResponse_resourceGroupName,
createLogPatternResponse_httpStatus,
)
where
import Amazonka.ApplicationInsights.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 CreateLogPattern = CreateLogPattern'
{
CreateLogPattern -> Text
resourceGroupName :: Prelude.Text,
CreateLogPattern -> Text
patternSetName :: Prelude.Text,
CreateLogPattern -> Text
patternName :: Prelude.Text,
CreateLogPattern -> Text
pattern' :: Prelude.Text,
CreateLogPattern -> Int
rank :: Prelude.Int
}
deriving (CreateLogPattern -> CreateLogPattern -> Bool
(CreateLogPattern -> CreateLogPattern -> Bool)
-> (CreateLogPattern -> CreateLogPattern -> Bool)
-> Eq CreateLogPattern
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateLogPattern -> CreateLogPattern -> Bool
$c/= :: CreateLogPattern -> CreateLogPattern -> Bool
== :: CreateLogPattern -> CreateLogPattern -> Bool
$c== :: CreateLogPattern -> CreateLogPattern -> Bool
Prelude.Eq, ReadPrec [CreateLogPattern]
ReadPrec CreateLogPattern
Int -> ReadS CreateLogPattern
ReadS [CreateLogPattern]
(Int -> ReadS CreateLogPattern)
-> ReadS [CreateLogPattern]
-> ReadPrec CreateLogPattern
-> ReadPrec [CreateLogPattern]
-> Read CreateLogPattern
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateLogPattern]
$creadListPrec :: ReadPrec [CreateLogPattern]
readPrec :: ReadPrec CreateLogPattern
$creadPrec :: ReadPrec CreateLogPattern
readList :: ReadS [CreateLogPattern]
$creadList :: ReadS [CreateLogPattern]
readsPrec :: Int -> ReadS CreateLogPattern
$creadsPrec :: Int -> ReadS CreateLogPattern
Prelude.Read, Int -> CreateLogPattern -> ShowS
[CreateLogPattern] -> ShowS
CreateLogPattern -> String
(Int -> CreateLogPattern -> ShowS)
-> (CreateLogPattern -> String)
-> ([CreateLogPattern] -> ShowS)
-> Show CreateLogPattern
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateLogPattern] -> ShowS
$cshowList :: [CreateLogPattern] -> ShowS
show :: CreateLogPattern -> String
$cshow :: CreateLogPattern -> String
showsPrec :: Int -> CreateLogPattern -> ShowS
$cshowsPrec :: Int -> CreateLogPattern -> ShowS
Prelude.Show, (forall x. CreateLogPattern -> Rep CreateLogPattern x)
-> (forall x. Rep CreateLogPattern x -> CreateLogPattern)
-> Generic CreateLogPattern
forall x. Rep CreateLogPattern x -> CreateLogPattern
forall x. CreateLogPattern -> Rep CreateLogPattern x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateLogPattern x -> CreateLogPattern
$cfrom :: forall x. CreateLogPattern -> Rep CreateLogPattern x
Prelude.Generic)
newCreateLogPattern ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
Prelude.Int ->
CreateLogPattern
newCreateLogPattern :: Text -> Text -> Text -> Text -> Int -> CreateLogPattern
newCreateLogPattern
Text
pResourceGroupName_
Text
pPatternSetName_
Text
pPatternName_
Text
pPattern_
Int
pRank_ =
CreateLogPattern' :: Text -> Text -> Text -> Text -> Int -> CreateLogPattern
CreateLogPattern'
{ $sel:resourceGroupName:CreateLogPattern' :: Text
resourceGroupName =
Text
pResourceGroupName_,
$sel:patternSetName:CreateLogPattern' :: Text
patternSetName = Text
pPatternSetName_,
$sel:patternName:CreateLogPattern' :: Text
patternName = Text
pPatternName_,
$sel:pattern':CreateLogPattern' :: Text
pattern' = Text
pPattern_,
$sel:rank:CreateLogPattern' :: Int
rank = Int
pRank_
}
createLogPattern_resourceGroupName :: Lens.Lens' CreateLogPattern Prelude.Text
createLogPattern_resourceGroupName :: (Text -> f Text) -> CreateLogPattern -> f CreateLogPattern
createLogPattern_resourceGroupName = (CreateLogPattern -> Text)
-> (CreateLogPattern -> Text -> CreateLogPattern)
-> Lens CreateLogPattern CreateLogPattern Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLogPattern' {Text
resourceGroupName :: Text
$sel:resourceGroupName:CreateLogPattern' :: CreateLogPattern -> Text
resourceGroupName} -> Text
resourceGroupName) (\s :: CreateLogPattern
s@CreateLogPattern' {} Text
a -> CreateLogPattern
s {$sel:resourceGroupName:CreateLogPattern' :: Text
resourceGroupName = Text
a} :: CreateLogPattern)
createLogPattern_patternSetName :: Lens.Lens' CreateLogPattern Prelude.Text
createLogPattern_patternSetName :: (Text -> f Text) -> CreateLogPattern -> f CreateLogPattern
createLogPattern_patternSetName = (CreateLogPattern -> Text)
-> (CreateLogPattern -> Text -> CreateLogPattern)
-> Lens CreateLogPattern CreateLogPattern Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLogPattern' {Text
patternSetName :: Text
$sel:patternSetName:CreateLogPattern' :: CreateLogPattern -> Text
patternSetName} -> Text
patternSetName) (\s :: CreateLogPattern
s@CreateLogPattern' {} Text
a -> CreateLogPattern
s {$sel:patternSetName:CreateLogPattern' :: Text
patternSetName = Text
a} :: CreateLogPattern)
createLogPattern_patternName :: Lens.Lens' CreateLogPattern Prelude.Text
createLogPattern_patternName :: (Text -> f Text) -> CreateLogPattern -> f CreateLogPattern
createLogPattern_patternName = (CreateLogPattern -> Text)
-> (CreateLogPattern -> Text -> CreateLogPattern)
-> Lens CreateLogPattern CreateLogPattern Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLogPattern' {Text
patternName :: Text
$sel:patternName:CreateLogPattern' :: CreateLogPattern -> Text
patternName} -> Text
patternName) (\s :: CreateLogPattern
s@CreateLogPattern' {} Text
a -> CreateLogPattern
s {$sel:patternName:CreateLogPattern' :: Text
patternName = Text
a} :: CreateLogPattern)
createLogPattern_pattern :: Lens.Lens' CreateLogPattern Prelude.Text
createLogPattern_pattern :: (Text -> f Text) -> CreateLogPattern -> f CreateLogPattern
createLogPattern_pattern = (CreateLogPattern -> Text)
-> (CreateLogPattern -> Text -> CreateLogPattern)
-> Lens CreateLogPattern CreateLogPattern Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLogPattern' {Text
pattern' :: Text
$sel:pattern':CreateLogPattern' :: CreateLogPattern -> Text
pattern'} -> Text
pattern') (\s :: CreateLogPattern
s@CreateLogPattern' {} Text
a -> CreateLogPattern
s {$sel:pattern':CreateLogPattern' :: Text
pattern' = Text
a} :: CreateLogPattern)
createLogPattern_rank :: Lens.Lens' CreateLogPattern Prelude.Int
createLogPattern_rank :: (Int -> f Int) -> CreateLogPattern -> f CreateLogPattern
createLogPattern_rank = (CreateLogPattern -> Int)
-> (CreateLogPattern -> Int -> CreateLogPattern)
-> Lens CreateLogPattern CreateLogPattern Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLogPattern' {Int
rank :: Int
$sel:rank:CreateLogPattern' :: CreateLogPattern -> Int
rank} -> Int
rank) (\s :: CreateLogPattern
s@CreateLogPattern' {} Int
a -> CreateLogPattern
s {$sel:rank:CreateLogPattern' :: Int
rank = Int
a} :: CreateLogPattern)
instance Core.AWSRequest CreateLogPattern where
type
AWSResponse CreateLogPattern =
CreateLogPatternResponse
request :: CreateLogPattern -> Request CreateLogPattern
request = Service -> CreateLogPattern -> Request CreateLogPattern
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateLogPattern
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateLogPattern)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateLogPattern))
-> Logger
-> Service
-> Proxy CreateLogPattern
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateLogPattern)))
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 LogPattern -> Maybe Text -> Int -> CreateLogPatternResponse
CreateLogPatternResponse'
(Maybe LogPattern -> Maybe Text -> Int -> CreateLogPatternResponse)
-> Either String (Maybe LogPattern)
-> Either String (Maybe Text -> Int -> CreateLogPatternResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe LogPattern)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"LogPattern")
Either String (Maybe Text -> Int -> CreateLogPatternResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateLogPatternResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ResourceGroupName")
Either String (Int -> CreateLogPatternResponse)
-> Either String Int -> Either String CreateLogPatternResponse
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 CreateLogPattern
instance Prelude.NFData CreateLogPattern
instance Core.ToHeaders CreateLogPattern where
toHeaders :: CreateLogPattern -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateLogPattern -> 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
"EC2WindowsBarleyService.CreateLogPattern" ::
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 CreateLogPattern where
toJSON :: CreateLogPattern -> Value
toJSON CreateLogPattern' {Int
Text
rank :: Int
pattern' :: Text
patternName :: Text
patternSetName :: Text
resourceGroupName :: Text
$sel:rank:CreateLogPattern' :: CreateLogPattern -> Int
$sel:pattern':CreateLogPattern' :: CreateLogPattern -> Text
$sel:patternName:CreateLogPattern' :: CreateLogPattern -> Text
$sel:patternSetName:CreateLogPattern' :: CreateLogPattern -> Text
$sel:resourceGroupName:CreateLogPattern' :: CreateLogPattern -> 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
"ResourceGroupName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
resourceGroupName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"PatternSetName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
patternSetName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"PatternName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
patternName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Pattern" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
pattern'),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Rank" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Int
rank)
]
)
instance Core.ToPath CreateLogPattern where
toPath :: CreateLogPattern -> ByteString
toPath = ByteString -> CreateLogPattern -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateLogPattern where
toQuery :: CreateLogPattern -> QueryString
toQuery = QueryString -> CreateLogPattern -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateLogPatternResponse = CreateLogPatternResponse'
{
CreateLogPatternResponse -> Maybe LogPattern
logPattern :: Prelude.Maybe LogPattern,
CreateLogPatternResponse -> Maybe Text
resourceGroupName :: Prelude.Maybe Prelude.Text,
CreateLogPatternResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateLogPatternResponse -> CreateLogPatternResponse -> Bool
(CreateLogPatternResponse -> CreateLogPatternResponse -> Bool)
-> (CreateLogPatternResponse -> CreateLogPatternResponse -> Bool)
-> Eq CreateLogPatternResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateLogPatternResponse -> CreateLogPatternResponse -> Bool
$c/= :: CreateLogPatternResponse -> CreateLogPatternResponse -> Bool
== :: CreateLogPatternResponse -> CreateLogPatternResponse -> Bool
$c== :: CreateLogPatternResponse -> CreateLogPatternResponse -> Bool
Prelude.Eq, ReadPrec [CreateLogPatternResponse]
ReadPrec CreateLogPatternResponse
Int -> ReadS CreateLogPatternResponse
ReadS [CreateLogPatternResponse]
(Int -> ReadS CreateLogPatternResponse)
-> ReadS [CreateLogPatternResponse]
-> ReadPrec CreateLogPatternResponse
-> ReadPrec [CreateLogPatternResponse]
-> Read CreateLogPatternResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateLogPatternResponse]
$creadListPrec :: ReadPrec [CreateLogPatternResponse]
readPrec :: ReadPrec CreateLogPatternResponse
$creadPrec :: ReadPrec CreateLogPatternResponse
readList :: ReadS [CreateLogPatternResponse]
$creadList :: ReadS [CreateLogPatternResponse]
readsPrec :: Int -> ReadS CreateLogPatternResponse
$creadsPrec :: Int -> ReadS CreateLogPatternResponse
Prelude.Read, Int -> CreateLogPatternResponse -> ShowS
[CreateLogPatternResponse] -> ShowS
CreateLogPatternResponse -> String
(Int -> CreateLogPatternResponse -> ShowS)
-> (CreateLogPatternResponse -> String)
-> ([CreateLogPatternResponse] -> ShowS)
-> Show CreateLogPatternResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateLogPatternResponse] -> ShowS
$cshowList :: [CreateLogPatternResponse] -> ShowS
show :: CreateLogPatternResponse -> String
$cshow :: CreateLogPatternResponse -> String
showsPrec :: Int -> CreateLogPatternResponse -> ShowS
$cshowsPrec :: Int -> CreateLogPatternResponse -> ShowS
Prelude.Show, (forall x.
CreateLogPatternResponse -> Rep CreateLogPatternResponse x)
-> (forall x.
Rep CreateLogPatternResponse x -> CreateLogPatternResponse)
-> Generic CreateLogPatternResponse
forall x.
Rep CreateLogPatternResponse x -> CreateLogPatternResponse
forall x.
CreateLogPatternResponse -> Rep CreateLogPatternResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateLogPatternResponse x -> CreateLogPatternResponse
$cfrom :: forall x.
CreateLogPatternResponse -> Rep CreateLogPatternResponse x
Prelude.Generic)
newCreateLogPatternResponse ::
Prelude.Int ->
CreateLogPatternResponse
newCreateLogPatternResponse :: Int -> CreateLogPatternResponse
newCreateLogPatternResponse Int
pHttpStatus_ =
CreateLogPatternResponse' :: Maybe LogPattern -> Maybe Text -> Int -> CreateLogPatternResponse
CreateLogPatternResponse'
{ $sel:logPattern:CreateLogPatternResponse' :: Maybe LogPattern
logPattern =
Maybe LogPattern
forall a. Maybe a
Prelude.Nothing,
$sel:resourceGroupName:CreateLogPatternResponse' :: Maybe Text
resourceGroupName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateLogPatternResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createLogPatternResponse_logPattern :: Lens.Lens' CreateLogPatternResponse (Prelude.Maybe LogPattern)
createLogPatternResponse_logPattern :: (Maybe LogPattern -> f (Maybe LogPattern))
-> CreateLogPatternResponse -> f CreateLogPatternResponse
createLogPatternResponse_logPattern = (CreateLogPatternResponse -> Maybe LogPattern)
-> (CreateLogPatternResponse
-> Maybe LogPattern -> CreateLogPatternResponse)
-> Lens
CreateLogPatternResponse
CreateLogPatternResponse
(Maybe LogPattern)
(Maybe LogPattern)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLogPatternResponse' {Maybe LogPattern
logPattern :: Maybe LogPattern
$sel:logPattern:CreateLogPatternResponse' :: CreateLogPatternResponse -> Maybe LogPattern
logPattern} -> Maybe LogPattern
logPattern) (\s :: CreateLogPatternResponse
s@CreateLogPatternResponse' {} Maybe LogPattern
a -> CreateLogPatternResponse
s {$sel:logPattern:CreateLogPatternResponse' :: Maybe LogPattern
logPattern = Maybe LogPattern
a} :: CreateLogPatternResponse)
createLogPatternResponse_resourceGroupName :: Lens.Lens' CreateLogPatternResponse (Prelude.Maybe Prelude.Text)
createLogPatternResponse_resourceGroupName :: (Maybe Text -> f (Maybe Text))
-> CreateLogPatternResponse -> f CreateLogPatternResponse
createLogPatternResponse_resourceGroupName = (CreateLogPatternResponse -> Maybe Text)
-> (CreateLogPatternResponse
-> Maybe Text -> CreateLogPatternResponse)
-> Lens
CreateLogPatternResponse
CreateLogPatternResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLogPatternResponse' {Maybe Text
resourceGroupName :: Maybe Text
$sel:resourceGroupName:CreateLogPatternResponse' :: CreateLogPatternResponse -> Maybe Text
resourceGroupName} -> Maybe Text
resourceGroupName) (\s :: CreateLogPatternResponse
s@CreateLogPatternResponse' {} Maybe Text
a -> CreateLogPatternResponse
s {$sel:resourceGroupName:CreateLogPatternResponse' :: Maybe Text
resourceGroupName = Maybe Text
a} :: CreateLogPatternResponse)
createLogPatternResponse_httpStatus :: Lens.Lens' CreateLogPatternResponse Prelude.Int
createLogPatternResponse_httpStatus :: (Int -> f Int)
-> CreateLogPatternResponse -> f CreateLogPatternResponse
createLogPatternResponse_httpStatus = (CreateLogPatternResponse -> Int)
-> (CreateLogPatternResponse -> Int -> CreateLogPatternResponse)
-> Lens CreateLogPatternResponse CreateLogPatternResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLogPatternResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateLogPatternResponse' :: CreateLogPatternResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateLogPatternResponse
s@CreateLogPatternResponse' {} Int
a -> CreateLogPatternResponse
s {$sel:httpStatus:CreateLogPatternResponse' :: Int
httpStatus = Int
a} :: CreateLogPatternResponse)
instance Prelude.NFData CreateLogPatternResponse