{-# 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.Connect.CreateUseCase
(
CreateUseCase (..),
newCreateUseCase,
createUseCase_tags,
createUseCase_instanceId,
createUseCase_integrationAssociationId,
createUseCase_useCaseType,
CreateUseCaseResponse (..),
newCreateUseCaseResponse,
createUseCaseResponse_useCaseArn,
createUseCaseResponse_useCaseId,
createUseCaseResponse_httpStatus,
)
where
import Amazonka.Connect.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 CreateUseCase = CreateUseCase'
{
CreateUseCase -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
CreateUseCase -> Text
instanceId :: Prelude.Text,
CreateUseCase -> Text
integrationAssociationId :: Prelude.Text,
CreateUseCase -> UseCaseType
useCaseType :: UseCaseType
}
deriving (CreateUseCase -> CreateUseCase -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateUseCase -> CreateUseCase -> Bool
$c/= :: CreateUseCase -> CreateUseCase -> Bool
== :: CreateUseCase -> CreateUseCase -> Bool
$c== :: CreateUseCase -> CreateUseCase -> Bool
Prelude.Eq, ReadPrec [CreateUseCase]
ReadPrec CreateUseCase
Int -> ReadS CreateUseCase
ReadS [CreateUseCase]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateUseCase]
$creadListPrec :: ReadPrec [CreateUseCase]
readPrec :: ReadPrec CreateUseCase
$creadPrec :: ReadPrec CreateUseCase
readList :: ReadS [CreateUseCase]
$creadList :: ReadS [CreateUseCase]
readsPrec :: Int -> ReadS CreateUseCase
$creadsPrec :: Int -> ReadS CreateUseCase
Prelude.Read, Int -> CreateUseCase -> ShowS
[CreateUseCase] -> ShowS
CreateUseCase -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateUseCase] -> ShowS
$cshowList :: [CreateUseCase] -> ShowS
show :: CreateUseCase -> String
$cshow :: CreateUseCase -> String
showsPrec :: Int -> CreateUseCase -> ShowS
$cshowsPrec :: Int -> CreateUseCase -> ShowS
Prelude.Show, forall x. Rep CreateUseCase x -> CreateUseCase
forall x. CreateUseCase -> Rep CreateUseCase x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateUseCase x -> CreateUseCase
$cfrom :: forall x. CreateUseCase -> Rep CreateUseCase x
Prelude.Generic)
newCreateUseCase ::
Prelude.Text ->
Prelude.Text ->
UseCaseType ->
CreateUseCase
newCreateUseCase :: Text -> Text -> UseCaseType -> CreateUseCase
newCreateUseCase
Text
pInstanceId_
Text
pIntegrationAssociationId_
UseCaseType
pUseCaseType_ =
CreateUseCase'
{ $sel:tags:CreateUseCase' :: Maybe (HashMap Text Text)
tags = forall a. Maybe a
Prelude.Nothing,
$sel:instanceId:CreateUseCase' :: Text
instanceId = Text
pInstanceId_,
$sel:integrationAssociationId:CreateUseCase' :: Text
integrationAssociationId =
Text
pIntegrationAssociationId_,
$sel:useCaseType:CreateUseCase' :: UseCaseType
useCaseType = UseCaseType
pUseCaseType_
}
createUseCase_tags :: Lens.Lens' CreateUseCase (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createUseCase_tags :: Lens' CreateUseCase (Maybe (HashMap Text Text))
createUseCase_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateUseCase' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateUseCase' :: CreateUseCase -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateUseCase
s@CreateUseCase' {} Maybe (HashMap Text Text)
a -> CreateUseCase
s {$sel:tags:CreateUseCase' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateUseCase) 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
createUseCase_instanceId :: Lens.Lens' CreateUseCase Prelude.Text
createUseCase_instanceId :: Lens' CreateUseCase Text
createUseCase_instanceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateUseCase' {Text
instanceId :: Text
$sel:instanceId:CreateUseCase' :: CreateUseCase -> Text
instanceId} -> Text
instanceId) (\s :: CreateUseCase
s@CreateUseCase' {} Text
a -> CreateUseCase
s {$sel:instanceId:CreateUseCase' :: Text
instanceId = Text
a} :: CreateUseCase)
createUseCase_integrationAssociationId :: Lens.Lens' CreateUseCase Prelude.Text
createUseCase_integrationAssociationId :: Lens' CreateUseCase Text
createUseCase_integrationAssociationId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateUseCase' {Text
integrationAssociationId :: Text
$sel:integrationAssociationId:CreateUseCase' :: CreateUseCase -> Text
integrationAssociationId} -> Text
integrationAssociationId) (\s :: CreateUseCase
s@CreateUseCase' {} Text
a -> CreateUseCase
s {$sel:integrationAssociationId:CreateUseCase' :: Text
integrationAssociationId = Text
a} :: CreateUseCase)
createUseCase_useCaseType :: Lens.Lens' CreateUseCase UseCaseType
createUseCase_useCaseType :: Lens' CreateUseCase UseCaseType
createUseCase_useCaseType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateUseCase' {UseCaseType
useCaseType :: UseCaseType
$sel:useCaseType:CreateUseCase' :: CreateUseCase -> UseCaseType
useCaseType} -> UseCaseType
useCaseType) (\s :: CreateUseCase
s@CreateUseCase' {} UseCaseType
a -> CreateUseCase
s {$sel:useCaseType:CreateUseCase' :: UseCaseType
useCaseType = UseCaseType
a} :: CreateUseCase)
instance Core.AWSRequest CreateUseCase where
type
AWSResponse CreateUseCase =
CreateUseCaseResponse
request :: (Service -> Service) -> CreateUseCase -> Request CreateUseCase
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreateUseCase
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateUseCase)))
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 Text -> Maybe Text -> Int -> CreateUseCaseResponse
CreateUseCaseResponse'
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
"UseCaseArn")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"UseCaseId")
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 CreateUseCase where
hashWithSalt :: Int -> CreateUseCase -> Int
hashWithSalt Int
_salt CreateUseCase' {Maybe (HashMap Text Text)
Text
UseCaseType
useCaseType :: UseCaseType
integrationAssociationId :: Text
instanceId :: Text
tags :: Maybe (HashMap Text Text)
$sel:useCaseType:CreateUseCase' :: CreateUseCase -> UseCaseType
$sel:integrationAssociationId:CreateUseCase' :: CreateUseCase -> Text
$sel:instanceId:CreateUseCase' :: CreateUseCase -> Text
$sel:tags:CreateUseCase' :: CreateUseCase -> Maybe (HashMap Text Text)
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
tags
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
instanceId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
integrationAssociationId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` UseCaseType
useCaseType
instance Prelude.NFData CreateUseCase where
rnf :: CreateUseCase -> ()
rnf CreateUseCase' {Maybe (HashMap Text Text)
Text
UseCaseType
useCaseType :: UseCaseType
integrationAssociationId :: Text
instanceId :: Text
tags :: Maybe (HashMap Text Text)
$sel:useCaseType:CreateUseCase' :: CreateUseCase -> UseCaseType
$sel:integrationAssociationId:CreateUseCase' :: CreateUseCase -> Text
$sel:instanceId:CreateUseCase' :: CreateUseCase -> Text
$sel:tags:CreateUseCase' :: CreateUseCase -> Maybe (HashMap Text Text)
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
tags
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
instanceId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
integrationAssociationId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf UseCaseType
useCaseType
instance Data.ToHeaders CreateUseCase where
toHeaders :: CreateUseCase -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON CreateUseCase where
toJSON :: CreateUseCase -> Value
toJSON CreateUseCase' {Maybe (HashMap Text Text)
Text
UseCaseType
useCaseType :: UseCaseType
integrationAssociationId :: Text
instanceId :: Text
tags :: Maybe (HashMap Text Text)
$sel:useCaseType:CreateUseCase' :: CreateUseCase -> UseCaseType
$sel:integrationAssociationId:CreateUseCase' :: CreateUseCase -> Text
$sel:instanceId:CreateUseCase' :: CreateUseCase -> Text
$sel:tags:CreateUseCase' :: CreateUseCase -> Maybe (HashMap Text Text)
..} =
[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 (HashMap Text Text)
tags,
forall a. a -> Maybe a
Prelude.Just (Key
"UseCaseType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= UseCaseType
useCaseType)
]
)
instance Data.ToPath CreateUseCase where
toPath :: CreateUseCase -> ByteString
toPath CreateUseCase' {Maybe (HashMap Text Text)
Text
UseCaseType
useCaseType :: UseCaseType
integrationAssociationId :: Text
instanceId :: Text
tags :: Maybe (HashMap Text Text)
$sel:useCaseType:CreateUseCase' :: CreateUseCase -> UseCaseType
$sel:integrationAssociationId:CreateUseCase' :: CreateUseCase -> Text
$sel:instanceId:CreateUseCase' :: CreateUseCase -> Text
$sel:tags:CreateUseCase' :: CreateUseCase -> Maybe (HashMap Text Text)
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/instance/",
forall a. ToByteString a => a -> ByteString
Data.toBS Text
instanceId,
ByteString
"/integration-associations/",
forall a. ToByteString a => a -> ByteString
Data.toBS Text
integrationAssociationId,
ByteString
"/use-cases"
]
instance Data.ToQuery CreateUseCase where
toQuery :: CreateUseCase -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data CreateUseCaseResponse = CreateUseCaseResponse'
{
CreateUseCaseResponse -> Maybe Text
useCaseArn :: Prelude.Maybe Prelude.Text,
CreateUseCaseResponse -> Maybe Text
useCaseId :: Prelude.Maybe Prelude.Text,
CreateUseCaseResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateUseCaseResponse -> CreateUseCaseResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateUseCaseResponse -> CreateUseCaseResponse -> Bool
$c/= :: CreateUseCaseResponse -> CreateUseCaseResponse -> Bool
== :: CreateUseCaseResponse -> CreateUseCaseResponse -> Bool
$c== :: CreateUseCaseResponse -> CreateUseCaseResponse -> Bool
Prelude.Eq, ReadPrec [CreateUseCaseResponse]
ReadPrec CreateUseCaseResponse
Int -> ReadS CreateUseCaseResponse
ReadS [CreateUseCaseResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateUseCaseResponse]
$creadListPrec :: ReadPrec [CreateUseCaseResponse]
readPrec :: ReadPrec CreateUseCaseResponse
$creadPrec :: ReadPrec CreateUseCaseResponse
readList :: ReadS [CreateUseCaseResponse]
$creadList :: ReadS [CreateUseCaseResponse]
readsPrec :: Int -> ReadS CreateUseCaseResponse
$creadsPrec :: Int -> ReadS CreateUseCaseResponse
Prelude.Read, Int -> CreateUseCaseResponse -> ShowS
[CreateUseCaseResponse] -> ShowS
CreateUseCaseResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateUseCaseResponse] -> ShowS
$cshowList :: [CreateUseCaseResponse] -> ShowS
show :: CreateUseCaseResponse -> String
$cshow :: CreateUseCaseResponse -> String
showsPrec :: Int -> CreateUseCaseResponse -> ShowS
$cshowsPrec :: Int -> CreateUseCaseResponse -> ShowS
Prelude.Show, forall x. Rep CreateUseCaseResponse x -> CreateUseCaseResponse
forall x. CreateUseCaseResponse -> Rep CreateUseCaseResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateUseCaseResponse x -> CreateUseCaseResponse
$cfrom :: forall x. CreateUseCaseResponse -> Rep CreateUseCaseResponse x
Prelude.Generic)
newCreateUseCaseResponse ::
Prelude.Int ->
CreateUseCaseResponse
newCreateUseCaseResponse :: Int -> CreateUseCaseResponse
newCreateUseCaseResponse Int
pHttpStatus_ =
CreateUseCaseResponse'
{ $sel:useCaseArn:CreateUseCaseResponse' :: Maybe Text
useCaseArn =
forall a. Maybe a
Prelude.Nothing,
$sel:useCaseId:CreateUseCaseResponse' :: Maybe Text
useCaseId = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateUseCaseResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createUseCaseResponse_useCaseArn :: Lens.Lens' CreateUseCaseResponse (Prelude.Maybe Prelude.Text)
createUseCaseResponse_useCaseArn :: Lens' CreateUseCaseResponse (Maybe Text)
createUseCaseResponse_useCaseArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateUseCaseResponse' {Maybe Text
useCaseArn :: Maybe Text
$sel:useCaseArn:CreateUseCaseResponse' :: CreateUseCaseResponse -> Maybe Text
useCaseArn} -> Maybe Text
useCaseArn) (\s :: CreateUseCaseResponse
s@CreateUseCaseResponse' {} Maybe Text
a -> CreateUseCaseResponse
s {$sel:useCaseArn:CreateUseCaseResponse' :: Maybe Text
useCaseArn = Maybe Text
a} :: CreateUseCaseResponse)
createUseCaseResponse_useCaseId :: Lens.Lens' CreateUseCaseResponse (Prelude.Maybe Prelude.Text)
createUseCaseResponse_useCaseId :: Lens' CreateUseCaseResponse (Maybe Text)
createUseCaseResponse_useCaseId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateUseCaseResponse' {Maybe Text
useCaseId :: Maybe Text
$sel:useCaseId:CreateUseCaseResponse' :: CreateUseCaseResponse -> Maybe Text
useCaseId} -> Maybe Text
useCaseId) (\s :: CreateUseCaseResponse
s@CreateUseCaseResponse' {} Maybe Text
a -> CreateUseCaseResponse
s {$sel:useCaseId:CreateUseCaseResponse' :: Maybe Text
useCaseId = Maybe Text
a} :: CreateUseCaseResponse)
createUseCaseResponse_httpStatus :: Lens.Lens' CreateUseCaseResponse Prelude.Int
createUseCaseResponse_httpStatus :: Lens' CreateUseCaseResponse Int
createUseCaseResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateUseCaseResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateUseCaseResponse' :: CreateUseCaseResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateUseCaseResponse
s@CreateUseCaseResponse' {} Int
a -> CreateUseCaseResponse
s {$sel:httpStatus:CreateUseCaseResponse' :: Int
httpStatus = Int
a} :: CreateUseCaseResponse)
instance Prelude.NFData CreateUseCaseResponse where
rnf :: CreateUseCaseResponse -> ()
rnf CreateUseCaseResponse' {Int
Maybe Text
httpStatus :: Int
useCaseId :: Maybe Text
useCaseArn :: Maybe Text
$sel:httpStatus:CreateUseCaseResponse' :: CreateUseCaseResponse -> Int
$sel:useCaseId:CreateUseCaseResponse' :: CreateUseCaseResponse -> Maybe Text
$sel:useCaseArn:CreateUseCaseResponse' :: CreateUseCaseResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
useCaseArn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
useCaseId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus