Skip to content

Commit 154726b

Browse files
authored
feat(iam): add filtering on multiple IDs on listing endpoints (#416)
1 parent 5481529 commit 154726b

File tree

4 files changed

+52
-6
lines changed

4 files changed

+52
-6
lines changed

scaleway-async/scaleway_async/iam/v1alpha1/api.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1206,6 +1206,7 @@ async def list_policies(
12061206
no_principal: Optional[bool] = None,
12071207
policy_name: Optional[str] = None,
12081208
tag: Optional[str] = None,
1209+
policy_ids: Optional[List[str]] = None,
12091210
) -> ListPoliciesResponse:
12101211
"""
12111212
List policies of an Organization.
@@ -1221,6 +1222,7 @@ async def list_policies(
12211222
:param no_principal: Defines whether or not the policy is attributed to a principal.
12221223
:param policy_name: Name of the policy to fetch.
12231224
:param tag: Filter by tags containing a given string.
1225+
:param policy_ids: Filter by a list of IDs.
12241226
:return: :class:`ListPoliciesResponse <ListPoliciesResponse>`
12251227
12261228
Usage:
@@ -1242,6 +1244,7 @@ async def list_policies(
12421244
or self.client.default_organization_id,
12431245
"page": page,
12441246
"page_size": page_size or self.client.default_page_size,
1247+
"policy_ids": policy_ids,
12451248
"policy_name": policy_name,
12461249
"tag": tag,
12471250
"user_ids": user_ids,
@@ -1265,6 +1268,7 @@ async def list_policies_all(
12651268
no_principal: Optional[bool] = None,
12661269
policy_name: Optional[str] = None,
12671270
tag: Optional[str] = None,
1271+
policy_ids: Optional[List[str]] = None,
12681272
) -> List[Policy]:
12691273
"""
12701274
List policies of an Organization.
@@ -1280,6 +1284,7 @@ async def list_policies_all(
12801284
:param no_principal: Defines whether or not the policy is attributed to a principal.
12811285
:param policy_name: Name of the policy to fetch.
12821286
:param tag: Filter by tags containing a given string.
1287+
:param policy_ids: Filter by a list of IDs.
12831288
:return: :class:`List[ListPoliciesResponse] <List[ListPoliciesResponse]>`
12841289
12851290
Usage:
@@ -1304,6 +1309,7 @@ async def list_policies_all(
13041309
"no_principal": no_principal,
13051310
"policy_name": policy_name,
13061311
"tag": tag,
1312+
"policy_ids": policy_ids,
13071313
},
13081314
)
13091315

@@ -1703,6 +1709,7 @@ async def list_api_keys(
17031709
description: Optional[str] = None,
17041710
bearer_id: Optional[str] = None,
17051711
bearer_type: BearerType = BearerType.UNKNOWN_BEARER_TYPE,
1712+
access_keys: Optional[List[str]] = None,
17061713
) -> ListAPIKeysResponse:
17071714
"""
17081715
List API keys.
@@ -1719,10 +1726,11 @@ async def list_api_keys(
17191726
One-of ('bearer'): at most one of 'application_id', 'user_id' could be set.
17201727
:param editable: Defines whether to filter out editable API keys or not.
17211728
:param expired: Defines whether to filter out expired API keys or not.
1722-
:param access_key: Filter by access key.
1729+
:param access_key: Filter by access key (deprecated in favor of `access_keys`).
17231730
:param description: Filter by description.
17241731
:param bearer_id: Filter by bearer ID.
17251732
:param bearer_type: Filter by type of bearer.
1733+
:param access_keys: Filter by a list of access keys.
17261734
:return: :class:`ListAPIKeysResponse <ListAPIKeysResponse>`
17271735
17281736
Usage:
@@ -1736,6 +1744,7 @@ async def list_api_keys(
17361744
f"/iam/v1alpha1/api-keys",
17371745
params={
17381746
"access_key": access_key,
1747+
"access_keys": access_keys,
17391748
"bearer_id": bearer_id,
17401749
"bearer_type": bearer_type,
17411750
"description": description,
@@ -1773,6 +1782,7 @@ async def list_api_keys_all(
17731782
description: Optional[str] = None,
17741783
bearer_id: Optional[str] = None,
17751784
bearer_type: Optional[BearerType] = None,
1785+
access_keys: Optional[List[str]] = None,
17761786
) -> List[APIKey]:
17771787
"""
17781788
List API keys.
@@ -1789,10 +1799,11 @@ async def list_api_keys_all(
17891799
One-of ('bearer'): at most one of 'application_id', 'user_id' could be set.
17901800
:param editable: Defines whether to filter out editable API keys or not.
17911801
:param expired: Defines whether to filter out expired API keys or not.
1792-
:param access_key: Filter by access key.
1802+
:param access_key: Filter by access key (deprecated in favor of `access_keys`).
17931803
:param description: Filter by description.
17941804
:param bearer_id: Filter by bearer ID.
17951805
:param bearer_type: Filter by type of bearer.
1806+
:param access_keys: Filter by a list of access keys.
17961807
:return: :class:`List[ListAPIKeysResponse] <List[ListAPIKeysResponse]>`
17971808
17981809
Usage:
@@ -1818,6 +1829,7 @@ async def list_api_keys_all(
18181829
"description": description,
18191830
"bearer_id": bearer_id,
18201831
"bearer_type": bearer_type,
1832+
"access_keys": access_keys,
18211833
},
18221834
)
18231835

scaleway-async/scaleway_async/iam/v1alpha1/types.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1493,6 +1493,11 @@ class ListPoliciesRequest:
14931493
Filter by tags containing a given string.
14941494
"""
14951495

1496+
policy_ids: Optional[List[str]]
1497+
"""
1498+
Filter by a list of IDs.
1499+
"""
1500+
14961501

14971502
@dataclass
14981503
class CreatePolicyRequest:
@@ -1726,7 +1731,8 @@ class ListAPIKeysRequest:
17261731

17271732
access_key: Optional[str]
17281733
"""
1729-
Filter by access key.
1734+
Filter by access key (deprecated in favor of `access_keys`).
1735+
:deprecated
17301736
"""
17311737

17321738
description: Optional[str]
@@ -1744,6 +1750,11 @@ class ListAPIKeysRequest:
17441750
Filter by type of bearer.
17451751
"""
17461752

1753+
access_keys: Optional[List[str]]
1754+
"""
1755+
Filter by a list of access keys.
1756+
"""
1757+
17471758

17481759
@dataclass
17491760
class CreateAPIKeyRequest:

scaleway/scaleway/iam/v1alpha1/api.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1206,6 +1206,7 @@ def list_policies(
12061206
no_principal: Optional[bool] = None,
12071207
policy_name: Optional[str] = None,
12081208
tag: Optional[str] = None,
1209+
policy_ids: Optional[List[str]] = None,
12091210
) -> ListPoliciesResponse:
12101211
"""
12111212
List policies of an Organization.
@@ -1221,6 +1222,7 @@ def list_policies(
12211222
:param no_principal: Defines whether or not the policy is attributed to a principal.
12221223
:param policy_name: Name of the policy to fetch.
12231224
:param tag: Filter by tags containing a given string.
1225+
:param policy_ids: Filter by a list of IDs.
12241226
:return: :class:`ListPoliciesResponse <ListPoliciesResponse>`
12251227
12261228
Usage:
@@ -1242,6 +1244,7 @@ def list_policies(
12421244
or self.client.default_organization_id,
12431245
"page": page,
12441246
"page_size": page_size or self.client.default_page_size,
1247+
"policy_ids": policy_ids,
12451248
"policy_name": policy_name,
12461249
"tag": tag,
12471250
"user_ids": user_ids,
@@ -1265,6 +1268,7 @@ def list_policies_all(
12651268
no_principal: Optional[bool] = None,
12661269
policy_name: Optional[str] = None,
12671270
tag: Optional[str] = None,
1271+
policy_ids: Optional[List[str]] = None,
12681272
) -> List[Policy]:
12691273
"""
12701274
List policies of an Organization.
@@ -1280,6 +1284,7 @@ def list_policies_all(
12801284
:param no_principal: Defines whether or not the policy is attributed to a principal.
12811285
:param policy_name: Name of the policy to fetch.
12821286
:param tag: Filter by tags containing a given string.
1287+
:param policy_ids: Filter by a list of IDs.
12831288
:return: :class:`List[ListPoliciesResponse] <List[ListPoliciesResponse]>`
12841289
12851290
Usage:
@@ -1304,6 +1309,7 @@ def list_policies_all(
13041309
"no_principal": no_principal,
13051310
"policy_name": policy_name,
13061311
"tag": tag,
1312+
"policy_ids": policy_ids,
13071313
},
13081314
)
13091315

@@ -1703,6 +1709,7 @@ def list_api_keys(
17031709
description: Optional[str] = None,
17041710
bearer_id: Optional[str] = None,
17051711
bearer_type: BearerType = BearerType.UNKNOWN_BEARER_TYPE,
1712+
access_keys: Optional[List[str]] = None,
17061713
) -> ListAPIKeysResponse:
17071714
"""
17081715
List API keys.
@@ -1719,10 +1726,11 @@ def list_api_keys(
17191726
One-of ('bearer'): at most one of 'application_id', 'user_id' could be set.
17201727
:param editable: Defines whether to filter out editable API keys or not.
17211728
:param expired: Defines whether to filter out expired API keys or not.
1722-
:param access_key: Filter by access key.
1729+
:param access_key: Filter by access key (deprecated in favor of `access_keys`).
17231730
:param description: Filter by description.
17241731
:param bearer_id: Filter by bearer ID.
17251732
:param bearer_type: Filter by type of bearer.
1733+
:param access_keys: Filter by a list of access keys.
17261734
:return: :class:`ListAPIKeysResponse <ListAPIKeysResponse>`
17271735
17281736
Usage:
@@ -1736,6 +1744,7 @@ def list_api_keys(
17361744
f"/iam/v1alpha1/api-keys",
17371745
params={
17381746
"access_key": access_key,
1747+
"access_keys": access_keys,
17391748
"bearer_id": bearer_id,
17401749
"bearer_type": bearer_type,
17411750
"description": description,
@@ -1773,6 +1782,7 @@ def list_api_keys_all(
17731782
description: Optional[str] = None,
17741783
bearer_id: Optional[str] = None,
17751784
bearer_type: Optional[BearerType] = None,
1785+
access_keys: Optional[List[str]] = None,
17761786
) -> List[APIKey]:
17771787
"""
17781788
List API keys.
@@ -1789,10 +1799,11 @@ def list_api_keys_all(
17891799
One-of ('bearer'): at most one of 'application_id', 'user_id' could be set.
17901800
:param editable: Defines whether to filter out editable API keys or not.
17911801
:param expired: Defines whether to filter out expired API keys or not.
1792-
:param access_key: Filter by access key.
1802+
:param access_key: Filter by access key (deprecated in favor of `access_keys`).
17931803
:param description: Filter by description.
17941804
:param bearer_id: Filter by bearer ID.
17951805
:param bearer_type: Filter by type of bearer.
1806+
:param access_keys: Filter by a list of access keys.
17961807
:return: :class:`List[ListAPIKeysResponse] <List[ListAPIKeysResponse]>`
17971808
17981809
Usage:
@@ -1818,6 +1829,7 @@ def list_api_keys_all(
18181829
"description": description,
18191830
"bearer_id": bearer_id,
18201831
"bearer_type": bearer_type,
1832+
"access_keys": access_keys,
18211833
},
18221834
)
18231835

scaleway/scaleway/iam/v1alpha1/types.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1493,6 +1493,11 @@ class ListPoliciesRequest:
14931493
Filter by tags containing a given string.
14941494
"""
14951495

1496+
policy_ids: Optional[List[str]]
1497+
"""
1498+
Filter by a list of IDs.
1499+
"""
1500+
14961501

14971502
@dataclass
14981503
class CreatePolicyRequest:
@@ -1726,7 +1731,8 @@ class ListAPIKeysRequest:
17261731

17271732
access_key: Optional[str]
17281733
"""
1729-
Filter by access key.
1734+
Filter by access key (deprecated in favor of `access_keys`).
1735+
:deprecated
17301736
"""
17311737

17321738
description: Optional[str]
@@ -1744,6 +1750,11 @@ class ListAPIKeysRequest:
17441750
Filter by type of bearer.
17451751
"""
17461752

1753+
access_keys: Optional[List[str]]
1754+
"""
1755+
Filter by a list of access keys.
1756+
"""
1757+
17471758

17481759
@dataclass
17491760
class CreateAPIKeyRequest:

0 commit comments

Comments
 (0)