Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/connectedvmware/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
Release History
===============

0.1.9
++++++
* Update API Version from 2020-10-01-preview to 2022-01-10-preview.
* Support for VM delete in retain mode.

0.1.8
++++++
* Displaying asterisks (*****) for password input.
Expand Down
2 changes: 1 addition & 1 deletion src/connectedvmware/azext_connectedvmware/_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

import argparse
from collections import defaultdict
from azext_connectedvmware.vmware_utils import create_dictionary_from_arg_string
from azure.cli.core.azclierror import InvalidArgumentValueError
from azext_connectedvmware.vmware_utils import create_dictionary_from_arg_string


class VmNicAddAction(argparse._AppendAction):
Expand Down
5 changes: 5 additions & 0 deletions src/connectedvmware/azext_connectedvmware/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,11 @@ def load_arguments(self, _):

with self.argument_context('connectedvmware vm delete') as c:
c.argument('force', action='store_true', help="Whether force delete or not.")
c.argument(
'retain',
action='store_true',
help='Disable the VM from azure; delete the ARM resource but retain the VM in VMware.',
)

with self.argument_context('connectedvmware vm stop') as c:
c.argument(
Expand Down
5 changes: 3 additions & 2 deletions src/connectedvmware/azext_connectedvmware/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

from pwinput import pwinput
from knack.util import CLIError
from azext_connectedvmware.vmware_utils import get_resource_id
from azure.cli.core.util import sdk_no_wait
from azext_connectedvmware.vmware_utils import get_resource_id
from .vmware_constants import (
VMWARE_NAMESPACE,
VCENTER_RESOURCE_TYPE,
Expand Down Expand Up @@ -975,11 +975,12 @@ def delete_vm(
resource_group_name,
resource_name,
force=False,
retain=None,
no_wait=False,
):

return sdk_no_wait(
no_wait, client.begin_delete, resource_group_name, resource_name, force
no_wait, client.begin_delete, resource_group_name, resource_name, force, retain,
)


Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def test_connectedvmware(self):
self.cmd('az connectedvmware vcenter list -g {rg}').get_output_in_json()
)
# vcenter count list should report 1
self.assertEqual(count, 1, 'vcenter resource count expected to be 1')
self.assertGreaterEqual(count, 1, 'vcenter resource count expected to be at least 1')

# Create resource-pool resource.
self.cmd(
Expand Down Expand Up @@ -189,12 +189,16 @@ def test_connectedvmware(self):
)

# Validate the show command output with vm name.
self.cmd(
vm = self.cmd(
'az connectedvmware vm show -g {rg} --name {vm_name}',
checks=[
self.check('name', '{vm_name}'),
],
)
).get_output_in_json()
vm_moRefId = vm['moRefId']
self.kwargs.update({ 'vm_moRefId': vm_moRefId })
self.assertIsNotNone(vm_moRefId)
self.assertNotEqual(len(vm_moRefId), 0, 'moRefId of the VM should not be empty')

# List the VM resources in this resource group.
resource_list = self.cmd(
Expand Down Expand Up @@ -247,6 +251,14 @@ def test_connectedvmware(self):
# Start VM.
self.cmd('az connectedvmware vm start -g {rg} --name {vm_name}')

# Disable the VM from azure; delete the ARM resource, retain the VM in vCenter.
self.cmd('az connectedvmware vm delete -g {rg} --name {vm_name} --retain -y')

# Enable the VM to azure again.
self.cmd(
'az connectedvmware vm create -g {rg} -l {loc} --custom-location {cus_loc} --vcenter {vc_name} -i {vm_moRefId} --name {vm_name}'
)

# Delete the created VM.
self.cmd('az connectedvmware vm delete -g {rg} --name {vm_name} -y')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ class AzureArcVMwareManagementServiceAPI(object): # pylint: disable=too-many-

:ivar operations: Operations operations
:vartype operations: azure.mgmt.connectedvmware.operations.Operations
:ivar virtual_machines: VirtualMachinesOperations operations
:vartype virtual_machines: azure.mgmt.connectedvmware.operations.VirtualMachinesOperations
:ivar resource_pools: ResourcePoolsOperations operations
:vartype resource_pools: azure.mgmt.connectedvmware.operations.ResourcePoolsOperations
:ivar clusters: ClustersOperations operations
Expand All @@ -39,8 +41,6 @@ class AzureArcVMwareManagementServiceAPI(object): # pylint: disable=too-many-
:vartype datastores: azure.mgmt.connectedvmware.operations.DatastoresOperations
:ivar vcenters: VCentersOperations operations
:vartype vcenters: azure.mgmt.connectedvmware.operations.VCentersOperations
:ivar virtual_machines: VirtualMachinesOperations operations
:vartype virtual_machines: azure.mgmt.connectedvmware.operations.VirtualMachinesOperations
:ivar virtual_machine_templates: VirtualMachineTemplatesOperations operations
:vartype virtual_machine_templates:
azure.mgmt.connectedvmware.operations.VirtualMachineTemplatesOperations
Expand All @@ -61,7 +61,7 @@ class AzureArcVMwareManagementServiceAPI(object): # pylint: disable=too-many-
:type subscription_id: str
:param base_url: Service URL. Default value is 'https://management.azure.com'.
:type base_url: str
:keyword api_version: Api Version. The default value is "2020-10-01-preview". Note that
:keyword api_version: Api Version. The default value is "2022-01-10-preview". Note that
overriding this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Expand All @@ -84,12 +84,12 @@ def __init__(
self._deserialize = Deserializer(client_models)
self._serialize.client_side_validation = False
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
self.virtual_machines = VirtualMachinesOperations(self._client, self._config, self._serialize, self._deserialize)
self.resource_pools = ResourcePoolsOperations(self._client, self._config, self._serialize, self._deserialize)
self.clusters = ClustersOperations(self._client, self._config, self._serialize, self._deserialize)
self.hosts = HostsOperations(self._client, self._config, self._serialize, self._deserialize)
self.datastores = DatastoresOperations(self._client, self._config, self._serialize, self._deserialize)
self.vcenters = VCentersOperations(self._client, self._config, self._serialize, self._deserialize)
self.virtual_machines = VirtualMachinesOperations(self._client, self._config, self._serialize, self._deserialize)
self.virtual_machine_templates = VirtualMachineTemplatesOperations(self._client, self._config, self._serialize, self._deserialize)
self.virtual_networks = VirtualNetworksOperations(self._client, self._config, self._serialize, self._deserialize)
self.inventory_items = InventoryItemsOperations(self._client, self._config, self._serialize, self._deserialize)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class AzureArcVMwareManagementServiceAPIConfiguration(Configuration): # pylint:
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: The Subscription ID.
:type subscription_id: str
:keyword api_version: Api Version. The default value is "2020-10-01-preview". Note that
:keyword api_version: Api Version. The default value is "2022-01-10-preview". Note that
overriding this default value may result in unsupported behavior.
:paramtype api_version: str
"""
Expand All @@ -44,7 +44,7 @@ def __init__(
):
# type: (...) -> None
super(AzureArcVMwareManagementServiceAPIConfiguration, self).__init__(**kwargs)
api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str
api_version = kwargs.pop('api_version', "2022-01-10-preview") # type: str

if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

VERSION = "0.1.1"
VERSION = "1.0.0b1"
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ class AzureArcVMwareManagementServiceAPI: # pylint: disable=too-many-instance

:ivar operations: Operations operations
:vartype operations: azure.mgmt.connectedvmware.aio.operations.Operations
:ivar virtual_machines: VirtualMachinesOperations operations
:vartype virtual_machines: azure.mgmt.connectedvmware.aio.operations.VirtualMachinesOperations
:ivar resource_pools: ResourcePoolsOperations operations
:vartype resource_pools: azure.mgmt.connectedvmware.aio.operations.ResourcePoolsOperations
:ivar clusters: ClustersOperations operations
Expand All @@ -37,8 +39,6 @@ class AzureArcVMwareManagementServiceAPI: # pylint: disable=too-many-instance
:vartype datastores: azure.mgmt.connectedvmware.aio.operations.DatastoresOperations
:ivar vcenters: VCentersOperations operations
:vartype vcenters: azure.mgmt.connectedvmware.aio.operations.VCentersOperations
:ivar virtual_machines: VirtualMachinesOperations operations
:vartype virtual_machines: azure.mgmt.connectedvmware.aio.operations.VirtualMachinesOperations
:ivar virtual_machine_templates: VirtualMachineTemplatesOperations operations
:vartype virtual_machine_templates:
azure.mgmt.connectedvmware.aio.operations.VirtualMachineTemplatesOperations
Expand All @@ -60,7 +60,7 @@ class AzureArcVMwareManagementServiceAPI: # pylint: disable=too-many-instance
:type subscription_id: str
:param base_url: Service URL. Default value is 'https://management.azure.com'.
:type base_url: str
:keyword api_version: Api Version. The default value is "2020-10-01-preview". Note that
:keyword api_version: Api Version. The default value is "2022-01-10-preview". Note that
overriding this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Expand All @@ -82,12 +82,12 @@ def __init__(
self._deserialize = Deserializer(client_models)
self._serialize.client_side_validation = False
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
self.virtual_machines = VirtualMachinesOperations(self._client, self._config, self._serialize, self._deserialize)
self.resource_pools = ResourcePoolsOperations(self._client, self._config, self._serialize, self._deserialize)
self.clusters = ClustersOperations(self._client, self._config, self._serialize, self._deserialize)
self.hosts = HostsOperations(self._client, self._config, self._serialize, self._deserialize)
self.datastores = DatastoresOperations(self._client, self._config, self._serialize, self._deserialize)
self.vcenters = VCentersOperations(self._client, self._config, self._serialize, self._deserialize)
self.virtual_machines = VirtualMachinesOperations(self._client, self._config, self._serialize, self._deserialize)
self.virtual_machine_templates = VirtualMachineTemplatesOperations(self._client, self._config, self._serialize, self._deserialize)
self.virtual_networks = VirtualNetworksOperations(self._client, self._config, self._serialize, self._deserialize)
self.inventory_items = InventoryItemsOperations(self._client, self._config, self._serialize, self._deserialize)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class AzureArcVMwareManagementServiceAPIConfiguration(Configuration): # pylint:
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
:param subscription_id: The Subscription ID.
:type subscription_id: str
:keyword api_version: Api Version. The default value is "2020-10-01-preview". Note that
:keyword api_version: Api Version. The default value is "2022-01-10-preview". Note that
overriding this default value may result in unsupported behavior.
:paramtype api_version: str
"""
Expand All @@ -41,7 +41,7 @@ def __init__(
**kwargs: Any
) -> None:
super(AzureArcVMwareManagementServiceAPIConfiguration, self).__init__(**kwargs)
api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str
api_version = kwargs.pop('api_version', "2022-01-10-preview") # type: str

if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
# --------------------------------------------------------------------------

from ._operations import Operations
from ._virtual_machines_operations import VirtualMachinesOperations
from ._resource_pools_operations import ResourcePoolsOperations
from ._clusters_operations import ClustersOperations
from ._hosts_operations import HostsOperations
from ._datastores_operations import DatastoresOperations
from ._vcenters_operations import VCentersOperations
from ._virtual_machines_operations import VirtualMachinesOperations
from ._virtual_machine_templates_operations import VirtualMachineTemplatesOperations
from ._virtual_networks_operations import VirtualNetworksOperations
from ._inventory_items_operations import InventoryItemsOperations
Expand All @@ -22,12 +22,12 @@

__all__ = [
'Operations',
'VirtualMachinesOperations',
'ResourcePoolsOperations',
'ClustersOperations',
'HostsOperations',
'DatastoresOperations',
'VCentersOperations',
'VirtualMachinesOperations',
'VirtualMachineTemplatesOperations',
'VirtualNetworksOperations',
'InventoryItemsOperations',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ async def _create_initial(
}
error_map.update(kwargs.pop('error_map', {}))

api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str
api_version = kwargs.pop('api_version', "2022-01-10-preview") # type: str
content_type = kwargs.pop('content_type', "application/json") # type: Optional[str]

if body is not None:
Expand Down Expand Up @@ -136,7 +136,7 @@ async def begin_create(
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.connectedvmware.models.Cluster]
:raises: ~azure.core.exceptions.HttpResponseError
"""
api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str
api_version = kwargs.pop('api_version', "2022-01-10-preview") # type: str
content_type = kwargs.pop('content_type', "application/json") # type: Optional[str]
polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod]
cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"]
Expand Down Expand Up @@ -205,7 +205,7 @@ async def get(
}
error_map.update(kwargs.pop('error_map', {}))

api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str
api_version = kwargs.pop('api_version', "2022-01-10-preview") # type: str


request = build_get_request(
Expand Down Expand Up @@ -269,7 +269,7 @@ async def update(
}
error_map.update(kwargs.pop('error_map', {}))

api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str
api_version = kwargs.pop('api_version', "2022-01-10-preview") # type: str
content_type = kwargs.pop('content_type', "application/json") # type: Optional[str]

if body is not None:
Expand Down Expand Up @@ -324,7 +324,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
}
error_map.update(kwargs.pop('error_map', {}))

api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str
api_version = kwargs.pop('api_version', "2022-01-10-preview") # type: str


request = build_delete_request_initial(
Expand Down Expand Up @@ -385,7 +385,7 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises: ~azure.core.exceptions.HttpResponseError
"""
api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str
api_version = kwargs.pop('api_version', "2022-01-10-preview") # type: str
polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod]
cls = kwargs.pop('cls', None) # type: ClsType[None]
lro_delay = kwargs.pop(
Expand Down Expand Up @@ -438,7 +438,7 @@ def list(
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.connectedvmware.models.ClustersList]
:raises: ~azure.core.exceptions.HttpResponseError
"""
api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str
api_version = kwargs.pop('api_version', "2022-01-10-preview") # type: str

cls = kwargs.pop('cls', None) # type: ClsType["_models.ClustersList"]
error_map = {
Expand Down Expand Up @@ -516,7 +516,7 @@ def list_by_resource_group(
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.connectedvmware.models.ClustersList]
:raises: ~azure.core.exceptions.HttpResponseError
"""
api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str
api_version = kwargs.pop('api_version', "2022-01-10-preview") # type: str

cls = kwargs.pop('cls', None) # type: ClsType["_models.ClustersList"]
error_map = {
Expand Down
Loading