Skip to content

Commit be32215

Browse files
feat(api): api update
1 parent 84b83b5 commit be32215

File tree

5 files changed

+37
-93
lines changed

5 files changed

+37
-93
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 1692
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-fd163487e976a58ac8b6f86053e92bb14b5283b89481fa2a10357425dc40515b.yml
3-
openapi_spec_hash: ff394241e840b5fe4503239c06a14125
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-2d2329bb0e03362bf3f7ecbbb8b4765f4fc71e9c13e261fde06ce442398cbabb.yml
3+
openapi_spec_hash: 093f41d1494f005d0f6a85786cc72b06
44
config_hash: be55f8a46c1d39367277ece7fd55ef1e

src/cloudflare/resources/iam/resource_groups.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ def create(
5353
self,
5454
*,
5555
account_id: str,
56+
name: str,
5657
scope: resource_group_create_params.Scope,
57-
meta: object | NotGiven = NOT_GIVEN,
5858
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
5959
# The extra values given here take precedence over values defined on the client or passed to this method.
6060
extra_headers: Headers | None = None,
@@ -68,9 +68,9 @@ def create(
6868
Args:
6969
account_id: Account identifier tag.
7070
71-
scope: A scope is a combination of scope objects which provides additional context.
71+
name: Name of the resource group
7272
73-
meta: Attributes associated to the resource group.
73+
scope: A scope is a combination of scope objects which provides additional context.
7474
7575
extra_headers: Send extra headers
7676
@@ -86,8 +86,8 @@ def create(
8686
f"/accounts/{account_id}/iam/resource_groups",
8787
body=maybe_transform(
8888
{
89+
"name": name,
8990
"scope": scope,
90-
"meta": meta,
9191
},
9292
resource_group_create_params.ResourceGroupCreateParams,
9393
),
@@ -102,8 +102,8 @@ def update(
102102
resource_group_id: str,
103103
*,
104104
account_id: str,
105-
scope: resource_group_update_params.Scope,
106-
meta: object | NotGiven = NOT_GIVEN,
105+
name: str | NotGiven = NOT_GIVEN,
106+
scope: resource_group_update_params.Scope | NotGiven = NOT_GIVEN,
107107
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
108108
# The extra values given here take precedence over values defined on the client or passed to this method.
109109
extra_headers: Headers | None = None,
@@ -119,9 +119,9 @@ def update(
119119
120120
resource_group_id: Resource Group identifier tag.
121121
122-
scope: A scope is a combination of scope objects which provides additional context.
122+
name: Name of the resource group
123123
124-
meta: Attributes associated to the resource group.
124+
scope: A scope is a combination of scope objects which provides additional context.
125125
126126
extra_headers: Send extra headers
127127
@@ -139,8 +139,8 @@ def update(
139139
f"/accounts/{account_id}/iam/resource_groups/{resource_group_id}",
140140
body=maybe_transform(
141141
{
142+
"name": name,
142143
"scope": scope,
143-
"meta": meta,
144144
},
145145
resource_group_update_params.ResourceGroupUpdateParams,
146146
),
@@ -319,8 +319,8 @@ async def create(
319319
self,
320320
*,
321321
account_id: str,
322+
name: str,
322323
scope: resource_group_create_params.Scope,
323-
meta: object | NotGiven = NOT_GIVEN,
324324
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
325325
# The extra values given here take precedence over values defined on the client or passed to this method.
326326
extra_headers: Headers | None = None,
@@ -334,9 +334,9 @@ async def create(
334334
Args:
335335
account_id: Account identifier tag.
336336
337-
scope: A scope is a combination of scope objects which provides additional context.
337+
name: Name of the resource group
338338
339-
meta: Attributes associated to the resource group.
339+
scope: A scope is a combination of scope objects which provides additional context.
340340
341341
extra_headers: Send extra headers
342342
@@ -352,8 +352,8 @@ async def create(
352352
f"/accounts/{account_id}/iam/resource_groups",
353353
body=await async_maybe_transform(
354354
{
355+
"name": name,
355356
"scope": scope,
356-
"meta": meta,
357357
},
358358
resource_group_create_params.ResourceGroupCreateParams,
359359
),
@@ -368,8 +368,8 @@ async def update(
368368
resource_group_id: str,
369369
*,
370370
account_id: str,
371-
scope: resource_group_update_params.Scope,
372-
meta: object | NotGiven = NOT_GIVEN,
371+
name: str | NotGiven = NOT_GIVEN,
372+
scope: resource_group_update_params.Scope | NotGiven = NOT_GIVEN,
373373
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
374374
# The extra values given here take precedence over values defined on the client or passed to this method.
375375
extra_headers: Headers | None = None,
@@ -385,9 +385,9 @@ async def update(
385385
386386
resource_group_id: Resource Group identifier tag.
387387
388-
scope: A scope is a combination of scope objects which provides additional context.
388+
name: Name of the resource group
389389
390-
meta: Attributes associated to the resource group.
390+
scope: A scope is a combination of scope objects which provides additional context.
391391
392392
extra_headers: Send extra headers
393393
@@ -405,8 +405,8 @@ async def update(
405405
f"/accounts/{account_id}/iam/resource_groups/{resource_group_id}",
406406
body=await async_maybe_transform(
407407
{
408+
"name": name,
408409
"scope": scope,
409-
"meta": meta,
410410
},
411411
resource_group_update_params.ResourceGroupUpdateParams,
412412
),

src/cloudflare/types/iam/resource_group_create_params.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ class ResourceGroupCreateParams(TypedDict, total=False):
1212
account_id: Required[str]
1313
"""Account identifier tag."""
1414

15+
name: Required[str]
16+
"""Name of the resource group"""
17+
1518
scope: Required[Scope]
1619
"""A scope is a combination of scope objects which provides additional context."""
1720

18-
meta: object
19-
"""Attributes associated to the resource group."""
20-
2121

2222
class ScopeObject(TypedDict, total=False):
2323
key: Required[str]

src/cloudflare/types/iam/resource_group_update_params.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ class ResourceGroupUpdateParams(TypedDict, total=False):
1212
account_id: Required[str]
1313
"""Account identifier tag."""
1414

15-
scope: Required[Scope]
16-
"""A scope is a combination of scope objects which provides additional context."""
15+
name: str
16+
"""Name of the resource group"""
1717

18-
meta: object
19-
"""Attributes associated to the resource group."""
18+
scope: Scope
19+
"""A scope is a combination of scope objects which provides additional context."""
2020

2121

2222
class ScopeObject(TypedDict, total=False):

tests/api_resources/iam/test_resource_groups.py

Lines changed: 10 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -28,29 +28,19 @@ class TestResourceGroups:
2828
def test_method_create(self, client: Cloudflare) -> None:
2929
resource_group = client.iam.resource_groups.create(
3030
account_id="eb78d65290b24279ba6f44721b3ea3c4",
31+
name="NewResourceGroup",
3132
scope={
3233
"key": "com.cloudflare.api.account.eb78d65290b24279ba6f44721b3ea3c4",
3334
"objects": [{"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}],
3435
},
3536
)
3637
assert_matches_type(ResourceGroupCreateResponse, resource_group, path=["response"])
3738

38-
@parametrize
39-
def test_method_create_with_all_params(self, client: Cloudflare) -> None:
40-
resource_group = client.iam.resource_groups.create(
41-
account_id="eb78d65290b24279ba6f44721b3ea3c4",
42-
scope={
43-
"key": "com.cloudflare.api.account.eb78d65290b24279ba6f44721b3ea3c4",
44-
"objects": [{"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}],
45-
},
46-
meta={"editable": "false"},
47-
)
48-
assert_matches_type(ResourceGroupCreateResponse, resource_group, path=["response"])
49-
5039
@parametrize
5140
def test_raw_response_create(self, client: Cloudflare) -> None:
5241
response = client.iam.resource_groups.with_raw_response.create(
5342
account_id="eb78d65290b24279ba6f44721b3ea3c4",
43+
name="NewResourceGroup",
5444
scope={
5545
"key": "com.cloudflare.api.account.eb78d65290b24279ba6f44721b3ea3c4",
5646
"objects": [{"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}],
@@ -66,6 +56,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None:
6656
def test_streaming_response_create(self, client: Cloudflare) -> None:
6757
with client.iam.resource_groups.with_streaming_response.create(
6858
account_id="eb78d65290b24279ba6f44721b3ea3c4",
59+
name="NewResourceGroup",
6960
scope={
7061
"key": "com.cloudflare.api.account.eb78d65290b24279ba6f44721b3ea3c4",
7162
"objects": [{"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}],
@@ -84,6 +75,7 @@ def test_path_params_create(self, client: Cloudflare) -> None:
8475
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
8576
client.iam.resource_groups.with_raw_response.create(
8677
account_id="",
78+
name="NewResourceGroup",
8779
scope={
8880
"key": "com.cloudflare.api.account.eb78d65290b24279ba6f44721b3ea3c4",
8981
"objects": [{"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}],
@@ -95,10 +87,6 @@ def test_method_update(self, client: Cloudflare) -> None:
9587
resource_group = client.iam.resource_groups.update(
9688
resource_group_id="6d7f2f5f5b1d4a0e9081fdc98d432fd1",
9789
account_id="eb78d65290b24279ba6f44721b3ea3c4",
98-
scope={
99-
"key": "com.cloudflare.api.account.eb78d65290b24279ba6f44721b3ea3c4",
100-
"objects": [{"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}],
101-
},
10290
)
10391
assert_matches_type(ResourceGroupUpdateResponse, resource_group, path=["response"])
10492

@@ -107,11 +95,11 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None:
10795
resource_group = client.iam.resource_groups.update(
10896
resource_group_id="6d7f2f5f5b1d4a0e9081fdc98d432fd1",
10997
account_id="eb78d65290b24279ba6f44721b3ea3c4",
98+
name="UpdatedResourceGroup",
11099
scope={
111100
"key": "com.cloudflare.api.account.eb78d65290b24279ba6f44721b3ea3c4",
112101
"objects": [{"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}],
113102
},
114-
meta={"editable": "false"},
115103
)
116104
assert_matches_type(ResourceGroupUpdateResponse, resource_group, path=["response"])
117105

@@ -120,10 +108,6 @@ def test_raw_response_update(self, client: Cloudflare) -> None:
120108
response = client.iam.resource_groups.with_raw_response.update(
121109
resource_group_id="6d7f2f5f5b1d4a0e9081fdc98d432fd1",
122110
account_id="eb78d65290b24279ba6f44721b3ea3c4",
123-
scope={
124-
"key": "com.cloudflare.api.account.eb78d65290b24279ba6f44721b3ea3c4",
125-
"objects": [{"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}],
126-
},
127111
)
128112

129113
assert response.is_closed is True
@@ -136,10 +120,6 @@ def test_streaming_response_update(self, client: Cloudflare) -> None:
136120
with client.iam.resource_groups.with_streaming_response.update(
137121
resource_group_id="6d7f2f5f5b1d4a0e9081fdc98d432fd1",
138122
account_id="eb78d65290b24279ba6f44721b3ea3c4",
139-
scope={
140-
"key": "com.cloudflare.api.account.eb78d65290b24279ba6f44721b3ea3c4",
141-
"objects": [{"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}],
142-
},
143123
) as response:
144124
assert not response.is_closed
145125
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -155,20 +135,12 @@ def test_path_params_update(self, client: Cloudflare) -> None:
155135
client.iam.resource_groups.with_raw_response.update(
156136
resource_group_id="6d7f2f5f5b1d4a0e9081fdc98d432fd1",
157137
account_id="",
158-
scope={
159-
"key": "com.cloudflare.api.account.eb78d65290b24279ba6f44721b3ea3c4",
160-
"objects": [{"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}],
161-
},
162138
)
163139

164140
with pytest.raises(ValueError, match=r"Expected a non-empty value for `resource_group_id` but received ''"):
165141
client.iam.resource_groups.with_raw_response.update(
166142
resource_group_id="",
167143
account_id="eb78d65290b24279ba6f44721b3ea3c4",
168-
scope={
169-
"key": "com.cloudflare.api.account.eb78d65290b24279ba6f44721b3ea3c4",
170-
"objects": [{"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}],
171-
},
172144
)
173145

174146
@parametrize
@@ -324,29 +296,19 @@ class TestAsyncResourceGroups:
324296
async def test_method_create(self, async_client: AsyncCloudflare) -> None:
325297
resource_group = await async_client.iam.resource_groups.create(
326298
account_id="eb78d65290b24279ba6f44721b3ea3c4",
299+
name="NewResourceGroup",
327300
scope={
328301
"key": "com.cloudflare.api.account.eb78d65290b24279ba6f44721b3ea3c4",
329302
"objects": [{"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}],
330303
},
331304
)
332305
assert_matches_type(ResourceGroupCreateResponse, resource_group, path=["response"])
333306

334-
@parametrize
335-
async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None:
336-
resource_group = await async_client.iam.resource_groups.create(
337-
account_id="eb78d65290b24279ba6f44721b3ea3c4",
338-
scope={
339-
"key": "com.cloudflare.api.account.eb78d65290b24279ba6f44721b3ea3c4",
340-
"objects": [{"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}],
341-
},
342-
meta={"editable": "false"},
343-
)
344-
assert_matches_type(ResourceGroupCreateResponse, resource_group, path=["response"])
345-
346307
@parametrize
347308
async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None:
348309
response = await async_client.iam.resource_groups.with_raw_response.create(
349310
account_id="eb78d65290b24279ba6f44721b3ea3c4",
311+
name="NewResourceGroup",
350312
scope={
351313
"key": "com.cloudflare.api.account.eb78d65290b24279ba6f44721b3ea3c4",
352314
"objects": [{"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}],
@@ -362,6 +324,7 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None:
362324
async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None:
363325
async with async_client.iam.resource_groups.with_streaming_response.create(
364326
account_id="eb78d65290b24279ba6f44721b3ea3c4",
327+
name="NewResourceGroup",
365328
scope={
366329
"key": "com.cloudflare.api.account.eb78d65290b24279ba6f44721b3ea3c4",
367330
"objects": [{"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}],
@@ -380,6 +343,7 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None:
380343
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
381344
await async_client.iam.resource_groups.with_raw_response.create(
382345
account_id="",
346+
name="NewResourceGroup",
383347
scope={
384348
"key": "com.cloudflare.api.account.eb78d65290b24279ba6f44721b3ea3c4",
385349
"objects": [{"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}],
@@ -391,10 +355,6 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None:
391355
resource_group = await async_client.iam.resource_groups.update(
392356
resource_group_id="6d7f2f5f5b1d4a0e9081fdc98d432fd1",
393357
account_id="eb78d65290b24279ba6f44721b3ea3c4",
394-
scope={
395-
"key": "com.cloudflare.api.account.eb78d65290b24279ba6f44721b3ea3c4",
396-
"objects": [{"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}],
397-
},
398358
)
399359
assert_matches_type(ResourceGroupUpdateResponse, resource_group, path=["response"])
400360

@@ -403,11 +363,11 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare
403363
resource_group = await async_client.iam.resource_groups.update(
404364
resource_group_id="6d7f2f5f5b1d4a0e9081fdc98d432fd1",
405365
account_id="eb78d65290b24279ba6f44721b3ea3c4",
366+
name="UpdatedResourceGroup",
406367
scope={
407368
"key": "com.cloudflare.api.account.eb78d65290b24279ba6f44721b3ea3c4",
408369
"objects": [{"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}],
409370
},
410-
meta={"editable": "false"},
411371
)
412372
assert_matches_type(ResourceGroupUpdateResponse, resource_group, path=["response"])
413373

@@ -416,10 +376,6 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None:
416376
response = await async_client.iam.resource_groups.with_raw_response.update(
417377
resource_group_id="6d7f2f5f5b1d4a0e9081fdc98d432fd1",
418378
account_id="eb78d65290b24279ba6f44721b3ea3c4",
419-
scope={
420-
"key": "com.cloudflare.api.account.eb78d65290b24279ba6f44721b3ea3c4",
421-
"objects": [{"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}],
422-
},
423379
)
424380

425381
assert response.is_closed is True
@@ -432,10 +388,6 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) ->
432388
async with async_client.iam.resource_groups.with_streaming_response.update(
433389
resource_group_id="6d7f2f5f5b1d4a0e9081fdc98d432fd1",
434390
account_id="eb78d65290b24279ba6f44721b3ea3c4",
435-
scope={
436-
"key": "com.cloudflare.api.account.eb78d65290b24279ba6f44721b3ea3c4",
437-
"objects": [{"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}],
438-
},
439391
) as response:
440392
assert not response.is_closed
441393
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -451,20 +403,12 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None:
451403
await async_client.iam.resource_groups.with_raw_response.update(
452404
resource_group_id="6d7f2f5f5b1d4a0e9081fdc98d432fd1",
453405
account_id="",
454-
scope={
455-
"key": "com.cloudflare.api.account.eb78d65290b24279ba6f44721b3ea3c4",
456-
"objects": [{"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}],
457-
},
458406
)
459407

460408
with pytest.raises(ValueError, match=r"Expected a non-empty value for `resource_group_id` but received ''"):
461409
await async_client.iam.resource_groups.with_raw_response.update(
462410
resource_group_id="",
463411
account_id="eb78d65290b24279ba6f44721b3ea3c4",
464-
scope={
465-
"key": "com.cloudflare.api.account.eb78d65290b24279ba6f44721b3ea3c4",
466-
"objects": [{"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}],
467-
},
468412
)
469413

470414
@parametrize

0 commit comments

Comments
 (0)