{-# 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.GuardDuty.ListPublishingDestinations
(
ListPublishingDestinations (..),
newListPublishingDestinations,
listPublishingDestinations_nextToken,
listPublishingDestinations_maxResults,
listPublishingDestinations_detectorId,
ListPublishingDestinationsResponse (..),
newListPublishingDestinationsResponse,
listPublishingDestinationsResponse_nextToken,
listPublishingDestinationsResponse_httpStatus,
listPublishingDestinationsResponse_destinations,
)
where
import qualified Amazonka.Core as Core
import Amazonka.GuardDuty.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 ListPublishingDestinations = ListPublishingDestinations'
{
ListPublishingDestinations -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListPublishingDestinations -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListPublishingDestinations -> Text
detectorId :: Prelude.Text
}
deriving (ListPublishingDestinations -> ListPublishingDestinations -> Bool
(ListPublishingDestinations -> ListPublishingDestinations -> Bool)
-> (ListPublishingDestinations
-> ListPublishingDestinations -> Bool)
-> Eq ListPublishingDestinations
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListPublishingDestinations -> ListPublishingDestinations -> Bool
$c/= :: ListPublishingDestinations -> ListPublishingDestinations -> Bool
== :: ListPublishingDestinations -> ListPublishingDestinations -> Bool
$c== :: ListPublishingDestinations -> ListPublishingDestinations -> Bool
Prelude.Eq, ReadPrec [ListPublishingDestinations]
ReadPrec ListPublishingDestinations
Int -> ReadS ListPublishingDestinations
ReadS [ListPublishingDestinations]
(Int -> ReadS ListPublishingDestinations)
-> ReadS [ListPublishingDestinations]
-> ReadPrec ListPublishingDestinations
-> ReadPrec [ListPublishingDestinations]
-> Read ListPublishingDestinations
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListPublishingDestinations]
$creadListPrec :: ReadPrec [ListPublishingDestinations]
readPrec :: ReadPrec ListPublishingDestinations
$creadPrec :: ReadPrec ListPublishingDestinations
readList :: ReadS [ListPublishingDestinations]
$creadList :: ReadS [ListPublishingDestinations]
readsPrec :: Int -> ReadS ListPublishingDestinations
$creadsPrec :: Int -> ReadS ListPublishingDestinations
Prelude.Read, Int -> ListPublishingDestinations -> ShowS
[ListPublishingDestinations] -> ShowS
ListPublishingDestinations -> String
(Int -> ListPublishingDestinations -> ShowS)
-> (ListPublishingDestinations -> String)
-> ([ListPublishingDestinations] -> ShowS)
-> Show ListPublishingDestinations
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListPublishingDestinations] -> ShowS
$cshowList :: [ListPublishingDestinations] -> ShowS
show :: ListPublishingDestinations -> String
$cshow :: ListPublishingDestinations -> String
showsPrec :: Int -> ListPublishingDestinations -> ShowS
$cshowsPrec :: Int -> ListPublishingDestinations -> ShowS
Prelude.Show, (forall x.
ListPublishingDestinations -> Rep ListPublishingDestinations x)
-> (forall x.
Rep ListPublishingDestinations x -> ListPublishingDestinations)
-> Generic ListPublishingDestinations
forall x.
Rep ListPublishingDestinations x -> ListPublishingDestinations
forall x.
ListPublishingDestinations -> Rep ListPublishingDestinations x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListPublishingDestinations x -> ListPublishingDestinations
$cfrom :: forall x.
ListPublishingDestinations -> Rep ListPublishingDestinations x
Prelude.Generic)
newListPublishingDestinations ::
Prelude.Text ->
ListPublishingDestinations
newListPublishingDestinations :: Text -> ListPublishingDestinations
newListPublishingDestinations Text
pDetectorId_ =
ListPublishingDestinations' :: Maybe Text -> Maybe Natural -> Text -> ListPublishingDestinations
ListPublishingDestinations'
{ $sel:nextToken:ListPublishingDestinations' :: Maybe Text
nextToken =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:ListPublishingDestinations' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:detectorId:ListPublishingDestinations' :: Text
detectorId = Text
pDetectorId_
}
listPublishingDestinations_nextToken :: Lens.Lens' ListPublishingDestinations (Prelude.Maybe Prelude.Text)
listPublishingDestinations_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListPublishingDestinations -> f ListPublishingDestinations
listPublishingDestinations_nextToken = (ListPublishingDestinations -> Maybe Text)
-> (ListPublishingDestinations
-> Maybe Text -> ListPublishingDestinations)
-> Lens
ListPublishingDestinations
ListPublishingDestinations
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPublishingDestinations' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListPublishingDestinations' :: ListPublishingDestinations -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListPublishingDestinations
s@ListPublishingDestinations' {} Maybe Text
a -> ListPublishingDestinations
s {$sel:nextToken:ListPublishingDestinations' :: Maybe Text
nextToken = Maybe Text
a} :: ListPublishingDestinations)
listPublishingDestinations_maxResults :: Lens.Lens' ListPublishingDestinations (Prelude.Maybe Prelude.Natural)
listPublishingDestinations_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListPublishingDestinations -> f ListPublishingDestinations
listPublishingDestinations_maxResults = (ListPublishingDestinations -> Maybe Natural)
-> (ListPublishingDestinations
-> Maybe Natural -> ListPublishingDestinations)
-> Lens
ListPublishingDestinations
ListPublishingDestinations
(Maybe Natural)
(Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPublishingDestinations' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListPublishingDestinations' :: ListPublishingDestinations -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListPublishingDestinations
s@ListPublishingDestinations' {} Maybe Natural
a -> ListPublishingDestinations
s {$sel:maxResults:ListPublishingDestinations' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListPublishingDestinations)
listPublishingDestinations_detectorId :: Lens.Lens' ListPublishingDestinations Prelude.Text
listPublishingDestinations_detectorId :: (Text -> f Text)
-> ListPublishingDestinations -> f ListPublishingDestinations
listPublishingDestinations_detectorId = (ListPublishingDestinations -> Text)
-> (ListPublishingDestinations
-> Text -> ListPublishingDestinations)
-> Lens
ListPublishingDestinations ListPublishingDestinations Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPublishingDestinations' {Text
detectorId :: Text
$sel:detectorId:ListPublishingDestinations' :: ListPublishingDestinations -> Text
detectorId} -> Text
detectorId) (\s :: ListPublishingDestinations
s@ListPublishingDestinations' {} Text
a -> ListPublishingDestinations
s {$sel:detectorId:ListPublishingDestinations' :: Text
detectorId = Text
a} :: ListPublishingDestinations)
instance Core.AWSRequest ListPublishingDestinations where
type
AWSResponse ListPublishingDestinations =
ListPublishingDestinationsResponse
request :: ListPublishingDestinations -> Request ListPublishingDestinations
request = Service
-> ListPublishingDestinations -> Request ListPublishingDestinations
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy ListPublishingDestinations
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ListPublishingDestinations)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ListPublishingDestinations))
-> Logger
-> Service
-> Proxy ListPublishingDestinations
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ListPublishingDestinations)))
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 Text
-> Int -> [Destination] -> ListPublishingDestinationsResponse
ListPublishingDestinationsResponse'
(Maybe Text
-> Int -> [Destination] -> ListPublishingDestinationsResponse)
-> Either String (Maybe Text)
-> Either
String (Int -> [Destination] -> ListPublishingDestinationsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"nextToken")
Either
String (Int -> [Destination] -> ListPublishingDestinationsResponse)
-> Either String Int
-> Either
String ([Destination] -> ListPublishingDestinationsResponse)
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))
Either String ([Destination] -> ListPublishingDestinationsResponse)
-> Either String [Destination]
-> Either String ListPublishingDestinationsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe [Destination])
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"destinations" Either String (Maybe [Destination])
-> [Destination] -> Either String [Destination]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Destination]
forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable ListPublishingDestinations
instance Prelude.NFData ListPublishingDestinations
instance Core.ToHeaders ListPublishingDestinations where
toHeaders :: ListPublishingDestinations -> ResponseHeaders
toHeaders =
ResponseHeaders -> ListPublishingDestinations -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ 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.ToPath ListPublishingDestinations where
toPath :: ListPublishingDestinations -> ByteString
toPath ListPublishingDestinations' {Maybe Natural
Maybe Text
Text
detectorId :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:detectorId:ListPublishingDestinations' :: ListPublishingDestinations -> Text
$sel:maxResults:ListPublishingDestinations' :: ListPublishingDestinations -> Maybe Natural
$sel:nextToken:ListPublishingDestinations' :: ListPublishingDestinations -> Maybe Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/detector/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
detectorId,
ByteString
"/publishingDestination"
]
instance Core.ToQuery ListPublishingDestinations where
toQuery :: ListPublishingDestinations -> QueryString
toQuery ListPublishingDestinations' {Maybe Natural
Maybe Text
Text
detectorId :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:detectorId:ListPublishingDestinations' :: ListPublishingDestinations -> Text
$sel:maxResults:ListPublishingDestinations' :: ListPublishingDestinations -> Maybe Natural
$sel:nextToken:ListPublishingDestinations' :: ListPublishingDestinations -> Maybe Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"nextToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
ByteString
"maxResults" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
maxResults
]
data ListPublishingDestinationsResponse = ListPublishingDestinationsResponse'
{
ListPublishingDestinationsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListPublishingDestinationsResponse -> Int
httpStatus :: Prelude.Int,
ListPublishingDestinationsResponse -> [Destination]
destinations :: [Destination]
}
deriving (ListPublishingDestinationsResponse
-> ListPublishingDestinationsResponse -> Bool
(ListPublishingDestinationsResponse
-> ListPublishingDestinationsResponse -> Bool)
-> (ListPublishingDestinationsResponse
-> ListPublishingDestinationsResponse -> Bool)
-> Eq ListPublishingDestinationsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListPublishingDestinationsResponse
-> ListPublishingDestinationsResponse -> Bool
$c/= :: ListPublishingDestinationsResponse
-> ListPublishingDestinationsResponse -> Bool
== :: ListPublishingDestinationsResponse
-> ListPublishingDestinationsResponse -> Bool
$c== :: ListPublishingDestinationsResponse
-> ListPublishingDestinationsResponse -> Bool
Prelude.Eq, ReadPrec [ListPublishingDestinationsResponse]
ReadPrec ListPublishingDestinationsResponse
Int -> ReadS ListPublishingDestinationsResponse
ReadS [ListPublishingDestinationsResponse]
(Int -> ReadS ListPublishingDestinationsResponse)
-> ReadS [ListPublishingDestinationsResponse]
-> ReadPrec ListPublishingDestinationsResponse
-> ReadPrec [ListPublishingDestinationsResponse]
-> Read ListPublishingDestinationsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListPublishingDestinationsResponse]
$creadListPrec :: ReadPrec [ListPublishingDestinationsResponse]
readPrec :: ReadPrec ListPublishingDestinationsResponse
$creadPrec :: ReadPrec ListPublishingDestinationsResponse
readList :: ReadS [ListPublishingDestinationsResponse]
$creadList :: ReadS [ListPublishingDestinationsResponse]
readsPrec :: Int -> ReadS ListPublishingDestinationsResponse
$creadsPrec :: Int -> ReadS ListPublishingDestinationsResponse
Prelude.Read, Int -> ListPublishingDestinationsResponse -> ShowS
[ListPublishingDestinationsResponse] -> ShowS
ListPublishingDestinationsResponse -> String
(Int -> ListPublishingDestinationsResponse -> ShowS)
-> (ListPublishingDestinationsResponse -> String)
-> ([ListPublishingDestinationsResponse] -> ShowS)
-> Show ListPublishingDestinationsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListPublishingDestinationsResponse] -> ShowS
$cshowList :: [ListPublishingDestinationsResponse] -> ShowS
show :: ListPublishingDestinationsResponse -> String
$cshow :: ListPublishingDestinationsResponse -> String
showsPrec :: Int -> ListPublishingDestinationsResponse -> ShowS
$cshowsPrec :: Int -> ListPublishingDestinationsResponse -> ShowS
Prelude.Show, (forall x.
ListPublishingDestinationsResponse
-> Rep ListPublishingDestinationsResponse x)
-> (forall x.
Rep ListPublishingDestinationsResponse x
-> ListPublishingDestinationsResponse)
-> Generic ListPublishingDestinationsResponse
forall x.
Rep ListPublishingDestinationsResponse x
-> ListPublishingDestinationsResponse
forall x.
ListPublishingDestinationsResponse
-> Rep ListPublishingDestinationsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListPublishingDestinationsResponse x
-> ListPublishingDestinationsResponse
$cfrom :: forall x.
ListPublishingDestinationsResponse
-> Rep ListPublishingDestinationsResponse x
Prelude.Generic)
newListPublishingDestinationsResponse ::
Prelude.Int ->
ListPublishingDestinationsResponse
newListPublishingDestinationsResponse :: Int -> ListPublishingDestinationsResponse
newListPublishingDestinationsResponse Int
pHttpStatus_ =
ListPublishingDestinationsResponse' :: Maybe Text
-> Int -> [Destination] -> ListPublishingDestinationsResponse
ListPublishingDestinationsResponse'
{ $sel:nextToken:ListPublishingDestinationsResponse' :: Maybe Text
nextToken =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListPublishingDestinationsResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:destinations:ListPublishingDestinationsResponse' :: [Destination]
destinations = [Destination]
forall a. Monoid a => a
Prelude.mempty
}
listPublishingDestinationsResponse_nextToken :: Lens.Lens' ListPublishingDestinationsResponse (Prelude.Maybe Prelude.Text)
listPublishingDestinationsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListPublishingDestinationsResponse
-> f ListPublishingDestinationsResponse
listPublishingDestinationsResponse_nextToken = (ListPublishingDestinationsResponse -> Maybe Text)
-> (ListPublishingDestinationsResponse
-> Maybe Text -> ListPublishingDestinationsResponse)
-> Lens
ListPublishingDestinationsResponse
ListPublishingDestinationsResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPublishingDestinationsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListPublishingDestinationsResponse' :: ListPublishingDestinationsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListPublishingDestinationsResponse
s@ListPublishingDestinationsResponse' {} Maybe Text
a -> ListPublishingDestinationsResponse
s {$sel:nextToken:ListPublishingDestinationsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListPublishingDestinationsResponse)
listPublishingDestinationsResponse_httpStatus :: Lens.Lens' ListPublishingDestinationsResponse Prelude.Int
listPublishingDestinationsResponse_httpStatus :: (Int -> f Int)
-> ListPublishingDestinationsResponse
-> f ListPublishingDestinationsResponse
listPublishingDestinationsResponse_httpStatus = (ListPublishingDestinationsResponse -> Int)
-> (ListPublishingDestinationsResponse
-> Int -> ListPublishingDestinationsResponse)
-> Lens
ListPublishingDestinationsResponse
ListPublishingDestinationsResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPublishingDestinationsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListPublishingDestinationsResponse' :: ListPublishingDestinationsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListPublishingDestinationsResponse
s@ListPublishingDestinationsResponse' {} Int
a -> ListPublishingDestinationsResponse
s {$sel:httpStatus:ListPublishingDestinationsResponse' :: Int
httpStatus = Int
a} :: ListPublishingDestinationsResponse)
listPublishingDestinationsResponse_destinations :: Lens.Lens' ListPublishingDestinationsResponse [Destination]
listPublishingDestinationsResponse_destinations :: ([Destination] -> f [Destination])
-> ListPublishingDestinationsResponse
-> f ListPublishingDestinationsResponse
listPublishingDestinationsResponse_destinations = (ListPublishingDestinationsResponse -> [Destination])
-> (ListPublishingDestinationsResponse
-> [Destination] -> ListPublishingDestinationsResponse)
-> Lens
ListPublishingDestinationsResponse
ListPublishingDestinationsResponse
[Destination]
[Destination]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPublishingDestinationsResponse' {[Destination]
destinations :: [Destination]
$sel:destinations:ListPublishingDestinationsResponse' :: ListPublishingDestinationsResponse -> [Destination]
destinations} -> [Destination]
destinations) (\s :: ListPublishingDestinationsResponse
s@ListPublishingDestinationsResponse' {} [Destination]
a -> ListPublishingDestinationsResponse
s {$sel:destinations:ListPublishingDestinationsResponse' :: [Destination]
destinations = [Destination]
a} :: ListPublishingDestinationsResponse) (([Destination] -> f [Destination])
-> ListPublishingDestinationsResponse
-> f ListPublishingDestinationsResponse)
-> (([Destination] -> f [Destination])
-> [Destination] -> f [Destination])
-> ([Destination] -> f [Destination])
-> ListPublishingDestinationsResponse
-> f ListPublishingDestinationsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Destination] -> f [Destination])
-> [Destination] -> f [Destination]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance
Prelude.NFData
ListPublishingDestinationsResponse