{-# 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.ResourceGroups.UpdateGroupQuery
(
UpdateGroupQuery (..),
newUpdateGroupQuery,
updateGroupQuery_group,
updateGroupQuery_groupName,
updateGroupQuery_resourceQuery,
UpdateGroupQueryResponse (..),
newUpdateGroupQueryResponse,
updateGroupQueryResponse_groupQuery,
updateGroupQueryResponse_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 Amazonka.ResourceGroups.Types
import qualified Amazonka.Response as Response
data UpdateGroupQuery = UpdateGroupQuery'
{
UpdateGroupQuery -> Maybe Text
group' :: Prelude.Maybe Prelude.Text,
UpdateGroupQuery -> Maybe Text
groupName :: Prelude.Maybe Prelude.Text,
UpdateGroupQuery -> ResourceQuery
resourceQuery :: ResourceQuery
}
deriving (UpdateGroupQuery -> UpdateGroupQuery -> Bool
(UpdateGroupQuery -> UpdateGroupQuery -> Bool)
-> (UpdateGroupQuery -> UpdateGroupQuery -> Bool)
-> Eq UpdateGroupQuery
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateGroupQuery -> UpdateGroupQuery -> Bool
$c/= :: UpdateGroupQuery -> UpdateGroupQuery -> Bool
== :: UpdateGroupQuery -> UpdateGroupQuery -> Bool
$c== :: UpdateGroupQuery -> UpdateGroupQuery -> Bool
Prelude.Eq, ReadPrec [UpdateGroupQuery]
ReadPrec UpdateGroupQuery
Int -> ReadS UpdateGroupQuery
ReadS [UpdateGroupQuery]
(Int -> ReadS UpdateGroupQuery)
-> ReadS [UpdateGroupQuery]
-> ReadPrec UpdateGroupQuery
-> ReadPrec [UpdateGroupQuery]
-> Read UpdateGroupQuery
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateGroupQuery]
$creadListPrec :: ReadPrec [UpdateGroupQuery]
readPrec :: ReadPrec UpdateGroupQuery
$creadPrec :: ReadPrec UpdateGroupQuery
readList :: ReadS [UpdateGroupQuery]
$creadList :: ReadS [UpdateGroupQuery]
readsPrec :: Int -> ReadS UpdateGroupQuery
$creadsPrec :: Int -> ReadS UpdateGroupQuery
Prelude.Read, Int -> UpdateGroupQuery -> ShowS
[UpdateGroupQuery] -> ShowS
UpdateGroupQuery -> String
(Int -> UpdateGroupQuery -> ShowS)
-> (UpdateGroupQuery -> String)
-> ([UpdateGroupQuery] -> ShowS)
-> Show UpdateGroupQuery
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateGroupQuery] -> ShowS
$cshowList :: [UpdateGroupQuery] -> ShowS
show :: UpdateGroupQuery -> String
$cshow :: UpdateGroupQuery -> String
showsPrec :: Int -> UpdateGroupQuery -> ShowS
$cshowsPrec :: Int -> UpdateGroupQuery -> ShowS
Prelude.Show, (forall x. UpdateGroupQuery -> Rep UpdateGroupQuery x)
-> (forall x. Rep UpdateGroupQuery x -> UpdateGroupQuery)
-> Generic UpdateGroupQuery
forall x. Rep UpdateGroupQuery x -> UpdateGroupQuery
forall x. UpdateGroupQuery -> Rep UpdateGroupQuery x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateGroupQuery x -> UpdateGroupQuery
$cfrom :: forall x. UpdateGroupQuery -> Rep UpdateGroupQuery x
Prelude.Generic)
newUpdateGroupQuery ::
ResourceQuery ->
UpdateGroupQuery
newUpdateGroupQuery :: ResourceQuery -> UpdateGroupQuery
newUpdateGroupQuery ResourceQuery
pResourceQuery_ =
UpdateGroupQuery' :: Maybe Text -> Maybe Text -> ResourceQuery -> UpdateGroupQuery
UpdateGroupQuery'
{ $sel:group':UpdateGroupQuery' :: Maybe Text
group' = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:groupName:UpdateGroupQuery' :: Maybe Text
groupName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:resourceQuery:UpdateGroupQuery' :: ResourceQuery
resourceQuery = ResourceQuery
pResourceQuery_
}
updateGroupQuery_group :: Lens.Lens' UpdateGroupQuery (Prelude.Maybe Prelude.Text)
updateGroupQuery_group :: (Maybe Text -> f (Maybe Text))
-> UpdateGroupQuery -> f UpdateGroupQuery
updateGroupQuery_group = (UpdateGroupQuery -> Maybe Text)
-> (UpdateGroupQuery -> Maybe Text -> UpdateGroupQuery)
-> Lens UpdateGroupQuery UpdateGroupQuery (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateGroupQuery' {Maybe Text
group' :: Maybe Text
$sel:group':UpdateGroupQuery' :: UpdateGroupQuery -> Maybe Text
group'} -> Maybe Text
group') (\s :: UpdateGroupQuery
s@UpdateGroupQuery' {} Maybe Text
a -> UpdateGroupQuery
s {$sel:group':UpdateGroupQuery' :: Maybe Text
group' = Maybe Text
a} :: UpdateGroupQuery)
updateGroupQuery_groupName :: Lens.Lens' UpdateGroupQuery (Prelude.Maybe Prelude.Text)
updateGroupQuery_groupName :: (Maybe Text -> f (Maybe Text))
-> UpdateGroupQuery -> f UpdateGroupQuery
updateGroupQuery_groupName = (UpdateGroupQuery -> Maybe Text)
-> (UpdateGroupQuery -> Maybe Text -> UpdateGroupQuery)
-> Lens UpdateGroupQuery UpdateGroupQuery (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateGroupQuery' {Maybe Text
groupName :: Maybe Text
$sel:groupName:UpdateGroupQuery' :: UpdateGroupQuery -> Maybe Text
groupName} -> Maybe Text
groupName) (\s :: UpdateGroupQuery
s@UpdateGroupQuery' {} Maybe Text
a -> UpdateGroupQuery
s {$sel:groupName:UpdateGroupQuery' :: Maybe Text
groupName = Maybe Text
a} :: UpdateGroupQuery)
updateGroupQuery_resourceQuery :: Lens.Lens' UpdateGroupQuery ResourceQuery
updateGroupQuery_resourceQuery :: (ResourceQuery -> f ResourceQuery)
-> UpdateGroupQuery -> f UpdateGroupQuery
updateGroupQuery_resourceQuery = (UpdateGroupQuery -> ResourceQuery)
-> (UpdateGroupQuery -> ResourceQuery -> UpdateGroupQuery)
-> Lens
UpdateGroupQuery UpdateGroupQuery ResourceQuery ResourceQuery
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateGroupQuery' {ResourceQuery
resourceQuery :: ResourceQuery
$sel:resourceQuery:UpdateGroupQuery' :: UpdateGroupQuery -> ResourceQuery
resourceQuery} -> ResourceQuery
resourceQuery) (\s :: UpdateGroupQuery
s@UpdateGroupQuery' {} ResourceQuery
a -> UpdateGroupQuery
s {$sel:resourceQuery:UpdateGroupQuery' :: ResourceQuery
resourceQuery = ResourceQuery
a} :: UpdateGroupQuery)
instance Core.AWSRequest UpdateGroupQuery where
type
AWSResponse UpdateGroupQuery =
UpdateGroupQueryResponse
request :: UpdateGroupQuery -> Request UpdateGroupQuery
request = Service -> UpdateGroupQuery -> Request UpdateGroupQuery
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateGroupQuery
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateGroupQuery)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateGroupQuery))
-> Logger
-> Service
-> Proxy UpdateGroupQuery
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateGroupQuery)))
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 GroupQuery -> Int -> UpdateGroupQueryResponse
UpdateGroupQueryResponse'
(Maybe GroupQuery -> Int -> UpdateGroupQueryResponse)
-> Either String (Maybe GroupQuery)
-> Either String (Int -> UpdateGroupQueryResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe GroupQuery)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"GroupQuery")
Either String (Int -> UpdateGroupQueryResponse)
-> Either String Int -> Either String UpdateGroupQueryResponse
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 UpdateGroupQuery
instance Prelude.NFData UpdateGroupQuery
instance Core.ToHeaders UpdateGroupQuery where
toHeaders :: UpdateGroupQuery -> ResponseHeaders
toHeaders = ResponseHeaders -> UpdateGroupQuery -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToJSON UpdateGroupQuery where
toJSON :: UpdateGroupQuery -> Value
toJSON UpdateGroupQuery' {Maybe Text
ResourceQuery
resourceQuery :: ResourceQuery
groupName :: Maybe Text
group' :: Maybe Text
$sel:resourceQuery:UpdateGroupQuery' :: UpdateGroupQuery -> ResourceQuery
$sel:groupName:UpdateGroupQuery' :: UpdateGroupQuery -> Maybe Text
$sel:group':UpdateGroupQuery' :: UpdateGroupQuery -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Group" 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
group',
(Text
"GroupName" 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
groupName,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"ResourceQuery" Text -> ResourceQuery -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ResourceQuery
resourceQuery)
]
)
instance Core.ToPath UpdateGroupQuery where
toPath :: UpdateGroupQuery -> ByteString
toPath = ByteString -> UpdateGroupQuery -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/update-group-query"
instance Core.ToQuery UpdateGroupQuery where
toQuery :: UpdateGroupQuery -> QueryString
toQuery = QueryString -> UpdateGroupQuery -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateGroupQueryResponse = UpdateGroupQueryResponse'
{
UpdateGroupQueryResponse -> Maybe GroupQuery
groupQuery :: Prelude.Maybe GroupQuery,
UpdateGroupQueryResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateGroupQueryResponse -> UpdateGroupQueryResponse -> Bool
(UpdateGroupQueryResponse -> UpdateGroupQueryResponse -> Bool)
-> (UpdateGroupQueryResponse -> UpdateGroupQueryResponse -> Bool)
-> Eq UpdateGroupQueryResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateGroupQueryResponse -> UpdateGroupQueryResponse -> Bool
$c/= :: UpdateGroupQueryResponse -> UpdateGroupQueryResponse -> Bool
== :: UpdateGroupQueryResponse -> UpdateGroupQueryResponse -> Bool
$c== :: UpdateGroupQueryResponse -> UpdateGroupQueryResponse -> Bool
Prelude.Eq, ReadPrec [UpdateGroupQueryResponse]
ReadPrec UpdateGroupQueryResponse
Int -> ReadS UpdateGroupQueryResponse
ReadS [UpdateGroupQueryResponse]
(Int -> ReadS UpdateGroupQueryResponse)
-> ReadS [UpdateGroupQueryResponse]
-> ReadPrec UpdateGroupQueryResponse
-> ReadPrec [UpdateGroupQueryResponse]
-> Read UpdateGroupQueryResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateGroupQueryResponse]
$creadListPrec :: ReadPrec [UpdateGroupQueryResponse]
readPrec :: ReadPrec UpdateGroupQueryResponse
$creadPrec :: ReadPrec UpdateGroupQueryResponse
readList :: ReadS [UpdateGroupQueryResponse]
$creadList :: ReadS [UpdateGroupQueryResponse]
readsPrec :: Int -> ReadS UpdateGroupQueryResponse
$creadsPrec :: Int -> ReadS UpdateGroupQueryResponse
Prelude.Read, Int -> UpdateGroupQueryResponse -> ShowS
[UpdateGroupQueryResponse] -> ShowS
UpdateGroupQueryResponse -> String
(Int -> UpdateGroupQueryResponse -> ShowS)
-> (UpdateGroupQueryResponse -> String)
-> ([UpdateGroupQueryResponse] -> ShowS)
-> Show UpdateGroupQueryResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateGroupQueryResponse] -> ShowS
$cshowList :: [UpdateGroupQueryResponse] -> ShowS
show :: UpdateGroupQueryResponse -> String
$cshow :: UpdateGroupQueryResponse -> String
showsPrec :: Int -> UpdateGroupQueryResponse -> ShowS
$cshowsPrec :: Int -> UpdateGroupQueryResponse -> ShowS
Prelude.Show, (forall x.
UpdateGroupQueryResponse -> Rep UpdateGroupQueryResponse x)
-> (forall x.
Rep UpdateGroupQueryResponse x -> UpdateGroupQueryResponse)
-> Generic UpdateGroupQueryResponse
forall x.
Rep UpdateGroupQueryResponse x -> UpdateGroupQueryResponse
forall x.
UpdateGroupQueryResponse -> Rep UpdateGroupQueryResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateGroupQueryResponse x -> UpdateGroupQueryResponse
$cfrom :: forall x.
UpdateGroupQueryResponse -> Rep UpdateGroupQueryResponse x
Prelude.Generic)
newUpdateGroupQueryResponse ::
Prelude.Int ->
UpdateGroupQueryResponse
newUpdateGroupQueryResponse :: Int -> UpdateGroupQueryResponse
newUpdateGroupQueryResponse Int
pHttpStatus_ =
UpdateGroupQueryResponse' :: Maybe GroupQuery -> Int -> UpdateGroupQueryResponse
UpdateGroupQueryResponse'
{ $sel:groupQuery:UpdateGroupQueryResponse' :: Maybe GroupQuery
groupQuery =
Maybe GroupQuery
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateGroupQueryResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateGroupQueryResponse_groupQuery :: Lens.Lens' UpdateGroupQueryResponse (Prelude.Maybe GroupQuery)
updateGroupQueryResponse_groupQuery :: (Maybe GroupQuery -> f (Maybe GroupQuery))
-> UpdateGroupQueryResponse -> f UpdateGroupQueryResponse
updateGroupQueryResponse_groupQuery = (UpdateGroupQueryResponse -> Maybe GroupQuery)
-> (UpdateGroupQueryResponse
-> Maybe GroupQuery -> UpdateGroupQueryResponse)
-> Lens
UpdateGroupQueryResponse
UpdateGroupQueryResponse
(Maybe GroupQuery)
(Maybe GroupQuery)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateGroupQueryResponse' {Maybe GroupQuery
groupQuery :: Maybe GroupQuery
$sel:groupQuery:UpdateGroupQueryResponse' :: UpdateGroupQueryResponse -> Maybe GroupQuery
groupQuery} -> Maybe GroupQuery
groupQuery) (\s :: UpdateGroupQueryResponse
s@UpdateGroupQueryResponse' {} Maybe GroupQuery
a -> UpdateGroupQueryResponse
s {$sel:groupQuery:UpdateGroupQueryResponse' :: Maybe GroupQuery
groupQuery = Maybe GroupQuery
a} :: UpdateGroupQueryResponse)
updateGroupQueryResponse_httpStatus :: Lens.Lens' UpdateGroupQueryResponse Prelude.Int
updateGroupQueryResponse_httpStatus :: (Int -> f Int)
-> UpdateGroupQueryResponse -> f UpdateGroupQueryResponse
updateGroupQueryResponse_httpStatus = (UpdateGroupQueryResponse -> Int)
-> (UpdateGroupQueryResponse -> Int -> UpdateGroupQueryResponse)
-> Lens UpdateGroupQueryResponse UpdateGroupQueryResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateGroupQueryResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateGroupQueryResponse' :: UpdateGroupQueryResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateGroupQueryResponse
s@UpdateGroupQueryResponse' {} Int
a -> UpdateGroupQueryResponse
s {$sel:httpStatus:UpdateGroupQueryResponse' :: Int
httpStatus = Int
a} :: UpdateGroupQueryResponse)
instance Prelude.NFData UpdateGroupQueryResponse