{-# 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_maxResults,
listPublishingDestinations_nextToken,
listPublishingDestinations_detectorId,
ListPublishingDestinationsResponse (..),
newListPublishingDestinationsResponse,
listPublishingDestinationsResponse_nextToken,
listPublishingDestinationsResponse_httpStatus,
listPublishingDestinationsResponse_destinations,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.GuardDuty.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListPublishingDestinations = ListPublishingDestinations'
{
ListPublishingDestinations -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListPublishingDestinations -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListPublishingDestinations -> Text
detectorId :: Prelude.Text
}
deriving (ListPublishingDestinations -> ListPublishingDestinations -> Bool
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]
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
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.
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'
{ $sel:maxResults:ListPublishingDestinations' :: Maybe Natural
maxResults =
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListPublishingDestinations' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:detectorId:ListPublishingDestinations' :: Text
detectorId = Text
pDetectorId_
}
listPublishingDestinations_maxResults :: Lens.Lens' ListPublishingDestinations (Prelude.Maybe Prelude.Natural)
listPublishingDestinations_maxResults :: Lens' ListPublishingDestinations (Maybe Natural)
listPublishingDestinations_maxResults = 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_nextToken :: Lens.Lens' ListPublishingDestinations (Prelude.Maybe Prelude.Text)
listPublishingDestinations_nextToken :: Lens' ListPublishingDestinations (Maybe Text)
listPublishingDestinations_nextToken = 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_detectorId :: Lens.Lens' ListPublishingDestinations Prelude.Text
listPublishingDestinations_detectorId :: Lens' ListPublishingDestinations Text
listPublishingDestinations_detectorId = 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 :: (Service -> Service)
-> ListPublishingDestinations -> Request ListPublishingDestinations
request Service -> Service
overrides =
forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListPublishingDestinations
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ListPublishingDestinations)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> 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'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"nextToken")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"destinations" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable ListPublishingDestinations where
hashWithSalt :: Int -> ListPublishingDestinations -> Int
hashWithSalt Int
_salt ListPublishingDestinations' {Maybe Natural
Maybe Text
Text
detectorId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:detectorId:ListPublishingDestinations' :: ListPublishingDestinations -> Text
$sel:nextToken:ListPublishingDestinations' :: ListPublishingDestinations -> Maybe Text
$sel:maxResults:ListPublishingDestinations' :: ListPublishingDestinations -> Maybe Natural
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
detectorId
instance Prelude.NFData ListPublishingDestinations where
rnf :: ListPublishingDestinations -> ()
rnf ListPublishingDestinations' {Maybe Natural
Maybe Text
Text
detectorId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:detectorId:ListPublishingDestinations' :: ListPublishingDestinations -> Text
$sel:nextToken:ListPublishingDestinations' :: ListPublishingDestinations -> Maybe Text
$sel:maxResults:ListPublishingDestinations' :: ListPublishingDestinations -> Maybe Natural
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxResults
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
detectorId
instance Data.ToHeaders ListPublishingDestinations where
toHeaders :: ListPublishingDestinations -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToPath ListPublishingDestinations where
toPath :: ListPublishingDestinations -> ByteString
toPath ListPublishingDestinations' {Maybe Natural
Maybe Text
Text
detectorId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:detectorId:ListPublishingDestinations' :: ListPublishingDestinations -> Text
$sel:nextToken:ListPublishingDestinations' :: ListPublishingDestinations -> Maybe Text
$sel:maxResults:ListPublishingDestinations' :: ListPublishingDestinations -> Maybe Natural
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/detector/",
forall a. ToByteString a => a -> ByteString
Data.toBS Text
detectorId,
ByteString
"/publishingDestination"
]
instance Data.ToQuery ListPublishingDestinations where
toQuery :: ListPublishingDestinations -> QueryString
toQuery ListPublishingDestinations' {Maybe Natural
Maybe Text
Text
detectorId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:detectorId:ListPublishingDestinations' :: ListPublishingDestinations -> Text
$sel:nextToken:ListPublishingDestinations' :: ListPublishingDestinations -> Maybe Text
$sel:maxResults:ListPublishingDestinations' :: ListPublishingDestinations -> Maybe Natural
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"maxResults" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Natural
maxResults,
ByteString
"nextToken" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
nextToken
]
data ListPublishingDestinationsResponse = ListPublishingDestinationsResponse'
{
ListPublishingDestinationsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListPublishingDestinationsResponse -> Int
httpStatus :: Prelude.Int,
ListPublishingDestinationsResponse -> [Destination]
destinations :: [Destination]
}
deriving (ListPublishingDestinationsResponse
-> ListPublishingDestinationsResponse -> Bool
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]
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
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.
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'
{ $sel:nextToken:ListPublishingDestinationsResponse' :: Maybe Text
nextToken =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListPublishingDestinationsResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:destinations:ListPublishingDestinationsResponse' :: [Destination]
destinations = forall a. Monoid a => a
Prelude.mempty
}
listPublishingDestinationsResponse_nextToken :: Lens.Lens' ListPublishingDestinationsResponse (Prelude.Maybe Prelude.Text)
listPublishingDestinationsResponse_nextToken :: Lens' ListPublishingDestinationsResponse (Maybe Text)
listPublishingDestinationsResponse_nextToken = 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 :: Lens' ListPublishingDestinationsResponse Int
listPublishingDestinationsResponse_httpStatus = 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 :: Lens' ListPublishingDestinationsResponse [Destination]
listPublishingDestinationsResponse_destinations = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance
Prelude.NFData
ListPublishingDestinationsResponse
where
rnf :: ListPublishingDestinationsResponse -> ()
rnf ListPublishingDestinationsResponse' {Int
[Destination]
Maybe Text
destinations :: [Destination]
httpStatus :: Int
nextToken :: Maybe Text
$sel:destinations:ListPublishingDestinationsResponse' :: ListPublishingDestinationsResponse -> [Destination]
$sel:httpStatus:ListPublishingDestinationsResponse' :: ListPublishingDestinationsResponse -> Int
$sel:nextToken:ListPublishingDestinationsResponse' :: ListPublishingDestinationsResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [Destination]
destinations