Skip to content

[SCVMM] Adding cli support for latest API version[2025-03-13]. #8643

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions src/scvmm/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
Release History
===============

1.2.0
++++++
* Bump API version to stable/2025-03-13.

1.1.2
++++++
* Security upgrades and fixes - Drop `msrestazure` dependency.
Expand Down
40 changes: 38 additions & 2 deletions src/scvmm/azext_scvmm/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,16 @@ def create_vm(
inventory_item=None,
vm_template=None,
cloud=None,
admin_username=None,
admin_password=None,
computer_name=None,
domain_name=None,
domain_username=None,
domain_password=None,
workgroup=None,
product_key=None,
timezone=None,
run_once_commands=None,
cpu_count=None,
memory_size=None,
dynamic_memory_enabled=None,
Expand Down Expand Up @@ -593,8 +602,33 @@ def create_vm(
dynamic_memory_max_mb=dynamic_memory_max,
)

if admin_password is not None:
os_profile = OsProfileForVmInstance(admin_password=admin_password)
if any(
prop is not None
for prop in [
admin_username,
admin_password,
computer_name,
domain_name,
domain_username,
domain_password,
workgroup,
product_key,
timezone,
run_once_commands,
]
):
os_profile = OsProfileForVmInstance(
admin_username=admin_username,
admin_password=admin_password,
computer_name=computer_name,
domain_name=domain_name,
domain_username=domain_username,
domain_password=domain_password,
workgroup=workgroup,
product_key=product_key,
timezone=timezone,
run_once_commands=run_once_commands,
)

if nics is not None:
network_profile = NetworkProfile(
Expand Down Expand Up @@ -1825,6 +1859,7 @@ def enable_guest_agent(
vm_name,
username,
password,
private_link_scope_resource_id=None,
https_proxy=None,
no_wait=False,
):
Expand Down Expand Up @@ -1854,6 +1889,7 @@ def enable_guest_agent(
credentials=vm_creds,
http_proxy_config=https_proxy_config,
provisioning_action=GUEST_AGENT_PROVISIONING_ACTION_INSTALL,
private_link_scope_resource_id=private_link_scope_resource_id,
)
guest_agent = GuestAgent(properties=guest_agent_props)

Expand Down
7 changes: 3 additions & 4 deletions src/scvmm/azext_scvmm/vendored_sdks/scvmm/_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from azure.core.credentials import TokenCredential


class ScVmmMgmtClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
class ScVmmMgmtClientConfiguration(Configuration):
"""Configuration for ScVmmMgmtClient.

Note that all parameters used to create this instance are saved as instance
Expand All @@ -31,8 +31,7 @@ class ScVmmMgmtClientConfiguration(Configuration): # pylint: disable=too-many-i
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: The ID of the target subscription. The value must be an UUID.
:type subscription_id: str
:keyword api_version: Api Version. The default value is "2023-10-07". Note that overriding this
default value may result in unsupported behavior.
:keyword api_version: Api Version. The default value is "2025-03-13". Note that overriding this default value may result in unsupported behavior.
:paramtype api_version: str
"""

Expand All @@ -44,7 +43,7 @@ def __init__(
):
# type: (...) -> None
super(ScVmmMgmtClientConfiguration, self).__init__(**kwargs)
api_version = kwargs.pop('api_version', "2023-10-07") # type: str
api_version = kwargs.pop('api_version', "2025-03-13") # 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 @@ -9,22 +9,21 @@
from copy import deepcopy
from typing import TYPE_CHECKING

from msrest import Deserializer, Serializer

from azure.mgmt.core import ARMPipelineClient
from msrest import Deserializer, Serializer

from . import models
from ._configuration import ScVmmMgmtClientConfiguration
from .operations import AvailabilitySetsOperations, CloudsOperations, GuestAgentsOperations, InventoryItemsOperations, Operations, VirtualMachineInstancesOperations, VirtualMachineTemplatesOperations, VirtualNetworksOperations, VmInstanceHybridIdentityMetadatasOperations, VmmServersOperations

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from typing import Any
from typing import Any, Optional

from azure.core.credentials import TokenCredential
from azure.core.rest import HttpRequest, HttpResponse

class ScVmmMgmtClient(object): # pylint: disable=too-many-instance-attributes
class ScVmmMgmtClient(object):
"""The Microsoft.ScVmm Rest API spec.

:ivar virtual_machine_instances: VirtualMachineInstancesOperations operations
Expand Down Expand Up @@ -57,7 +56,7 @@ class ScVmmMgmtClient(object): # pylint: disable=too-many-instance-attributes
: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 "2023-10-07". Note that overriding this
:keyword api_version: Api Version. The default value is "2025-03-13". 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 Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from azure.core.credentials_async import AsyncTokenCredential


class ScVmmMgmtClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
class ScVmmMgmtClientConfiguration(Configuration):
"""Configuration for ScVmmMgmtClient.

Note that all parameters used to create this instance are saved as instance
Expand All @@ -29,8 +29,7 @@ class ScVmmMgmtClientConfiguration(Configuration): # pylint: disable=too-many-i
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
:param subscription_id: The ID of the target subscription. The value must be an UUID.
:type subscription_id: str
:keyword api_version: Api Version. The default value is "2023-10-07". Note that overriding this
default value may result in unsupported behavior.
:keyword api_version: Api Version. The default value is "2025-03-13". Note that overriding this default value may result in unsupported behavior.
:paramtype api_version: str
"""

Expand All @@ -41,7 +40,7 @@ def __init__(
**kwargs: Any
) -> None:
super(ScVmmMgmtClientConfiguration, self).__init__(**kwargs)
api_version = kwargs.pop('api_version', "2023-10-07") # type: str
api_version = kwargs.pop('api_version', "2025-03-13") # 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,11 @@
# --------------------------------------------------------------------------

from copy import deepcopy
from typing import Any, Awaitable, TYPE_CHECKING

from msrest import Deserializer, Serializer
from typing import Any, Awaitable, Optional, TYPE_CHECKING

from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.mgmt.core import AsyncARMPipelineClient
from msrest import Deserializer, Serializer

from .. import models
from ._configuration import ScVmmMgmtClientConfiguration
Expand All @@ -22,7 +21,7 @@
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential

class ScVmmMgmtClient: # pylint: disable=too-many-instance-attributes
class ScVmmMgmtClient:
"""The Microsoft.ScVmm Rest API spec.

:ivar virtual_machine_instances: VirtualMachineInstancesOperations operations
Expand Down Expand Up @@ -55,7 +54,7 @@ class ScVmmMgmtClient: # pylint: disable=too-many-instance-attributes
: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 "2023-10-07". Note that overriding this
:keyword api_version: Api Version. The default value is "2025-03-13". 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 Down
Loading
Loading