{-# 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.DevOpsGuru.ListNotificationChannels
(
ListNotificationChannels (..),
newListNotificationChannels,
listNotificationChannels_nextToken,
ListNotificationChannelsResponse (..),
newListNotificationChannelsResponse,
listNotificationChannelsResponse_channels,
listNotificationChannelsResponse_nextToken,
listNotificationChannelsResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.DevOpsGuru.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListNotificationChannels = ListNotificationChannels'
{
ListNotificationChannels -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
}
deriving (ListNotificationChannels -> ListNotificationChannels -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListNotificationChannels -> ListNotificationChannels -> Bool
$c/= :: ListNotificationChannels -> ListNotificationChannels -> Bool
== :: ListNotificationChannels -> ListNotificationChannels -> Bool
$c== :: ListNotificationChannels -> ListNotificationChannels -> Bool
Prelude.Eq, ReadPrec [ListNotificationChannels]
ReadPrec ListNotificationChannels
Int -> ReadS ListNotificationChannels
ReadS [ListNotificationChannels]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListNotificationChannels]
$creadListPrec :: ReadPrec [ListNotificationChannels]
readPrec :: ReadPrec ListNotificationChannels
$creadPrec :: ReadPrec ListNotificationChannels
readList :: ReadS [ListNotificationChannels]
$creadList :: ReadS [ListNotificationChannels]
readsPrec :: Int -> ReadS ListNotificationChannels
$creadsPrec :: Int -> ReadS ListNotificationChannels
Prelude.Read, Int -> ListNotificationChannels -> ShowS
[ListNotificationChannels] -> ShowS
ListNotificationChannels -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListNotificationChannels] -> ShowS
$cshowList :: [ListNotificationChannels] -> ShowS
show :: ListNotificationChannels -> String
$cshow :: ListNotificationChannels -> String
showsPrec :: Int -> ListNotificationChannels -> ShowS
$cshowsPrec :: Int -> ListNotificationChannels -> ShowS
Prelude.Show, forall x.
Rep ListNotificationChannels x -> ListNotificationChannels
forall x.
ListNotificationChannels -> Rep ListNotificationChannels x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListNotificationChannels x -> ListNotificationChannels
$cfrom :: forall x.
ListNotificationChannels -> Rep ListNotificationChannels x
Prelude.Generic)
newListNotificationChannels ::
ListNotificationChannels
newListNotificationChannels :: ListNotificationChannels
newListNotificationChannels =
ListNotificationChannels'
{ $sel:nextToken:ListNotificationChannels' :: Maybe Text
nextToken =
forall a. Maybe a
Prelude.Nothing
}
listNotificationChannels_nextToken :: Lens.Lens' ListNotificationChannels (Prelude.Maybe Prelude.Text)
listNotificationChannels_nextToken :: Lens' ListNotificationChannels (Maybe Text)
listNotificationChannels_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListNotificationChannels' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListNotificationChannels' :: ListNotificationChannels -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListNotificationChannels
s@ListNotificationChannels' {} Maybe Text
a -> ListNotificationChannels
s {$sel:nextToken:ListNotificationChannels' :: Maybe Text
nextToken = Maybe Text
a} :: ListNotificationChannels)
instance Core.AWSPager ListNotificationChannels where
page :: ListNotificationChannels
-> AWSResponse ListNotificationChannels
-> Maybe ListNotificationChannels
page ListNotificationChannels
rq AWSResponse ListNotificationChannels
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListNotificationChannels
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListNotificationChannelsResponse (Maybe Text)
listNotificationChannelsResponse_nextToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListNotificationChannels
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens'
ListNotificationChannelsResponse (Maybe [NotificationChannel])
listNotificationChannelsResponse_channels
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
forall a. a -> Maybe a
Prelude.Just
forall a b. (a -> b) -> a -> b
Prelude.$ ListNotificationChannels
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListNotificationChannels (Maybe Text)
listNotificationChannels_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListNotificationChannels
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListNotificationChannelsResponse (Maybe Text)
listNotificationChannelsResponse_nextToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
instance Core.AWSRequest ListNotificationChannels where
type
AWSResponse ListNotificationChannels =
ListNotificationChannelsResponse
request :: (Service -> Service)
-> ListNotificationChannels -> Request ListNotificationChannels
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListNotificationChannels
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ListNotificationChannels)))
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 [NotificationChannel]
-> Maybe Text -> Int -> ListNotificationChannelsResponse
ListNotificationChannelsResponse'
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
"Channels" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
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
"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))
)
instance Prelude.Hashable ListNotificationChannels where
hashWithSalt :: Int -> ListNotificationChannels -> Int
hashWithSalt Int
_salt ListNotificationChannels' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListNotificationChannels' :: ListNotificationChannels -> Maybe Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
instance Prelude.NFData ListNotificationChannels where
rnf :: ListNotificationChannels -> ()
rnf ListNotificationChannels' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListNotificationChannels' :: ListNotificationChannels -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
instance Data.ToHeaders ListNotificationChannels where
toHeaders :: ListNotificationChannels -> 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.ToJSON ListNotificationChannels where
toJSON :: ListNotificationChannels -> Value
toJSON ListNotificationChannels' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListNotificationChannels' :: ListNotificationChannels -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[(Key
"NextToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken]
)
instance Data.ToPath ListNotificationChannels where
toPath :: ListNotificationChannels -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/channels"
instance Data.ToQuery ListNotificationChannels where
toQuery :: ListNotificationChannels -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data ListNotificationChannelsResponse = ListNotificationChannelsResponse'
{
ListNotificationChannelsResponse -> Maybe [NotificationChannel]
channels :: Prelude.Maybe [NotificationChannel],
ListNotificationChannelsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListNotificationChannelsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListNotificationChannelsResponse
-> ListNotificationChannelsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListNotificationChannelsResponse
-> ListNotificationChannelsResponse -> Bool
$c/= :: ListNotificationChannelsResponse
-> ListNotificationChannelsResponse -> Bool
== :: ListNotificationChannelsResponse
-> ListNotificationChannelsResponse -> Bool
$c== :: ListNotificationChannelsResponse
-> ListNotificationChannelsResponse -> Bool
Prelude.Eq, ReadPrec [ListNotificationChannelsResponse]
ReadPrec ListNotificationChannelsResponse
Int -> ReadS ListNotificationChannelsResponse
ReadS [ListNotificationChannelsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListNotificationChannelsResponse]
$creadListPrec :: ReadPrec [ListNotificationChannelsResponse]
readPrec :: ReadPrec ListNotificationChannelsResponse
$creadPrec :: ReadPrec ListNotificationChannelsResponse
readList :: ReadS [ListNotificationChannelsResponse]
$creadList :: ReadS [ListNotificationChannelsResponse]
readsPrec :: Int -> ReadS ListNotificationChannelsResponse
$creadsPrec :: Int -> ReadS ListNotificationChannelsResponse
Prelude.Read, Int -> ListNotificationChannelsResponse -> ShowS
[ListNotificationChannelsResponse] -> ShowS
ListNotificationChannelsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListNotificationChannelsResponse] -> ShowS
$cshowList :: [ListNotificationChannelsResponse] -> ShowS
show :: ListNotificationChannelsResponse -> String
$cshow :: ListNotificationChannelsResponse -> String
showsPrec :: Int -> ListNotificationChannelsResponse -> ShowS
$cshowsPrec :: Int -> ListNotificationChannelsResponse -> ShowS
Prelude.Show, forall x.
Rep ListNotificationChannelsResponse x
-> ListNotificationChannelsResponse
forall x.
ListNotificationChannelsResponse
-> Rep ListNotificationChannelsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListNotificationChannelsResponse x
-> ListNotificationChannelsResponse
$cfrom :: forall x.
ListNotificationChannelsResponse
-> Rep ListNotificationChannelsResponse x
Prelude.Generic)
newListNotificationChannelsResponse ::
Prelude.Int ->
ListNotificationChannelsResponse
newListNotificationChannelsResponse :: Int -> ListNotificationChannelsResponse
newListNotificationChannelsResponse Int
pHttpStatus_ =
ListNotificationChannelsResponse'
{ $sel:channels:ListNotificationChannelsResponse' :: Maybe [NotificationChannel]
channels =
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListNotificationChannelsResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListNotificationChannelsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listNotificationChannelsResponse_channels :: Lens.Lens' ListNotificationChannelsResponse (Prelude.Maybe [NotificationChannel])
listNotificationChannelsResponse_channels :: Lens'
ListNotificationChannelsResponse (Maybe [NotificationChannel])
listNotificationChannelsResponse_channels = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListNotificationChannelsResponse' {Maybe [NotificationChannel]
channels :: Maybe [NotificationChannel]
$sel:channels:ListNotificationChannelsResponse' :: ListNotificationChannelsResponse -> Maybe [NotificationChannel]
channels} -> Maybe [NotificationChannel]
channels) (\s :: ListNotificationChannelsResponse
s@ListNotificationChannelsResponse' {} Maybe [NotificationChannel]
a -> ListNotificationChannelsResponse
s {$sel:channels:ListNotificationChannelsResponse' :: Maybe [NotificationChannel]
channels = Maybe [NotificationChannel]
a} :: ListNotificationChannelsResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listNotificationChannelsResponse_nextToken :: Lens.Lens' ListNotificationChannelsResponse (Prelude.Maybe Prelude.Text)
listNotificationChannelsResponse_nextToken :: Lens' ListNotificationChannelsResponse (Maybe Text)
listNotificationChannelsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListNotificationChannelsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListNotificationChannelsResponse' :: ListNotificationChannelsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListNotificationChannelsResponse
s@ListNotificationChannelsResponse' {} Maybe Text
a -> ListNotificationChannelsResponse
s {$sel:nextToken:ListNotificationChannelsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListNotificationChannelsResponse)
listNotificationChannelsResponse_httpStatus :: Lens.Lens' ListNotificationChannelsResponse Prelude.Int
listNotificationChannelsResponse_httpStatus :: Lens' ListNotificationChannelsResponse Int
listNotificationChannelsResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListNotificationChannelsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListNotificationChannelsResponse' :: ListNotificationChannelsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListNotificationChannelsResponse
s@ListNotificationChannelsResponse' {} Int
a -> ListNotificationChannelsResponse
s {$sel:httpStatus:ListNotificationChannelsResponse' :: Int
httpStatus = Int
a} :: ListNotificationChannelsResponse)
instance
Prelude.NFData
ListNotificationChannelsResponse
where
rnf :: ListNotificationChannelsResponse -> ()
rnf ListNotificationChannelsResponse' {Int
Maybe [NotificationChannel]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
channels :: Maybe [NotificationChannel]
$sel:httpStatus:ListNotificationChannelsResponse' :: ListNotificationChannelsResponse -> Int
$sel:nextToken:ListNotificationChannelsResponse' :: ListNotificationChannelsResponse -> Maybe Text
$sel:channels:ListNotificationChannelsResponse' :: ListNotificationChannelsResponse -> Maybe [NotificationChannel]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [NotificationChannel]
channels
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 Int
httpStatus