{-# 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.Inspector.DescribeResourceGroups
(
DescribeResourceGroups (..),
newDescribeResourceGroups,
describeResourceGroups_resourceGroupArns,
DescribeResourceGroupsResponse (..),
newDescribeResourceGroupsResponse,
describeResourceGroupsResponse_httpStatus,
describeResourceGroupsResponse_resourceGroups,
describeResourceGroupsResponse_failedItems,
)
where
import qualified Amazonka.Core as Core
import Amazonka.Inspector.Types
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 DescribeResourceGroups = DescribeResourceGroups'
{
DescribeResourceGroups -> NonEmpty Text
resourceGroupArns :: Prelude.NonEmpty Prelude.Text
}
deriving (DescribeResourceGroups -> DescribeResourceGroups -> Bool
(DescribeResourceGroups -> DescribeResourceGroups -> Bool)
-> (DescribeResourceGroups -> DescribeResourceGroups -> Bool)
-> Eq DescribeResourceGroups
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeResourceGroups -> DescribeResourceGroups -> Bool
$c/= :: DescribeResourceGroups -> DescribeResourceGroups -> Bool
== :: DescribeResourceGroups -> DescribeResourceGroups -> Bool
$c== :: DescribeResourceGroups -> DescribeResourceGroups -> Bool
Prelude.Eq, ReadPrec [DescribeResourceGroups]
ReadPrec DescribeResourceGroups
Int -> ReadS DescribeResourceGroups
ReadS [DescribeResourceGroups]
(Int -> ReadS DescribeResourceGroups)
-> ReadS [DescribeResourceGroups]
-> ReadPrec DescribeResourceGroups
-> ReadPrec [DescribeResourceGroups]
-> Read DescribeResourceGroups
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeResourceGroups]
$creadListPrec :: ReadPrec [DescribeResourceGroups]
readPrec :: ReadPrec DescribeResourceGroups
$creadPrec :: ReadPrec DescribeResourceGroups
readList :: ReadS [DescribeResourceGroups]
$creadList :: ReadS [DescribeResourceGroups]
readsPrec :: Int -> ReadS DescribeResourceGroups
$creadsPrec :: Int -> ReadS DescribeResourceGroups
Prelude.Read, Int -> DescribeResourceGroups -> ShowS
[DescribeResourceGroups] -> ShowS
DescribeResourceGroups -> String
(Int -> DescribeResourceGroups -> ShowS)
-> (DescribeResourceGroups -> String)
-> ([DescribeResourceGroups] -> ShowS)
-> Show DescribeResourceGroups
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeResourceGroups] -> ShowS
$cshowList :: [DescribeResourceGroups] -> ShowS
show :: DescribeResourceGroups -> String
$cshow :: DescribeResourceGroups -> String
showsPrec :: Int -> DescribeResourceGroups -> ShowS
$cshowsPrec :: Int -> DescribeResourceGroups -> ShowS
Prelude.Show, (forall x. DescribeResourceGroups -> Rep DescribeResourceGroups x)
-> (forall x.
Rep DescribeResourceGroups x -> DescribeResourceGroups)
-> Generic DescribeResourceGroups
forall x. Rep DescribeResourceGroups x -> DescribeResourceGroups
forall x. DescribeResourceGroups -> Rep DescribeResourceGroups x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeResourceGroups x -> DescribeResourceGroups
$cfrom :: forall x. DescribeResourceGroups -> Rep DescribeResourceGroups x
Prelude.Generic)
newDescribeResourceGroups ::
Prelude.NonEmpty Prelude.Text ->
DescribeResourceGroups
newDescribeResourceGroups :: NonEmpty Text -> DescribeResourceGroups
newDescribeResourceGroups NonEmpty Text
pResourceGroupArns_ =
DescribeResourceGroups' :: NonEmpty Text -> DescribeResourceGroups
DescribeResourceGroups'
{ $sel:resourceGroupArns:DescribeResourceGroups' :: NonEmpty Text
resourceGroupArns =
Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text)))
-> NonEmpty Text -> NonEmpty Text
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pResourceGroupArns_
}
describeResourceGroups_resourceGroupArns :: Lens.Lens' DescribeResourceGroups (Prelude.NonEmpty Prelude.Text)
describeResourceGroups_resourceGroupArns :: (NonEmpty Text -> f (NonEmpty Text))
-> DescribeResourceGroups -> f DescribeResourceGroups
describeResourceGroups_resourceGroupArns = (DescribeResourceGroups -> NonEmpty Text)
-> (DescribeResourceGroups
-> NonEmpty Text -> DescribeResourceGroups)
-> Lens
DescribeResourceGroups
DescribeResourceGroups
(NonEmpty Text)
(NonEmpty Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeResourceGroups' {NonEmpty Text
resourceGroupArns :: NonEmpty Text
$sel:resourceGroupArns:DescribeResourceGroups' :: DescribeResourceGroups -> NonEmpty Text
resourceGroupArns} -> NonEmpty Text
resourceGroupArns) (\s :: DescribeResourceGroups
s@DescribeResourceGroups' {} NonEmpty Text
a -> DescribeResourceGroups
s {$sel:resourceGroupArns:DescribeResourceGroups' :: NonEmpty Text
resourceGroupArns = NonEmpty Text
a} :: DescribeResourceGroups) ((NonEmpty Text -> f (NonEmpty Text))
-> DescribeResourceGroups -> f DescribeResourceGroups)
-> ((NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text))
-> (NonEmpty Text -> f (NonEmpty Text))
-> DescribeResourceGroups
-> f DescribeResourceGroups
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest DescribeResourceGroups where
type
AWSResponse DescribeResourceGroups =
DescribeResourceGroupsResponse
request :: DescribeResourceGroups -> Request DescribeResourceGroups
request = Service -> DescribeResourceGroups -> Request DescribeResourceGroups
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeResourceGroups
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeResourceGroups)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeResourceGroups))
-> Logger
-> Service
-> Proxy DescribeResourceGroups
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeResourceGroups)))
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 ->
Int
-> [ResourceGroup]
-> HashMap Text FailedItemDetails
-> DescribeResourceGroupsResponse
DescribeResourceGroupsResponse'
(Int
-> [ResourceGroup]
-> HashMap Text FailedItemDetails
-> DescribeResourceGroupsResponse)
-> Either String Int
-> Either
String
([ResourceGroup]
-> HashMap Text FailedItemDetails
-> DescribeResourceGroupsResponse)
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))
Either
String
([ResourceGroup]
-> HashMap Text FailedItemDetails
-> DescribeResourceGroupsResponse)
-> Either String [ResourceGroup]
-> Either
String
(HashMap Text FailedItemDetails -> DescribeResourceGroupsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe [ResourceGroup])
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"resourceGroups" Either String (Maybe [ResourceGroup])
-> [ResourceGroup] -> Either String [ResourceGroup]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [ResourceGroup]
forall a. Monoid a => a
Prelude.mempty)
Either
String
(HashMap Text FailedItemDetails -> DescribeResourceGroupsResponse)
-> Either String (HashMap Text FailedItemDetails)
-> Either String DescribeResourceGroupsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text -> Either String (Maybe (HashMap Text FailedItemDetails))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"failedItems" Either String (Maybe (HashMap Text FailedItemDetails))
-> HashMap Text FailedItemDetails
-> Either String (HashMap Text FailedItemDetails)
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ HashMap Text FailedItemDetails
forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable DescribeResourceGroups
instance Prelude.NFData DescribeResourceGroups
instance Core.ToHeaders DescribeResourceGroups where
toHeaders :: DescribeResourceGroups -> ResponseHeaders
toHeaders =
ResponseHeaders -> DescribeResourceGroups -> 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
"InspectorService.DescribeResourceGroups" ::
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 DescribeResourceGroups where
toJSON :: DescribeResourceGroups -> Value
toJSON DescribeResourceGroups' {NonEmpty Text
resourceGroupArns :: NonEmpty Text
$sel:resourceGroupArns:DescribeResourceGroups' :: DescribeResourceGroups -> NonEmpty Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"resourceGroupArns" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty Text
resourceGroupArns)
]
)
instance Core.ToPath DescribeResourceGroups where
toPath :: DescribeResourceGroups -> ByteString
toPath = ByteString -> DescribeResourceGroups -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DescribeResourceGroups where
toQuery :: DescribeResourceGroups -> QueryString
toQuery = QueryString -> DescribeResourceGroups -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribeResourceGroupsResponse = DescribeResourceGroupsResponse'
{
DescribeResourceGroupsResponse -> Int
httpStatus :: Prelude.Int,
DescribeResourceGroupsResponse -> [ResourceGroup]
resourceGroups :: [ResourceGroup],
DescribeResourceGroupsResponse -> HashMap Text FailedItemDetails
failedItems :: Prelude.HashMap Prelude.Text FailedItemDetails
}
deriving (DescribeResourceGroupsResponse
-> DescribeResourceGroupsResponse -> Bool
(DescribeResourceGroupsResponse
-> DescribeResourceGroupsResponse -> Bool)
-> (DescribeResourceGroupsResponse
-> DescribeResourceGroupsResponse -> Bool)
-> Eq DescribeResourceGroupsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeResourceGroupsResponse
-> DescribeResourceGroupsResponse -> Bool
$c/= :: DescribeResourceGroupsResponse
-> DescribeResourceGroupsResponse -> Bool
== :: DescribeResourceGroupsResponse
-> DescribeResourceGroupsResponse -> Bool
$c== :: DescribeResourceGroupsResponse
-> DescribeResourceGroupsResponse -> Bool
Prelude.Eq, ReadPrec [DescribeResourceGroupsResponse]
ReadPrec DescribeResourceGroupsResponse
Int -> ReadS DescribeResourceGroupsResponse
ReadS [DescribeResourceGroupsResponse]
(Int -> ReadS DescribeResourceGroupsResponse)
-> ReadS [DescribeResourceGroupsResponse]
-> ReadPrec DescribeResourceGroupsResponse
-> ReadPrec [DescribeResourceGroupsResponse]
-> Read DescribeResourceGroupsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeResourceGroupsResponse]
$creadListPrec :: ReadPrec [DescribeResourceGroupsResponse]
readPrec :: ReadPrec DescribeResourceGroupsResponse
$creadPrec :: ReadPrec DescribeResourceGroupsResponse
readList :: ReadS [DescribeResourceGroupsResponse]
$creadList :: ReadS [DescribeResourceGroupsResponse]
readsPrec :: Int -> ReadS DescribeResourceGroupsResponse
$creadsPrec :: Int -> ReadS DescribeResourceGroupsResponse
Prelude.Read, Int -> DescribeResourceGroupsResponse -> ShowS
[DescribeResourceGroupsResponse] -> ShowS
DescribeResourceGroupsResponse -> String
(Int -> DescribeResourceGroupsResponse -> ShowS)
-> (DescribeResourceGroupsResponse -> String)
-> ([DescribeResourceGroupsResponse] -> ShowS)
-> Show DescribeResourceGroupsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeResourceGroupsResponse] -> ShowS
$cshowList :: [DescribeResourceGroupsResponse] -> ShowS
show :: DescribeResourceGroupsResponse -> String
$cshow :: DescribeResourceGroupsResponse -> String
showsPrec :: Int -> DescribeResourceGroupsResponse -> ShowS
$cshowsPrec :: Int -> DescribeResourceGroupsResponse -> ShowS
Prelude.Show, (forall x.
DescribeResourceGroupsResponse
-> Rep DescribeResourceGroupsResponse x)
-> (forall x.
Rep DescribeResourceGroupsResponse x
-> DescribeResourceGroupsResponse)
-> Generic DescribeResourceGroupsResponse
forall x.
Rep DescribeResourceGroupsResponse x
-> DescribeResourceGroupsResponse
forall x.
DescribeResourceGroupsResponse
-> Rep DescribeResourceGroupsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeResourceGroupsResponse x
-> DescribeResourceGroupsResponse
$cfrom :: forall x.
DescribeResourceGroupsResponse
-> Rep DescribeResourceGroupsResponse x
Prelude.Generic)
newDescribeResourceGroupsResponse ::
Prelude.Int ->
DescribeResourceGroupsResponse
newDescribeResourceGroupsResponse :: Int -> DescribeResourceGroupsResponse
newDescribeResourceGroupsResponse Int
pHttpStatus_ =
DescribeResourceGroupsResponse' :: Int
-> [ResourceGroup]
-> HashMap Text FailedItemDetails
-> DescribeResourceGroupsResponse
DescribeResourceGroupsResponse'
{ $sel:httpStatus:DescribeResourceGroupsResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:resourceGroups:DescribeResourceGroupsResponse' :: [ResourceGroup]
resourceGroups = [ResourceGroup]
forall a. Monoid a => a
Prelude.mempty,
$sel:failedItems:DescribeResourceGroupsResponse' :: HashMap Text FailedItemDetails
failedItems = HashMap Text FailedItemDetails
forall a. Monoid a => a
Prelude.mempty
}
describeResourceGroupsResponse_httpStatus :: Lens.Lens' DescribeResourceGroupsResponse Prelude.Int
describeResourceGroupsResponse_httpStatus :: (Int -> f Int)
-> DescribeResourceGroupsResponse
-> f DescribeResourceGroupsResponse
describeResourceGroupsResponse_httpStatus = (DescribeResourceGroupsResponse -> Int)
-> (DescribeResourceGroupsResponse
-> Int -> DescribeResourceGroupsResponse)
-> Lens
DescribeResourceGroupsResponse
DescribeResourceGroupsResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeResourceGroupsResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeResourceGroupsResponse' :: DescribeResourceGroupsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeResourceGroupsResponse
s@DescribeResourceGroupsResponse' {} Int
a -> DescribeResourceGroupsResponse
s {$sel:httpStatus:DescribeResourceGroupsResponse' :: Int
httpStatus = Int
a} :: DescribeResourceGroupsResponse)
describeResourceGroupsResponse_resourceGroups :: Lens.Lens' DescribeResourceGroupsResponse [ResourceGroup]
describeResourceGroupsResponse_resourceGroups :: ([ResourceGroup] -> f [ResourceGroup])
-> DescribeResourceGroupsResponse
-> f DescribeResourceGroupsResponse
describeResourceGroupsResponse_resourceGroups = (DescribeResourceGroupsResponse -> [ResourceGroup])
-> (DescribeResourceGroupsResponse
-> [ResourceGroup] -> DescribeResourceGroupsResponse)
-> Lens
DescribeResourceGroupsResponse
DescribeResourceGroupsResponse
[ResourceGroup]
[ResourceGroup]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeResourceGroupsResponse' {[ResourceGroup]
resourceGroups :: [ResourceGroup]
$sel:resourceGroups:DescribeResourceGroupsResponse' :: DescribeResourceGroupsResponse -> [ResourceGroup]
resourceGroups} -> [ResourceGroup]
resourceGroups) (\s :: DescribeResourceGroupsResponse
s@DescribeResourceGroupsResponse' {} [ResourceGroup]
a -> DescribeResourceGroupsResponse
s {$sel:resourceGroups:DescribeResourceGroupsResponse' :: [ResourceGroup]
resourceGroups = [ResourceGroup]
a} :: DescribeResourceGroupsResponse) (([ResourceGroup] -> f [ResourceGroup])
-> DescribeResourceGroupsResponse
-> f DescribeResourceGroupsResponse)
-> (([ResourceGroup] -> f [ResourceGroup])
-> [ResourceGroup] -> f [ResourceGroup])
-> ([ResourceGroup] -> f [ResourceGroup])
-> DescribeResourceGroupsResponse
-> f DescribeResourceGroupsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([ResourceGroup] -> f [ResourceGroup])
-> [ResourceGroup] -> f [ResourceGroup]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
describeResourceGroupsResponse_failedItems :: Lens.Lens' DescribeResourceGroupsResponse (Prelude.HashMap Prelude.Text FailedItemDetails)
describeResourceGroupsResponse_failedItems :: (HashMap Text FailedItemDetails
-> f (HashMap Text FailedItemDetails))
-> DescribeResourceGroupsResponse
-> f DescribeResourceGroupsResponse
describeResourceGroupsResponse_failedItems = (DescribeResourceGroupsResponse -> HashMap Text FailedItemDetails)
-> (DescribeResourceGroupsResponse
-> HashMap Text FailedItemDetails
-> DescribeResourceGroupsResponse)
-> Lens
DescribeResourceGroupsResponse
DescribeResourceGroupsResponse
(HashMap Text FailedItemDetails)
(HashMap Text FailedItemDetails)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeResourceGroupsResponse' {HashMap Text FailedItemDetails
failedItems :: HashMap Text FailedItemDetails
$sel:failedItems:DescribeResourceGroupsResponse' :: DescribeResourceGroupsResponse -> HashMap Text FailedItemDetails
failedItems} -> HashMap Text FailedItemDetails
failedItems) (\s :: DescribeResourceGroupsResponse
s@DescribeResourceGroupsResponse' {} HashMap Text FailedItemDetails
a -> DescribeResourceGroupsResponse
s {$sel:failedItems:DescribeResourceGroupsResponse' :: HashMap Text FailedItemDetails
failedItems = HashMap Text FailedItemDetails
a} :: DescribeResourceGroupsResponse) ((HashMap Text FailedItemDetails
-> f (HashMap Text FailedItemDetails))
-> DescribeResourceGroupsResponse
-> f DescribeResourceGroupsResponse)
-> ((HashMap Text FailedItemDetails
-> f (HashMap Text FailedItemDetails))
-> HashMap Text FailedItemDetails
-> f (HashMap Text FailedItemDetails))
-> (HashMap Text FailedItemDetails
-> f (HashMap Text FailedItemDetails))
-> DescribeResourceGroupsResponse
-> f DescribeResourceGroupsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (HashMap Text FailedItemDetails
-> f (HashMap Text FailedItemDetails))
-> HashMap Text FailedItemDetails
-> f (HashMap Text FailedItemDetails)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance
Prelude.NFData
DescribeResourceGroupsResponse