@@ -1626,21 +1626,26 @@ def list_feeds(
16261626 page_size : int = 100 ,
16271627 page_token : str = None ,
16281628 api_version : APIVersion | None = None ,
1629- ) -> list [dict [str , Any ]]:
1629+ as_list : bool = True ,
1630+ ) -> dict [str , Any ] | list [dict [str , Any ]]:
16301631 """List feeds.
16311632
16321633 Args:
16331634 page_size: The maximum number of feeds to return
16341635 page_token: A page token, received from a previous ListFeeds call
16351636 api_version: (Optional) Preferred API version to use.
1637+ as_list: If True, return only the list of feeds.
1638+ If False, return dict with metadata and pagination tokens.
1639+ Defaults to True for backward compatibility.
16361640
16371641 Returns:
1638- List of feed dictionaries
1642+ If as_list is True: List of feed dictionaries.
1643+ If as_list is False: Dict with feeds list and pagination metadata.
16391644
16401645 Raises:
16411646 APIError: If the API request fails
16421647 """
1643- return _list_feeds (self , page_size , page_token , api_version )
1648+ return _list_feeds (self , page_size , page_token , api_version , as_list )
16441649
16451650 def get_feed (
16461651 self , feed_id : str , api_version : APIVersion | None = None
@@ -2085,7 +2090,8 @@ def list_rules(
20852090 page_size : int | None = None ,
20862091 page_token : str | None = None ,
20872092 api_version : APIVersion | None = APIVersion .V1 ,
2088- ) -> dict [str , Any ]:
2093+ as_list : bool = False ,
2094+ ) -> dict [str , Any ] | list [Any ]:
20892095 """Gets a list of rules.
20902096
20912097 Args:
@@ -2099,9 +2105,12 @@ def list_rules(
20992105 page_size: Maximum number of rules to return per page.
21002106 page_token: Token for the next page of results, if available.
21012107 api_version: (Optional) Preferred API version to use.
2108+ as_list: If True, return only the list of rules.
2109+ If False, return dict with metadata and pagination tokens.
21022110
21032111 Returns:
2104- Dictionary containing information about rules
2112+ If as_list is True: List of rules.
2113+ If as_list is False: Dict with rules list and pagination metadata.
21052114
21062115 Raises:
21072116 APIError: If the API request fails
@@ -2112,6 +2121,7 @@ def list_rules(
21122121 page_size = page_size ,
21132122 page_token = page_token ,
21142123 api_version = api_version ,
2124+ as_list = as_list ,
21152125 )
21162126
21172127 def update_rule (
@@ -4852,17 +4862,22 @@ def list_rule_deployments(
48524862 page_token : str | None = None ,
48534863 filter_query : str | None = None ,
48544864 api_version : APIVersion | None = APIVersion .V1 ,
4855- ) -> dict [str , Any ]:
4865+ as_list : bool = False ,
4866+ ) -> dict [str , Any ] | list [Any ]:
48564867 """List rule deployments for the instance.
48574868
48584869 Args:
48594870 page_size: Maximum number of deployments to return per page
48604871 page_token: Token for the next page of results, if available
48614872 filter_query: Optional filter query to restrict results
48624873 api_version: (Optional) Preferred API version to use.
4874+ as_list: If True, return only the list of rule deployments.
4875+ If False, return dict with metadata and pagination tokens.
48634876
48644877 Returns:
4865- Dictionary containing rule deployments and pagination info
4878+ If as_list is True: List of rule deployments.
4879+ If as_list is False: Dict with ruleDeployments list and
4880+ pagination metadata.
48664881
48674882 Raises:
48684883 APIError: If the API request fails
@@ -4873,6 +4888,7 @@ def list_rule_deployments(
48734888 page_token = page_token ,
48744889 filter_query = filter_query ,
48754890 api_version = api_version ,
4891+ as_list = as_list ,
48764892 )
48774893
48784894 def set_rule_alerting (
0 commit comments