{-# 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.Transcribe.CreateCallAnalyticsCategory
(
CreateCallAnalyticsCategory (..),
newCreateCallAnalyticsCategory,
createCallAnalyticsCategory_categoryName,
createCallAnalyticsCategory_rules,
CreateCallAnalyticsCategoryResponse (..),
newCreateCallAnalyticsCategoryResponse,
createCallAnalyticsCategoryResponse_categoryProperties,
createCallAnalyticsCategoryResponse_httpStatus,
)
where
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
import Amazonka.Transcribe.Types
data CreateCallAnalyticsCategory = CreateCallAnalyticsCategory'
{
CreateCallAnalyticsCategory -> Text
categoryName :: Prelude.Text,
CreateCallAnalyticsCategory -> NonEmpty Rule
rules :: Prelude.NonEmpty Rule
}
deriving (CreateCallAnalyticsCategory -> CreateCallAnalyticsCategory -> Bool
(CreateCallAnalyticsCategory
-> CreateCallAnalyticsCategory -> Bool)
-> (CreateCallAnalyticsCategory
-> CreateCallAnalyticsCategory -> Bool)
-> Eq CreateCallAnalyticsCategory
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateCallAnalyticsCategory -> CreateCallAnalyticsCategory -> Bool
$c/= :: CreateCallAnalyticsCategory -> CreateCallAnalyticsCategory -> Bool
== :: CreateCallAnalyticsCategory -> CreateCallAnalyticsCategory -> Bool
$c== :: CreateCallAnalyticsCategory -> CreateCallAnalyticsCategory -> Bool
Prelude.Eq, ReadPrec [CreateCallAnalyticsCategory]
ReadPrec CreateCallAnalyticsCategory
Int -> ReadS CreateCallAnalyticsCategory
ReadS [CreateCallAnalyticsCategory]
(Int -> ReadS CreateCallAnalyticsCategory)
-> ReadS [CreateCallAnalyticsCategory]
-> ReadPrec CreateCallAnalyticsCategory
-> ReadPrec [CreateCallAnalyticsCategory]
-> Read CreateCallAnalyticsCategory
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateCallAnalyticsCategory]
$creadListPrec :: ReadPrec [CreateCallAnalyticsCategory]
readPrec :: ReadPrec CreateCallAnalyticsCategory
$creadPrec :: ReadPrec CreateCallAnalyticsCategory
readList :: ReadS [CreateCallAnalyticsCategory]
$creadList :: ReadS [CreateCallAnalyticsCategory]
readsPrec :: Int -> ReadS CreateCallAnalyticsCategory
$creadsPrec :: Int -> ReadS CreateCallAnalyticsCategory
Prelude.Read, Int -> CreateCallAnalyticsCategory -> ShowS
[CreateCallAnalyticsCategory] -> ShowS
CreateCallAnalyticsCategory -> String
(Int -> CreateCallAnalyticsCategory -> ShowS)
-> (CreateCallAnalyticsCategory -> String)
-> ([CreateCallAnalyticsCategory] -> ShowS)
-> Show CreateCallAnalyticsCategory
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateCallAnalyticsCategory] -> ShowS
$cshowList :: [CreateCallAnalyticsCategory] -> ShowS
show :: CreateCallAnalyticsCategory -> String
$cshow :: CreateCallAnalyticsCategory -> String
showsPrec :: Int -> CreateCallAnalyticsCategory -> ShowS
$cshowsPrec :: Int -> CreateCallAnalyticsCategory -> ShowS
Prelude.Show, (forall x.
CreateCallAnalyticsCategory -> Rep CreateCallAnalyticsCategory x)
-> (forall x.
Rep CreateCallAnalyticsCategory x -> CreateCallAnalyticsCategory)
-> Generic CreateCallAnalyticsCategory
forall x.
Rep CreateCallAnalyticsCategory x -> CreateCallAnalyticsCategory
forall x.
CreateCallAnalyticsCategory -> Rep CreateCallAnalyticsCategory x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateCallAnalyticsCategory x -> CreateCallAnalyticsCategory
$cfrom :: forall x.
CreateCallAnalyticsCategory -> Rep CreateCallAnalyticsCategory x
Prelude.Generic)
newCreateCallAnalyticsCategory ::
Prelude.Text ->
Prelude.NonEmpty Rule ->
CreateCallAnalyticsCategory
newCreateCallAnalyticsCategory :: Text -> NonEmpty Rule -> CreateCallAnalyticsCategory
newCreateCallAnalyticsCategory Text
pCategoryName_ NonEmpty Rule
pRules_ =
CreateCallAnalyticsCategory' :: Text -> NonEmpty Rule -> CreateCallAnalyticsCategory
CreateCallAnalyticsCategory'
{ $sel:categoryName:CreateCallAnalyticsCategory' :: Text
categoryName =
Text
pCategoryName_,
$sel:rules:CreateCallAnalyticsCategory' :: NonEmpty Rule
rules = Tagged (NonEmpty Rule) (Identity (NonEmpty Rule))
-> Tagged (NonEmpty Rule) (Identity (NonEmpty Rule))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged (NonEmpty Rule) (Identity (NonEmpty Rule))
-> Tagged (NonEmpty Rule) (Identity (NonEmpty Rule)))
-> NonEmpty Rule -> NonEmpty Rule
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Rule
pRules_
}
createCallAnalyticsCategory_categoryName :: Lens.Lens' CreateCallAnalyticsCategory Prelude.Text
createCallAnalyticsCategory_categoryName :: (Text -> f Text)
-> CreateCallAnalyticsCategory -> f CreateCallAnalyticsCategory
createCallAnalyticsCategory_categoryName = (CreateCallAnalyticsCategory -> Text)
-> (CreateCallAnalyticsCategory
-> Text -> CreateCallAnalyticsCategory)
-> Lens
CreateCallAnalyticsCategory CreateCallAnalyticsCategory Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCallAnalyticsCategory' {Text
categoryName :: Text
$sel:categoryName:CreateCallAnalyticsCategory' :: CreateCallAnalyticsCategory -> Text
categoryName} -> Text
categoryName) (\s :: CreateCallAnalyticsCategory
s@CreateCallAnalyticsCategory' {} Text
a -> CreateCallAnalyticsCategory
s {$sel:categoryName:CreateCallAnalyticsCategory' :: Text
categoryName = Text
a} :: CreateCallAnalyticsCategory)
createCallAnalyticsCategory_rules :: Lens.Lens' CreateCallAnalyticsCategory (Prelude.NonEmpty Rule)
createCallAnalyticsCategory_rules :: (NonEmpty Rule -> f (NonEmpty Rule))
-> CreateCallAnalyticsCategory -> f CreateCallAnalyticsCategory
createCallAnalyticsCategory_rules = (CreateCallAnalyticsCategory -> NonEmpty Rule)
-> (CreateCallAnalyticsCategory
-> NonEmpty Rule -> CreateCallAnalyticsCategory)
-> Lens
CreateCallAnalyticsCategory
CreateCallAnalyticsCategory
(NonEmpty Rule)
(NonEmpty Rule)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCallAnalyticsCategory' {NonEmpty Rule
rules :: NonEmpty Rule
$sel:rules:CreateCallAnalyticsCategory' :: CreateCallAnalyticsCategory -> NonEmpty Rule
rules} -> NonEmpty Rule
rules) (\s :: CreateCallAnalyticsCategory
s@CreateCallAnalyticsCategory' {} NonEmpty Rule
a -> CreateCallAnalyticsCategory
s {$sel:rules:CreateCallAnalyticsCategory' :: NonEmpty Rule
rules = NonEmpty Rule
a} :: CreateCallAnalyticsCategory) ((NonEmpty Rule -> f (NonEmpty Rule))
-> CreateCallAnalyticsCategory -> f CreateCallAnalyticsCategory)
-> ((NonEmpty Rule -> f (NonEmpty Rule))
-> NonEmpty Rule -> f (NonEmpty Rule))
-> (NonEmpty Rule -> f (NonEmpty Rule))
-> CreateCallAnalyticsCategory
-> f CreateCallAnalyticsCategory
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Rule -> f (NonEmpty Rule))
-> NonEmpty Rule -> f (NonEmpty Rule)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest CreateCallAnalyticsCategory where
type
AWSResponse CreateCallAnalyticsCategory =
CreateCallAnalyticsCategoryResponse
request :: CreateCallAnalyticsCategory -> Request CreateCallAnalyticsCategory
request = Service
-> CreateCallAnalyticsCategory
-> Request CreateCallAnalyticsCategory
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateCallAnalyticsCategory
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateCallAnalyticsCategory)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateCallAnalyticsCategory))
-> Logger
-> Service
-> Proxy CreateCallAnalyticsCategory
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateCallAnalyticsCategory)))
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 CategoryProperties
-> Int -> CreateCallAnalyticsCategoryResponse
CreateCallAnalyticsCategoryResponse'
(Maybe CategoryProperties
-> Int -> CreateCallAnalyticsCategoryResponse)
-> Either String (Maybe CategoryProperties)
-> Either String (Int -> CreateCallAnalyticsCategoryResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe CategoryProperties)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"CategoryProperties")
Either String (Int -> CreateCallAnalyticsCategoryResponse)
-> Either String Int
-> Either String CreateCallAnalyticsCategoryResponse
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 CreateCallAnalyticsCategory
instance Prelude.NFData CreateCallAnalyticsCategory
instance Core.ToHeaders CreateCallAnalyticsCategory where
toHeaders :: CreateCallAnalyticsCategory -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateCallAnalyticsCategory -> 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
"Transcribe.CreateCallAnalyticsCategory" ::
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 CreateCallAnalyticsCategory where
toJSON :: CreateCallAnalyticsCategory -> Value
toJSON CreateCallAnalyticsCategory' {NonEmpty Rule
Text
rules :: NonEmpty Rule
categoryName :: Text
$sel:rules:CreateCallAnalyticsCategory' :: CreateCallAnalyticsCategory -> NonEmpty Rule
$sel:categoryName:CreateCallAnalyticsCategory' :: CreateCallAnalyticsCategory -> 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
"CategoryName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
categoryName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Rules" Text -> NonEmpty Rule -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty Rule
rules)
]
)
instance Core.ToPath CreateCallAnalyticsCategory where
toPath :: CreateCallAnalyticsCategory -> ByteString
toPath = ByteString -> CreateCallAnalyticsCategory -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateCallAnalyticsCategory where
toQuery :: CreateCallAnalyticsCategory -> QueryString
toQuery = QueryString -> CreateCallAnalyticsCategory -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateCallAnalyticsCategoryResponse = CreateCallAnalyticsCategoryResponse'
{
CreateCallAnalyticsCategoryResponse -> Maybe CategoryProperties
categoryProperties :: Prelude.Maybe CategoryProperties,
CreateCallAnalyticsCategoryResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateCallAnalyticsCategoryResponse
-> CreateCallAnalyticsCategoryResponse -> Bool
(CreateCallAnalyticsCategoryResponse
-> CreateCallAnalyticsCategoryResponse -> Bool)
-> (CreateCallAnalyticsCategoryResponse
-> CreateCallAnalyticsCategoryResponse -> Bool)
-> Eq CreateCallAnalyticsCategoryResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateCallAnalyticsCategoryResponse
-> CreateCallAnalyticsCategoryResponse -> Bool
$c/= :: CreateCallAnalyticsCategoryResponse
-> CreateCallAnalyticsCategoryResponse -> Bool
== :: CreateCallAnalyticsCategoryResponse
-> CreateCallAnalyticsCategoryResponse -> Bool
$c== :: CreateCallAnalyticsCategoryResponse
-> CreateCallAnalyticsCategoryResponse -> Bool
Prelude.Eq, ReadPrec [CreateCallAnalyticsCategoryResponse]
ReadPrec CreateCallAnalyticsCategoryResponse
Int -> ReadS CreateCallAnalyticsCategoryResponse
ReadS [CreateCallAnalyticsCategoryResponse]
(Int -> ReadS CreateCallAnalyticsCategoryResponse)
-> ReadS [CreateCallAnalyticsCategoryResponse]
-> ReadPrec CreateCallAnalyticsCategoryResponse
-> ReadPrec [CreateCallAnalyticsCategoryResponse]
-> Read CreateCallAnalyticsCategoryResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateCallAnalyticsCategoryResponse]
$creadListPrec :: ReadPrec [CreateCallAnalyticsCategoryResponse]
readPrec :: ReadPrec CreateCallAnalyticsCategoryResponse
$creadPrec :: ReadPrec CreateCallAnalyticsCategoryResponse
readList :: ReadS [CreateCallAnalyticsCategoryResponse]
$creadList :: ReadS [CreateCallAnalyticsCategoryResponse]
readsPrec :: Int -> ReadS CreateCallAnalyticsCategoryResponse
$creadsPrec :: Int -> ReadS CreateCallAnalyticsCategoryResponse
Prelude.Read, Int -> CreateCallAnalyticsCategoryResponse -> ShowS
[CreateCallAnalyticsCategoryResponse] -> ShowS
CreateCallAnalyticsCategoryResponse -> String
(Int -> CreateCallAnalyticsCategoryResponse -> ShowS)
-> (CreateCallAnalyticsCategoryResponse -> String)
-> ([CreateCallAnalyticsCategoryResponse] -> ShowS)
-> Show CreateCallAnalyticsCategoryResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateCallAnalyticsCategoryResponse] -> ShowS
$cshowList :: [CreateCallAnalyticsCategoryResponse] -> ShowS
show :: CreateCallAnalyticsCategoryResponse -> String
$cshow :: CreateCallAnalyticsCategoryResponse -> String
showsPrec :: Int -> CreateCallAnalyticsCategoryResponse -> ShowS
$cshowsPrec :: Int -> CreateCallAnalyticsCategoryResponse -> ShowS
Prelude.Show, (forall x.
CreateCallAnalyticsCategoryResponse
-> Rep CreateCallAnalyticsCategoryResponse x)
-> (forall x.
Rep CreateCallAnalyticsCategoryResponse x
-> CreateCallAnalyticsCategoryResponse)
-> Generic CreateCallAnalyticsCategoryResponse
forall x.
Rep CreateCallAnalyticsCategoryResponse x
-> CreateCallAnalyticsCategoryResponse
forall x.
CreateCallAnalyticsCategoryResponse
-> Rep CreateCallAnalyticsCategoryResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateCallAnalyticsCategoryResponse x
-> CreateCallAnalyticsCategoryResponse
$cfrom :: forall x.
CreateCallAnalyticsCategoryResponse
-> Rep CreateCallAnalyticsCategoryResponse x
Prelude.Generic)
newCreateCallAnalyticsCategoryResponse ::
Prelude.Int ->
CreateCallAnalyticsCategoryResponse
newCreateCallAnalyticsCategoryResponse :: Int -> CreateCallAnalyticsCategoryResponse
newCreateCallAnalyticsCategoryResponse Int
pHttpStatus_ =
CreateCallAnalyticsCategoryResponse' :: Maybe CategoryProperties
-> Int -> CreateCallAnalyticsCategoryResponse
CreateCallAnalyticsCategoryResponse'
{ $sel:categoryProperties:CreateCallAnalyticsCategoryResponse' :: Maybe CategoryProperties
categoryProperties =
Maybe CategoryProperties
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateCallAnalyticsCategoryResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createCallAnalyticsCategoryResponse_categoryProperties :: Lens.Lens' CreateCallAnalyticsCategoryResponse (Prelude.Maybe CategoryProperties)
createCallAnalyticsCategoryResponse_categoryProperties :: (Maybe CategoryProperties -> f (Maybe CategoryProperties))
-> CreateCallAnalyticsCategoryResponse
-> f CreateCallAnalyticsCategoryResponse
createCallAnalyticsCategoryResponse_categoryProperties = (CreateCallAnalyticsCategoryResponse -> Maybe CategoryProperties)
-> (CreateCallAnalyticsCategoryResponse
-> Maybe CategoryProperties -> CreateCallAnalyticsCategoryResponse)
-> Lens
CreateCallAnalyticsCategoryResponse
CreateCallAnalyticsCategoryResponse
(Maybe CategoryProperties)
(Maybe CategoryProperties)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCallAnalyticsCategoryResponse' {Maybe CategoryProperties
categoryProperties :: Maybe CategoryProperties
$sel:categoryProperties:CreateCallAnalyticsCategoryResponse' :: CreateCallAnalyticsCategoryResponse -> Maybe CategoryProperties
categoryProperties} -> Maybe CategoryProperties
categoryProperties) (\s :: CreateCallAnalyticsCategoryResponse
s@CreateCallAnalyticsCategoryResponse' {} Maybe CategoryProperties
a -> CreateCallAnalyticsCategoryResponse
s {$sel:categoryProperties:CreateCallAnalyticsCategoryResponse' :: Maybe CategoryProperties
categoryProperties = Maybe CategoryProperties
a} :: CreateCallAnalyticsCategoryResponse)
createCallAnalyticsCategoryResponse_httpStatus :: Lens.Lens' CreateCallAnalyticsCategoryResponse Prelude.Int
createCallAnalyticsCategoryResponse_httpStatus :: (Int -> f Int)
-> CreateCallAnalyticsCategoryResponse
-> f CreateCallAnalyticsCategoryResponse
createCallAnalyticsCategoryResponse_httpStatus = (CreateCallAnalyticsCategoryResponse -> Int)
-> (CreateCallAnalyticsCategoryResponse
-> Int -> CreateCallAnalyticsCategoryResponse)
-> Lens
CreateCallAnalyticsCategoryResponse
CreateCallAnalyticsCategoryResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCallAnalyticsCategoryResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateCallAnalyticsCategoryResponse' :: CreateCallAnalyticsCategoryResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateCallAnalyticsCategoryResponse
s@CreateCallAnalyticsCategoryResponse' {} Int
a -> CreateCallAnalyticsCategoryResponse
s {$sel:httpStatus:CreateCallAnalyticsCategoryResponse' :: Int
httpStatus = Int
a} :: CreateCallAnalyticsCategoryResponse)
instance
Prelude.NFData
CreateCallAnalyticsCategoryResponse