{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.CloudWatchEvents.ListRuleNamesByTarget
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Lists the rules for the specified target. You can see which of the rules
-- in Amazon EventBridge can invoke a specific target in your account.
--
-- This operation returns paginated results.
module Amazonka.CloudWatchEvents.ListRuleNamesByTarget
  ( -- * Creating a Request
    ListRuleNamesByTarget (..),
    newListRuleNamesByTarget,

    -- * Request Lenses
    listRuleNamesByTarget_nextToken,
    listRuleNamesByTarget_eventBusName,
    listRuleNamesByTarget_limit,
    listRuleNamesByTarget_targetArn,

    -- * Destructuring the Response
    ListRuleNamesByTargetResponse (..),
    newListRuleNamesByTargetResponse,

    -- * Response Lenses
    listRuleNamesByTargetResponse_ruleNames,
    listRuleNamesByTargetResponse_nextToken,
    listRuleNamesByTargetResponse_httpStatus,
  )
where

import Amazonka.CloudWatchEvents.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newListRuleNamesByTarget' smart constructor.
data ListRuleNamesByTarget = ListRuleNamesByTarget'
  { -- | The token returned by a previous call to retrieve the next set of
    -- results.
    ListRuleNamesByTarget -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The name or ARN of the event bus to list rules for. If you omit this,
    -- the default event bus is used.
    ListRuleNamesByTarget -> Maybe Text
eventBusName :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results to return.
    ListRuleNamesByTarget -> Maybe Natural
limit :: Prelude.Maybe Prelude.Natural,
    -- | The Amazon Resource Name (ARN) of the target resource.
    ListRuleNamesByTarget -> Text
targetArn :: Prelude.Text
  }
  deriving (ListRuleNamesByTarget -> ListRuleNamesByTarget -> Bool
(ListRuleNamesByTarget -> ListRuleNamesByTarget -> Bool)
-> (ListRuleNamesByTarget -> ListRuleNamesByTarget -> Bool)
-> Eq ListRuleNamesByTarget
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListRuleNamesByTarget -> ListRuleNamesByTarget -> Bool
$c/= :: ListRuleNamesByTarget -> ListRuleNamesByTarget -> Bool
== :: ListRuleNamesByTarget -> ListRuleNamesByTarget -> Bool
$c== :: ListRuleNamesByTarget -> ListRuleNamesByTarget -> Bool
Prelude.Eq, ReadPrec [ListRuleNamesByTarget]
ReadPrec ListRuleNamesByTarget
Int -> ReadS ListRuleNamesByTarget
ReadS [ListRuleNamesByTarget]
(Int -> ReadS ListRuleNamesByTarget)
-> ReadS [ListRuleNamesByTarget]
-> ReadPrec ListRuleNamesByTarget
-> ReadPrec [ListRuleNamesByTarget]
-> Read ListRuleNamesByTarget
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListRuleNamesByTarget]
$creadListPrec :: ReadPrec [ListRuleNamesByTarget]
readPrec :: ReadPrec ListRuleNamesByTarget
$creadPrec :: ReadPrec ListRuleNamesByTarget
readList :: ReadS [ListRuleNamesByTarget]
$creadList :: ReadS [ListRuleNamesByTarget]
readsPrec :: Int -> ReadS ListRuleNamesByTarget
$creadsPrec :: Int -> ReadS ListRuleNamesByTarget
Prelude.Read, Int -> ListRuleNamesByTarget -> ShowS
[ListRuleNamesByTarget] -> ShowS
ListRuleNamesByTarget -> String
(Int -> ListRuleNamesByTarget -> ShowS)
-> (ListRuleNamesByTarget -> String)
-> ([ListRuleNamesByTarget] -> ShowS)
-> Show ListRuleNamesByTarget
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListRuleNamesByTarget] -> ShowS
$cshowList :: [ListRuleNamesByTarget] -> ShowS
show :: ListRuleNamesByTarget -> String
$cshow :: ListRuleNamesByTarget -> String
showsPrec :: Int -> ListRuleNamesByTarget -> ShowS
$cshowsPrec :: Int -> ListRuleNamesByTarget -> ShowS
Prelude.Show, (forall x. ListRuleNamesByTarget -> Rep ListRuleNamesByTarget x)
-> (forall x. Rep ListRuleNamesByTarget x -> ListRuleNamesByTarget)
-> Generic ListRuleNamesByTarget
forall x. Rep ListRuleNamesByTarget x -> ListRuleNamesByTarget
forall x. ListRuleNamesByTarget -> Rep ListRuleNamesByTarget x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListRuleNamesByTarget x -> ListRuleNamesByTarget
$cfrom :: forall x. ListRuleNamesByTarget -> Rep ListRuleNamesByTarget x
Prelude.Generic)

-- |
-- Create a value of 'ListRuleNamesByTarget' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'nextToken', 'listRuleNamesByTarget_nextToken' - The token returned by a previous call to retrieve the next set of
-- results.
--
-- 'eventBusName', 'listRuleNamesByTarget_eventBusName' - The name or ARN of the event bus to list rules for. If you omit this,
-- the default event bus is used.
--
-- 'limit', 'listRuleNamesByTarget_limit' - The maximum number of results to return.
--
-- 'targetArn', 'listRuleNamesByTarget_targetArn' - The Amazon Resource Name (ARN) of the target resource.
newListRuleNamesByTarget ::
  -- | 'targetArn'
  Prelude.Text ->
  ListRuleNamesByTarget
newListRuleNamesByTarget :: Text -> ListRuleNamesByTarget
newListRuleNamesByTarget Text
pTargetArn_ =
  ListRuleNamesByTarget' :: Maybe Text
-> Maybe Text -> Maybe Natural -> Text -> ListRuleNamesByTarget
ListRuleNamesByTarget'
    { $sel:nextToken:ListRuleNamesByTarget' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:eventBusName:ListRuleNamesByTarget' :: Maybe Text
eventBusName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:limit:ListRuleNamesByTarget' :: Maybe Natural
limit = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:targetArn:ListRuleNamesByTarget' :: Text
targetArn = Text
pTargetArn_
    }

-- | The token returned by a previous call to retrieve the next set of
-- results.
listRuleNamesByTarget_nextToken :: Lens.Lens' ListRuleNamesByTarget (Prelude.Maybe Prelude.Text)
listRuleNamesByTarget_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListRuleNamesByTarget -> f ListRuleNamesByTarget
listRuleNamesByTarget_nextToken = (ListRuleNamesByTarget -> Maybe Text)
-> (ListRuleNamesByTarget -> Maybe Text -> ListRuleNamesByTarget)
-> Lens
     ListRuleNamesByTarget
     ListRuleNamesByTarget
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRuleNamesByTarget' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListRuleNamesByTarget' :: ListRuleNamesByTarget -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListRuleNamesByTarget
s@ListRuleNamesByTarget' {} Maybe Text
a -> ListRuleNamesByTarget
s {$sel:nextToken:ListRuleNamesByTarget' :: Maybe Text
nextToken = Maybe Text
a} :: ListRuleNamesByTarget)

-- | The name or ARN of the event bus to list rules for. If you omit this,
-- the default event bus is used.
listRuleNamesByTarget_eventBusName :: Lens.Lens' ListRuleNamesByTarget (Prelude.Maybe Prelude.Text)
listRuleNamesByTarget_eventBusName :: (Maybe Text -> f (Maybe Text))
-> ListRuleNamesByTarget -> f ListRuleNamesByTarget
listRuleNamesByTarget_eventBusName = (ListRuleNamesByTarget -> Maybe Text)
-> (ListRuleNamesByTarget -> Maybe Text -> ListRuleNamesByTarget)
-> Lens
     ListRuleNamesByTarget
     ListRuleNamesByTarget
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRuleNamesByTarget' {Maybe Text
eventBusName :: Maybe Text
$sel:eventBusName:ListRuleNamesByTarget' :: ListRuleNamesByTarget -> Maybe Text
eventBusName} -> Maybe Text
eventBusName) (\s :: ListRuleNamesByTarget
s@ListRuleNamesByTarget' {} Maybe Text
a -> ListRuleNamesByTarget
s {$sel:eventBusName:ListRuleNamesByTarget' :: Maybe Text
eventBusName = Maybe Text
a} :: ListRuleNamesByTarget)

-- | The maximum number of results to return.
listRuleNamesByTarget_limit :: Lens.Lens' ListRuleNamesByTarget (Prelude.Maybe Prelude.Natural)
listRuleNamesByTarget_limit :: (Maybe Natural -> f (Maybe Natural))
-> ListRuleNamesByTarget -> f ListRuleNamesByTarget
listRuleNamesByTarget_limit = (ListRuleNamesByTarget -> Maybe Natural)
-> (ListRuleNamesByTarget
    -> Maybe Natural -> ListRuleNamesByTarget)
-> Lens
     ListRuleNamesByTarget
     ListRuleNamesByTarget
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRuleNamesByTarget' {Maybe Natural
limit :: Maybe Natural
$sel:limit:ListRuleNamesByTarget' :: ListRuleNamesByTarget -> Maybe Natural
limit} -> Maybe Natural
limit) (\s :: ListRuleNamesByTarget
s@ListRuleNamesByTarget' {} Maybe Natural
a -> ListRuleNamesByTarget
s {$sel:limit:ListRuleNamesByTarget' :: Maybe Natural
limit = Maybe Natural
a} :: ListRuleNamesByTarget)

-- | The Amazon Resource Name (ARN) of the target resource.
listRuleNamesByTarget_targetArn :: Lens.Lens' ListRuleNamesByTarget Prelude.Text
listRuleNamesByTarget_targetArn :: (Text -> f Text)
-> ListRuleNamesByTarget -> f ListRuleNamesByTarget
listRuleNamesByTarget_targetArn = (ListRuleNamesByTarget -> Text)
-> (ListRuleNamesByTarget -> Text -> ListRuleNamesByTarget)
-> Lens ListRuleNamesByTarget ListRuleNamesByTarget Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRuleNamesByTarget' {Text
targetArn :: Text
$sel:targetArn:ListRuleNamesByTarget' :: ListRuleNamesByTarget -> Text
targetArn} -> Text
targetArn) (\s :: ListRuleNamesByTarget
s@ListRuleNamesByTarget' {} Text
a -> ListRuleNamesByTarget
s {$sel:targetArn:ListRuleNamesByTarget' :: Text
targetArn = Text
a} :: ListRuleNamesByTarget)

instance Core.AWSPager ListRuleNamesByTarget where
  page :: ListRuleNamesByTarget
-> AWSResponse ListRuleNamesByTarget -> Maybe ListRuleNamesByTarget
page ListRuleNamesByTarget
rq AWSResponse ListRuleNamesByTarget
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListRuleNamesByTarget
ListRuleNamesByTargetResponse
rs
            ListRuleNamesByTargetResponse
-> Getting (First Text) ListRuleNamesByTargetResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListRuleNamesByTargetResponse
-> Const (First Text) ListRuleNamesByTargetResponse
Lens' ListRuleNamesByTargetResponse (Maybe Text)
listRuleNamesByTargetResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListRuleNamesByTargetResponse
 -> Const (First Text) ListRuleNamesByTargetResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListRuleNamesByTargetResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListRuleNamesByTarget
forall a. Maybe a
Prelude.Nothing
    | Maybe [Text] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListRuleNamesByTarget
ListRuleNamesByTargetResponse
rs
            ListRuleNamesByTargetResponse
-> Getting (First [Text]) ListRuleNamesByTargetResponse [Text]
-> Maybe [Text]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [Text] -> Const (First [Text]) (Maybe [Text]))
-> ListRuleNamesByTargetResponse
-> Const (First [Text]) ListRuleNamesByTargetResponse
Lens' ListRuleNamesByTargetResponse (Maybe [Text])
listRuleNamesByTargetResponse_ruleNames
              ((Maybe [Text] -> Const (First [Text]) (Maybe [Text]))
 -> ListRuleNamesByTargetResponse
 -> Const (First [Text]) ListRuleNamesByTargetResponse)
-> (([Text] -> Const (First [Text]) [Text])
    -> Maybe [Text] -> Const (First [Text]) (Maybe [Text]))
-> Getting (First [Text]) ListRuleNamesByTargetResponse [Text]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> Const (First [Text]) [Text])
-> Maybe [Text] -> Const (First [Text]) (Maybe [Text])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListRuleNamesByTarget
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListRuleNamesByTarget -> Maybe ListRuleNamesByTarget
forall a. a -> Maybe a
Prelude.Just (ListRuleNamesByTarget -> Maybe ListRuleNamesByTarget)
-> ListRuleNamesByTarget -> Maybe ListRuleNamesByTarget
forall a b. (a -> b) -> a -> b
Prelude.$
        ListRuleNamesByTarget
rq
          ListRuleNamesByTarget
-> (ListRuleNamesByTarget -> ListRuleNamesByTarget)
-> ListRuleNamesByTarget
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListRuleNamesByTarget -> Identity ListRuleNamesByTarget
Lens
  ListRuleNamesByTarget
  ListRuleNamesByTarget
  (Maybe Text)
  (Maybe Text)
listRuleNamesByTarget_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListRuleNamesByTarget -> Identity ListRuleNamesByTarget)
-> Maybe Text -> ListRuleNamesByTarget -> ListRuleNamesByTarget
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListRuleNamesByTarget
ListRuleNamesByTargetResponse
rs
          ListRuleNamesByTargetResponse
-> Getting (First Text) ListRuleNamesByTargetResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListRuleNamesByTargetResponse
-> Const (First Text) ListRuleNamesByTargetResponse
Lens' ListRuleNamesByTargetResponse (Maybe Text)
listRuleNamesByTargetResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListRuleNamesByTargetResponse
 -> Const (First Text) ListRuleNamesByTargetResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListRuleNamesByTargetResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest ListRuleNamesByTarget where
  type
    AWSResponse ListRuleNamesByTarget =
      ListRuleNamesByTargetResponse
  request :: ListRuleNamesByTarget -> Request ListRuleNamesByTarget
request = Service -> ListRuleNamesByTarget -> Request ListRuleNamesByTarget
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ListRuleNamesByTarget
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListRuleNamesByTarget)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListRuleNamesByTarget))
-> Logger
-> Service
-> Proxy ListRuleNamesByTarget
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListRuleNamesByTarget)))
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] -> Maybe Text -> Int -> ListRuleNamesByTargetResponse
ListRuleNamesByTargetResponse'
            (Maybe [Text]
 -> Maybe Text -> Int -> ListRuleNamesByTargetResponse)
-> Either String (Maybe [Text])
-> Either
     String (Maybe Text -> Int -> ListRuleNamesByTargetResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"RuleNames" Either String (Maybe (Maybe [Text]))
-> Maybe [Text] -> Either String (Maybe [Text])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
            Either String (Maybe Text -> Int -> ListRuleNamesByTargetResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListRuleNamesByTargetResponse)
forall (f :: * -> *) a b. Applicative f => 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 -> ListRuleNamesByTargetResponse)
-> Either String Int -> Either String ListRuleNamesByTargetResponse
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))
      )

instance Prelude.Hashable ListRuleNamesByTarget

instance Prelude.NFData ListRuleNamesByTarget

instance Core.ToHeaders ListRuleNamesByTarget where
  toHeaders :: ListRuleNamesByTarget -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListRuleNamesByTarget -> 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
"AWSEvents.ListRuleNamesByTarget" ::
                          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 ListRuleNamesByTarget where
  toJSON :: ListRuleNamesByTarget -> Value
toJSON ListRuleNamesByTarget' {Maybe Natural
Maybe Text
Text
targetArn :: Text
limit :: Maybe Natural
eventBusName :: Maybe Text
nextToken :: Maybe Text
$sel:targetArn:ListRuleNamesByTarget' :: ListRuleNamesByTarget -> Text
$sel:limit:ListRuleNamesByTarget' :: ListRuleNamesByTarget -> Maybe Natural
$sel:eventBusName:ListRuleNamesByTarget' :: ListRuleNamesByTarget -> Maybe Text
$sel:nextToken:ListRuleNamesByTarget' :: ListRuleNamesByTarget -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"NextToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
            (Text
"EventBusName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
eventBusName,
            (Text
"Limit" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
limit,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"TargetArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
targetArn)
          ]
      )

instance Core.ToPath ListRuleNamesByTarget where
  toPath :: ListRuleNamesByTarget -> ByteString
toPath = ByteString -> ListRuleNamesByTarget -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery ListRuleNamesByTarget where
  toQuery :: ListRuleNamesByTarget -> QueryString
toQuery = QueryString -> ListRuleNamesByTarget -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newListRuleNamesByTargetResponse' smart constructor.
data ListRuleNamesByTargetResponse = ListRuleNamesByTargetResponse'
  { -- | The names of the rules that can invoke the given target.
    ListRuleNamesByTargetResponse -> Maybe [Text]
ruleNames :: Prelude.Maybe [Prelude.Text],
    -- | Indicates whether there are additional results to retrieve. If there are
    -- no more results, the value is null.
    ListRuleNamesByTargetResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListRuleNamesByTargetResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListRuleNamesByTargetResponse
-> ListRuleNamesByTargetResponse -> Bool
(ListRuleNamesByTargetResponse
 -> ListRuleNamesByTargetResponse -> Bool)
-> (ListRuleNamesByTargetResponse
    -> ListRuleNamesByTargetResponse -> Bool)
-> Eq ListRuleNamesByTargetResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListRuleNamesByTargetResponse
-> ListRuleNamesByTargetResponse -> Bool
$c/= :: ListRuleNamesByTargetResponse
-> ListRuleNamesByTargetResponse -> Bool
== :: ListRuleNamesByTargetResponse
-> ListRuleNamesByTargetResponse -> Bool
$c== :: ListRuleNamesByTargetResponse
-> ListRuleNamesByTargetResponse -> Bool
Prelude.Eq, ReadPrec [ListRuleNamesByTargetResponse]
ReadPrec ListRuleNamesByTargetResponse
Int -> ReadS ListRuleNamesByTargetResponse
ReadS [ListRuleNamesByTargetResponse]
(Int -> ReadS ListRuleNamesByTargetResponse)
-> ReadS [ListRuleNamesByTargetResponse]
-> ReadPrec ListRuleNamesByTargetResponse
-> ReadPrec [ListRuleNamesByTargetResponse]
-> Read ListRuleNamesByTargetResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListRuleNamesByTargetResponse]
$creadListPrec :: ReadPrec [ListRuleNamesByTargetResponse]
readPrec :: ReadPrec ListRuleNamesByTargetResponse
$creadPrec :: ReadPrec ListRuleNamesByTargetResponse
readList :: ReadS [ListRuleNamesByTargetResponse]
$creadList :: ReadS [ListRuleNamesByTargetResponse]
readsPrec :: Int -> ReadS ListRuleNamesByTargetResponse
$creadsPrec :: Int -> ReadS ListRuleNamesByTargetResponse
Prelude.Read, Int -> ListRuleNamesByTargetResponse -> ShowS
[ListRuleNamesByTargetResponse] -> ShowS
ListRuleNamesByTargetResponse -> String
(Int -> ListRuleNamesByTargetResponse -> ShowS)
-> (ListRuleNamesByTargetResponse -> String)
-> ([ListRuleNamesByTargetResponse] -> ShowS)
-> Show ListRuleNamesByTargetResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListRuleNamesByTargetResponse] -> ShowS
$cshowList :: [ListRuleNamesByTargetResponse] -> ShowS
show :: ListRuleNamesByTargetResponse -> String
$cshow :: ListRuleNamesByTargetResponse -> String
showsPrec :: Int -> ListRuleNamesByTargetResponse -> ShowS
$cshowsPrec :: Int -> ListRuleNamesByTargetResponse -> ShowS
Prelude.Show, (forall x.
 ListRuleNamesByTargetResponse
 -> Rep ListRuleNamesByTargetResponse x)
-> (forall x.
    Rep ListRuleNamesByTargetResponse x
    -> ListRuleNamesByTargetResponse)
-> Generic ListRuleNamesByTargetResponse
forall x.
Rep ListRuleNamesByTargetResponse x
-> ListRuleNamesByTargetResponse
forall x.
ListRuleNamesByTargetResponse
-> Rep ListRuleNamesByTargetResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListRuleNamesByTargetResponse x
-> ListRuleNamesByTargetResponse
$cfrom :: forall x.
ListRuleNamesByTargetResponse
-> Rep ListRuleNamesByTargetResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListRuleNamesByTargetResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'ruleNames', 'listRuleNamesByTargetResponse_ruleNames' - The names of the rules that can invoke the given target.
--
-- 'nextToken', 'listRuleNamesByTargetResponse_nextToken' - Indicates whether there are additional results to retrieve. If there are
-- no more results, the value is null.
--
-- 'httpStatus', 'listRuleNamesByTargetResponse_httpStatus' - The response's http status code.
newListRuleNamesByTargetResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListRuleNamesByTargetResponse
newListRuleNamesByTargetResponse :: Int -> ListRuleNamesByTargetResponse
newListRuleNamesByTargetResponse Int
pHttpStatus_ =
  ListRuleNamesByTargetResponse' :: Maybe [Text] -> Maybe Text -> Int -> ListRuleNamesByTargetResponse
ListRuleNamesByTargetResponse'
    { $sel:ruleNames:ListRuleNamesByTargetResponse' :: Maybe [Text]
ruleNames =
        Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListRuleNamesByTargetResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListRuleNamesByTargetResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The names of the rules that can invoke the given target.
listRuleNamesByTargetResponse_ruleNames :: Lens.Lens' ListRuleNamesByTargetResponse (Prelude.Maybe [Prelude.Text])
listRuleNamesByTargetResponse_ruleNames :: (Maybe [Text] -> f (Maybe [Text]))
-> ListRuleNamesByTargetResponse -> f ListRuleNamesByTargetResponse
listRuleNamesByTargetResponse_ruleNames = (ListRuleNamesByTargetResponse -> Maybe [Text])
-> (ListRuleNamesByTargetResponse
    -> Maybe [Text] -> ListRuleNamesByTargetResponse)
-> Lens' ListRuleNamesByTargetResponse (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRuleNamesByTargetResponse' {Maybe [Text]
ruleNames :: Maybe [Text]
$sel:ruleNames:ListRuleNamesByTargetResponse' :: ListRuleNamesByTargetResponse -> Maybe [Text]
ruleNames} -> Maybe [Text]
ruleNames) (\s :: ListRuleNamesByTargetResponse
s@ListRuleNamesByTargetResponse' {} Maybe [Text]
a -> ListRuleNamesByTargetResponse
s {$sel:ruleNames:ListRuleNamesByTargetResponse' :: Maybe [Text]
ruleNames = Maybe [Text]
a} :: ListRuleNamesByTargetResponse) ((Maybe [Text] -> f (Maybe [Text]))
 -> ListRuleNamesByTargetResponse
 -> f ListRuleNamesByTargetResponse)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> ListRuleNamesByTargetResponse
-> f ListRuleNamesByTargetResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Indicates whether there are additional results to retrieve. If there are
-- no more results, the value is null.
listRuleNamesByTargetResponse_nextToken :: Lens.Lens' ListRuleNamesByTargetResponse (Prelude.Maybe Prelude.Text)
listRuleNamesByTargetResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListRuleNamesByTargetResponse -> f ListRuleNamesByTargetResponse
listRuleNamesByTargetResponse_nextToken = (ListRuleNamesByTargetResponse -> Maybe Text)
-> (ListRuleNamesByTargetResponse
    -> Maybe Text -> ListRuleNamesByTargetResponse)
-> Lens' ListRuleNamesByTargetResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRuleNamesByTargetResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListRuleNamesByTargetResponse' :: ListRuleNamesByTargetResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListRuleNamesByTargetResponse
s@ListRuleNamesByTargetResponse' {} Maybe Text
a -> ListRuleNamesByTargetResponse
s {$sel:nextToken:ListRuleNamesByTargetResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListRuleNamesByTargetResponse)

-- | The response's http status code.
listRuleNamesByTargetResponse_httpStatus :: Lens.Lens' ListRuleNamesByTargetResponse Prelude.Int
listRuleNamesByTargetResponse_httpStatus :: (Int -> f Int)
-> ListRuleNamesByTargetResponse -> f ListRuleNamesByTargetResponse
listRuleNamesByTargetResponse_httpStatus = (ListRuleNamesByTargetResponse -> Int)
-> (ListRuleNamesByTargetResponse
    -> Int -> ListRuleNamesByTargetResponse)
-> Lens
     ListRuleNamesByTargetResponse ListRuleNamesByTargetResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRuleNamesByTargetResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListRuleNamesByTargetResponse' :: ListRuleNamesByTargetResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListRuleNamesByTargetResponse
s@ListRuleNamesByTargetResponse' {} Int
a -> ListRuleNamesByTargetResponse
s {$sel:httpStatus:ListRuleNamesByTargetResponse' :: Int
httpStatus = Int
a} :: ListRuleNamesByTargetResponse)

instance Prelude.NFData ListRuleNamesByTargetResponse