{-# 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.DeleteGroup
(
DeleteGroup (..),
newDeleteGroup,
deleteGroup_group,
deleteGroup_groupName,
DeleteGroupResponse (..),
newDeleteGroupResponse,
deleteGroupResponse_group,
deleteGroupResponse_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 DeleteGroup = DeleteGroup'
{
DeleteGroup -> Maybe Text
group' :: Prelude.Maybe Prelude.Text,
DeleteGroup -> Maybe Text
groupName :: Prelude.Maybe Prelude.Text
}
deriving (DeleteGroup -> DeleteGroup -> Bool
(DeleteGroup -> DeleteGroup -> Bool)
-> (DeleteGroup -> DeleteGroup -> Bool) -> Eq DeleteGroup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteGroup -> DeleteGroup -> Bool
$c/= :: DeleteGroup -> DeleteGroup -> Bool
== :: DeleteGroup -> DeleteGroup -> Bool
$c== :: DeleteGroup -> DeleteGroup -> Bool
Prelude.Eq, ReadPrec [DeleteGroup]
ReadPrec DeleteGroup
Int -> ReadS DeleteGroup
ReadS [DeleteGroup]
(Int -> ReadS DeleteGroup)
-> ReadS [DeleteGroup]
-> ReadPrec DeleteGroup
-> ReadPrec [DeleteGroup]
-> Read DeleteGroup
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteGroup]
$creadListPrec :: ReadPrec [DeleteGroup]
readPrec :: ReadPrec DeleteGroup
$creadPrec :: ReadPrec DeleteGroup
readList :: ReadS [DeleteGroup]
$creadList :: ReadS [DeleteGroup]
readsPrec :: Int -> ReadS DeleteGroup
$creadsPrec :: Int -> ReadS DeleteGroup
Prelude.Read, Int -> DeleteGroup -> ShowS
[DeleteGroup] -> ShowS
DeleteGroup -> String
(Int -> DeleteGroup -> ShowS)
-> (DeleteGroup -> String)
-> ([DeleteGroup] -> ShowS)
-> Show DeleteGroup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteGroup] -> ShowS
$cshowList :: [DeleteGroup] -> ShowS
show :: DeleteGroup -> String
$cshow :: DeleteGroup -> String
showsPrec :: Int -> DeleteGroup -> ShowS
$cshowsPrec :: Int -> DeleteGroup -> ShowS
Prelude.Show, (forall x. DeleteGroup -> Rep DeleteGroup x)
-> (forall x. Rep DeleteGroup x -> DeleteGroup)
-> Generic DeleteGroup
forall x. Rep DeleteGroup x -> DeleteGroup
forall x. DeleteGroup -> Rep DeleteGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteGroup x -> DeleteGroup
$cfrom :: forall x. DeleteGroup -> Rep DeleteGroup x
Prelude.Generic)
newDeleteGroup ::
DeleteGroup
newDeleteGroup :: DeleteGroup
newDeleteGroup =
DeleteGroup' :: Maybe Text -> Maybe Text -> DeleteGroup
DeleteGroup'
{ $sel:group':DeleteGroup' :: Maybe Text
group' = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:groupName:DeleteGroup' :: Maybe Text
groupName = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
deleteGroup_group :: Lens.Lens' DeleteGroup (Prelude.Maybe Prelude.Text)
deleteGroup_group :: (Maybe Text -> f (Maybe Text)) -> DeleteGroup -> f DeleteGroup
deleteGroup_group = (DeleteGroup -> Maybe Text)
-> (DeleteGroup -> Maybe Text -> DeleteGroup)
-> Lens DeleteGroup DeleteGroup (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteGroup' {Maybe Text
group' :: Maybe Text
$sel:group':DeleteGroup' :: DeleteGroup -> Maybe Text
group'} -> Maybe Text
group') (\s :: DeleteGroup
s@DeleteGroup' {} Maybe Text
a -> DeleteGroup
s {$sel:group':DeleteGroup' :: Maybe Text
group' = Maybe Text
a} :: DeleteGroup)
deleteGroup_groupName :: Lens.Lens' DeleteGroup (Prelude.Maybe Prelude.Text)
deleteGroup_groupName :: (Maybe Text -> f (Maybe Text)) -> DeleteGroup -> f DeleteGroup
deleteGroup_groupName = (DeleteGroup -> Maybe Text)
-> (DeleteGroup -> Maybe Text -> DeleteGroup)
-> Lens DeleteGroup DeleteGroup (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteGroup' {Maybe Text
groupName :: Maybe Text
$sel:groupName:DeleteGroup' :: DeleteGroup -> Maybe Text
groupName} -> Maybe Text
groupName) (\s :: DeleteGroup
s@DeleteGroup' {} Maybe Text
a -> DeleteGroup
s {$sel:groupName:DeleteGroup' :: Maybe Text
groupName = Maybe Text
a} :: DeleteGroup)
instance Core.AWSRequest DeleteGroup where
type AWSResponse DeleteGroup = DeleteGroupResponse
request :: DeleteGroup -> Request DeleteGroup
request = Service -> DeleteGroup -> Request DeleteGroup
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DeleteGroup
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteGroup)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DeleteGroup))
-> Logger
-> Service
-> Proxy DeleteGroup
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteGroup)))
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 Group -> Int -> DeleteGroupResponse
DeleteGroupResponse'
(Maybe Group -> Int -> DeleteGroupResponse)
-> Either String (Maybe Group)
-> Either String (Int -> DeleteGroupResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Group)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Group")
Either String (Int -> DeleteGroupResponse)
-> Either String Int -> Either String DeleteGroupResponse
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 DeleteGroup
instance Prelude.NFData DeleteGroup
instance Core.ToHeaders DeleteGroup where
toHeaders :: DeleteGroup -> ResponseHeaders
toHeaders = ResponseHeaders -> DeleteGroup -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToJSON DeleteGroup where
toJSON :: DeleteGroup -> Value
toJSON DeleteGroup' {Maybe Text
groupName :: Maybe Text
group' :: Maybe Text
$sel:groupName:DeleteGroup' :: DeleteGroup -> Maybe Text
$sel:group':DeleteGroup' :: DeleteGroup -> 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
]
)
instance Core.ToPath DeleteGroup where
toPath :: DeleteGroup -> ByteString
toPath = ByteString -> DeleteGroup -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/delete-group"
instance Core.ToQuery DeleteGroup where
toQuery :: DeleteGroup -> QueryString
toQuery = QueryString -> DeleteGroup -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DeleteGroupResponse = DeleteGroupResponse'
{
DeleteGroupResponse -> Maybe Group
group' :: Prelude.Maybe Group,
DeleteGroupResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DeleteGroupResponse -> DeleteGroupResponse -> Bool
(DeleteGroupResponse -> DeleteGroupResponse -> Bool)
-> (DeleteGroupResponse -> DeleteGroupResponse -> Bool)
-> Eq DeleteGroupResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteGroupResponse -> DeleteGroupResponse -> Bool
$c/= :: DeleteGroupResponse -> DeleteGroupResponse -> Bool
== :: DeleteGroupResponse -> DeleteGroupResponse -> Bool
$c== :: DeleteGroupResponse -> DeleteGroupResponse -> Bool
Prelude.Eq, ReadPrec [DeleteGroupResponse]
ReadPrec DeleteGroupResponse
Int -> ReadS DeleteGroupResponse
ReadS [DeleteGroupResponse]
(Int -> ReadS DeleteGroupResponse)
-> ReadS [DeleteGroupResponse]
-> ReadPrec DeleteGroupResponse
-> ReadPrec [DeleteGroupResponse]
-> Read DeleteGroupResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteGroupResponse]
$creadListPrec :: ReadPrec [DeleteGroupResponse]
readPrec :: ReadPrec DeleteGroupResponse
$creadPrec :: ReadPrec DeleteGroupResponse
readList :: ReadS [DeleteGroupResponse]
$creadList :: ReadS [DeleteGroupResponse]
readsPrec :: Int -> ReadS DeleteGroupResponse
$creadsPrec :: Int -> ReadS DeleteGroupResponse
Prelude.Read, Int -> DeleteGroupResponse -> ShowS
[DeleteGroupResponse] -> ShowS
DeleteGroupResponse -> String
(Int -> DeleteGroupResponse -> ShowS)
-> (DeleteGroupResponse -> String)
-> ([DeleteGroupResponse] -> ShowS)
-> Show DeleteGroupResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteGroupResponse] -> ShowS
$cshowList :: [DeleteGroupResponse] -> ShowS
show :: DeleteGroupResponse -> String
$cshow :: DeleteGroupResponse -> String
showsPrec :: Int -> DeleteGroupResponse -> ShowS
$cshowsPrec :: Int -> DeleteGroupResponse -> ShowS
Prelude.Show, (forall x. DeleteGroupResponse -> Rep DeleteGroupResponse x)
-> (forall x. Rep DeleteGroupResponse x -> DeleteGroupResponse)
-> Generic DeleteGroupResponse
forall x. Rep DeleteGroupResponse x -> DeleteGroupResponse
forall x. DeleteGroupResponse -> Rep DeleteGroupResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteGroupResponse x -> DeleteGroupResponse
$cfrom :: forall x. DeleteGroupResponse -> Rep DeleteGroupResponse x
Prelude.Generic)
newDeleteGroupResponse ::
Prelude.Int ->
DeleteGroupResponse
newDeleteGroupResponse :: Int -> DeleteGroupResponse
newDeleteGroupResponse Int
pHttpStatus_ =
DeleteGroupResponse' :: Maybe Group -> Int -> DeleteGroupResponse
DeleteGroupResponse'
{ $sel:group':DeleteGroupResponse' :: Maybe Group
group' = Maybe Group
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DeleteGroupResponse' :: Int
httpStatus = Int
pHttpStatus_
}
deleteGroupResponse_group :: Lens.Lens' DeleteGroupResponse (Prelude.Maybe Group)
deleteGroupResponse_group :: (Maybe Group -> f (Maybe Group))
-> DeleteGroupResponse -> f DeleteGroupResponse
deleteGroupResponse_group = (DeleteGroupResponse -> Maybe Group)
-> (DeleteGroupResponse -> Maybe Group -> DeleteGroupResponse)
-> Lens
DeleteGroupResponse DeleteGroupResponse (Maybe Group) (Maybe Group)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteGroupResponse' {Maybe Group
group' :: Maybe Group
$sel:group':DeleteGroupResponse' :: DeleteGroupResponse -> Maybe Group
group'} -> Maybe Group
group') (\s :: DeleteGroupResponse
s@DeleteGroupResponse' {} Maybe Group
a -> DeleteGroupResponse
s {$sel:group':DeleteGroupResponse' :: Maybe Group
group' = Maybe Group
a} :: DeleteGroupResponse)
deleteGroupResponse_httpStatus :: Lens.Lens' DeleteGroupResponse Prelude.Int
deleteGroupResponse_httpStatus :: (Int -> f Int) -> DeleteGroupResponse -> f DeleteGroupResponse
deleteGroupResponse_httpStatus = (DeleteGroupResponse -> Int)
-> (DeleteGroupResponse -> Int -> DeleteGroupResponse)
-> Lens DeleteGroupResponse DeleteGroupResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteGroupResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteGroupResponse' :: DeleteGroupResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DeleteGroupResponse
s@DeleteGroupResponse' {} Int
a -> DeleteGroupResponse
s {$sel:httpStatus:DeleteGroupResponse' :: Int
httpStatus = Int
a} :: DeleteGroupResponse)
instance Prelude.NFData DeleteGroupResponse