зеркало из https://github.com/microsoft/azure-cli.git
[Compute] `az disk-access`: Add new command group to operate disk access resource (#14460)
* Add command support for new resource: disk-access * fix typos in help file * fix live test * make location optional for creating and updating * fix test issue
This commit is contained in:
Родитель
e4578aaed9
Коммит
ad36d05eb0
|
@ -136,6 +136,7 @@ AZURE_API_PROFILES = {
|
|||
'resource_skus': '2019-04-01',
|
||||
'disks': '2020-05-01',
|
||||
'disk_encryption_sets': '2020-05-01',
|
||||
'disk_accesses': '2020-05-01',
|
||||
'snapshots': '2019-07-01',
|
||||
'galleries': '2019-12-01',
|
||||
'gallery_images': '2019-12-01',
|
||||
|
|
|
@ -81,6 +81,10 @@ def cf_snapshots(cli_ctx, _):
|
|||
return _compute_client_factory(cli_ctx).snapshots
|
||||
|
||||
|
||||
def cf_disk_accesses(cli_ctx, _):
|
||||
return _compute_client_factory(cli_ctx).disk_accesses
|
||||
|
||||
|
||||
def cf_images(cli_ctx, _):
|
||||
return _compute_client_factory(cli_ctx).images
|
||||
|
||||
|
|
|
@ -118,6 +118,65 @@ examples:
|
|||
crafted: true
|
||||
"""
|
||||
|
||||
helps['disk-access'] = """
|
||||
type: group
|
||||
short-summary: Manage disk access resources.
|
||||
"""
|
||||
|
||||
helps['disk-access create'] = """
|
||||
type: command
|
||||
short-summary: Create a disk access resource.
|
||||
examples:
|
||||
- name: Create a disk access resource.
|
||||
text: >
|
||||
az disk-access create -g MyResourceGroup -l centraluseuap -n MyDiskAccess
|
||||
"""
|
||||
|
||||
helps['disk-access update'] = """
|
||||
type: command
|
||||
short-summary: Update a disk access resource.
|
||||
examples:
|
||||
- name: Update a disk access resource.
|
||||
text: >
|
||||
az disk-access update -g MyResourceGroup -n MyDiskAccess --tags tag1=val1 tag2=val2
|
||||
"""
|
||||
|
||||
helps['disk-access list'] = """
|
||||
type: command
|
||||
short-summary: List disk access resources.
|
||||
examples:
|
||||
- name: List all disk access reosurces in a resource group.
|
||||
text: |
|
||||
az disk-access list -g MyResourceGroup
|
||||
"""
|
||||
|
||||
helps['disk-access show'] = """
|
||||
type: command
|
||||
short-summary: Get information of a disk access resource.
|
||||
examples:
|
||||
- name: Get information of a disk access reosurce.
|
||||
text: |
|
||||
az disk-access show -g MyResourceGroup -n MyDiskAccess
|
||||
"""
|
||||
|
||||
helps['disk-access delete'] = """
|
||||
type: command
|
||||
short-summary: Delete a disk access resource.
|
||||
examples:
|
||||
- name: Delete a disk access reosurce.
|
||||
text: |
|
||||
az disk-access delete -g MyResourceGroup -n MyDiskAccess
|
||||
"""
|
||||
|
||||
helps['disk-access wait'] = """
|
||||
type: command
|
||||
short-summary: Place the CLI in a waiting state until a condition of a disk access is met.
|
||||
examples:
|
||||
- name: Place the CLI in a waiting state until the disk access is created with 'provisioningState' at 'Succeeded'.
|
||||
text: |
|
||||
az disk-access wait --created -g MyResourceGroup -n MyDiskAccess
|
||||
"""
|
||||
|
||||
helps['disk-encryption-set'] = """
|
||||
type: group
|
||||
short-summary: Disk Encryption Set resource.
|
||||
|
|
|
@ -940,3 +940,10 @@ def load_arguments(self, _):
|
|||
c.argument('location', validator=get_default_location_from_resource_group)
|
||||
c.argument('tags', tags_type)
|
||||
# endregion
|
||||
|
||||
# region DiskAccess
|
||||
with self.argument_context('disk-access', resource_type=ResourceType.MGMT_COMPUTE, operation_group='disk_accesses') as c:
|
||||
c.argument('disk_access_name', arg_type=name_arg_type, help='Name of the disk access resource.', id_part='name')
|
||||
c.argument('location', validator=get_default_location_from_resource_group)
|
||||
c.argument('tags', tags_type)
|
||||
# endRegion
|
||||
|
|
|
@ -8,7 +8,7 @@ from azure.cli.command_modules.vm._client_factory import (cf_vm, cf_avail_set, c
|
|||
cf_vm_image, cf_vm_image_term, cf_usage,
|
||||
cf_vmss, cf_vmss_vm,
|
||||
cf_vm_sizes, cf_disks, cf_snapshots,
|
||||
cf_images, cf_run_commands,
|
||||
cf_disk_accesses, cf_images, cf_run_commands,
|
||||
cf_rolling_upgrade_commands, cf_galleries,
|
||||
cf_gallery_images, cf_gallery_image_versions,
|
||||
cf_proximity_placement_groups,
|
||||
|
@ -65,6 +65,12 @@ def load_command_table(self, _):
|
|||
operation_group='disks'
|
||||
)
|
||||
|
||||
compute_disk_access_sdk = CliCommandType(
|
||||
operations_tmpl='azure.mgmt.compute.operations#DiskAccessesOperations.{}',
|
||||
client_factory=cf_disk_accesses,
|
||||
operation_group='disk_accesses'
|
||||
)
|
||||
|
||||
compute_image_sdk = CliCommandType(
|
||||
operations_tmpl='azure.mgmt.compute.operations#ImagesOperations.{}',
|
||||
client_factory=cf_images
|
||||
|
@ -205,6 +211,14 @@ def load_command_table(self, _):
|
|||
g.show_command('show', 'get')
|
||||
g.custom_command('list', 'list_disk_encryption_sets')
|
||||
|
||||
with self.command_group('disk-access', compute_disk_access_sdk, operation_group='disk_accesses', client_factory=cf_disk_accesses, min_api='2020-05-01') as g:
|
||||
g.custom_command('create', 'create_disk_access', supports_no_wait=True)
|
||||
g.generic_update_command('update', setter_name='set_disk_access', setter_type=compute_custom, supports_no_wait=True)
|
||||
g.show_command('show', 'get')
|
||||
g.custom_command('list', 'list_disk_accesses')
|
||||
g.wait_command('wait')
|
||||
g.command('delete', 'delete')
|
||||
|
||||
with self.command_group('image', compute_image_sdk, min_api='2016-04-30-preview') as g:
|
||||
g.custom_command('create', 'create_image', validator=process_image_create_namespace)
|
||||
g.custom_command('list', 'list_images')
|
||||
|
|
|
@ -3410,3 +3410,25 @@ def update_disk_encryption_set(instance, client, resource_group_name, key_url=No
|
|||
return instance
|
||||
|
||||
# endregion
|
||||
|
||||
|
||||
# region Disk Access
|
||||
def create_disk_access(cmd, client, resource_group_name, disk_access_name, location=None, tags=None, no_wait=False):
|
||||
return sdk_no_wait(no_wait, client.create_or_update,
|
||||
resource_group_name, disk_access_name,
|
||||
location=location, tags=tags)
|
||||
|
||||
|
||||
def list_disk_accesses(cmd, client, resource_group_name=None):
|
||||
if resource_group_name:
|
||||
return client.list_by_resource_group(resource_group_name)
|
||||
return client.list()
|
||||
|
||||
|
||||
def set_disk_access(cmd, client, parameters, resource_group_name, disk_access_name, tags=None, no_wait=False):
|
||||
location = _get_resource_group_location(cmd.cli_ctx, resource_group_name)
|
||||
return sdk_no_wait(no_wait, client.create_or_update,
|
||||
resource_group_name, disk_access_name,
|
||||
location=location, tags=tags)
|
||||
|
||||
# endregion
|
||||
|
|
|
@ -0,0 +1,684 @@
|
|||
interactions:
|
||||
- request:
|
||||
body: '{"location": "centraluseuap"}'
|
||||
headers:
|
||||
Accept:
|
||||
- application/json
|
||||
Accept-Encoding:
|
||||
- gzip, deflate
|
||||
CommandName:
|
||||
- disk-access create
|
||||
Connection:
|
||||
- keep-alive
|
||||
Content-Length:
|
||||
- '29'
|
||||
Content-Type:
|
||||
- application/json; charset=utf-8
|
||||
ParameterSetName:
|
||||
- -g -l -n
|
||||
User-Agent:
|
||||
- python/3.8.2 (Windows-10-10.0.18362-SP0) msrest/0.6.9 msrest_azure/0.6.3 azure-mgmt-compute/13.0.0
|
||||
Azure-SDK-For-Python AZURECLI/2.9.1
|
||||
accept-language:
|
||||
- en-US
|
||||
method: PUT
|
||||
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_disk_access_000001/providers/Microsoft.Compute/diskAccesses/mydiskaccess?api-version=2020-05-01
|
||||
response:
|
||||
body:
|
||||
string: "{\r\n \"name\": \"mydiskaccess\",\r\n \"type\": \"Microsoft.Compute/diskAccesses\",\r\n
|
||||
\ \"location\": \"centraluseuap\"\r\n}"
|
||||
headers:
|
||||
azure-asyncoperation:
|
||||
- https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/centraluseuap/DiskOperations/6ded4d76-496d-4745-9733-bd15dd64f05e?api-version=2020-05-01
|
||||
cache-control:
|
||||
- no-cache
|
||||
content-length:
|
||||
- '107'
|
||||
content-type:
|
||||
- application/json; charset=utf-8
|
||||
date:
|
||||
- Wed, 29 Jul 2020 04:32:48 GMT
|
||||
expires:
|
||||
- '-1'
|
||||
location:
|
||||
- https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/centraluseuap/DiskOperations/6ded4d76-496d-4745-9733-bd15dd64f05e?monitor=true&api-version=2020-05-01
|
||||
pragma:
|
||||
- no-cache
|
||||
server:
|
||||
- Microsoft-HTTPAPI/2.0
|
||||
- Microsoft-HTTPAPI/2.0
|
||||
strict-transport-security:
|
||||
- max-age=31536000; includeSubDomains
|
||||
x-content-type-options:
|
||||
- nosniff
|
||||
x-ms-ratelimit-remaining-subscription-writes:
|
||||
- '1199'
|
||||
status:
|
||||
code: 202
|
||||
message: Accepted
|
||||
- request:
|
||||
body: null
|
||||
headers:
|
||||
Accept:
|
||||
- application/json
|
||||
Accept-Encoding:
|
||||
- gzip, deflate
|
||||
CommandName:
|
||||
- disk-access create
|
||||
Connection:
|
||||
- keep-alive
|
||||
ParameterSetName:
|
||||
- -g -l -n
|
||||
User-Agent:
|
||||
- python/3.8.2 (Windows-10-10.0.18362-SP0) msrest/0.6.9 msrest_azure/0.6.3 azure-mgmt-compute/13.0.0
|
||||
Azure-SDK-For-Python AZURECLI/2.9.1
|
||||
method: GET
|
||||
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/centraluseuap/DiskOperations/6ded4d76-496d-4745-9733-bd15dd64f05e?api-version=2020-05-01
|
||||
response:
|
||||
body:
|
||||
string: "{\r\n \"startTime\": \"2020-07-29T04:32:48.5667075+00:00\",\r\n \"endTime\":
|
||||
\"2020-07-29T04:32:50.2239397+00:00\",\r\n \"status\": \"Succeeded\",\r\n
|
||||
\ \"properties\": {\r\n \"output\": {\"name\":\"mydiskaccess\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CLI_TEST_DISK_ACCESS_TMVH6ZNFABJY3L4LAZIYW4H4E7BAR66I5JSZ5BD6XZN7I2457RWQQQ/providers/Microsoft.Compute/diskAccesses/mydiskaccess\",\"type\":\"Microsoft.Compute/diskAccesses\",\"location\":\"centraluseuap\",\"properties\":{\"provisioningState\":\"Succeeded\",\"timeCreated\":\"2020-07-29T04:32:48.5823151+00:00\"}}\r\n
|
||||
\ },\r\n \"name\": \"6ded4d76-496d-4745-9733-bd15dd64f05e\"\r\n}"
|
||||
headers:
|
||||
cache-control:
|
||||
- no-cache
|
||||
content-length:
|
||||
- '616'
|
||||
content-type:
|
||||
- application/json; charset=utf-8
|
||||
date:
|
||||
- Wed, 29 Jul 2020 04:33:19 GMT
|
||||
expires:
|
||||
- '-1'
|
||||
pragma:
|
||||
- no-cache
|
||||
server:
|
||||
- Microsoft-HTTPAPI/2.0
|
||||
- Microsoft-HTTPAPI/2.0
|
||||
strict-transport-security:
|
||||
- max-age=31536000; includeSubDomains
|
||||
transfer-encoding:
|
||||
- chunked
|
||||
vary:
|
||||
- Accept-Encoding
|
||||
x-content-type-options:
|
||||
- nosniff
|
||||
x-ms-ratelimit-remaining-resource:
|
||||
- Microsoft.Compute/GetOperation3Min;49998,Microsoft.Compute/GetOperation30Min;399992
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
- request:
|
||||
body: null
|
||||
headers:
|
||||
Accept:
|
||||
- application/json
|
||||
Accept-Encoding:
|
||||
- gzip, deflate
|
||||
CommandName:
|
||||
- disk-access create
|
||||
Connection:
|
||||
- keep-alive
|
||||
ParameterSetName:
|
||||
- -g -l -n
|
||||
User-Agent:
|
||||
- python/3.8.2 (Windows-10-10.0.18362-SP0) msrest/0.6.9 msrest_azure/0.6.3 azure-mgmt-compute/13.0.0
|
||||
Azure-SDK-For-Python AZURECLI/2.9.1
|
||||
method: GET
|
||||
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_disk_access_000001/providers/Microsoft.Compute/diskAccesses/mydiskaccess?api-version=2020-05-01
|
||||
response:
|
||||
body:
|
||||
string: "{\r\n \"name\": \"mydiskaccess\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CLI_TEST_DISK_ACCESS_TMVH6ZNFABJY3L4LAZIYW4H4E7BAR66I5JSZ5BD6XZN7I2457RWQQQ/providers/Microsoft.Compute/diskAccesses/mydiskaccess\",\r\n
|
||||
\ \"type\": \"Microsoft.Compute/diskAccesses\",\r\n \"location\": \"centraluseuap\",\r\n
|
||||
\ \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"timeCreated\":
|
||||
\"2020-07-29T04:32:48.5823151+00:00\"\r\n }\r\n}"
|
||||
headers:
|
||||
cache-control:
|
||||
- no-cache
|
||||
content-length:
|
||||
- '436'
|
||||
content-type:
|
||||
- application/json; charset=utf-8
|
||||
date:
|
||||
- Wed, 29 Jul 2020 04:33:19 GMT
|
||||
expires:
|
||||
- '-1'
|
||||
pragma:
|
||||
- no-cache
|
||||
server:
|
||||
- Microsoft-HTTPAPI/2.0
|
||||
- Microsoft-HTTPAPI/2.0
|
||||
strict-transport-security:
|
||||
- max-age=31536000; includeSubDomains
|
||||
transfer-encoding:
|
||||
- chunked
|
||||
vary:
|
||||
- Accept-Encoding
|
||||
x-content-type-options:
|
||||
- nosniff
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
- request:
|
||||
body: null
|
||||
headers:
|
||||
Accept:
|
||||
- application/json
|
||||
Accept-Encoding:
|
||||
- gzip, deflate
|
||||
CommandName:
|
||||
- disk-access list
|
||||
Connection:
|
||||
- keep-alive
|
||||
ParameterSetName:
|
||||
- -g
|
||||
User-Agent:
|
||||
- python/3.8.2 (Windows-10-10.0.18362-SP0) msrest/0.6.9 msrest_azure/0.6.3 azure-mgmt-compute/13.0.0
|
||||
Azure-SDK-For-Python AZURECLI/2.9.1
|
||||
accept-language:
|
||||
- en-US
|
||||
method: GET
|
||||
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_disk_access_000001/providers/Microsoft.Compute/diskAccesses?api-version=2020-05-01
|
||||
response:
|
||||
body:
|
||||
string: "{\r\n \"value\": [\r\n {\r\n \"name\": \"mydiskaccess\",\r\n
|
||||
\ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CLI_TEST_DISK_ACCESS_TMVH6ZNFABJY3L4LAZIYW4H4E7BAR66I5JSZ5BD6XZN7I2457RWQQQ/providers/Microsoft.Compute/diskAccesses/mydiskaccess\",\r\n
|
||||
\ \"type\": \"Microsoft.Compute/diskAccesses\",\r\n \"location\":
|
||||
\"centraluseuap\",\r\n \"properties\": {\r\n \"provisioningState\":
|
||||
\"Succeeded\",\r\n \"timeCreated\": \"2020-07-29T04:32:48.5823151+00:00\"\r\n
|
||||
\ }\r\n }\r\n ]\r\n}"
|
||||
headers:
|
||||
cache-control:
|
||||
- no-cache
|
||||
content-length:
|
||||
- '501'
|
||||
content-type:
|
||||
- application/json; charset=utf-8
|
||||
date:
|
||||
- Wed, 29 Jul 2020 04:33:22 GMT
|
||||
expires:
|
||||
- '-1'
|
||||
pragma:
|
||||
- no-cache
|
||||
server:
|
||||
- Microsoft-HTTPAPI/2.0
|
||||
- Microsoft-HTTPAPI/2.0
|
||||
strict-transport-security:
|
||||
- max-age=31536000; includeSubDomains
|
||||
transfer-encoding:
|
||||
- chunked
|
||||
vary:
|
||||
- Accept-Encoding
|
||||
x-content-type-options:
|
||||
- nosniff
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
- request:
|
||||
body: null
|
||||
headers:
|
||||
Accept:
|
||||
- application/json
|
||||
Accept-Encoding:
|
||||
- gzip, deflate
|
||||
CommandName:
|
||||
- disk-access update
|
||||
Connection:
|
||||
- keep-alive
|
||||
ParameterSetName:
|
||||
- -g -n --tags
|
||||
User-Agent:
|
||||
- python/3.8.2 (Windows-10-10.0.18362-SP0) msrest/0.6.9 msrest_azure/0.6.3 azure-mgmt-compute/13.0.0
|
||||
Azure-SDK-For-Python AZURECLI/2.9.1
|
||||
accept-language:
|
||||
- en-US
|
||||
method: GET
|
||||
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_disk_access_000001/providers/Microsoft.Compute/diskAccesses/mydiskaccess?api-version=2020-05-01
|
||||
response:
|
||||
body:
|
||||
string: "{\r\n \"name\": \"mydiskaccess\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CLI_TEST_DISK_ACCESS_TMVH6ZNFABJY3L4LAZIYW4H4E7BAR66I5JSZ5BD6XZN7I2457RWQQQ/providers/Microsoft.Compute/diskAccesses/mydiskaccess\",\r\n
|
||||
\ \"type\": \"Microsoft.Compute/diskAccesses\",\r\n \"location\": \"centraluseuap\",\r\n
|
||||
\ \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"timeCreated\":
|
||||
\"2020-07-29T04:32:48.5823151+00:00\"\r\n }\r\n}"
|
||||
headers:
|
||||
cache-control:
|
||||
- no-cache
|
||||
content-length:
|
||||
- '436'
|
||||
content-type:
|
||||
- application/json; charset=utf-8
|
||||
date:
|
||||
- Wed, 29 Jul 2020 04:33:22 GMT
|
||||
expires:
|
||||
- '-1'
|
||||
pragma:
|
||||
- no-cache
|
||||
server:
|
||||
- Microsoft-HTTPAPI/2.0
|
||||
- Microsoft-HTTPAPI/2.0
|
||||
strict-transport-security:
|
||||
- max-age=31536000; includeSubDomains
|
||||
transfer-encoding:
|
||||
- chunked
|
||||
vary:
|
||||
- Accept-Encoding
|
||||
x-content-type-options:
|
||||
- nosniff
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
- request:
|
||||
body: null
|
||||
headers:
|
||||
Accept:
|
||||
- application/json
|
||||
Accept-Encoding:
|
||||
- gzip, deflate
|
||||
CommandName:
|
||||
- disk-access update
|
||||
Connection:
|
||||
- keep-alive
|
||||
ParameterSetName:
|
||||
- -g -n --tags
|
||||
User-Agent:
|
||||
- python/3.8.2 (Windows-10-10.0.18362-SP0) msrest/0.6.9 msrest_azure/0.6.3 azure-mgmt-resource/10.1.0
|
||||
Azure-SDK-For-Python AZURECLI/2.9.1
|
||||
accept-language:
|
||||
- en-US
|
||||
method: GET
|
||||
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_disk_access_000001?api-version=2020-06-01
|
||||
response:
|
||||
body:
|
||||
string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_disk_access_000001","name":"cli_test_disk_access_000001","type":"Microsoft.Resources/resourceGroups","location":"centraluseuap","tags":{"product":"azurecli","cause":"automation","date":"2020-07-29T04:32:36Z"},"properties":{"provisioningState":"Succeeded"}}'
|
||||
headers:
|
||||
cache-control:
|
||||
- no-cache
|
||||
content-length:
|
||||
- '435'
|
||||
content-type:
|
||||
- application/json; charset=utf-8
|
||||
date:
|
||||
- Wed, 29 Jul 2020 04:33:23 GMT
|
||||
expires:
|
||||
- '-1'
|
||||
pragma:
|
||||
- no-cache
|
||||
strict-transport-security:
|
||||
- max-age=31536000; includeSubDomains
|
||||
vary:
|
||||
- Accept-Encoding
|
||||
x-content-type-options:
|
||||
- nosniff
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
- request:
|
||||
body: '{"location": "centraluseuap", "tags": {"tag1": "val1"}}'
|
||||
headers:
|
||||
Accept:
|
||||
- application/json
|
||||
Accept-Encoding:
|
||||
- gzip, deflate
|
||||
CommandName:
|
||||
- disk-access update
|
||||
Connection:
|
||||
- keep-alive
|
||||
Content-Length:
|
||||
- '55'
|
||||
Content-Type:
|
||||
- application/json; charset=utf-8
|
||||
ParameterSetName:
|
||||
- -g -n --tags
|
||||
User-Agent:
|
||||
- python/3.8.2 (Windows-10-10.0.18362-SP0) msrest/0.6.9 msrest_azure/0.6.3 azure-mgmt-compute/13.0.0
|
||||
Azure-SDK-For-Python AZURECLI/2.9.1
|
||||
accept-language:
|
||||
- en-US
|
||||
method: PUT
|
||||
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_disk_access_000001/providers/Microsoft.Compute/diskAccesses/mydiskaccess?api-version=2020-05-01
|
||||
response:
|
||||
body:
|
||||
string: "{\r\n \"name\": \"mydiskaccess\",\r\n \"type\": \"Microsoft.Compute/diskAccesses\",\r\n
|
||||
\ \"location\": \"centraluseuap\",\r\n \"tags\": {\r\n \"tag1\": \"val1\"\r\n
|
||||
\ }\r\n}"
|
||||
headers:
|
||||
azure-asyncoperation:
|
||||
- https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/centraluseuap/DiskOperations/4c499a92-cae9-4179-bbdd-986259e833e9?api-version=2020-05-01
|
||||
cache-control:
|
||||
- no-cache
|
||||
content-length:
|
||||
- '146'
|
||||
content-type:
|
||||
- application/json; charset=utf-8
|
||||
date:
|
||||
- Wed, 29 Jul 2020 04:33:25 GMT
|
||||
expires:
|
||||
- '-1'
|
||||
location:
|
||||
- https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/centraluseuap/DiskOperations/4c499a92-cae9-4179-bbdd-986259e833e9?monitor=true&api-version=2020-05-01
|
||||
pragma:
|
||||
- no-cache
|
||||
server:
|
||||
- Microsoft-HTTPAPI/2.0
|
||||
- Microsoft-HTTPAPI/2.0
|
||||
strict-transport-security:
|
||||
- max-age=31536000; includeSubDomains
|
||||
x-content-type-options:
|
||||
- nosniff
|
||||
x-ms-ratelimit-remaining-subscription-writes:
|
||||
- '1198'
|
||||
status:
|
||||
code: 202
|
||||
message: Accepted
|
||||
- request:
|
||||
body: null
|
||||
headers:
|
||||
Accept:
|
||||
- application/json
|
||||
Accept-Encoding:
|
||||
- gzip, deflate
|
||||
CommandName:
|
||||
- disk-access update
|
||||
Connection:
|
||||
- keep-alive
|
||||
ParameterSetName:
|
||||
- -g -n --tags
|
||||
User-Agent:
|
||||
- python/3.8.2 (Windows-10-10.0.18362-SP0) msrest/0.6.9 msrest_azure/0.6.3 azure-mgmt-compute/13.0.0
|
||||
Azure-SDK-For-Python AZURECLI/2.9.1
|
||||
method: GET
|
||||
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/centraluseuap/DiskOperations/4c499a92-cae9-4179-bbdd-986259e833e9?api-version=2020-05-01
|
||||
response:
|
||||
body:
|
||||
string: "{\r\n \"startTime\": \"2020-07-29T04:33:25.0890084+00:00\",\r\n \"endTime\":
|
||||
\"2020-07-29T04:33:25.1358599+00:00\",\r\n \"status\": \"Succeeded\",\r\n
|
||||
\ \"properties\": {\r\n \"output\": {\"name\":\"mydiskaccess\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CLI_TEST_DISK_ACCESS_TMVH6ZNFABJY3L4LAZIYW4H4E7BAR66I5JSZ5BD6XZN7I2457RWQQQ/providers/Microsoft.Compute/diskAccesses/mydiskaccess\",\"type\":\"Microsoft.Compute/diskAccesses\",\"location\":\"centraluseuap\",\"tags\":{\"tag1\":\"val1\"},\"properties\":{\"provisioningState\":\"Succeeded\",\"timeCreated\":\"2020-07-29T04:32:48.5823151+00:00\"}}\r\n
|
||||
\ },\r\n \"name\": \"4c499a92-cae9-4179-bbdd-986259e833e9\"\r\n}"
|
||||
headers:
|
||||
cache-control:
|
||||
- no-cache
|
||||
content-length:
|
||||
- '639'
|
||||
content-type:
|
||||
- application/json; charset=utf-8
|
||||
date:
|
||||
- Wed, 29 Jul 2020 04:33:55 GMT
|
||||
expires:
|
||||
- '-1'
|
||||
pragma:
|
||||
- no-cache
|
||||
server:
|
||||
- Microsoft-HTTPAPI/2.0
|
||||
- Microsoft-HTTPAPI/2.0
|
||||
strict-transport-security:
|
||||
- max-age=31536000; includeSubDomains
|
||||
transfer-encoding:
|
||||
- chunked
|
||||
vary:
|
||||
- Accept-Encoding
|
||||
x-content-type-options:
|
||||
- nosniff
|
||||
x-ms-ratelimit-remaining-resource:
|
||||
- Microsoft.Compute/GetOperation3Min;49996,Microsoft.Compute/GetOperation30Min;399990
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
- request:
|
||||
body: null
|
||||
headers:
|
||||
Accept:
|
||||
- application/json
|
||||
Accept-Encoding:
|
||||
- gzip, deflate
|
||||
CommandName:
|
||||
- disk-access update
|
||||
Connection:
|
||||
- keep-alive
|
||||
ParameterSetName:
|
||||
- -g -n --tags
|
||||
User-Agent:
|
||||
- python/3.8.2 (Windows-10-10.0.18362-SP0) msrest/0.6.9 msrest_azure/0.6.3 azure-mgmt-compute/13.0.0
|
||||
Azure-SDK-For-Python AZURECLI/2.9.1
|
||||
method: GET
|
||||
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_disk_access_000001/providers/Microsoft.Compute/diskAccesses/mydiskaccess?api-version=2020-05-01
|
||||
response:
|
||||
body:
|
||||
string: "{\r\n \"name\": \"mydiskaccess\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CLI_TEST_DISK_ACCESS_TMVH6ZNFABJY3L4LAZIYW4H4E7BAR66I5JSZ5BD6XZN7I2457RWQQQ/providers/Microsoft.Compute/diskAccesses/mydiskaccess\",\r\n
|
||||
\ \"type\": \"Microsoft.Compute/diskAccesses\",\r\n \"location\": \"centraluseuap\",\r\n
|
||||
\ \"tags\": {\r\n \"tag1\": \"val1\"\r\n },\r\n \"properties\": {\r\n
|
||||
\ \"provisioningState\": \"Succeeded\",\r\n \"timeCreated\": \"2020-07-29T04:32:48.5823151+00:00\"\r\n
|
||||
\ }\r\n}"
|
||||
headers:
|
||||
cache-control:
|
||||
- no-cache
|
||||
content-length:
|
||||
- '475'
|
||||
content-type:
|
||||
- application/json; charset=utf-8
|
||||
date:
|
||||
- Wed, 29 Jul 2020 04:33:55 GMT
|
||||
expires:
|
||||
- '-1'
|
||||
pragma:
|
||||
- no-cache
|
||||
server:
|
||||
- Microsoft-HTTPAPI/2.0
|
||||
- Microsoft-HTTPAPI/2.0
|
||||
strict-transport-security:
|
||||
- max-age=31536000; includeSubDomains
|
||||
transfer-encoding:
|
||||
- chunked
|
||||
vary:
|
||||
- Accept-Encoding
|
||||
x-content-type-options:
|
||||
- nosniff
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
- request:
|
||||
body: null
|
||||
headers:
|
||||
Accept:
|
||||
- application/json
|
||||
Accept-Encoding:
|
||||
- gzip, deflate
|
||||
CommandName:
|
||||
- disk-access show
|
||||
Connection:
|
||||
- keep-alive
|
||||
ParameterSetName:
|
||||
- -g -n
|
||||
User-Agent:
|
||||
- python/3.8.2 (Windows-10-10.0.18362-SP0) msrest/0.6.9 msrest_azure/0.6.3 azure-mgmt-compute/13.0.0
|
||||
Azure-SDK-For-Python AZURECLI/2.9.1
|
||||
accept-language:
|
||||
- en-US
|
||||
method: GET
|
||||
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_disk_access_000001/providers/Microsoft.Compute/diskAccesses/mydiskaccess?api-version=2020-05-01
|
||||
response:
|
||||
body:
|
||||
string: "{\r\n \"name\": \"mydiskaccess\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/CLI_TEST_DISK_ACCESS_TMVH6ZNFABJY3L4LAZIYW4H4E7BAR66I5JSZ5BD6XZN7I2457RWQQQ/providers/Microsoft.Compute/diskAccesses/mydiskaccess\",\r\n
|
||||
\ \"type\": \"Microsoft.Compute/diskAccesses\",\r\n \"location\": \"centraluseuap\",\r\n
|
||||
\ \"tags\": {\r\n \"tag1\": \"val1\"\r\n },\r\n \"properties\": {\r\n
|
||||
\ \"provisioningState\": \"Succeeded\",\r\n \"timeCreated\": \"2020-07-29T04:32:48.5823151+00:00\"\r\n
|
||||
\ }\r\n}"
|
||||
headers:
|
||||
cache-control:
|
||||
- no-cache
|
||||
content-length:
|
||||
- '475'
|
||||
content-type:
|
||||
- application/json; charset=utf-8
|
||||
date:
|
||||
- Wed, 29 Jul 2020 04:33:57 GMT
|
||||
expires:
|
||||
- '-1'
|
||||
pragma:
|
||||
- no-cache
|
||||
server:
|
||||
- Microsoft-HTTPAPI/2.0
|
||||
- Microsoft-HTTPAPI/2.0
|
||||
strict-transport-security:
|
||||
- max-age=31536000; includeSubDomains
|
||||
transfer-encoding:
|
||||
- chunked
|
||||
vary:
|
||||
- Accept-Encoding
|
||||
x-content-type-options:
|
||||
- nosniff
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
- request:
|
||||
body: null
|
||||
headers:
|
||||
Accept:
|
||||
- application/json
|
||||
Accept-Encoding:
|
||||
- gzip, deflate
|
||||
CommandName:
|
||||
- disk-access delete
|
||||
Connection:
|
||||
- keep-alive
|
||||
Content-Length:
|
||||
- '0'
|
||||
ParameterSetName:
|
||||
- -g -n
|
||||
User-Agent:
|
||||
- python/3.8.2 (Windows-10-10.0.18362-SP0) msrest/0.6.9 msrest_azure/0.6.3 azure-mgmt-compute/13.0.0
|
||||
Azure-SDK-For-Python AZURECLI/2.9.1
|
||||
accept-language:
|
||||
- en-US
|
||||
method: DELETE
|
||||
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_disk_access_000001/providers/Microsoft.Compute/diskAccesses/mydiskaccess?api-version=2020-05-01
|
||||
response:
|
||||
body:
|
||||
string: 'null'
|
||||
headers:
|
||||
azure-asyncoperation:
|
||||
- https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/centraluseuap/DiskOperations/728e78fd-07fa-47d7-a99a-83cfa81a5f94?api-version=2020-05-01
|
||||
cache-control:
|
||||
- no-cache
|
||||
content-length:
|
||||
- '4'
|
||||
content-type:
|
||||
- application/json; charset=utf-8
|
||||
date:
|
||||
- Wed, 29 Jul 2020 04:33:58 GMT
|
||||
expires:
|
||||
- '-1'
|
||||
location:
|
||||
- https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/centraluseuap/DiskOperations/728e78fd-07fa-47d7-a99a-83cfa81a5f94?monitor=true&api-version=2020-05-01
|
||||
pragma:
|
||||
- no-cache
|
||||
server:
|
||||
- Microsoft-HTTPAPI/2.0
|
||||
- Microsoft-HTTPAPI/2.0
|
||||
strict-transport-security:
|
||||
- max-age=31536000; includeSubDomains
|
||||
x-content-type-options:
|
||||
- nosniff
|
||||
x-ms-ratelimit-remaining-subscription-deletes:
|
||||
- '14999'
|
||||
status:
|
||||
code: 202
|
||||
message: Accepted
|
||||
- request:
|
||||
body: null
|
||||
headers:
|
||||
Accept:
|
||||
- application/json
|
||||
Accept-Encoding:
|
||||
- gzip, deflate
|
||||
CommandName:
|
||||
- disk-access delete
|
||||
Connection:
|
||||
- keep-alive
|
||||
ParameterSetName:
|
||||
- -g -n
|
||||
User-Agent:
|
||||
- python/3.8.2 (Windows-10-10.0.18362-SP0) msrest/0.6.9 msrest_azure/0.6.3 azure-mgmt-compute/13.0.0
|
||||
Azure-SDK-For-Python AZURECLI/2.9.1
|
||||
method: GET
|
||||
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/centraluseuap/DiskOperations/728e78fd-07fa-47d7-a99a-83cfa81a5f94?api-version=2020-05-01
|
||||
response:
|
||||
body:
|
||||
string: "{\r\n \"startTime\": \"2020-07-29T04:33:59.0517021+00:00\",\r\n \"endTime\":
|
||||
\"2020-07-29T04:33:59.1923313+00:00\",\r\n \"status\": \"Succeeded\",\r\n
|
||||
\ \"name\": \"728e78fd-07fa-47d7-a99a-83cfa81a5f94\"\r\n}"
|
||||
headers:
|
||||
cache-control:
|
||||
- no-cache
|
||||
content-length:
|
||||
- '184'
|
||||
content-type:
|
||||
- application/json; charset=utf-8
|
||||
date:
|
||||
- Wed, 29 Jul 2020 04:34:29 GMT
|
||||
expires:
|
||||
- '-1'
|
||||
pragma:
|
||||
- no-cache
|
||||
server:
|
||||
- Microsoft-HTTPAPI/2.0
|
||||
- Microsoft-HTTPAPI/2.0
|
||||
strict-transport-security:
|
||||
- max-age=31536000; includeSubDomains
|
||||
transfer-encoding:
|
||||
- chunked
|
||||
vary:
|
||||
- Accept-Encoding
|
||||
x-content-type-options:
|
||||
- nosniff
|
||||
x-ms-ratelimit-remaining-resource:
|
||||
- Microsoft.Compute/GetOperation3Min;49994,Microsoft.Compute/GetOperation30Min;399988
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
- request:
|
||||
body: null
|
||||
headers:
|
||||
Accept:
|
||||
- application/json
|
||||
Accept-Encoding:
|
||||
- gzip, deflate
|
||||
CommandName:
|
||||
- disk-access list
|
||||
Connection:
|
||||
- keep-alive
|
||||
ParameterSetName:
|
||||
- -g
|
||||
User-Agent:
|
||||
- python/3.8.2 (Windows-10-10.0.18362-SP0) msrest/0.6.9 msrest_azure/0.6.3 azure-mgmt-compute/13.0.0
|
||||
Azure-SDK-For-Python AZURECLI/2.9.1
|
||||
accept-language:
|
||||
- en-US
|
||||
method: GET
|
||||
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_disk_access_000001/providers/Microsoft.Compute/diskAccesses?api-version=2020-05-01
|
||||
response:
|
||||
body:
|
||||
string: '{"value":[]}'
|
||||
headers:
|
||||
cache-control:
|
||||
- no-cache
|
||||
content-length:
|
||||
- '12'
|
||||
content-type:
|
||||
- application/json; charset=utf-8
|
||||
date:
|
||||
- Wed, 29 Jul 2020 04:34:30 GMT
|
||||
expires:
|
||||
- '-1'
|
||||
pragma:
|
||||
- no-cache
|
||||
strict-transport-security:
|
||||
- max-age=31536000; includeSubDomains
|
||||
vary:
|
||||
- Accept-Encoding
|
||||
x-content-type-options:
|
||||
- nosniff
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
version: 1
|
|
@ -4518,6 +4518,34 @@ class DiskEncryptionSetTest(ScenarioTest):
|
|||
self.cmd('vmss create -g {rg} -n {vmss1} --image centos --os-disk-encryption-set {des1} --admin-username azureuser --admin-password testPassword0 --authentication-type password')
|
||||
|
||||
|
||||
class DiskAccessTest(ScenarioTest):
|
||||
|
||||
@ResourceGroupPreparer(name_prefix='cli_test_disk_access_', location='centraluseuap')
|
||||
def test_disk_access(self, resource_group):
|
||||
self.kwargs.update({
|
||||
'loc': 'centraluseuap',
|
||||
'name': 'mydiskaccess'
|
||||
})
|
||||
|
||||
self.cmd('disk-access create -g {rg} -l {loc} -n {name}')
|
||||
self.cmd('disk-access list -g {rg}', checks=[
|
||||
self.check('length(@)', 1),
|
||||
self.check('[0].name', '{name}'),
|
||||
self.check('[0].location', '{loc}')
|
||||
])
|
||||
self.cmd('disk-access update -g {rg} -n {name} --tags tag1=val1')
|
||||
self.cmd('disk-access show -g {rg} -n {name}', checks=[
|
||||
self.check('name', '{name}'),
|
||||
self.check('location', '{loc}'),
|
||||
self.check('tags.tag1', 'val1')
|
||||
])
|
||||
|
||||
self.cmd('disk-access delete -g {rg} -n {name}')
|
||||
self.cmd('disk-access list -g {rg}', checks=[
|
||||
self.check('length(@)', 0)
|
||||
])
|
||||
|
||||
|
||||
class VMSSCreateDiskOptionTest(ScenarioTest):
|
||||
|
||||
@ResourceGroupPreparer(name_prefix='cli_test_vmss_create_disk_iops_mbps_', location='eastus')
|
||||
|
|
Загрузка…
Ссылка в новой задаче