{-# 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.Athena.CreateWorkGroup
(
CreateWorkGroup (..),
newCreateWorkGroup,
createWorkGroup_configuration,
createWorkGroup_description,
createWorkGroup_tags,
createWorkGroup_name,
CreateWorkGroupResponse (..),
newCreateWorkGroupResponse,
createWorkGroupResponse_httpStatus,
)
where
import Amazonka.Athena.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 CreateWorkGroup = CreateWorkGroup'
{
CreateWorkGroup -> Maybe WorkGroupConfiguration
configuration :: Prelude.Maybe WorkGroupConfiguration,
CreateWorkGroup -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
CreateWorkGroup -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
CreateWorkGroup -> Text
name :: Prelude.Text
}
deriving (CreateWorkGroup -> CreateWorkGroup -> Bool
(CreateWorkGroup -> CreateWorkGroup -> Bool)
-> (CreateWorkGroup -> CreateWorkGroup -> Bool)
-> Eq CreateWorkGroup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateWorkGroup -> CreateWorkGroup -> Bool
$c/= :: CreateWorkGroup -> CreateWorkGroup -> Bool
== :: CreateWorkGroup -> CreateWorkGroup -> Bool
$c== :: CreateWorkGroup -> CreateWorkGroup -> Bool
Prelude.Eq, ReadPrec [CreateWorkGroup]
ReadPrec CreateWorkGroup
Int -> ReadS CreateWorkGroup
ReadS [CreateWorkGroup]
(Int -> ReadS CreateWorkGroup)
-> ReadS [CreateWorkGroup]
-> ReadPrec CreateWorkGroup
-> ReadPrec [CreateWorkGroup]
-> Read CreateWorkGroup
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateWorkGroup]
$creadListPrec :: ReadPrec [CreateWorkGroup]
readPrec :: ReadPrec CreateWorkGroup
$creadPrec :: ReadPrec CreateWorkGroup
readList :: ReadS [CreateWorkGroup]
$creadList :: ReadS [CreateWorkGroup]
readsPrec :: Int -> ReadS CreateWorkGroup
$creadsPrec :: Int -> ReadS CreateWorkGroup
Prelude.Read, Int -> CreateWorkGroup -> ShowS
[CreateWorkGroup] -> ShowS
CreateWorkGroup -> String
(Int -> CreateWorkGroup -> ShowS)
-> (CreateWorkGroup -> String)
-> ([CreateWorkGroup] -> ShowS)
-> Show CreateWorkGroup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateWorkGroup] -> ShowS
$cshowList :: [CreateWorkGroup] -> ShowS
show :: CreateWorkGroup -> String
$cshow :: CreateWorkGroup -> String
showsPrec :: Int -> CreateWorkGroup -> ShowS
$cshowsPrec :: Int -> CreateWorkGroup -> ShowS
Prelude.Show, (forall x. CreateWorkGroup -> Rep CreateWorkGroup x)
-> (forall x. Rep CreateWorkGroup x -> CreateWorkGroup)
-> Generic CreateWorkGroup
forall x. Rep CreateWorkGroup x -> CreateWorkGroup
forall x. CreateWorkGroup -> Rep CreateWorkGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateWorkGroup x -> CreateWorkGroup
$cfrom :: forall x. CreateWorkGroup -> Rep CreateWorkGroup x
Prelude.Generic)
newCreateWorkGroup ::
Prelude.Text ->
CreateWorkGroup
newCreateWorkGroup :: Text -> CreateWorkGroup
newCreateWorkGroup Text
pName_ =
CreateWorkGroup' :: Maybe WorkGroupConfiguration
-> Maybe Text -> Maybe [Tag] -> Text -> CreateWorkGroup
CreateWorkGroup'
{ $sel:configuration:CreateWorkGroup' :: Maybe WorkGroupConfiguration
configuration = Maybe WorkGroupConfiguration
forall a. Maybe a
Prelude.Nothing,
$sel:description:CreateWorkGroup' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:tags:CreateWorkGroup' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
$sel:name:CreateWorkGroup' :: Text
name = Text
pName_
}
createWorkGroup_configuration :: Lens.Lens' CreateWorkGroup (Prelude.Maybe WorkGroupConfiguration)
createWorkGroup_configuration :: (Maybe WorkGroupConfiguration -> f (Maybe WorkGroupConfiguration))
-> CreateWorkGroup -> f CreateWorkGroup
createWorkGroup_configuration = (CreateWorkGroup -> Maybe WorkGroupConfiguration)
-> (CreateWorkGroup
-> Maybe WorkGroupConfiguration -> CreateWorkGroup)
-> Lens
CreateWorkGroup
CreateWorkGroup
(Maybe WorkGroupConfiguration)
(Maybe WorkGroupConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateWorkGroup' {Maybe WorkGroupConfiguration
configuration :: Maybe WorkGroupConfiguration
$sel:configuration:CreateWorkGroup' :: CreateWorkGroup -> Maybe WorkGroupConfiguration
configuration} -> Maybe WorkGroupConfiguration
configuration) (\s :: CreateWorkGroup
s@CreateWorkGroup' {} Maybe WorkGroupConfiguration
a -> CreateWorkGroup
s {$sel:configuration:CreateWorkGroup' :: Maybe WorkGroupConfiguration
configuration = Maybe WorkGroupConfiguration
a} :: CreateWorkGroup)
createWorkGroup_description :: Lens.Lens' CreateWorkGroup (Prelude.Maybe Prelude.Text)
createWorkGroup_description :: (Maybe Text -> f (Maybe Text))
-> CreateWorkGroup -> f CreateWorkGroup
createWorkGroup_description = (CreateWorkGroup -> Maybe Text)
-> (CreateWorkGroup -> Maybe Text -> CreateWorkGroup)
-> Lens CreateWorkGroup CreateWorkGroup (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateWorkGroup' {Maybe Text
description :: Maybe Text
$sel:description:CreateWorkGroup' :: CreateWorkGroup -> Maybe Text
description} -> Maybe Text
description) (\s :: CreateWorkGroup
s@CreateWorkGroup' {} Maybe Text
a -> CreateWorkGroup
s {$sel:description:CreateWorkGroup' :: Maybe Text
description = Maybe Text
a} :: CreateWorkGroup)
createWorkGroup_tags :: Lens.Lens' CreateWorkGroup (Prelude.Maybe [Tag])
createWorkGroup_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateWorkGroup -> f CreateWorkGroup
createWorkGroup_tags = (CreateWorkGroup -> Maybe [Tag])
-> (CreateWorkGroup -> Maybe [Tag] -> CreateWorkGroup)
-> Lens CreateWorkGroup CreateWorkGroup (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateWorkGroup' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateWorkGroup' :: CreateWorkGroup -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateWorkGroup
s@CreateWorkGroup' {} Maybe [Tag]
a -> CreateWorkGroup
s {$sel:tags:CreateWorkGroup' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateWorkGroup) ((Maybe [Tag] -> f (Maybe [Tag]))
-> CreateWorkGroup -> f CreateWorkGroup)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
-> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateWorkGroup
-> f CreateWorkGroup
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
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 AnIso [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createWorkGroup_name :: Lens.Lens' CreateWorkGroup Prelude.Text
createWorkGroup_name :: (Text -> f Text) -> CreateWorkGroup -> f CreateWorkGroup
createWorkGroup_name = (CreateWorkGroup -> Text)
-> (CreateWorkGroup -> Text -> CreateWorkGroup)
-> Lens CreateWorkGroup CreateWorkGroup Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateWorkGroup' {Text
name :: Text
$sel:name:CreateWorkGroup' :: CreateWorkGroup -> Text
name} -> Text
name) (\s :: CreateWorkGroup
s@CreateWorkGroup' {} Text
a -> CreateWorkGroup
s {$sel:name:CreateWorkGroup' :: Text
name = Text
a} :: CreateWorkGroup)
instance Core.AWSRequest CreateWorkGroup where
type
AWSResponse CreateWorkGroup =
CreateWorkGroupResponse
request :: CreateWorkGroup -> Request CreateWorkGroup
request = Service -> CreateWorkGroup -> Request CreateWorkGroup
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateWorkGroup
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateWorkGroup)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse CreateWorkGroup))
-> Logger
-> Service
-> Proxy CreateWorkGroup
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateWorkGroup)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> CreateWorkGroupResponse
CreateWorkGroupResponse'
(Int -> CreateWorkGroupResponse)
-> Either String Int -> Either String CreateWorkGroupResponse
forall (f :: * -> *) a b. Functor 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 CreateWorkGroup
instance Prelude.NFData CreateWorkGroup
instance Core.ToHeaders CreateWorkGroup where
toHeaders :: CreateWorkGroup -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateWorkGroup -> 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
"AmazonAthena.CreateWorkGroup" ::
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 CreateWorkGroup where
toJSON :: CreateWorkGroup -> Value
toJSON CreateWorkGroup' {Maybe [Tag]
Maybe Text
Maybe WorkGroupConfiguration
Text
name :: Text
tags :: Maybe [Tag]
description :: Maybe Text
configuration :: Maybe WorkGroupConfiguration
$sel:name:CreateWorkGroup' :: CreateWorkGroup -> Text
$sel:tags:CreateWorkGroup' :: CreateWorkGroup -> Maybe [Tag]
$sel:description:CreateWorkGroup' :: CreateWorkGroup -> Maybe Text
$sel:configuration:CreateWorkGroup' :: CreateWorkGroup -> Maybe WorkGroupConfiguration
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Configuration" Text -> WorkGroupConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (WorkGroupConfiguration -> Pair)
-> Maybe WorkGroupConfiguration -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe WorkGroupConfiguration
configuration,
(Text
"Description" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
description,
(Text
"Tags" Text -> [Tag] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Tag] -> Pair) -> Maybe [Tag] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name)
]
)
instance Core.ToPath CreateWorkGroup where
toPath :: CreateWorkGroup -> ByteString
toPath = ByteString -> CreateWorkGroup -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateWorkGroup where
toQuery :: CreateWorkGroup -> QueryString
toQuery = QueryString -> CreateWorkGroup -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateWorkGroupResponse = CreateWorkGroupResponse'
{
CreateWorkGroupResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateWorkGroupResponse -> CreateWorkGroupResponse -> Bool
(CreateWorkGroupResponse -> CreateWorkGroupResponse -> Bool)
-> (CreateWorkGroupResponse -> CreateWorkGroupResponse -> Bool)
-> Eq CreateWorkGroupResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateWorkGroupResponse -> CreateWorkGroupResponse -> Bool
$c/= :: CreateWorkGroupResponse -> CreateWorkGroupResponse -> Bool
== :: CreateWorkGroupResponse -> CreateWorkGroupResponse -> Bool
$c== :: CreateWorkGroupResponse -> CreateWorkGroupResponse -> Bool
Prelude.Eq, ReadPrec [CreateWorkGroupResponse]
ReadPrec CreateWorkGroupResponse
Int -> ReadS CreateWorkGroupResponse
ReadS [CreateWorkGroupResponse]
(Int -> ReadS CreateWorkGroupResponse)
-> ReadS [CreateWorkGroupResponse]
-> ReadPrec CreateWorkGroupResponse
-> ReadPrec [CreateWorkGroupResponse]
-> Read CreateWorkGroupResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateWorkGroupResponse]
$creadListPrec :: ReadPrec [CreateWorkGroupResponse]
readPrec :: ReadPrec CreateWorkGroupResponse
$creadPrec :: ReadPrec CreateWorkGroupResponse
readList :: ReadS [CreateWorkGroupResponse]
$creadList :: ReadS [CreateWorkGroupResponse]
readsPrec :: Int -> ReadS CreateWorkGroupResponse
$creadsPrec :: Int -> ReadS CreateWorkGroupResponse
Prelude.Read, Int -> CreateWorkGroupResponse -> ShowS
[CreateWorkGroupResponse] -> ShowS
CreateWorkGroupResponse -> String
(Int -> CreateWorkGroupResponse -> ShowS)
-> (CreateWorkGroupResponse -> String)
-> ([CreateWorkGroupResponse] -> ShowS)
-> Show CreateWorkGroupResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateWorkGroupResponse] -> ShowS
$cshowList :: [CreateWorkGroupResponse] -> ShowS
show :: CreateWorkGroupResponse -> String
$cshow :: CreateWorkGroupResponse -> String
showsPrec :: Int -> CreateWorkGroupResponse -> ShowS
$cshowsPrec :: Int -> CreateWorkGroupResponse -> ShowS
Prelude.Show, (forall x.
CreateWorkGroupResponse -> Rep CreateWorkGroupResponse x)
-> (forall x.
Rep CreateWorkGroupResponse x -> CreateWorkGroupResponse)
-> Generic CreateWorkGroupResponse
forall x. Rep CreateWorkGroupResponse x -> CreateWorkGroupResponse
forall x. CreateWorkGroupResponse -> Rep CreateWorkGroupResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateWorkGroupResponse x -> CreateWorkGroupResponse
$cfrom :: forall x. CreateWorkGroupResponse -> Rep CreateWorkGroupResponse x
Prelude.Generic)
newCreateWorkGroupResponse ::
Prelude.Int ->
CreateWorkGroupResponse
newCreateWorkGroupResponse :: Int -> CreateWorkGroupResponse
newCreateWorkGroupResponse Int
pHttpStatus_ =
CreateWorkGroupResponse' :: Int -> CreateWorkGroupResponse
CreateWorkGroupResponse' {$sel:httpStatus:CreateWorkGroupResponse' :: Int
httpStatus = Int
pHttpStatus_}
createWorkGroupResponse_httpStatus :: Lens.Lens' CreateWorkGroupResponse Prelude.Int
createWorkGroupResponse_httpStatus :: (Int -> f Int)
-> CreateWorkGroupResponse -> f CreateWorkGroupResponse
createWorkGroupResponse_httpStatus = (CreateWorkGroupResponse -> Int)
-> (CreateWorkGroupResponse -> Int -> CreateWorkGroupResponse)
-> Lens CreateWorkGroupResponse CreateWorkGroupResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateWorkGroupResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateWorkGroupResponse' :: CreateWorkGroupResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateWorkGroupResponse
s@CreateWorkGroupResponse' {} Int
a -> CreateWorkGroupResponse
s {$sel:httpStatus:CreateWorkGroupResponse' :: Int
httpStatus = Int
a} :: CreateWorkGroupResponse)
instance Prelude.NFData CreateWorkGroupResponse