@typespec/http-client-python 0.6.10 → 0.6.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/emitter/emitter.d.ts.map +1 -1
- package/dist/emitter/emitter.js +3 -1
- package/dist/emitter/emitter.js.map +1 -1
- package/emitter/src/emitter.ts +6 -4
- package/emitter/temp/tsconfig.tsbuildinfo +1 -1
- package/eng/scripts/ci/regenerate.ts +3 -0
- package/eng/scripts/setup/__pycache__/venvtools.cpython-38.pyc +0 -0
- package/generator/build/lib/pygen/black.py +13 -2
- package/generator/build/lib/pygen/codegen/models/client.py +0 -8
- package/generator/build/lib/pygen/codegen/serializers/builder_serializer.py +18 -33
- package/generator/build/lib/pygen/codegen/serializers/model_serializer.py +1 -7
- package/generator/build/lib/pygen/codegen/templates/client.py.jinja2 +1 -1
- package/generator/build/lib/pygen/codegen/templates/macros.jinja2 +0 -4
- package/generator/build/lib/pygen/codegen/templates/operation_tools.jinja2 +0 -3
- package/generator/build/lib/pygen/codegen/templates/serialization.py.jinja2 +1 -1
- package/generator/component-detection-pip-report.json +1 -1
- package/generator/dist/pygen-0.1.0-py3-none-any.whl +0 -0
- package/generator/pygen/black.py +13 -2
- package/generator/pygen/codegen/models/client.py +0 -8
- package/generator/pygen/codegen/serializers/builder_serializer.py +18 -33
- package/generator/pygen/codegen/serializers/model_serializer.py +1 -7
- package/generator/pygen/codegen/templates/client.py.jinja2 +1 -1
- package/generator/pygen/codegen/templates/macros.jinja2 +0 -4
- package/generator/pygen/codegen/templates/operation_tools.jinja2 +0 -3
- package/generator/pygen/codegen/templates/serialization.py.jinja2 +1 -1
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_arm_operationtemplates_async.py +92 -0
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_arm_resource_async.py +199 -3
- package/generator/test/azure/mock_api_tests/test_azure_arm_operationtemplates.py +80 -0
- package/generator/test/azure/mock_api_tests/test_azure_arm_resource.py +187 -3
- package/generator/test/azure/requirements.txt +1 -0
- package/package.json +30 -28
|
@@ -14,7 +14,10 @@ RESOURCE_GROUP_NAME = "test-rg"
|
|
|
14
14
|
@pytest.fixture
|
|
15
15
|
async def client(credential, authentication_policy):
|
|
16
16
|
async with ResourcesClient(
|
|
17
|
-
credential,
|
|
17
|
+
credential,
|
|
18
|
+
SUBSCRIPTION_ID,
|
|
19
|
+
"http://localhost:3000",
|
|
20
|
+
authentication_policy=authentication_policy,
|
|
18
21
|
) as client:
|
|
19
22
|
yield client
|
|
20
23
|
|
|
@@ -23,7 +26,10 @@ async def client(credential, authentication_policy):
|
|
|
23
26
|
async def test_client_signature(credential, authentication_policy):
|
|
24
27
|
# make sure signautre order is correct
|
|
25
28
|
client1 = ResourcesClient(
|
|
26
|
-
credential,
|
|
29
|
+
credential,
|
|
30
|
+
SUBSCRIPTION_ID,
|
|
31
|
+
"http://localhost:3000",
|
|
32
|
+
authentication_policy=authentication_policy,
|
|
27
33
|
)
|
|
28
34
|
# make sure signautre name is correct
|
|
29
35
|
client2 = ResourcesClient(
|
|
@@ -36,7 +42,10 @@ async def test_client_signature(credential, authentication_policy):
|
|
|
36
42
|
# make sure signautre order is correct
|
|
37
43
|
await client.top_level.get(RESOURCE_GROUP_NAME, "top")
|
|
38
44
|
# make sure signautre name is correct
|
|
39
|
-
await client.top_level.get(
|
|
45
|
+
await client.top_level.get(
|
|
46
|
+
resource_group_name=RESOURCE_GROUP_NAME,
|
|
47
|
+
top_level_tracked_resource_name="top",
|
|
48
|
+
)
|
|
40
49
|
|
|
41
50
|
|
|
42
51
|
@pytest.mark.asyncio
|
|
@@ -280,3 +289,190 @@ async def test_singleton_list_by_resource_group(client):
|
|
|
280
289
|
assert result.name == "default"
|
|
281
290
|
assert result.type == "Azure.ResourceManager.Resources/singletonTrackedResources"
|
|
282
291
|
assert result.system_data.created_by == "AzureSDK"
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
@pytest.mark.asyncio
|
|
295
|
+
@pytest.mark.parametrize(
|
|
296
|
+
"scope",
|
|
297
|
+
[
|
|
298
|
+
"",
|
|
299
|
+
"/subscriptions/00000000-0000-0000-0000-000000000000",
|
|
300
|
+
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg",
|
|
301
|
+
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top",
|
|
302
|
+
],
|
|
303
|
+
)
|
|
304
|
+
async def test_extensions_resources_begin_create_or_update(client, scope):
|
|
305
|
+
result = await (
|
|
306
|
+
await client.extensions_resources.begin_create_or_update(
|
|
307
|
+
resource_uri=scope,
|
|
308
|
+
extensions_resource_name="extension",
|
|
309
|
+
resource=models.ExtensionsResource(properties=models.ExtensionsResourceProperties(description="valid")),
|
|
310
|
+
)
|
|
311
|
+
).result()
|
|
312
|
+
assert result.id == f"{scope}/providers/Azure.ResourceManager.Resources/extensionsResources/extension"
|
|
313
|
+
assert result.name == "extension"
|
|
314
|
+
assert result.type == "Azure.ResourceManager.Resources/extensionsResources"
|
|
315
|
+
assert result.properties.description == "valid"
|
|
316
|
+
assert result.properties.provisioning_state == "Succeeded"
|
|
317
|
+
assert result.system_data.created_by == "AzureSDK"
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
@pytest.mark.asyncio
|
|
321
|
+
@pytest.mark.parametrize(
|
|
322
|
+
"scope",
|
|
323
|
+
[
|
|
324
|
+
"",
|
|
325
|
+
"/subscriptions/00000000-0000-0000-0000-000000000000",
|
|
326
|
+
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg",
|
|
327
|
+
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top",
|
|
328
|
+
],
|
|
329
|
+
)
|
|
330
|
+
async def test_extensions_resources_update(client, scope):
|
|
331
|
+
result = await client.extensions_resources.update(
|
|
332
|
+
resource_uri=scope,
|
|
333
|
+
extensions_resource_name="extension",
|
|
334
|
+
properties=models.ExtensionsResource(properties=models.ExtensionsResourceProperties(description="valid2")),
|
|
335
|
+
)
|
|
336
|
+
assert result.id == f"{scope}/providers/Azure.ResourceManager.Resources/extensionsResources/extension"
|
|
337
|
+
assert result.name == "extension"
|
|
338
|
+
assert result.type == "Azure.ResourceManager.Resources/extensionsResources"
|
|
339
|
+
assert result.properties.description == "valid2"
|
|
340
|
+
assert result.properties.provisioning_state == "Succeeded"
|
|
341
|
+
assert result.system_data.created_by == "AzureSDK"
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
@pytest.mark.asyncio
|
|
345
|
+
@pytest.mark.parametrize(
|
|
346
|
+
"scope",
|
|
347
|
+
[
|
|
348
|
+
"",
|
|
349
|
+
"/subscriptions/00000000-0000-0000-0000-000000000000",
|
|
350
|
+
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg",
|
|
351
|
+
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top",
|
|
352
|
+
],
|
|
353
|
+
)
|
|
354
|
+
async def test_extensions_resources_get(client, scope):
|
|
355
|
+
result = await client.extensions_resources.get(resource_uri=scope, extensions_resource_name="extension")
|
|
356
|
+
assert result.id == f"{scope}/providers/Azure.ResourceManager.Resources/extensionsResources/extension"
|
|
357
|
+
assert result.name == "extension"
|
|
358
|
+
assert result.type == "Azure.ResourceManager.Resources/extensionsResources"
|
|
359
|
+
assert result.properties.description == "valid"
|
|
360
|
+
assert result.properties.provisioning_state == "Succeeded"
|
|
361
|
+
assert result.system_data.created_by == "AzureSDK"
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
@pytest.mark.asyncio
|
|
365
|
+
@pytest.mark.parametrize(
|
|
366
|
+
"scope",
|
|
367
|
+
[
|
|
368
|
+
"",
|
|
369
|
+
"/subscriptions/00000000-0000-0000-0000-000000000000",
|
|
370
|
+
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg",
|
|
371
|
+
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top",
|
|
372
|
+
],
|
|
373
|
+
)
|
|
374
|
+
async def test_extensions_resources_list_by_scope(client, scope):
|
|
375
|
+
response = client.extensions_resources.list_by_scope(
|
|
376
|
+
resource_uri=scope,
|
|
377
|
+
)
|
|
378
|
+
result = [r async for r in response]
|
|
379
|
+
for result in result:
|
|
380
|
+
assert result.id == f"{scope}/providers/Azure.ResourceManager.Resources/extensionsResources/extension"
|
|
381
|
+
assert result.name == "extension"
|
|
382
|
+
assert result.type == "Azure.ResourceManager.Resources/extensionsResources"
|
|
383
|
+
assert result.properties.description == "valid"
|
|
384
|
+
assert result.properties.provisioning_state == "Succeeded"
|
|
385
|
+
assert result.system_data.created_by == "AzureSDK"
|
|
386
|
+
|
|
387
|
+
|
|
388
|
+
@pytest.mark.asyncio
|
|
389
|
+
@pytest.mark.parametrize(
|
|
390
|
+
"scope",
|
|
391
|
+
[
|
|
392
|
+
"",
|
|
393
|
+
"/subscriptions/00000000-0000-0000-0000-000000000000",
|
|
394
|
+
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg",
|
|
395
|
+
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top",
|
|
396
|
+
],
|
|
397
|
+
)
|
|
398
|
+
async def test_extensions_resources_delete(client, scope):
|
|
399
|
+
await client.extensions_resources.delete(resource_uri=scope, extensions_resource_name="extension")
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
@pytest.mark.asyncio
|
|
403
|
+
async def test_location_resources_create_or_update(client):
|
|
404
|
+
result = await client.location_resources.create_or_update(
|
|
405
|
+
location="eastus",
|
|
406
|
+
location_resource_name="resource",
|
|
407
|
+
resource=models.LocationResource(properties=models.LocationResourceProperties(description="valid")),
|
|
408
|
+
)
|
|
409
|
+
assert (
|
|
410
|
+
result.id
|
|
411
|
+
== "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.Resources/locations/eastus/locationResources/resource"
|
|
412
|
+
)
|
|
413
|
+
assert result.name == "resource"
|
|
414
|
+
assert result.type == "Azure.ResourceManager.Resources/locationResources"
|
|
415
|
+
assert result.properties.description == "valid"
|
|
416
|
+
assert result.properties.provisioning_state == "Succeeded"
|
|
417
|
+
assert result.system_data.created_by == "AzureSDK"
|
|
418
|
+
|
|
419
|
+
|
|
420
|
+
@pytest.mark.asyncio
|
|
421
|
+
async def test_location_resources_update(client):
|
|
422
|
+
result = await client.location_resources.update(
|
|
423
|
+
location="eastus",
|
|
424
|
+
location_resource_name="resource",
|
|
425
|
+
properties=models.LocationResource(properties=models.LocationResourceProperties(description="valid2")),
|
|
426
|
+
)
|
|
427
|
+
assert (
|
|
428
|
+
result.id
|
|
429
|
+
== "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.Resources/locations/eastus/locationResources/resource"
|
|
430
|
+
)
|
|
431
|
+
assert result.name == "resource"
|
|
432
|
+
assert result.type == "Azure.ResourceManager.Resources/locationResources"
|
|
433
|
+
assert result.properties.description == "valid2"
|
|
434
|
+
assert result.properties.provisioning_state == "Succeeded"
|
|
435
|
+
assert result.system_data.created_by == "AzureSDK"
|
|
436
|
+
|
|
437
|
+
|
|
438
|
+
@pytest.mark.asyncio
|
|
439
|
+
async def test_location_resources_get(client):
|
|
440
|
+
result = await client.location_resources.get(
|
|
441
|
+
location="eastus",
|
|
442
|
+
location_resource_name="resource",
|
|
443
|
+
)
|
|
444
|
+
assert (
|
|
445
|
+
result.id
|
|
446
|
+
== "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.Resources/locations/eastus/locationResources/resource"
|
|
447
|
+
)
|
|
448
|
+
assert result.name == "resource"
|
|
449
|
+
assert result.type == "Azure.ResourceManager.Resources/locationResources"
|
|
450
|
+
assert result.properties.description == "valid"
|
|
451
|
+
assert result.properties.provisioning_state == "Succeeded"
|
|
452
|
+
assert result.system_data.created_by == "AzureSDK"
|
|
453
|
+
|
|
454
|
+
|
|
455
|
+
@pytest.mark.asyncio
|
|
456
|
+
async def test_location_resources_delete(client):
|
|
457
|
+
await client.location_resources.delete(
|
|
458
|
+
location="eastus",
|
|
459
|
+
location_resource_name="resource",
|
|
460
|
+
)
|
|
461
|
+
|
|
462
|
+
|
|
463
|
+
@pytest.mark.asyncio
|
|
464
|
+
async def test_location_resources_list_by_location(client):
|
|
465
|
+
response = client.location_resources.list_by_location(
|
|
466
|
+
location="eastus",
|
|
467
|
+
)
|
|
468
|
+
result = [r async for r in response]
|
|
469
|
+
for result in result:
|
|
470
|
+
assert (
|
|
471
|
+
result.id
|
|
472
|
+
== "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.Resources/locations/eastus/locationResources/resource"
|
|
473
|
+
)
|
|
474
|
+
assert result.name == "resource"
|
|
475
|
+
assert result.type == "Azure.ResourceManager.Resources/locationResources"
|
|
476
|
+
assert result.properties.description == "valid"
|
|
477
|
+
assert result.properties.provisioning_state == "Succeeded"
|
|
478
|
+
assert result.system_data.created_by == "AzureSDK"
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# -------------------------------------------------------------------------
|
|
2
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
# Licensed under the MIT License. See License.txt in the project root for
|
|
4
|
+
# license information.
|
|
5
|
+
# --------------------------------------------------------------------------
|
|
6
|
+
import pytest
|
|
7
|
+
from azure.resourcemanager.operationtemplates import OperationTemplatesClient
|
|
8
|
+
from azure.resourcemanager.operationtemplates import models
|
|
9
|
+
|
|
10
|
+
SUBSCRIPTION_ID = "00000000-0000-0000-0000-000000000000"
|
|
11
|
+
RESOURCE_GROUP_NAME = "test-rg"
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@pytest.fixture
|
|
15
|
+
def client(credential, authentication_policy):
|
|
16
|
+
with OperationTemplatesClient(
|
|
17
|
+
credential,
|
|
18
|
+
SUBSCRIPTION_ID,
|
|
19
|
+
"http://localhost:3000",
|
|
20
|
+
authentication_policy=authentication_policy,
|
|
21
|
+
) as client:
|
|
22
|
+
yield client
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def test_check_name_availability_check_global(client):
|
|
26
|
+
result = client.check_name_availability.check_global(
|
|
27
|
+
body=models.CheckNameAvailabilityRequest(name="checkName", type="Microsoft.Web/site")
|
|
28
|
+
)
|
|
29
|
+
assert result.name_available == False
|
|
30
|
+
assert result.reason == models.CheckNameAvailabilityReason.ALREADY_EXISTS
|
|
31
|
+
assert result.message == "Hostname 'checkName' already exists. Please select a different name."
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def test_check_name_availability_check_local(client):
|
|
35
|
+
result = client.check_name_availability.check_local(
|
|
36
|
+
location="westus",
|
|
37
|
+
body=models.CheckNameAvailabilityRequest(name="checkName", type="Microsoft.Web/site"),
|
|
38
|
+
)
|
|
39
|
+
assert result.name_available == False
|
|
40
|
+
assert result.reason == models.CheckNameAvailabilityReason.ALREADY_EXISTS
|
|
41
|
+
assert result.message == "Hostname 'checkName' already exists. Please select a different name."
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def test_operations_list(client):
|
|
45
|
+
result = client.operations.list()
|
|
46
|
+
assert result
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def test_lro_begin_create_or_replace(client):
|
|
50
|
+
result = client.lro.begin_create_or_replace(
|
|
51
|
+
resource_group_name=RESOURCE_GROUP_NAME,
|
|
52
|
+
order_name="order1",
|
|
53
|
+
resource=models.Order(
|
|
54
|
+
location="eastus",
|
|
55
|
+
properties=models.OrderProperties(product_id="product1", amount=1),
|
|
56
|
+
),
|
|
57
|
+
).result()
|
|
58
|
+
assert result.name == "order1"
|
|
59
|
+
assert (
|
|
60
|
+
result.id
|
|
61
|
+
== "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.OperationTemplates/orders/order1"
|
|
62
|
+
)
|
|
63
|
+
assert result.type == "Azure.ResourceManager.Resources/orders"
|
|
64
|
+
assert result.location == "eastus"
|
|
65
|
+
assert result.system_data.created_by == "AzureSDK"
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def test_lro_begin_export(client):
|
|
69
|
+
client.lro.begin_export(
|
|
70
|
+
resource_group_name=RESOURCE_GROUP_NAME,
|
|
71
|
+
order_name="order1",
|
|
72
|
+
body=models.ExportRequest(format="csv"),
|
|
73
|
+
).result()
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def test_lro_begin_delete(client):
|
|
77
|
+
client.lro.begin_delete(
|
|
78
|
+
resource_group_name=RESOURCE_GROUP_NAME,
|
|
79
|
+
order_name="order1",
|
|
80
|
+
).result()
|
|
@@ -14,7 +14,10 @@ RESOURCE_GROUP_NAME = "test-rg"
|
|
|
14
14
|
@pytest.fixture
|
|
15
15
|
def client(credential, authentication_policy):
|
|
16
16
|
with ResourcesClient(
|
|
17
|
-
credential,
|
|
17
|
+
credential,
|
|
18
|
+
SUBSCRIPTION_ID,
|
|
19
|
+
"http://localhost:3000",
|
|
20
|
+
authentication_policy=authentication_policy,
|
|
18
21
|
) as client:
|
|
19
22
|
yield client
|
|
20
23
|
|
|
@@ -22,7 +25,10 @@ def client(credential, authentication_policy):
|
|
|
22
25
|
def test_client_signature(credential, authentication_policy):
|
|
23
26
|
# make sure signautre order is correct
|
|
24
27
|
client1 = ResourcesClient(
|
|
25
|
-
credential,
|
|
28
|
+
credential,
|
|
29
|
+
SUBSCRIPTION_ID,
|
|
30
|
+
"http://localhost:3000",
|
|
31
|
+
authentication_policy=authentication_policy,
|
|
26
32
|
)
|
|
27
33
|
# make sure signautre name is correct
|
|
28
34
|
client2 = ResourcesClient(
|
|
@@ -35,7 +41,10 @@ def test_client_signature(credential, authentication_policy):
|
|
|
35
41
|
# make sure signautre order is correct
|
|
36
42
|
client.top_level.get(RESOURCE_GROUP_NAME, "top")
|
|
37
43
|
# make sure signautre name is correct
|
|
38
|
-
client.top_level.get(
|
|
44
|
+
client.top_level.get(
|
|
45
|
+
resource_group_name=RESOURCE_GROUP_NAME,
|
|
46
|
+
top_level_tracked_resource_name="top",
|
|
47
|
+
)
|
|
39
48
|
|
|
40
49
|
|
|
41
50
|
def test_top_level_begin_create_or_replace(client):
|
|
@@ -250,3 +259,178 @@ def test_singleton_list_by_resource_group(client):
|
|
|
250
259
|
assert result.name == "default"
|
|
251
260
|
assert result.type == "Azure.ResourceManager.Resources/singletonTrackedResources"
|
|
252
261
|
assert result.system_data.created_by == "AzureSDK"
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
@pytest.mark.parametrize(
|
|
265
|
+
"scope",
|
|
266
|
+
[
|
|
267
|
+
"",
|
|
268
|
+
"/subscriptions/00000000-0000-0000-0000-000000000000",
|
|
269
|
+
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg",
|
|
270
|
+
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top",
|
|
271
|
+
],
|
|
272
|
+
)
|
|
273
|
+
def test_extensions_resources_begin_create_or_update(client, scope):
|
|
274
|
+
result = client.extensions_resources.begin_create_or_update(
|
|
275
|
+
resource_uri=scope,
|
|
276
|
+
extensions_resource_name="extension",
|
|
277
|
+
resource=models.ExtensionsResource(properties=models.ExtensionsResourceProperties(description="valid")),
|
|
278
|
+
).result()
|
|
279
|
+
assert result.id == f"{scope}/providers/Azure.ResourceManager.Resources/extensionsResources/extension"
|
|
280
|
+
assert result.name == "extension"
|
|
281
|
+
assert result.type == "Azure.ResourceManager.Resources/extensionsResources"
|
|
282
|
+
assert result.properties.description == "valid"
|
|
283
|
+
assert result.properties.provisioning_state == "Succeeded"
|
|
284
|
+
assert result.system_data.created_by == "AzureSDK"
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
@pytest.mark.parametrize(
|
|
288
|
+
"scope",
|
|
289
|
+
[
|
|
290
|
+
"",
|
|
291
|
+
"/subscriptions/00000000-0000-0000-0000-000000000000",
|
|
292
|
+
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg",
|
|
293
|
+
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top",
|
|
294
|
+
],
|
|
295
|
+
)
|
|
296
|
+
def test_extensions_resources_update(client, scope):
|
|
297
|
+
result = client.extensions_resources.update(
|
|
298
|
+
resource_uri=scope,
|
|
299
|
+
extensions_resource_name="extension",
|
|
300
|
+
properties=models.ExtensionsResource(properties=models.ExtensionsResourceProperties(description="valid2")),
|
|
301
|
+
)
|
|
302
|
+
assert result.id == f"{scope}/providers/Azure.ResourceManager.Resources/extensionsResources/extension"
|
|
303
|
+
assert result.name == "extension"
|
|
304
|
+
assert result.type == "Azure.ResourceManager.Resources/extensionsResources"
|
|
305
|
+
assert result.properties.description == "valid2"
|
|
306
|
+
assert result.properties.provisioning_state == "Succeeded"
|
|
307
|
+
assert result.system_data.created_by == "AzureSDK"
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
@pytest.mark.parametrize(
|
|
311
|
+
"scope",
|
|
312
|
+
[
|
|
313
|
+
"",
|
|
314
|
+
"/subscriptions/00000000-0000-0000-0000-000000000000",
|
|
315
|
+
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg",
|
|
316
|
+
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top",
|
|
317
|
+
],
|
|
318
|
+
)
|
|
319
|
+
def test_extensions_resources_get(client, scope):
|
|
320
|
+
result = client.extensions_resources.get(resource_uri=scope, extensions_resource_name="extension")
|
|
321
|
+
assert result.id == f"{scope}/providers/Azure.ResourceManager.Resources/extensionsResources/extension"
|
|
322
|
+
assert result.name == "extension"
|
|
323
|
+
assert result.type == "Azure.ResourceManager.Resources/extensionsResources"
|
|
324
|
+
assert result.properties.description == "valid"
|
|
325
|
+
assert result.properties.provisioning_state == "Succeeded"
|
|
326
|
+
assert result.system_data.created_by == "AzureSDK"
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
@pytest.mark.parametrize(
|
|
330
|
+
"scope",
|
|
331
|
+
[
|
|
332
|
+
"",
|
|
333
|
+
"/subscriptions/00000000-0000-0000-0000-000000000000",
|
|
334
|
+
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg",
|
|
335
|
+
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top",
|
|
336
|
+
],
|
|
337
|
+
)
|
|
338
|
+
def test_extensions_resources_list(client, scope):
|
|
339
|
+
response = client.extensions_resources.list_by_scope(
|
|
340
|
+
resource_uri=scope,
|
|
341
|
+
)
|
|
342
|
+
result = [r for r in response]
|
|
343
|
+
for result in result:
|
|
344
|
+
assert result.id == f"{scope}/providers/Azure.ResourceManager.Resources/extensionsResources/extension"
|
|
345
|
+
assert result.name == "extension"
|
|
346
|
+
assert result.type == "Azure.ResourceManager.Resources/extensionsResources"
|
|
347
|
+
assert result.properties.description == "valid"
|
|
348
|
+
assert result.properties.provisioning_state == "Succeeded"
|
|
349
|
+
assert result.system_data.created_by == "AzureSDK"
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
@pytest.mark.parametrize(
|
|
353
|
+
"scope",
|
|
354
|
+
[
|
|
355
|
+
"",
|
|
356
|
+
"/subscriptions/00000000-0000-0000-0000-000000000000",
|
|
357
|
+
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg",
|
|
358
|
+
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top",
|
|
359
|
+
],
|
|
360
|
+
)
|
|
361
|
+
def test_extensions_resources_delete(client, scope):
|
|
362
|
+
client.extensions_resources.delete(resource_uri=scope, extensions_resource_name="extension")
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
def test_location_resources_create_or_update(client):
|
|
366
|
+
result = client.location_resources.create_or_update(
|
|
367
|
+
location="eastus",
|
|
368
|
+
location_resource_name="resource",
|
|
369
|
+
resource=models.LocationResource(properties=models.LocationResourceProperties(description="valid")),
|
|
370
|
+
)
|
|
371
|
+
assert (
|
|
372
|
+
result.id
|
|
373
|
+
== "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.Resources/locations/eastus/locationResources/resource"
|
|
374
|
+
)
|
|
375
|
+
assert result.name == "resource"
|
|
376
|
+
assert result.type == "Azure.ResourceManager.Resources/locationResources"
|
|
377
|
+
assert result.properties.description == "valid"
|
|
378
|
+
assert result.properties.provisioning_state == "Succeeded"
|
|
379
|
+
assert result.system_data.created_by == "AzureSDK"
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
def test_location_resources_update(client):
|
|
383
|
+
result = client.location_resources.update(
|
|
384
|
+
location="eastus",
|
|
385
|
+
location_resource_name="resource",
|
|
386
|
+
properties=models.LocationResource(properties=models.LocationResourceProperties(description="valid2")),
|
|
387
|
+
)
|
|
388
|
+
assert (
|
|
389
|
+
result.id
|
|
390
|
+
== "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.Resources/locations/eastus/locationResources/resource"
|
|
391
|
+
)
|
|
392
|
+
assert result.name == "resource"
|
|
393
|
+
assert result.type == "Azure.ResourceManager.Resources/locationResources"
|
|
394
|
+
assert result.properties.description == "valid2"
|
|
395
|
+
assert result.properties.provisioning_state == "Succeeded"
|
|
396
|
+
assert result.system_data.created_by == "AzureSDK"
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
def test_location_resources_get(client):
|
|
400
|
+
result = client.location_resources.get(
|
|
401
|
+
location="eastus",
|
|
402
|
+
location_resource_name="resource",
|
|
403
|
+
)
|
|
404
|
+
assert (
|
|
405
|
+
result.id
|
|
406
|
+
== "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.Resources/locations/eastus/locationResources/resource"
|
|
407
|
+
)
|
|
408
|
+
assert result.name == "resource"
|
|
409
|
+
assert result.type == "Azure.ResourceManager.Resources/locationResources"
|
|
410
|
+
assert result.properties.description == "valid"
|
|
411
|
+
assert result.properties.provisioning_state == "Succeeded"
|
|
412
|
+
assert result.system_data.created_by == "AzureSDK"
|
|
413
|
+
|
|
414
|
+
|
|
415
|
+
def test_location_resources_delete(client):
|
|
416
|
+
client.location_resources.delete(
|
|
417
|
+
location="eastus",
|
|
418
|
+
location_resource_name="resource",
|
|
419
|
+
)
|
|
420
|
+
|
|
421
|
+
|
|
422
|
+
def test_location_resources_list_by_location(client):
|
|
423
|
+
response = client.location_resources.list_by_location(
|
|
424
|
+
location="eastus",
|
|
425
|
+
)
|
|
426
|
+
result = [r for r in response]
|
|
427
|
+
for result in result:
|
|
428
|
+
assert (
|
|
429
|
+
result.id
|
|
430
|
+
== "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.Resources/locations/eastus/locationResources/resource"
|
|
431
|
+
)
|
|
432
|
+
assert result.name == "resource"
|
|
433
|
+
assert result.type == "Azure.ResourceManager.Resources/locationResources"
|
|
434
|
+
assert result.properties.description == "valid"
|
|
435
|
+
assert result.properties.provisioning_state == "Succeeded"
|
|
436
|
+
assert result.system_data.created_by == "AzureSDK"
|
|
@@ -17,6 +17,7 @@ azure-mgmt-core==1.3.2
|
|
|
17
17
|
-e ./generated/azure-special-headers-client-request-id/
|
|
18
18
|
-e ./generated/azure-example-basic
|
|
19
19
|
-e ./generated/azure-resource-manager-common-properties
|
|
20
|
+
-e ./generated/azure-resource-manager-operation-templates
|
|
20
21
|
-e ./generated/azure-resource-manager-resources
|
|
21
22
|
# -e ./generated/client-namespace
|
|
22
23
|
-e ./generated/azure-payload-pageable
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@typespec/http-client-python",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.11",
|
|
4
4
|
"author": "Microsoft Corporation",
|
|
5
5
|
"description": "TypeSpec emitter for Python SDKs",
|
|
6
6
|
"homepage": "https://typespec.io",
|
|
@@ -41,7 +41,9 @@
|
|
|
41
41
|
"ci": "npm run test:emitter && npm run ci:generator --",
|
|
42
42
|
"ci:generator": "tsx ./eng/scripts/ci/run-ci.ts",
|
|
43
43
|
"test:generator": "tsx ./eng/scripts/ci/run-ci.ts --command=test",
|
|
44
|
-
"test:emitter": "vitest run -c ./emitter/vitest.config.ts"
|
|
44
|
+
"test:emitter": "vitest run -c ./emitter/vitest.config.ts",
|
|
45
|
+
"change:version": "pnpm chronus version --ignore-policies --only @typespec/http-client-python",
|
|
46
|
+
"change:add": "pnpm chronus add"
|
|
45
47
|
},
|
|
46
48
|
"files": [
|
|
47
49
|
"dist/**",
|
|
@@ -51,16 +53,16 @@
|
|
|
51
53
|
"emitter"
|
|
52
54
|
],
|
|
53
55
|
"peerDependencies": {
|
|
54
|
-
"@azure-tools/typespec-autorest": ">=0.
|
|
55
|
-
"@azure-tools/typespec-azure-core": ">=0.
|
|
56
|
-
"@azure-tools/typespec-azure-resource-manager": ">=0.
|
|
57
|
-
"@azure-tools/typespec-azure-rulesets": ">=0.
|
|
58
|
-
"@azure-tools/typespec-client-generator-core": ">=0.
|
|
59
|
-
"@typespec/compiler": ">=0.
|
|
60
|
-
"@typespec/http": ">=0.
|
|
61
|
-
"@typespec/openapi": ">=0.
|
|
62
|
-
"@typespec/rest": ">=0.
|
|
63
|
-
"@typespec/versioning": ">=0.
|
|
56
|
+
"@azure-tools/typespec-autorest": ">=0.51.0 <1.0.0",
|
|
57
|
+
"@azure-tools/typespec-azure-core": ">=0.51.0 <1.0.0",
|
|
58
|
+
"@azure-tools/typespec-azure-resource-manager": ">=0.51.0 <1.0.0",
|
|
59
|
+
"@azure-tools/typespec-azure-rulesets": ">=0.51.0 <3.0.0",
|
|
60
|
+
"@azure-tools/typespec-client-generator-core": ">=0.51.1 <1.0.0",
|
|
61
|
+
"@typespec/compiler": ">=0.65.0 <1.0.0",
|
|
62
|
+
"@typespec/http": ">=0.65.0 <1.0.0",
|
|
63
|
+
"@typespec/openapi": ">=0.65.0 <1.0.0",
|
|
64
|
+
"@typespec/rest": ">=0.65.0 <1.0.0",
|
|
65
|
+
"@typespec/versioning": ">=0.65.0 <1.0.0"
|
|
64
66
|
},
|
|
65
67
|
"dependencies": {
|
|
66
68
|
"js-yaml": "~4.1.0",
|
|
@@ -69,26 +71,26 @@
|
|
|
69
71
|
"tsx": "~4.19.1"
|
|
70
72
|
},
|
|
71
73
|
"devDependencies": {
|
|
72
|
-
"@azure-tools/azure-http-specs": "0.1.0-alpha.
|
|
73
|
-
"@azure-tools/typespec-autorest": "~0.
|
|
74
|
-
"@azure-tools/typespec-azure-core": "~0.
|
|
75
|
-
"@azure-tools/typespec-azure-resource-manager": "~0.
|
|
76
|
-
"@azure-tools/typespec-azure-rulesets": "~0.
|
|
77
|
-
"@azure-tools/typespec-client-generator-core": "~0.
|
|
74
|
+
"@azure-tools/azure-http-specs": "0.1.0-alpha.6",
|
|
75
|
+
"@azure-tools/typespec-autorest": "~0.51.0",
|
|
76
|
+
"@azure-tools/typespec-azure-core": "~0.51.0",
|
|
77
|
+
"@azure-tools/typespec-azure-resource-manager": "~0.51.0",
|
|
78
|
+
"@azure-tools/typespec-azure-rulesets": "~0.51.0",
|
|
79
|
+
"@azure-tools/typespec-client-generator-core": "~0.51.1",
|
|
78
80
|
"@types/js-yaml": "~4.0.5",
|
|
79
81
|
"@types/node": "~22.5.4",
|
|
80
82
|
"@types/semver": "7.5.8",
|
|
81
|
-
"@typespec/compiler": "~0.
|
|
82
|
-
"@typespec/http": "~0.
|
|
83
|
-
"@typespec/http-specs": "0.1.0-alpha.
|
|
84
|
-
"@typespec/openapi": "~0.
|
|
85
|
-
"@typespec/rest": "~0.
|
|
86
|
-
"@typespec/versioning": "~0.
|
|
87
|
-
"c8": "^10.1.
|
|
83
|
+
"@typespec/compiler": "~0.65.0",
|
|
84
|
+
"@typespec/http": "~0.65.0",
|
|
85
|
+
"@typespec/http-specs": "0.1.0-alpha.9",
|
|
86
|
+
"@typespec/openapi": "~0.65.0",
|
|
87
|
+
"@typespec/rest": "~0.65.0",
|
|
88
|
+
"@typespec/versioning": "~0.65.0",
|
|
89
|
+
"c8": "^10.1.3",
|
|
88
90
|
"chalk": "5.3.0",
|
|
89
91
|
"rimraf": "~6.0.1",
|
|
90
|
-
"typescript": "~5.
|
|
91
|
-
"typescript-eslint": "^8.
|
|
92
|
-
"vitest": "^
|
|
92
|
+
"typescript": "~5.7.3",
|
|
93
|
+
"typescript-eslint": "^8.21.0",
|
|
94
|
+
"vitest": "^3.0.5"
|
|
93
95
|
}
|
|
94
96
|
}
|