{-# 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.CodeStarNotifications.ListNotificationRules
(
ListNotificationRules (..),
newListNotificationRules,
listNotificationRules_filters,
listNotificationRules_maxResults,
listNotificationRules_nextToken,
ListNotificationRulesResponse (..),
newListNotificationRulesResponse,
listNotificationRulesResponse_nextToken,
listNotificationRulesResponse_notificationRules,
listNotificationRulesResponse_httpStatus,
)
where
import Amazonka.CodeStarNotifications.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListNotificationRules = ListNotificationRules'
{
ListNotificationRules -> Maybe [ListNotificationRulesFilter]
filters :: Prelude.Maybe [ListNotificationRulesFilter],
ListNotificationRules -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListNotificationRules -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
}
deriving (ListNotificationRules -> ListNotificationRules -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListNotificationRules -> ListNotificationRules -> Bool
$c/= :: ListNotificationRules -> ListNotificationRules -> Bool
== :: ListNotificationRules -> ListNotificationRules -> Bool
$c== :: ListNotificationRules -> ListNotificationRules -> Bool
Prelude.Eq, ReadPrec [ListNotificationRules]
ReadPrec ListNotificationRules
Int -> ReadS ListNotificationRules
ReadS [ListNotificationRules]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListNotificationRules]
$creadListPrec :: ReadPrec [ListNotificationRules]
readPrec :: ReadPrec ListNotificationRules
$creadPrec :: ReadPrec ListNotificationRules
readList :: ReadS [ListNotificationRules]
$creadList :: ReadS [ListNotificationRules]
readsPrec :: Int -> ReadS ListNotificationRules
$creadsPrec :: Int -> ReadS ListNotificationRules
Prelude.Read, Int -> ListNotificationRules -> ShowS
[ListNotificationRules] -> ShowS
ListNotificationRules -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListNotificationRules] -> ShowS
$cshowList :: [ListNotificationRules] -> ShowS
show :: ListNotificationRules -> String
$cshow :: ListNotificationRules -> String
showsPrec :: Int -> ListNotificationRules -> ShowS
$cshowsPrec :: Int -> ListNotificationRules -> ShowS
Prelude.Show, forall x. Rep ListNotificationRules x -> ListNotificationRules
forall x. ListNotificationRules -> Rep ListNotificationRules x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListNotificationRules x -> ListNotificationRules
$cfrom :: forall x. ListNotificationRules -> Rep ListNotificationRules x
Prelude.Generic)
newListNotificationRules ::
ListNotificationRules
newListNotificationRules :: ListNotificationRules
newListNotificationRules =
ListNotificationRules'
{ $sel:filters:ListNotificationRules' :: Maybe [ListNotificationRulesFilter]
filters = forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:ListNotificationRules' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListNotificationRules' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
}
listNotificationRules_filters :: Lens.Lens' ListNotificationRules (Prelude.Maybe [ListNotificationRulesFilter])
listNotificationRules_filters :: Lens' ListNotificationRules (Maybe [ListNotificationRulesFilter])
listNotificationRules_filters = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListNotificationRules' {Maybe [ListNotificationRulesFilter]
filters :: Maybe [ListNotificationRulesFilter]
$sel:filters:ListNotificationRules' :: ListNotificationRules -> Maybe [ListNotificationRulesFilter]
filters} -> Maybe [ListNotificationRulesFilter]
filters) (\s :: ListNotificationRules
s@ListNotificationRules' {} Maybe [ListNotificationRulesFilter]
a -> ListNotificationRules
s {$sel:filters:ListNotificationRules' :: Maybe [ListNotificationRulesFilter]
filters = Maybe [ListNotificationRulesFilter]
a} :: ListNotificationRules) 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
listNotificationRules_maxResults :: Lens.Lens' ListNotificationRules (Prelude.Maybe Prelude.Natural)
listNotificationRules_maxResults :: Lens' ListNotificationRules (Maybe Natural)
listNotificationRules_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListNotificationRules' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListNotificationRules' :: ListNotificationRules -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListNotificationRules
s@ListNotificationRules' {} Maybe Natural
a -> ListNotificationRules
s {$sel:maxResults:ListNotificationRules' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListNotificationRules)
listNotificationRules_nextToken :: Lens.Lens' ListNotificationRules (Prelude.Maybe Prelude.Text)
listNotificationRules_nextToken :: Lens' ListNotificationRules (Maybe Text)
listNotificationRules_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListNotificationRules' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListNotificationRules' :: ListNotificationRules -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListNotificationRules
s@ListNotificationRules' {} Maybe Text
a -> ListNotificationRules
s {$sel:nextToken:ListNotificationRules' :: Maybe Text
nextToken = Maybe Text
a} :: ListNotificationRules)
instance Core.AWSPager ListNotificationRules where
page :: ListNotificationRules
-> AWSResponse ListNotificationRules -> Maybe ListNotificationRules
page ListNotificationRules
rq AWSResponse ListNotificationRules
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListNotificationRules
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListNotificationRulesResponse (Maybe Text)
listNotificationRulesResponse_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 ListNotificationRules
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens'
ListNotificationRulesResponse (Maybe [NotificationRuleSummary])
listNotificationRulesResponse_notificationRules
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.$ ListNotificationRules
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListNotificationRules (Maybe Text)
listNotificationRules_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListNotificationRules
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListNotificationRulesResponse (Maybe Text)
listNotificationRulesResponse_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 ListNotificationRules where
type
AWSResponse ListNotificationRules =
ListNotificationRulesResponse
request :: (Service -> Service)
-> ListNotificationRules -> Request ListNotificationRules
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 ListNotificationRules
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ListNotificationRules)))
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
-> Maybe [NotificationRuleSummary]
-> Int
-> ListNotificationRulesResponse
ListNotificationRulesResponse'
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.<*> ( Object
x
forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"NotificationRules"
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.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable ListNotificationRules where
hashWithSalt :: Int -> ListNotificationRules -> Int
hashWithSalt Int
_salt ListNotificationRules' {Maybe Natural
Maybe [ListNotificationRulesFilter]
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
filters :: Maybe [ListNotificationRulesFilter]
$sel:nextToken:ListNotificationRules' :: ListNotificationRules -> Maybe Text
$sel:maxResults:ListNotificationRules' :: ListNotificationRules -> Maybe Natural
$sel:filters:ListNotificationRules' :: ListNotificationRules -> Maybe [ListNotificationRulesFilter]
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [ListNotificationRulesFilter]
filters
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
instance Prelude.NFData ListNotificationRules where
rnf :: ListNotificationRules -> ()
rnf ListNotificationRules' {Maybe Natural
Maybe [ListNotificationRulesFilter]
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
filters :: Maybe [ListNotificationRulesFilter]
$sel:nextToken:ListNotificationRules' :: ListNotificationRules -> Maybe Text
$sel:maxResults:ListNotificationRules' :: ListNotificationRules -> Maybe Natural
$sel:filters:ListNotificationRules' :: ListNotificationRules -> Maybe [ListNotificationRulesFilter]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [ListNotificationRulesFilter]
filters
seq :: forall a b. a -> b -> b
`Prelude.seq` 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
instance Data.ToHeaders ListNotificationRules where
toHeaders :: ListNotificationRules -> 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 ListNotificationRules where
toJSON :: ListNotificationRules -> Value
toJSON ListNotificationRules' {Maybe Natural
Maybe [ListNotificationRulesFilter]
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
filters :: Maybe [ListNotificationRulesFilter]
$sel:nextToken:ListNotificationRules' :: ListNotificationRules -> Maybe Text
$sel:maxResults:ListNotificationRules' :: ListNotificationRules -> Maybe Natural
$sel:filters:ListNotificationRules' :: ListNotificationRules -> Maybe [ListNotificationRulesFilter]
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"Filters" 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 [ListNotificationRulesFilter]
filters,
(Key
"MaxResults" 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 Natural
maxResults,
(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 ListNotificationRules where
toPath :: ListNotificationRules -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/listNotificationRules"
instance Data.ToQuery ListNotificationRules where
toQuery :: ListNotificationRules -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data ListNotificationRulesResponse = ListNotificationRulesResponse'
{
ListNotificationRulesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListNotificationRulesResponse -> Maybe [NotificationRuleSummary]
notificationRules :: Prelude.Maybe [NotificationRuleSummary],
ListNotificationRulesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListNotificationRulesResponse
-> ListNotificationRulesResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListNotificationRulesResponse
-> ListNotificationRulesResponse -> Bool
$c/= :: ListNotificationRulesResponse
-> ListNotificationRulesResponse -> Bool
== :: ListNotificationRulesResponse
-> ListNotificationRulesResponse -> Bool
$c== :: ListNotificationRulesResponse
-> ListNotificationRulesResponse -> Bool
Prelude.Eq, ReadPrec [ListNotificationRulesResponse]
ReadPrec ListNotificationRulesResponse
Int -> ReadS ListNotificationRulesResponse
ReadS [ListNotificationRulesResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListNotificationRulesResponse]
$creadListPrec :: ReadPrec [ListNotificationRulesResponse]
readPrec :: ReadPrec ListNotificationRulesResponse
$creadPrec :: ReadPrec ListNotificationRulesResponse
readList :: ReadS [ListNotificationRulesResponse]
$creadList :: ReadS [ListNotificationRulesResponse]
readsPrec :: Int -> ReadS ListNotificationRulesResponse
$creadsPrec :: Int -> ReadS ListNotificationRulesResponse
Prelude.Read, Int -> ListNotificationRulesResponse -> ShowS
[ListNotificationRulesResponse] -> ShowS
ListNotificationRulesResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListNotificationRulesResponse] -> ShowS
$cshowList :: [ListNotificationRulesResponse] -> ShowS
show :: ListNotificationRulesResponse -> String
$cshow :: ListNotificationRulesResponse -> String
showsPrec :: Int -> ListNotificationRulesResponse -> ShowS
$cshowsPrec :: Int -> ListNotificationRulesResponse -> ShowS
Prelude.Show, forall x.
Rep ListNotificationRulesResponse x
-> ListNotificationRulesResponse
forall x.
ListNotificationRulesResponse
-> Rep ListNotificationRulesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListNotificationRulesResponse x
-> ListNotificationRulesResponse
$cfrom :: forall x.
ListNotificationRulesResponse
-> Rep ListNotificationRulesResponse x
Prelude.Generic)
newListNotificationRulesResponse ::
Prelude.Int ->
ListNotificationRulesResponse
newListNotificationRulesResponse :: Int -> ListNotificationRulesResponse
newListNotificationRulesResponse Int
pHttpStatus_ =
ListNotificationRulesResponse'
{ $sel:nextToken:ListNotificationRulesResponse' :: Maybe Text
nextToken =
forall a. Maybe a
Prelude.Nothing,
$sel:notificationRules:ListNotificationRulesResponse' :: Maybe [NotificationRuleSummary]
notificationRules = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListNotificationRulesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listNotificationRulesResponse_nextToken :: Lens.Lens' ListNotificationRulesResponse (Prelude.Maybe Prelude.Text)
listNotificationRulesResponse_nextToken :: Lens' ListNotificationRulesResponse (Maybe Text)
listNotificationRulesResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListNotificationRulesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListNotificationRulesResponse' :: ListNotificationRulesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListNotificationRulesResponse
s@ListNotificationRulesResponse' {} Maybe Text
a -> ListNotificationRulesResponse
s {$sel:nextToken:ListNotificationRulesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListNotificationRulesResponse)
listNotificationRulesResponse_notificationRules :: Lens.Lens' ListNotificationRulesResponse (Prelude.Maybe [NotificationRuleSummary])
listNotificationRulesResponse_notificationRules :: Lens'
ListNotificationRulesResponse (Maybe [NotificationRuleSummary])
listNotificationRulesResponse_notificationRules = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListNotificationRulesResponse' {Maybe [NotificationRuleSummary]
notificationRules :: Maybe [NotificationRuleSummary]
$sel:notificationRules:ListNotificationRulesResponse' :: ListNotificationRulesResponse -> Maybe [NotificationRuleSummary]
notificationRules} -> Maybe [NotificationRuleSummary]
notificationRules) (\s :: ListNotificationRulesResponse
s@ListNotificationRulesResponse' {} Maybe [NotificationRuleSummary]
a -> ListNotificationRulesResponse
s {$sel:notificationRules:ListNotificationRulesResponse' :: Maybe [NotificationRuleSummary]
notificationRules = Maybe [NotificationRuleSummary]
a} :: ListNotificationRulesResponse) 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
listNotificationRulesResponse_httpStatus :: Lens.Lens' ListNotificationRulesResponse Prelude.Int
listNotificationRulesResponse_httpStatus :: Lens' ListNotificationRulesResponse Int
listNotificationRulesResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListNotificationRulesResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListNotificationRulesResponse' :: ListNotificationRulesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListNotificationRulesResponse
s@ListNotificationRulesResponse' {} Int
a -> ListNotificationRulesResponse
s {$sel:httpStatus:ListNotificationRulesResponse' :: Int
httpStatus = Int
a} :: ListNotificationRulesResponse)
instance Prelude.NFData ListNotificationRulesResponse where
rnf :: ListNotificationRulesResponse -> ()
rnf ListNotificationRulesResponse' {Int
Maybe [NotificationRuleSummary]
Maybe Text
httpStatus :: Int
notificationRules :: Maybe [NotificationRuleSummary]
nextToken :: Maybe Text
$sel:httpStatus:ListNotificationRulesResponse' :: ListNotificationRulesResponse -> Int
$sel:notificationRules:ListNotificationRulesResponse' :: ListNotificationRulesResponse -> Maybe [NotificationRuleSummary]
$sel:nextToken:ListNotificationRulesResponse' :: ListNotificationRulesResponse -> 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 Maybe [NotificationRuleSummary]
notificationRules
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus