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/network-manager/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

Release History
===============
1.0.0b2
+++++
* `az network manager group static-member create`: Fix cross-tenant --resource-id
* `az network manager post-commit`: Fix when no response body is returned

1.0.0b1
+++++
* Migrate to CodeGen V2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class PostCommit(AAZCommand):

def _handler(self, command_args):
super()._handler(command_args)
return self.build_lro_poller(self._execute_operations, self._output)
return self.build_lro_poller(self._execute_operations, None)

_args_schema = None

Expand Down Expand Up @@ -97,10 +97,6 @@ def pre_operations(self):
def post_operations(self):
pass

def _output(self, *args, **kwargs):
result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True)
return result

class NetworkManagerCommitsPost(AAZHttpOperation):
CLIENT_TYPE = "MgmtClient"

Expand Down Expand Up @@ -177,9 +173,6 @@ def header_parameters(self):
**self.serialize_header_param(
"Content-Type", "application/json",
),
**self.serialize_header_param(
"Accept", "application/json",
),
}
return parameters

Expand All @@ -205,69 +198,11 @@ def content(self):
return self.serialize_content(_content_value)

def on_200(self, session):
data = self.deserialize_http_content(session)
self.ctx.set_var(
"instance",
data,
schema_builder=self._build_schema_on_200
)

_schema_on_200 = None

@classmethod
def _build_schema_on_200(cls):
if cls._schema_on_200 is not None:
return cls._schema_on_200

cls._schema_on_200 = AAZObjectType()
_PostCommitHelper._build_schema_network_manager_commit_read(cls._schema_on_200)

return cls._schema_on_200
pass


class _PostCommitHelper:
"""Helper class for PostCommit"""

_schema_network_manager_commit_read = None

@classmethod
def _build_schema_network_manager_commit_read(cls, _schema):
if cls._schema_network_manager_commit_read is not None:
_schema.commit_id = cls._schema_network_manager_commit_read.commit_id
_schema.commit_type = cls._schema_network_manager_commit_read.commit_type
_schema.configuration_ids = cls._schema_network_manager_commit_read.configuration_ids
_schema.target_locations = cls._schema_network_manager_commit_read.target_locations
return

cls._schema_network_manager_commit_read = _schema_network_manager_commit_read = AAZObjectType()

network_manager_commit_read = _schema_network_manager_commit_read
network_manager_commit_read.commit_id = AAZStrType(
serialized_name="commitId",
flags={"read_only": True},
)
network_manager_commit_read.commit_type = AAZStrType(
serialized_name="commitType",
flags={"required": True},
)
network_manager_commit_read.configuration_ids = AAZListType(
serialized_name="configurationIds",
)
network_manager_commit_read.target_locations = AAZListType(
serialized_name="targetLocations",
flags={"required": True},
)

configuration_ids = _schema_network_manager_commit_read.configuration_ids
configuration_ids.Element = AAZStrType()

target_locations = _schema_network_manager_commit_read.target_locations
target_locations.Element = AAZStrType()

_schema.commit_id = cls._schema_network_manager_commit_read.commit_id
_schema.commit_type = cls._schema_network_manager_commit_read.commit_type
_schema.configuration_ids = cls._schema_network_manager_commit_read.configuration_ids
_schema.target_locations = cls._schema_network_manager_commit_read.target_locations


__all__ = ["PostCommit"]
4 changes: 4 additions & 0 deletions src/network-manager/azext_network_manager/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,7 @@ def load_command_table(self, _):
with self.command_group('network manager security-admin-config rule-collection') as g:
g.custom_command('create', 'network_manager_admin_rule_collection_create')
g.custom_command('update', 'network_manager_admin_rule_collection_update')

with self.command_group("network manager group static-member") as g:
from .custom import GroupStaticMemberCreate
self.command_table["network manager group static-member create"] = GroupStaticMemberCreate(loader=self)
12 changes: 12 additions & 0 deletions src/network-manager/azext_network_manager/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
# pylint: disable=too-many-lines
# pylint: disable=unused-argument
from knack.util import CLIError
from .aaz.latest.network.manager.group.static_member import Create as _GroupStaticMemberCreate


def network_manager_create(cmd,
Expand Down Expand Up @@ -245,3 +246,14 @@ def network_manager_admin_rule_update(cmd,
if direction is not None:
rule['custom']['direction'] = direction
return _RuleUpdate(cli_ctx=cmd.cli_ctx)(command_args=rule)


class GroupStaticMemberCreate(_GroupStaticMemberCreate):
@classmethod
def _build_arguments_schema(cls, *args, **kwargs):
from azure.cli.core.aaz import AAZResourceIdArgFormat
args_schema = super()._build_arguments_schema(*args, **kwargs)
args_schema.resource_id._fmt = AAZResourceIdArgFormat(
template="/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/virtualNetworks/{}",
)
return args_schema
Loading