{-# 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.UpdateWorkGroup
(
UpdateWorkGroup (..),
newUpdateWorkGroup,
updateWorkGroup_state,
updateWorkGroup_configurationUpdates,
updateWorkGroup_description,
updateWorkGroup_workGroup,
UpdateWorkGroupResponse (..),
newUpdateWorkGroupResponse,
updateWorkGroupResponse_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 UpdateWorkGroup = UpdateWorkGroup'
{
UpdateWorkGroup -> Maybe WorkGroupState
state :: Prelude.Maybe WorkGroupState,
UpdateWorkGroup -> Maybe WorkGroupConfigurationUpdates
configurationUpdates :: Prelude.Maybe WorkGroupConfigurationUpdates,
UpdateWorkGroup -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
UpdateWorkGroup -> Text
workGroup :: Prelude.Text
}
deriving (UpdateWorkGroup -> UpdateWorkGroup -> Bool
(UpdateWorkGroup -> UpdateWorkGroup -> Bool)
-> (UpdateWorkGroup -> UpdateWorkGroup -> Bool)
-> Eq UpdateWorkGroup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateWorkGroup -> UpdateWorkGroup -> Bool
$c/= :: UpdateWorkGroup -> UpdateWorkGroup -> Bool
== :: UpdateWorkGroup -> UpdateWorkGroup -> Bool
$c== :: UpdateWorkGroup -> UpdateWorkGroup -> Bool
Prelude.Eq, ReadPrec [UpdateWorkGroup]
ReadPrec UpdateWorkGroup
Int -> ReadS UpdateWorkGroup
ReadS [UpdateWorkGroup]
(Int -> ReadS UpdateWorkGroup)
-> ReadS [UpdateWorkGroup]
-> ReadPrec UpdateWorkGroup
-> ReadPrec [UpdateWorkGroup]
-> Read UpdateWorkGroup
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateWorkGroup]
$creadListPrec :: ReadPrec [UpdateWorkGroup]
readPrec :: ReadPrec UpdateWorkGroup
$creadPrec :: ReadPrec UpdateWorkGroup
readList :: ReadS [UpdateWorkGroup]
$creadList :: ReadS [UpdateWorkGroup]
readsPrec :: Int -> ReadS UpdateWorkGroup
$creadsPrec :: Int -> ReadS UpdateWorkGroup
Prelude.Read, Int -> UpdateWorkGroup -> ShowS
[UpdateWorkGroup] -> ShowS
UpdateWorkGroup -> String
(Int -> UpdateWorkGroup -> ShowS)
-> (UpdateWorkGroup -> String)
-> ([UpdateWorkGroup] -> ShowS)
-> Show UpdateWorkGroup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateWorkGroup] -> ShowS
$cshowList :: [UpdateWorkGroup] -> ShowS
show :: UpdateWorkGroup -> String
$cshow :: UpdateWorkGroup -> String
showsPrec :: Int -> UpdateWorkGroup -> ShowS
$cshowsPrec :: Int -> UpdateWorkGroup -> ShowS
Prelude.Show, (forall x. UpdateWorkGroup -> Rep UpdateWorkGroup x)
-> (forall x. Rep UpdateWorkGroup x -> UpdateWorkGroup)
-> Generic UpdateWorkGroup
forall x. Rep UpdateWorkGroup x -> UpdateWorkGroup
forall x. UpdateWorkGroup -> Rep UpdateWorkGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateWorkGroup x -> UpdateWorkGroup
$cfrom :: forall x. UpdateWorkGroup -> Rep UpdateWorkGroup x
Prelude.Generic)
newUpdateWorkGroup ::
Prelude.Text ->
UpdateWorkGroup
newUpdateWorkGroup :: Text -> UpdateWorkGroup
newUpdateWorkGroup Text
pWorkGroup_ =
UpdateWorkGroup' :: Maybe WorkGroupState
-> Maybe WorkGroupConfigurationUpdates
-> Maybe Text
-> Text
-> UpdateWorkGroup
UpdateWorkGroup'
{ $sel:state:UpdateWorkGroup' :: Maybe WorkGroupState
state = Maybe WorkGroupState
forall a. Maybe a
Prelude.Nothing,
$sel:configurationUpdates:UpdateWorkGroup' :: Maybe WorkGroupConfigurationUpdates
configurationUpdates = Maybe WorkGroupConfigurationUpdates
forall a. Maybe a
Prelude.Nothing,
$sel:description:UpdateWorkGroup' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:workGroup:UpdateWorkGroup' :: Text
workGroup = Text
pWorkGroup_
}
updateWorkGroup_state :: Lens.Lens' UpdateWorkGroup (Prelude.Maybe WorkGroupState)
updateWorkGroup_state :: (Maybe WorkGroupState -> f (Maybe WorkGroupState))
-> UpdateWorkGroup -> f UpdateWorkGroup
updateWorkGroup_state = (UpdateWorkGroup -> Maybe WorkGroupState)
-> (UpdateWorkGroup -> Maybe WorkGroupState -> UpdateWorkGroup)
-> Lens
UpdateWorkGroup
UpdateWorkGroup
(Maybe WorkGroupState)
(Maybe WorkGroupState)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateWorkGroup' {Maybe WorkGroupState
state :: Maybe WorkGroupState
$sel:state:UpdateWorkGroup' :: UpdateWorkGroup -> Maybe WorkGroupState
state} -> Maybe WorkGroupState
state) (\s :: UpdateWorkGroup
s@UpdateWorkGroup' {} Maybe WorkGroupState
a -> UpdateWorkGroup
s {$sel:state:UpdateWorkGroup' :: Maybe WorkGroupState
state = Maybe WorkGroupState
a} :: UpdateWorkGroup)
updateWorkGroup_configurationUpdates :: Lens.Lens' UpdateWorkGroup (Prelude.Maybe WorkGroupConfigurationUpdates)
updateWorkGroup_configurationUpdates :: (Maybe WorkGroupConfigurationUpdates
-> f (Maybe WorkGroupConfigurationUpdates))
-> UpdateWorkGroup -> f UpdateWorkGroup
updateWorkGroup_configurationUpdates = (UpdateWorkGroup -> Maybe WorkGroupConfigurationUpdates)
-> (UpdateWorkGroup
-> Maybe WorkGroupConfigurationUpdates -> UpdateWorkGroup)
-> Lens
UpdateWorkGroup
UpdateWorkGroup
(Maybe WorkGroupConfigurationUpdates)
(Maybe WorkGroupConfigurationUpdates)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateWorkGroup' {Maybe WorkGroupConfigurationUpdates
configurationUpdates :: Maybe WorkGroupConfigurationUpdates
$sel:configurationUpdates:UpdateWorkGroup' :: UpdateWorkGroup -> Maybe WorkGroupConfigurationUpdates
configurationUpdates} -> Maybe WorkGroupConfigurationUpdates
configurationUpdates) (\s :: UpdateWorkGroup
s@UpdateWorkGroup' {} Maybe WorkGroupConfigurationUpdates
a -> UpdateWorkGroup
s {$sel:configurationUpdates:UpdateWorkGroup' :: Maybe WorkGroupConfigurationUpdates
configurationUpdates = Maybe WorkGroupConfigurationUpdates
a} :: UpdateWorkGroup)
updateWorkGroup_description :: Lens.Lens' UpdateWorkGroup (Prelude.Maybe Prelude.Text)
updateWorkGroup_description :: (Maybe Text -> f (Maybe Text))
-> UpdateWorkGroup -> f UpdateWorkGroup
updateWorkGroup_description = (UpdateWorkGroup -> Maybe Text)
-> (UpdateWorkGroup -> Maybe Text -> UpdateWorkGroup)
-> Lens UpdateWorkGroup UpdateWorkGroup (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateWorkGroup' {Maybe Text
description :: Maybe Text
$sel:description:UpdateWorkGroup' :: UpdateWorkGroup -> Maybe Text
description} -> Maybe Text
description) (\s :: UpdateWorkGroup
s@UpdateWorkGroup' {} Maybe Text
a -> UpdateWorkGroup
s {$sel:description:UpdateWorkGroup' :: Maybe Text
description = Maybe Text
a} :: UpdateWorkGroup)
updateWorkGroup_workGroup :: Lens.Lens' UpdateWorkGroup Prelude.Text
updateWorkGroup_workGroup :: (Text -> f Text) -> UpdateWorkGroup -> f UpdateWorkGroup
updateWorkGroup_workGroup = (UpdateWorkGroup -> Text)
-> (UpdateWorkGroup -> Text -> UpdateWorkGroup)
-> Lens UpdateWorkGroup UpdateWorkGroup Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateWorkGroup' {Text
workGroup :: Text
$sel:workGroup:UpdateWorkGroup' :: UpdateWorkGroup -> Text
workGroup} -> Text
workGroup) (\s :: UpdateWorkGroup
s@UpdateWorkGroup' {} Text
a -> UpdateWorkGroup
s {$sel:workGroup:UpdateWorkGroup' :: Text
workGroup = Text
a} :: UpdateWorkGroup)
instance Core.AWSRequest UpdateWorkGroup where
type
AWSResponse UpdateWorkGroup =
UpdateWorkGroupResponse
request :: UpdateWorkGroup -> Request UpdateWorkGroup
request = Service -> UpdateWorkGroup -> Request UpdateWorkGroup
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateWorkGroup
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateWorkGroup)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse UpdateWorkGroup))
-> Logger
-> Service
-> Proxy UpdateWorkGroup
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateWorkGroup)))
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 -> UpdateWorkGroupResponse
UpdateWorkGroupResponse'
(Int -> UpdateWorkGroupResponse)
-> Either String Int -> Either String UpdateWorkGroupResponse
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 UpdateWorkGroup
instance Prelude.NFData UpdateWorkGroup
instance Core.ToHeaders UpdateWorkGroup where
toHeaders :: UpdateWorkGroup -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateWorkGroup -> 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.UpdateWorkGroup" ::
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 UpdateWorkGroup where
toJSON :: UpdateWorkGroup -> Value
toJSON UpdateWorkGroup' {Maybe Text
Maybe WorkGroupConfigurationUpdates
Maybe WorkGroupState
Text
workGroup :: Text
description :: Maybe Text
configurationUpdates :: Maybe WorkGroupConfigurationUpdates
state :: Maybe WorkGroupState
$sel:workGroup:UpdateWorkGroup' :: UpdateWorkGroup -> Text
$sel:description:UpdateWorkGroup' :: UpdateWorkGroup -> Maybe Text
$sel:configurationUpdates:UpdateWorkGroup' :: UpdateWorkGroup -> Maybe WorkGroupConfigurationUpdates
$sel:state:UpdateWorkGroup' :: UpdateWorkGroup -> Maybe WorkGroupState
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"State" Text -> WorkGroupState -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (WorkGroupState -> Pair) -> Maybe WorkGroupState -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe WorkGroupState
state,
(Text
"ConfigurationUpdates" Text -> WorkGroupConfigurationUpdates -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(WorkGroupConfigurationUpdates -> Pair)
-> Maybe WorkGroupConfigurationUpdates -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe WorkGroupConfigurationUpdates
configurationUpdates,
(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,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"WorkGroup" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
workGroup)
]
)
instance Core.ToPath UpdateWorkGroup where
toPath :: UpdateWorkGroup -> ByteString
toPath = ByteString -> UpdateWorkGroup -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery UpdateWorkGroup where
toQuery :: UpdateWorkGroup -> QueryString
toQuery = QueryString -> UpdateWorkGroup -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateWorkGroupResponse = UpdateWorkGroupResponse'
{
UpdateWorkGroupResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateWorkGroupResponse -> UpdateWorkGroupResponse -> Bool
(UpdateWorkGroupResponse -> UpdateWorkGroupResponse -> Bool)
-> (UpdateWorkGroupResponse -> UpdateWorkGroupResponse -> Bool)
-> Eq UpdateWorkGroupResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateWorkGroupResponse -> UpdateWorkGroupResponse -> Bool
$c/= :: UpdateWorkGroupResponse -> UpdateWorkGroupResponse -> Bool
== :: UpdateWorkGroupResponse -> UpdateWorkGroupResponse -> Bool
$c== :: UpdateWorkGroupResponse -> UpdateWorkGroupResponse -> Bool
Prelude.Eq, ReadPrec [UpdateWorkGroupResponse]
ReadPrec UpdateWorkGroupResponse
Int -> ReadS UpdateWorkGroupResponse
ReadS [UpdateWorkGroupResponse]
(Int -> ReadS UpdateWorkGroupResponse)
-> ReadS [UpdateWorkGroupResponse]
-> ReadPrec UpdateWorkGroupResponse
-> ReadPrec [UpdateWorkGroupResponse]
-> Read UpdateWorkGroupResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateWorkGroupResponse]
$creadListPrec :: ReadPrec [UpdateWorkGroupResponse]
readPrec :: ReadPrec UpdateWorkGroupResponse
$creadPrec :: ReadPrec UpdateWorkGroupResponse
readList :: ReadS [UpdateWorkGroupResponse]
$creadList :: ReadS [UpdateWorkGroupResponse]
readsPrec :: Int -> ReadS UpdateWorkGroupResponse
$creadsPrec :: Int -> ReadS UpdateWorkGroupResponse
Prelude.Read, Int -> UpdateWorkGroupResponse -> ShowS
[UpdateWorkGroupResponse] -> ShowS
UpdateWorkGroupResponse -> String
(Int -> UpdateWorkGroupResponse -> ShowS)
-> (UpdateWorkGroupResponse -> String)
-> ([UpdateWorkGroupResponse] -> ShowS)
-> Show UpdateWorkGroupResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateWorkGroupResponse] -> ShowS
$cshowList :: [UpdateWorkGroupResponse] -> ShowS
show :: UpdateWorkGroupResponse -> String
$cshow :: UpdateWorkGroupResponse -> String
showsPrec :: Int -> UpdateWorkGroupResponse -> ShowS
$cshowsPrec :: Int -> UpdateWorkGroupResponse -> ShowS
Prelude.Show, (forall x.
UpdateWorkGroupResponse -> Rep UpdateWorkGroupResponse x)
-> (forall x.
Rep UpdateWorkGroupResponse x -> UpdateWorkGroupResponse)
-> Generic UpdateWorkGroupResponse
forall x. Rep UpdateWorkGroupResponse x -> UpdateWorkGroupResponse
forall x. UpdateWorkGroupResponse -> Rep UpdateWorkGroupResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateWorkGroupResponse x -> UpdateWorkGroupResponse
$cfrom :: forall x. UpdateWorkGroupResponse -> Rep UpdateWorkGroupResponse x
Prelude.Generic)
newUpdateWorkGroupResponse ::
Prelude.Int ->
UpdateWorkGroupResponse
newUpdateWorkGroupResponse :: Int -> UpdateWorkGroupResponse
newUpdateWorkGroupResponse Int
pHttpStatus_ =
UpdateWorkGroupResponse' :: Int -> UpdateWorkGroupResponse
UpdateWorkGroupResponse' {$sel:httpStatus:UpdateWorkGroupResponse' :: Int
httpStatus = Int
pHttpStatus_}
updateWorkGroupResponse_httpStatus :: Lens.Lens' UpdateWorkGroupResponse Prelude.Int
updateWorkGroupResponse_httpStatus :: (Int -> f Int)
-> UpdateWorkGroupResponse -> f UpdateWorkGroupResponse
updateWorkGroupResponse_httpStatus = (UpdateWorkGroupResponse -> Int)
-> (UpdateWorkGroupResponse -> Int -> UpdateWorkGroupResponse)
-> Lens UpdateWorkGroupResponse UpdateWorkGroupResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateWorkGroupResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateWorkGroupResponse' :: UpdateWorkGroupResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateWorkGroupResponse
s@UpdateWorkGroupResponse' {} Int
a -> UpdateWorkGroupResponse
s {$sel:httpStatus:UpdateWorkGroupResponse' :: Int
httpStatus = Int
a} :: UpdateWorkGroupResponse)
instance Prelude.NFData UpdateWorkGroupResponse