diff --git a/src/networkcloud/HISTORY.rst b/src/networkcloud/HISTORY.rst index 49cc0c17190..2a506850706 100644 --- a/src/networkcloud/HISTORY.rst +++ b/src/networkcloud/HISTORY.rst @@ -3,6 +3,13 @@ Release History =============== +2.0.0b7 +++++++++ +* This version requires a minimum of 2.66 Azure core CLI. See release notes for more details: https://github.com/MicrosoftDocs/azure-docs-cli/blob/main/docs-ref-conceptual/release-notes-azure-cli.md +* This version upgrades the internal generation tool aaz-dev-tools to 3.1.0. Refer to the release notes for more details: https://github.com/Azure/aaz-dev-tools/releases/tag/v3.1.0. +* Optional Cluster properties can be now set to null during update (PATCH) operation. This includes `--cluster-service-principal`, `--command-output-settings`, `--compute-deployment-threshold`, `--update-strategy`, `--secret-archive`, and `--runtime-protection`. In that case, the value will be reset to the default if defined by the API. +* This version introduces custom code to validate the `--command-output-settings` property of a cluster for both create and update operations. When the `identity-type` is `SystemAssignedIdentity`, the UAI(User Assigned Identity) should not be provided and will be set to None to erase any previous value. When the `identity-type` is `UserAssignedIdentity`, the UAI must be provided. + 2.0.0b6 ++++++++ * This is a maintenace update to the internal auto-generation tools (3.0.0) to ensure compatibility with the Python 3.12. diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/_list.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/_list.py index c49a4f54f9b..3df4b2d5a68 100644 --- a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/_list.py +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/_list.py @@ -55,12 +55,12 @@ def _build_arguments_schema(cls, *args, **kwargs): def _execute_operations(self): self.pre_operations() - condition_0 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) - condition_1 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True + condition_0 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True + condition_1 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) if condition_0: - self.BareMetalMachinesListByResourceGroup(ctx=self.ctx)() - if condition_1: self.BareMetalMachinesListBySubscription(ctx=self.ctx)() + if condition_1: + self.BareMetalMachinesListByResourceGroup(ctx=self.ctx)() self.post_operations() @register_callback @@ -76,7 +76,7 @@ def _output(self, *args, **kwargs): next_link = self.deserialize_output(self.ctx.vars.instance.next_link) return result, next_link - class BareMetalMachinesListByResourceGroup(AAZHttpOperation): + class BareMetalMachinesListBySubscription(AAZHttpOperation): CLIENT_TYPE = "MgmtClient" def __call__(self, *args, **kwargs): @@ -90,7 +90,7 @@ def __call__(self, *args, **kwargs): @property def url(self): return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/bareMetalMachines", + "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/bareMetalMachines", **self.url_parameters ) @@ -105,10 +105,6 @@ def error_format(self): @property def url_parameters(self): parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), **self.serialize_url_param( "subscriptionId", self.ctx.subscription_id, required=True, @@ -505,7 +501,7 @@ def _build_schema_on_200(cls): return cls._schema_on_200 - class BareMetalMachinesListBySubscription(AAZHttpOperation): + class BareMetalMachinesListByResourceGroup(AAZHttpOperation): CLIENT_TYPE = "MgmtClient" def __call__(self, *args, **kwargs): @@ -519,7 +515,7 @@ def __call__(self, *args, **kwargs): @property def url(self): return self.client.format_url( - "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/bareMetalMachines", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/bareMetalMachines", **self.url_parameters ) @@ -534,6 +530,10 @@ def error_format(self): @property def url_parameters(self): parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), **self.serialize_url_param( "subscriptionId", self.ctx.subscription_id, required=True, diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cloudservicesnetwork/_list.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cloudservicesnetwork/_list.py index 9e7061eafcc..73563ad30c2 100644 --- a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cloudservicesnetwork/_list.py +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cloudservicesnetwork/_list.py @@ -55,12 +55,12 @@ def _build_arguments_schema(cls, *args, **kwargs): def _execute_operations(self): self.pre_operations() - condition_0 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) - condition_1 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True + condition_0 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True + condition_1 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) if condition_0: - self.CloudServicesNetworksListByResourceGroup(ctx=self.ctx)() - if condition_1: self.CloudServicesNetworksListBySubscription(ctx=self.ctx)() + if condition_1: + self.CloudServicesNetworksListByResourceGroup(ctx=self.ctx)() self.post_operations() @register_callback @@ -76,7 +76,7 @@ def _output(self, *args, **kwargs): next_link = self.deserialize_output(self.ctx.vars.instance.next_link) return result, next_link - class CloudServicesNetworksListByResourceGroup(AAZHttpOperation): + class CloudServicesNetworksListBySubscription(AAZHttpOperation): CLIENT_TYPE = "MgmtClient" def __call__(self, *args, **kwargs): @@ -90,7 +90,7 @@ def __call__(self, *args, **kwargs): @property def url(self): return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/cloudServicesNetworks", + "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/cloudServicesNetworks", **self.url_parameters ) @@ -105,10 +105,6 @@ def error_format(self): @property def url_parameters(self): parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), **self.serialize_url_param( "subscriptionId", self.ctx.subscription_id, required=True, @@ -281,7 +277,7 @@ def _build_schema_on_200(cls): return cls._schema_on_200 - class CloudServicesNetworksListBySubscription(AAZHttpOperation): + class CloudServicesNetworksListByResourceGroup(AAZHttpOperation): CLIENT_TYPE = "MgmtClient" def __call__(self, *args, **kwargs): @@ -295,7 +291,7 @@ def __call__(self, *args, **kwargs): @property def url(self): return self.client.format_url( - "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/cloudServicesNetworks", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/cloudServicesNetworks", **self.url_parameters ) @@ -310,6 +306,10 @@ def error_format(self): @property def url_parameters(self): parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), **self.serialize_url_param( "subscriptionId", self.ctx.subscription_id, required=True, diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/_create.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/_create.py index 405096b047e..69f9cf96280 100644 --- a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/_create.py +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/_create.py @@ -105,17 +105,30 @@ def _build_arguments_schema(cls, *args, **kwargs): ) identity = cls._args_schema.identity + identity.mi_system_assigned = AAZStrArg( + options=["system-assigned", "mi-system-assigned"], + help="Set the system managed identity.", + blank="True", + ) identity.type = AAZStrArg( options=["type"], help="Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed).", required=True, enum={"None": "None", "SystemAssigned": "SystemAssigned", "SystemAssigned,UserAssigned": "SystemAssigned,UserAssigned", "UserAssigned": "UserAssigned"}, ) + identity.mi_user_assigned = AAZListArg( + options=["user-assigned", "mi-user-assigned"], + help="Set the user managed identities.", + blank=[], + ) identity.user_assigned_identities = AAZDictArg( options=["user-assigned-identities"], help="The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. The dictionary values can be empty objects ({}) in requests.", ) + mi_user_assigned = cls._args_schema.identity.mi_user_assigned + mi_user_assigned.Element = AAZStrArg() + user_assigned_identities = cls._args_schema.identity.user_assigned_identities user_assigned_identities.Element = AAZObjectArg( nullable=True, @@ -239,6 +252,7 @@ def _build_arguments_schema(cls, *args, **kwargs): command_output_settings.identity_resource_id = AAZResourceIdArg( options=["identity-resource-id"], help="The user assigned managed identity resource ID to use. Mutually exclusive with a system assigned identity type.", + nullable=True, ) command_output_settings.container_url = AAZStrArg( options=["container-url"], @@ -640,7 +654,7 @@ def content(self): typ_kwargs={"flags": {"required": True, "client_flatten": True}} ) _builder.set_prop("extendedLocation", AAZObjectType, ".extended_location", typ_kwargs={"flags": {"required": True}}) - _builder.set_prop("identity", AAZObjectType, ".identity") + _builder.set_prop("identity", AAZIdentityObjectType, ".identity") _builder.set_prop("location", AAZStrType, ".location", typ_kwargs={"flags": {"required": True}}) _builder.set_prop("properties", AAZObjectType, ".", typ_kwargs={"flags": {"required": True, "client_flatten": True}}) _builder.set_prop("tags", AAZDictType, ".tags") @@ -654,11 +668,17 @@ def content(self): if identity is not None: identity.set_prop("type", AAZStrType, ".type", typ_kwargs={"flags": {"required": True}}) identity.set_prop("userAssignedIdentities", AAZDictType, ".user_assigned_identities") + identity.set_prop("userAssigned", AAZListType, ".mi_user_assigned", typ_kwargs={"flags": {"action": "create"}}) + identity.set_prop("systemAssigned", AAZStrType, ".mi_system_assigned", typ_kwargs={"flags": {"action": "create"}}) user_assigned_identities = _builder.get(".identity.userAssignedIdentities") if user_assigned_identities is not None: user_assigned_identities.set_elements(AAZObjectType, ".", typ_kwargs={"nullable": True}) + user_assigned = _builder.get(".identity.userAssigned") + if user_assigned is not None: + user_assigned.set_elements(AAZStrType, ".") + properties = _builder.get(".properties") if properties is not None: _CreateHelper._build_schema_rack_definition_create(properties.set_prop("aggregatorOrSingleRackDefinition", AAZObjectType, ".aggregator_or_single_rack_definition", typ_kwargs={"flags": {"required": True}})) @@ -691,7 +711,7 @@ def content(self): associated_identity = _builder.get(".properties.commandOutputSettings.associatedIdentity") if associated_identity is not None: associated_identity.set_prop("identityType", AAZStrType, ".identity_type") - associated_identity.set_prop("userAssignedIdentityResourceId", AAZStrType, ".identity_resource_id") + associated_identity.set_prop("userAssignedIdentityResourceId", AAZStrType, ".identity_resource_id", typ_kwargs={"nullable": True}) compute_deployment_threshold = _builder.get(".properties.computeDeploymentThreshold") if compute_deployment_threshold is not None: @@ -757,7 +777,7 @@ def _build_schema_on_200_201(cls): _schema_on_200_201.id = AAZStrType( flags={"read_only": True}, ) - _schema_on_200_201.identity = AAZObjectType() + _schema_on_200_201.identity = AAZIdentityObjectType() _schema_on_200_201.location = AAZStrType( flags={"required": True}, ) @@ -996,6 +1016,7 @@ def _build_schema_on_200_201(cls): ) associated_identity.user_assigned_identity_resource_id = AAZStrType( serialized_name="userAssignedIdentityResourceId", + nullable=True, ) compute_deployment_threshold = cls._schema_on_200_201.properties.compute_deployment_threshold diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/_list.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/_list.py index b21d6fca9b5..87666b3b6f5 100644 --- a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/_list.py +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/_list.py @@ -55,12 +55,12 @@ def _build_arguments_schema(cls, *args, **kwargs): def _execute_operations(self): self.pre_operations() - condition_0 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) - condition_1 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True + condition_0 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True + condition_1 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) if condition_0: - self.ClustersListByResourceGroup(ctx=self.ctx)() - if condition_1: self.ClustersListBySubscription(ctx=self.ctx)() + if condition_1: + self.ClustersListByResourceGroup(ctx=self.ctx)() self.post_operations() @register_callback @@ -76,7 +76,7 @@ def _output(self, *args, **kwargs): next_link = self.deserialize_output(self.ctx.vars.instance.next_link) return result, next_link - class ClustersListByResourceGroup(AAZHttpOperation): + class ClustersListBySubscription(AAZHttpOperation): CLIENT_TYPE = "MgmtClient" def __call__(self, *args, **kwargs): @@ -90,7 +90,7 @@ def __call__(self, *args, **kwargs): @property def url(self): return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters", + "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/clusters", **self.url_parameters ) @@ -105,10 +105,6 @@ def error_format(self): @property def url_parameters(self): parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), **self.serialize_url_param( "subscriptionId", self.ctx.subscription_id, required=True, @@ -170,7 +166,7 @@ def _build_schema_on_200(cls): _element.id = AAZStrType( flags={"read_only": True}, ) - _element.identity = AAZObjectType() + _element.identity = AAZIdentityObjectType() _element.location = AAZStrType( flags={"required": True}, ) @@ -409,6 +405,7 @@ def _build_schema_on_200(cls): ) associated_identity.user_assigned_identity_resource_id = AAZStrType( serialized_name="userAssignedIdentityResourceId", + nullable=True, ) compute_deployment_threshold = cls._schema_on_200.value.Element.properties.compute_deployment_threshold @@ -492,7 +489,7 @@ def _build_schema_on_200(cls): return cls._schema_on_200 - class ClustersListBySubscription(AAZHttpOperation): + class ClustersListByResourceGroup(AAZHttpOperation): CLIENT_TYPE = "MgmtClient" def __call__(self, *args, **kwargs): @@ -506,7 +503,7 @@ def __call__(self, *args, **kwargs): @property def url(self): return self.client.format_url( - "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/clusters", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters", **self.url_parameters ) @@ -521,6 +518,10 @@ def error_format(self): @property def url_parameters(self): parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), **self.serialize_url_param( "subscriptionId", self.ctx.subscription_id, required=True, @@ -582,7 +583,7 @@ def _build_schema_on_200(cls): _element.id = AAZStrType( flags={"read_only": True}, ) - _element.identity = AAZObjectType() + _element.identity = AAZIdentityObjectType() _element.location = AAZStrType( flags={"required": True}, ) @@ -821,6 +822,7 @@ def _build_schema_on_200(cls): ) associated_identity.user_assigned_identity_resource_id = AAZStrType( serialized_name="userAssignedIdentityResourceId", + nullable=True, ) compute_deployment_threshold = cls._schema_on_200.value.Element.properties.compute_deployment_threshold diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/_show.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/_show.py index 71afa860607..a93975694ae 100644 --- a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/_show.py +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/_show.py @@ -165,7 +165,7 @@ def _build_schema_on_200(cls): _schema_on_200.id = AAZStrType( flags={"read_only": True}, ) - _schema_on_200.identity = AAZObjectType() + _schema_on_200.identity = AAZIdentityObjectType() _schema_on_200.location = AAZStrType( flags={"required": True}, ) @@ -404,6 +404,7 @@ def _build_schema_on_200(cls): ) associated_identity.user_assigned_identity_resource_id = AAZStrType( serialized_name="userAssignedIdentityResourceId", + nullable=True, ) compute_deployment_threshold = cls._schema_on_200.properties.compute_deployment_threshold diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/_update.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/_update.py index c9749bcb3d6..e4fd0c993cb 100644 --- a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/_update.py +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/_update.py @@ -95,17 +95,30 @@ def _build_arguments_schema(cls, *args, **kwargs): ) identity = cls._args_schema.identity + identity.mi_system_assigned = AAZStrArg( + options=["system-assigned", "mi-system-assigned"], + help="Set the system managed identity.", + blank="True", + ) identity.type = AAZStrArg( options=["type"], help="Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed).", required=True, enum={"None": "None", "SystemAssigned": "SystemAssigned", "SystemAssigned,UserAssigned": "SystemAssigned,UserAssigned", "UserAssigned": "UserAssigned"}, ) + identity.mi_user_assigned = AAZListArg( + options=["user-assigned", "mi-user-assigned"], + help="Set the user managed identities.", + blank=[], + ) identity.user_assigned_identities = AAZDictArg( options=["user-assigned-identities"], help="The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. The dictionary values can be empty objects ({}) in requests.", ) + mi_user_assigned = cls._args_schema.identity.mi_user_assigned + mi_user_assigned.Element = AAZStrArg() + user_assigned_identities = cls._args_schema.identity.user_assigned_identities user_assigned_identities.Element = AAZObjectArg( nullable=True, @@ -133,16 +146,19 @@ def _build_arguments_schema(cls, *args, **kwargs): options=["--cluster-service-principal"], arg_group="Properties", help="The service principal to be used by the cluster during Arc Appliance installation.", + nullable=True, ) _args_schema.command_output_settings = AAZObjectArg( options=["--co-settings", "--command-output-settings"], arg_group="Properties", help="The settings for commands run in this cluster, such as bare metal machine run read only commands and data extracts.", + nullable=True, ) _args_schema.compute_deployment_threshold = AAZObjectArg( options=["--compute-deployment-threshold"], arg_group="Properties", help="The validation threshold indicating the allowable failures of compute machines during environment validation and deployment.", + nullable=True, ) _args_schema.compute_rack_definitions = AAZListArg( options=["--compute-rack-definitions"], @@ -153,16 +169,19 @@ def _build_arguments_schema(cls, *args, **kwargs): options=["--runtime-protection"], arg_group="Properties", help="The settings for cluster runtime protection.", + nullable=True, ) _args_schema.secret_archive = AAZObjectArg( options=["--secret-archive"], arg_group="Properties", help="The configuration for use of a key vault to store secrets for later retrieval by the operator.", + nullable=True, ) _args_schema.update_strategy = AAZObjectArg( options=["--update-strategy"], arg_group="Properties", help="The strategy for updating the cluster.", + nullable=True, ) cluster_service_principal = cls._args_schema.cluster_service_principal @@ -196,6 +215,7 @@ def _build_arguments_schema(cls, *args, **kwargs): command_output_settings.identity_resource_id = AAZResourceIdArg( options=["identity-resource-id"], help="The user assigned managed identity resource ID to use. Mutually exclusive with a system assigned identity type.", + nullable=True, ) command_output_settings.container_url = AAZStrArg( options=["container-url"], @@ -583,7 +603,7 @@ def content(self): typ=AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}} ) - _builder.set_prop("identity", AAZObjectType, ".identity") + _builder.set_prop("identity", AAZIdentityObjectType, ".identity") _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) _builder.set_prop("tags", AAZDictType, ".tags") @@ -591,22 +611,28 @@ def content(self): if identity is not None: identity.set_prop("type", AAZStrType, ".type", typ_kwargs={"flags": {"required": True}}) identity.set_prop("userAssignedIdentities", AAZDictType, ".user_assigned_identities") + identity.set_prop("userAssigned", AAZListType, ".mi_user_assigned", typ_kwargs={"flags": {"action": "create"}}) + identity.set_prop("systemAssigned", AAZStrType, ".mi_system_assigned", typ_kwargs={"flags": {"action": "create"}}) user_assigned_identities = _builder.get(".identity.userAssignedIdentities") if user_assigned_identities is not None: user_assigned_identities.set_elements(AAZObjectType, ".", typ_kwargs={"nullable": True}) + user_assigned = _builder.get(".identity.userAssigned") + if user_assigned is not None: + user_assigned.set_elements(AAZStrType, ".") + properties = _builder.get(".properties") if properties is not None: _UpdateHelper._build_schema_rack_definition_update(properties.set_prop("aggregatorOrSingleRackDefinition", AAZObjectType, ".aggregator_or_single_rack_definition")) properties.set_prop("clusterLocation", AAZStrType, ".cluster_location") - properties.set_prop("clusterServicePrincipal", AAZObjectType, ".cluster_service_principal") - properties.set_prop("commandOutputSettings", AAZObjectType, ".command_output_settings") - properties.set_prop("computeDeploymentThreshold", AAZObjectType, ".compute_deployment_threshold") + properties.set_prop("clusterServicePrincipal", AAZObjectType, ".cluster_service_principal", typ_kwargs={"nullable": True}) + properties.set_prop("commandOutputSettings", AAZObjectType, ".command_output_settings", typ_kwargs={"nullable": True}) + properties.set_prop("computeDeploymentThreshold", AAZObjectType, ".compute_deployment_threshold", typ_kwargs={"nullable": True}) properties.set_prop("computeRackDefinitions", AAZListType, ".compute_rack_definitions") - properties.set_prop("runtimeProtectionConfiguration", AAZObjectType, ".runtime_protection") - properties.set_prop("secretArchive", AAZObjectType, ".secret_archive") - properties.set_prop("updateStrategy", AAZObjectType, ".update_strategy") + properties.set_prop("runtimeProtectionConfiguration", AAZObjectType, ".runtime_protection", typ_kwargs={"nullable": True}) + properties.set_prop("secretArchive", AAZObjectType, ".secret_archive", typ_kwargs={"nullable": True}) + properties.set_prop("updateStrategy", AAZObjectType, ".update_strategy", typ_kwargs={"nullable": True}) cluster_service_principal = _builder.get(".properties.clusterServicePrincipal") if cluster_service_principal is not None: @@ -623,7 +649,7 @@ def content(self): associated_identity = _builder.get(".properties.commandOutputSettings.associatedIdentity") if associated_identity is not None: associated_identity.set_prop("identityType", AAZStrType, ".identity_type") - associated_identity.set_prop("userAssignedIdentityResourceId", AAZStrType, ".identity_resource_id") + associated_identity.set_prop("userAssignedIdentityResourceId", AAZStrType, ".identity_resource_id", typ_kwargs={"nullable": True}) compute_deployment_threshold = _builder.get(".properties.computeDeploymentThreshold") if compute_deployment_threshold is not None: @@ -775,7 +801,7 @@ def _build_schema_cluster_read(cls, _schema): cluster_read.id = AAZStrType( flags={"read_only": True}, ) - cluster_read.identity = AAZObjectType() + cluster_read.identity = AAZIdentityObjectType() cluster_read.location = AAZStrType( flags={"required": True}, ) @@ -1014,6 +1040,7 @@ def _build_schema_cluster_read(cls, _schema): ) associated_identity.user_assigned_identity_resource_id = AAZStrType( serialized_name="userAssignedIdentityResourceId", + nullable=True, ) compute_deployment_threshold = _schema_cluster_read.properties.compute_deployment_threshold diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/_wait.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/_wait.py index ef64f066416..5d7a9934bad 100644 --- a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/_wait.py +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/_wait.py @@ -160,7 +160,7 @@ def _build_schema_on_200(cls): _schema_on_200.id = AAZStrType( flags={"read_only": True}, ) - _schema_on_200.identity = AAZObjectType() + _schema_on_200.identity = AAZIdentityObjectType() _schema_on_200.location = AAZStrType( flags={"required": True}, ) @@ -399,6 +399,7 @@ def _build_schema_on_200(cls): ) associated_identity.user_assigned_identity_resource_id = AAZStrType( serialized_name="userAssignedIdentityResourceId", + nullable=True, ) compute_deployment_threshold = cls._schema_on_200.properties.compute_deployment_threshold diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/clustermanager/_create.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/clustermanager/_create.py index 264a0269dcf..fc803d69073 100644 --- a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/clustermanager/_create.py +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/clustermanager/_create.py @@ -87,17 +87,30 @@ def _build_arguments_schema(cls, *args, **kwargs): ) identity = cls._args_schema.identity + identity.mi_system_assigned = AAZStrArg( + options=["system-assigned", "mi-system-assigned"], + help="Set the system managed identity.", + blank="True", + ) identity.type = AAZStrArg( options=["type"], help="Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed).", required=True, enum={"None": "None", "SystemAssigned": "SystemAssigned", "SystemAssigned,UserAssigned": "SystemAssigned,UserAssigned", "UserAssigned": "UserAssigned"}, ) + identity.mi_user_assigned = AAZListArg( + options=["user-assigned", "mi-user-assigned"], + help="Set the user managed identities.", + blank=[], + ) identity.user_assigned_identities = AAZDictArg( options=["user-assigned-identities"], help="The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. The dictionary values can be empty objects ({}) in requests.", ) + mi_user_assigned = cls._args_schema.identity.mi_user_assigned + mi_user_assigned.Element = AAZStrArg() + user_assigned_identities = cls._args_schema.identity.user_assigned_identities user_assigned_identities.Element = AAZObjectArg( nullable=True, @@ -247,7 +260,7 @@ def content(self): typ=AAZObjectType, typ_kwargs={"flags": {"required": True, "client_flatten": True}} ) - _builder.set_prop("identity", AAZObjectType, ".identity") + _builder.set_prop("identity", AAZIdentityObjectType, ".identity") _builder.set_prop("location", AAZStrType, ".location", typ_kwargs={"flags": {"required": True}}) _builder.set_prop("properties", AAZObjectType, ".", typ_kwargs={"flags": {"required": True, "client_flatten": True}}) _builder.set_prop("tags", AAZDictType, ".tags") @@ -256,11 +269,17 @@ def content(self): if identity is not None: identity.set_prop("type", AAZStrType, ".type", typ_kwargs={"flags": {"required": True}}) identity.set_prop("userAssignedIdentities", AAZDictType, ".user_assigned_identities") + identity.set_prop("userAssigned", AAZListType, ".mi_user_assigned", typ_kwargs={"flags": {"action": "create"}}) + identity.set_prop("systemAssigned", AAZStrType, ".mi_system_assigned", typ_kwargs={"flags": {"action": "create"}}) user_assigned_identities = _builder.get(".identity.userAssignedIdentities") if user_assigned_identities is not None: user_assigned_identities.set_elements(AAZObjectType, ".", typ_kwargs={"nullable": True}) + user_assigned = _builder.get(".identity.userAssigned") + if user_assigned is not None: + user_assigned.set_elements(AAZStrType, ".") + properties = _builder.get(".properties") if properties is not None: properties.set_prop("analyticsWorkspaceId", AAZStrType, ".analytics_workspace_id") @@ -299,7 +318,7 @@ def _build_schema_on_200_201(cls): _schema_on_200_201.id = AAZStrType( flags={"read_only": True}, ) - _schema_on_200_201.identity = AAZObjectType() + _schema_on_200_201.identity = AAZIdentityObjectType() _schema_on_200_201.location = AAZStrType( flags={"required": True}, ) diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/clustermanager/_list.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/clustermanager/_list.py index 651b5d3a266..6859484deed 100644 --- a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/clustermanager/_list.py +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/clustermanager/_list.py @@ -55,12 +55,12 @@ def _build_arguments_schema(cls, *args, **kwargs): def _execute_operations(self): self.pre_operations() - condition_0 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) - condition_1 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True + condition_0 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True + condition_1 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) if condition_0: - self.ClusterManagersListByResourceGroup(ctx=self.ctx)() - if condition_1: self.ClusterManagersListBySubscription(ctx=self.ctx)() + if condition_1: + self.ClusterManagersListByResourceGroup(ctx=self.ctx)() self.post_operations() @register_callback @@ -76,7 +76,7 @@ def _output(self, *args, **kwargs): next_link = self.deserialize_output(self.ctx.vars.instance.next_link) return result, next_link - class ClusterManagersListByResourceGroup(AAZHttpOperation): + class ClusterManagersListBySubscription(AAZHttpOperation): CLIENT_TYPE = "MgmtClient" def __call__(self, *args, **kwargs): @@ -90,7 +90,7 @@ def __call__(self, *args, **kwargs): @property def url(self): return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusterManagers", + "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/clusterManagers", **self.url_parameters ) @@ -105,10 +105,6 @@ def error_format(self): @property def url_parameters(self): parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), **self.serialize_url_param( "subscriptionId", self.ctx.subscription_id, required=True, @@ -165,7 +161,7 @@ def _build_schema_on_200(cls): _element.id = AAZStrType( flags={"read_only": True}, ) - _element.identity = AAZObjectType() + _element.identity = AAZIdentityObjectType() _element.location = AAZStrType( flags={"required": True}, ) @@ -306,7 +302,7 @@ def _build_schema_on_200(cls): return cls._schema_on_200 - class ClusterManagersListBySubscription(AAZHttpOperation): + class ClusterManagersListByResourceGroup(AAZHttpOperation): CLIENT_TYPE = "MgmtClient" def __call__(self, *args, **kwargs): @@ -320,7 +316,7 @@ def __call__(self, *args, **kwargs): @property def url(self): return self.client.format_url( - "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/clusterManagers", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusterManagers", **self.url_parameters ) @@ -335,6 +331,10 @@ def error_format(self): @property def url_parameters(self): parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), **self.serialize_url_param( "subscriptionId", self.ctx.subscription_id, required=True, @@ -391,7 +391,7 @@ def _build_schema_on_200(cls): _element.id = AAZStrType( flags={"read_only": True}, ) - _element.identity = AAZObjectType() + _element.identity = AAZIdentityObjectType() _element.location = AAZStrType( flags={"required": True}, ) diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/clustermanager/_show.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/clustermanager/_show.py index 26ed39be15d..155fa5d756f 100644 --- a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/clustermanager/_show.py +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/clustermanager/_show.py @@ -160,7 +160,7 @@ def _build_schema_on_200(cls): _schema_on_200.id = AAZStrType( flags={"read_only": True}, ) - _schema_on_200.identity = AAZObjectType() + _schema_on_200.identity = AAZIdentityObjectType() _schema_on_200.location = AAZStrType( flags={"required": True}, ) diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/clustermanager/_update.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/clustermanager/_update.py index 136519de5a4..3b8870048e7 100644 --- a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/clustermanager/_update.py +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/clustermanager/_update.py @@ -79,17 +79,30 @@ def _build_arguments_schema(cls, *args, **kwargs): ) identity = cls._args_schema.identity + identity.mi_system_assigned = AAZStrArg( + options=["system-assigned", "mi-system-assigned"], + help="Set the system managed identity.", + blank="True", + ) identity.type = AAZStrArg( options=["type"], help="Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed).", required=True, enum={"None": "None", "SystemAssigned": "SystemAssigned", "SystemAssigned,UserAssigned": "SystemAssigned,UserAssigned", "UserAssigned": "UserAssigned"}, ) + identity.mi_user_assigned = AAZListArg( + options=["user-assigned", "mi-user-assigned"], + help="Set the user managed identities.", + blank=[], + ) identity.user_assigned_identities = AAZDictArg( options=["user-assigned-identities"], help="The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. The dictionary values can be empty objects ({}) in requests.", ) + mi_user_assigned = cls._args_schema.identity.mi_user_assigned + mi_user_assigned.Element = AAZStrArg() + user_assigned_identities = cls._args_schema.identity.user_assigned_identities user_assigned_identities.Element = AAZObjectArg( nullable=True, @@ -190,18 +203,24 @@ def content(self): typ=AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}} ) - _builder.set_prop("identity", AAZObjectType, ".identity") + _builder.set_prop("identity", AAZIdentityObjectType, ".identity") _builder.set_prop("tags", AAZDictType, ".tags") identity = _builder.get(".identity") if identity is not None: identity.set_prop("type", AAZStrType, ".type", typ_kwargs={"flags": {"required": True}}) identity.set_prop("userAssignedIdentities", AAZDictType, ".user_assigned_identities") + identity.set_prop("userAssigned", AAZListType, ".mi_user_assigned", typ_kwargs={"flags": {"action": "create"}}) + identity.set_prop("systemAssigned", AAZStrType, ".mi_system_assigned", typ_kwargs={"flags": {"action": "create"}}) user_assigned_identities = _builder.get(".identity.userAssignedIdentities") if user_assigned_identities is not None: user_assigned_identities.set_elements(AAZObjectType, ".", typ_kwargs={"nullable": True}) + user_assigned = _builder.get(".identity.userAssigned") + if user_assigned is not None: + user_assigned.set_elements(AAZStrType, ".") + tags = _builder.get(".tags") if tags is not None: tags.set_elements(AAZStrType, ".") @@ -229,7 +248,7 @@ def _build_schema_on_200(cls): _schema_on_200.id = AAZStrType( flags={"read_only": True}, ) - _schema_on_200.identity = AAZObjectType() + _schema_on_200.identity = AAZIdentityObjectType() _schema_on_200.location = AAZStrType( flags={"required": True}, ) diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/clustermanager/_wait.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/clustermanager/_wait.py index 1ca1cdf2a2d..6906ce3c5e0 100644 --- a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/clustermanager/_wait.py +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/clustermanager/_wait.py @@ -155,7 +155,7 @@ def _build_schema_on_200(cls): _schema_on_200.id = AAZStrType( flags={"read_only": True}, ) - _schema_on_200.identity = AAZObjectType() + _schema_on_200.identity = AAZIdentityObjectType() _schema_on_200.location = AAZStrType( flags={"required": True}, ) diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/kubernetescluster/_list.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/kubernetescluster/_list.py index be761d0fa81..909f2c91c3a 100644 --- a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/kubernetescluster/_list.py +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/kubernetescluster/_list.py @@ -55,12 +55,12 @@ def _build_arguments_schema(cls, *args, **kwargs): def _execute_operations(self): self.pre_operations() - condition_0 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) - condition_1 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True + condition_0 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True + condition_1 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) if condition_0: - self.KubernetesClustersListByResourceGroup(ctx=self.ctx)() - if condition_1: self.KubernetesClustersListBySubscription(ctx=self.ctx)() + if condition_1: + self.KubernetesClustersListByResourceGroup(ctx=self.ctx)() self.post_operations() @register_callback @@ -76,7 +76,7 @@ def _output(self, *args, **kwargs): next_link = self.deserialize_output(self.ctx.vars.instance.next_link) return result, next_link - class KubernetesClustersListByResourceGroup(AAZHttpOperation): + class KubernetesClustersListBySubscription(AAZHttpOperation): CLIENT_TYPE = "MgmtClient" def __call__(self, *args, **kwargs): @@ -90,7 +90,7 @@ def __call__(self, *args, **kwargs): @property def url(self): return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/kubernetesClusters", + "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/kubernetesClusters", **self.url_parameters ) @@ -105,10 +105,6 @@ def error_format(self): @property def url_parameters(self): parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), **self.serialize_url_param( "subscriptionId", self.ctx.subscription_id, required=True, @@ -725,7 +721,7 @@ def _build_schema_on_200(cls): return cls._schema_on_200 - class KubernetesClustersListBySubscription(AAZHttpOperation): + class KubernetesClustersListByResourceGroup(AAZHttpOperation): CLIENT_TYPE = "MgmtClient" def __call__(self, *args, **kwargs): @@ -739,7 +735,7 @@ def __call__(self, *args, **kwargs): @property def url(self): return self.client.format_url( - "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/kubernetesClusters", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/kubernetesClusters", **self.url_parameters ) @@ -754,6 +750,10 @@ def error_format(self): @property def url_parameters(self): parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), **self.serialize_url_param( "subscriptionId", self.ctx.subscription_id, required=True, diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l2network/_list.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l2network/_list.py index 9bae7f7100d..4889a88268e 100644 --- a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l2network/_list.py +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l2network/_list.py @@ -55,12 +55,12 @@ def _build_arguments_schema(cls, *args, **kwargs): def _execute_operations(self): self.pre_operations() - condition_0 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) - condition_1 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True + condition_0 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True + condition_1 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) if condition_0: - self.L2NetworksListByResourceGroup(ctx=self.ctx)() - if condition_1: self.L2NetworksListBySubscription(ctx=self.ctx)() + if condition_1: + self.L2NetworksListByResourceGroup(ctx=self.ctx)() self.post_operations() @register_callback @@ -76,7 +76,7 @@ def _output(self, *args, **kwargs): next_link = self.deserialize_output(self.ctx.vars.instance.next_link) return result, next_link - class L2NetworksListByResourceGroup(AAZHttpOperation): + class L2NetworksListBySubscription(AAZHttpOperation): CLIENT_TYPE = "MgmtClient" def __call__(self, *args, **kwargs): @@ -90,7 +90,7 @@ def __call__(self, *args, **kwargs): @property def url(self): return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/l2Networks", + "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/l2Networks", **self.url_parameters ) @@ -105,10 +105,6 @@ def error_format(self): @property def url_parameters(self): parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), **self.serialize_url_param( "subscriptionId", self.ctx.subscription_id, required=True, @@ -269,7 +265,7 @@ def _build_schema_on_200(cls): return cls._schema_on_200 - class L2NetworksListBySubscription(AAZHttpOperation): + class L2NetworksListByResourceGroup(AAZHttpOperation): CLIENT_TYPE = "MgmtClient" def __call__(self, *args, **kwargs): @@ -283,7 +279,7 @@ def __call__(self, *args, **kwargs): @property def url(self): return self.client.format_url( - "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/l2Networks", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/l2Networks", **self.url_parameters ) @@ -298,6 +294,10 @@ def error_format(self): @property def url_parameters(self): parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), **self.serialize_url_param( "subscriptionId", self.ctx.subscription_id, required=True, diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l3network/_list.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l3network/_list.py index 99c077cd2cb..da3170e5dd1 100644 --- a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l3network/_list.py +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l3network/_list.py @@ -55,12 +55,12 @@ def _build_arguments_schema(cls, *args, **kwargs): def _execute_operations(self): self.pre_operations() - condition_0 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) - condition_1 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True + condition_0 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True + condition_1 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) if condition_0: - self.L3NetworksListByResourceGroup(ctx=self.ctx)() - if condition_1: self.L3NetworksListBySubscription(ctx=self.ctx)() + if condition_1: + self.L3NetworksListByResourceGroup(ctx=self.ctx)() self.post_operations() @register_callback @@ -76,7 +76,7 @@ def _output(self, *args, **kwargs): next_link = self.deserialize_output(self.ctx.vars.instance.next_link) return result, next_link - class L3NetworksListByResourceGroup(AAZHttpOperation): + class L3NetworksListBySubscription(AAZHttpOperation): CLIENT_TYPE = "MgmtClient" def __call__(self, *args, **kwargs): @@ -90,7 +90,7 @@ def __call__(self, *args, **kwargs): @property def url(self): return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/l3Networks", + "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/l3Networks", **self.url_parameters ) @@ -105,10 +105,6 @@ def error_format(self): @property def url_parameters(self): parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), **self.serialize_url_param( "subscriptionId", self.ctx.subscription_id, required=True, @@ -284,7 +280,7 @@ def _build_schema_on_200(cls): return cls._schema_on_200 - class L3NetworksListBySubscription(AAZHttpOperation): + class L3NetworksListByResourceGroup(AAZHttpOperation): CLIENT_TYPE = "MgmtClient" def __call__(self, *args, **kwargs): @@ -298,7 +294,7 @@ def __call__(self, *args, **kwargs): @property def url(self): return self.client.format_url( - "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/l3Networks", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/l3Networks", **self.url_parameters ) @@ -313,6 +309,10 @@ def error_format(self): @property def url_parameters(self): parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), **self.serialize_url_param( "subscriptionId", self.ctx.subscription_id, required=True, diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/rack/_list.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/rack/_list.py index 56c794b5210..b789a0503a9 100644 --- a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/rack/_list.py +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/rack/_list.py @@ -55,12 +55,12 @@ def _build_arguments_schema(cls, *args, **kwargs): def _execute_operations(self): self.pre_operations() - condition_0 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) - condition_1 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True + condition_0 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True + condition_1 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) if condition_0: - self.RacksListByResourceGroup(ctx=self.ctx)() - if condition_1: self.RacksListBySubscription(ctx=self.ctx)() + if condition_1: + self.RacksListByResourceGroup(ctx=self.ctx)() self.post_operations() @register_callback @@ -76,7 +76,7 @@ def _output(self, *args, **kwargs): next_link = self.deserialize_output(self.ctx.vars.instance.next_link) return result, next_link - class RacksListByResourceGroup(AAZHttpOperation): + class RacksListBySubscription(AAZHttpOperation): CLIENT_TYPE = "MgmtClient" def __call__(self, *args, **kwargs): @@ -90,7 +90,7 @@ def __call__(self, *args, **kwargs): @property def url(self): return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/racks", + "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/racks", **self.url_parameters ) @@ -105,10 +105,6 @@ def error_format(self): @property def url_parameters(self): parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), **self.serialize_url_param( "subscriptionId", self.ctx.subscription_id, required=True, @@ -254,7 +250,7 @@ def _build_schema_on_200(cls): return cls._schema_on_200 - class RacksListBySubscription(AAZHttpOperation): + class RacksListByResourceGroup(AAZHttpOperation): CLIENT_TYPE = "MgmtClient" def __call__(self, *args, **kwargs): @@ -268,7 +264,7 @@ def __call__(self, *args, **kwargs): @property def url(self): return self.client.format_url( - "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/racks", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/racks", **self.url_parameters ) @@ -283,6 +279,10 @@ def error_format(self): @property def url_parameters(self): parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), **self.serialize_url_param( "subscriptionId", self.ctx.subscription_id, required=True, diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/storageappliance/_list.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/storageappliance/_list.py index ff601b24508..bec5006c80c 100644 --- a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/storageappliance/_list.py +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/storageappliance/_list.py @@ -55,12 +55,12 @@ def _build_arguments_schema(cls, *args, **kwargs): def _execute_operations(self): self.pre_operations() - condition_0 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) - condition_1 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True + condition_0 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True + condition_1 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) if condition_0: - self.StorageAppliancesListByResourceGroup(ctx=self.ctx)() - if condition_1: self.StorageAppliancesListBySubscription(ctx=self.ctx)() + if condition_1: + self.StorageAppliancesListByResourceGroup(ctx=self.ctx)() self.post_operations() @register_callback @@ -76,7 +76,7 @@ def _output(self, *args, **kwargs): next_link = self.deserialize_output(self.ctx.vars.instance.next_link) return result, next_link - class StorageAppliancesListByResourceGroup(AAZHttpOperation): + class StorageAppliancesListBySubscription(AAZHttpOperation): CLIENT_TYPE = "MgmtClient" def __call__(self, *args, **kwargs): @@ -90,7 +90,7 @@ def __call__(self, *args, **kwargs): @property def url(self): return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/storageAppliances", + "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/storageAppliances", **self.url_parameters ) @@ -105,10 +105,6 @@ def error_format(self): @property def url_parameters(self): parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), **self.serialize_url_param( "subscriptionId", self.ctx.subscription_id, required=True, @@ -337,7 +333,7 @@ def _build_schema_on_200(cls): return cls._schema_on_200 - class StorageAppliancesListBySubscription(AAZHttpOperation): + class StorageAppliancesListByResourceGroup(AAZHttpOperation): CLIENT_TYPE = "MgmtClient" def __call__(self, *args, **kwargs): @@ -351,7 +347,7 @@ def __call__(self, *args, **kwargs): @property def url(self): return self.client.format_url( - "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/storageAppliances", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/storageAppliances", **self.url_parameters ) @@ -366,6 +362,10 @@ def error_format(self): @property def url_parameters(self): parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), **self.serialize_url_param( "subscriptionId", self.ctx.subscription_id, required=True, diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/trunkednetwork/_list.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/trunkednetwork/_list.py index 4131c1f8197..64cab394083 100644 --- a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/trunkednetwork/_list.py +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/trunkednetwork/_list.py @@ -55,12 +55,12 @@ def _build_arguments_schema(cls, *args, **kwargs): def _execute_operations(self): self.pre_operations() - condition_0 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) - condition_1 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True + condition_0 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True + condition_1 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) if condition_0: - self.TrunkedNetworksListByResourceGroup(ctx=self.ctx)() - if condition_1: self.TrunkedNetworksListBySubscription(ctx=self.ctx)() + if condition_1: + self.TrunkedNetworksListByResourceGroup(ctx=self.ctx)() self.post_operations() @register_callback @@ -76,7 +76,7 @@ def _output(self, *args, **kwargs): next_link = self.deserialize_output(self.ctx.vars.instance.next_link) return result, next_link - class TrunkedNetworksListByResourceGroup(AAZHttpOperation): + class TrunkedNetworksListBySubscription(AAZHttpOperation): CLIENT_TYPE = "MgmtClient" def __call__(self, *args, **kwargs): @@ -90,7 +90,7 @@ def __call__(self, *args, **kwargs): @property def url(self): return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/trunkedNetworks", + "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/trunkedNetworks", **self.url_parameters ) @@ -105,10 +105,6 @@ def error_format(self): @property def url_parameters(self): parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), **self.serialize_url_param( "subscriptionId", self.ctx.subscription_id, required=True, @@ -278,7 +274,7 @@ def _build_schema_on_200(cls): return cls._schema_on_200 - class TrunkedNetworksListBySubscription(AAZHttpOperation): + class TrunkedNetworksListByResourceGroup(AAZHttpOperation): CLIENT_TYPE = "MgmtClient" def __call__(self, *args, **kwargs): @@ -292,7 +288,7 @@ def __call__(self, *args, **kwargs): @property def url(self): return self.client.format_url( - "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/trunkedNetworks", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/trunkedNetworks", **self.url_parameters ) @@ -307,6 +303,10 @@ def error_format(self): @property def url_parameters(self): parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), **self.serialize_url_param( "subscriptionId", self.ctx.subscription_id, required=True, diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/_list.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/_list.py index a906c223ddb..3747cb5025f 100644 --- a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/_list.py +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/_list.py @@ -55,12 +55,12 @@ def _build_arguments_schema(cls, *args, **kwargs): def _execute_operations(self): self.pre_operations() - condition_0 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) - condition_1 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True + condition_0 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True + condition_1 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) if condition_0: - self.VirtualMachinesListByResourceGroup(ctx=self.ctx)() - if condition_1: self.VirtualMachinesListBySubscription(ctx=self.ctx)() + if condition_1: + self.VirtualMachinesListByResourceGroup(ctx=self.ctx)() self.post_operations() @register_callback @@ -76,7 +76,7 @@ def _output(self, *args, **kwargs): next_link = self.deserialize_output(self.ctx.vars.instance.next_link) return result, next_link - class VirtualMachinesListByResourceGroup(AAZHttpOperation): + class VirtualMachinesListBySubscription(AAZHttpOperation): CLIENT_TYPE = "MgmtClient" def __call__(self, *args, **kwargs): @@ -90,7 +90,7 @@ def __call__(self, *args, **kwargs): @property def url(self): return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/virtualMachines", + "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/virtualMachines", **self.url_parameters ) @@ -105,10 +105,6 @@ def error_format(self): @property def url_parameters(self): parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), **self.serialize_url_param( "subscriptionId", self.ctx.subscription_id, required=True, @@ -430,7 +426,7 @@ def _build_schema_on_200(cls): return cls._schema_on_200 - class VirtualMachinesListBySubscription(AAZHttpOperation): + class VirtualMachinesListByResourceGroup(AAZHttpOperation): CLIENT_TYPE = "MgmtClient" def __call__(self, *args, **kwargs): @@ -444,7 +440,7 @@ def __call__(self, *args, **kwargs): @property def url(self): return self.client.format_url( - "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/virtualMachines", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/virtualMachines", **self.url_parameters ) @@ -459,6 +455,10 @@ def error_format(self): @property def url_parameters(self): parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), **self.serialize_url_param( "subscriptionId", self.ctx.subscription_id, required=True, diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/volume/_list.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/volume/_list.py index 9fb232158cf..6db232d86a6 100644 --- a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/volume/_list.py +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/volume/_list.py @@ -55,12 +55,12 @@ def _build_arguments_schema(cls, *args, **kwargs): def _execute_operations(self): self.pre_operations() - condition_0 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) - condition_1 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True + condition_0 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True + condition_1 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) if condition_0: - self.VolumesListByResourceGroup(ctx=self.ctx)() - if condition_1: self.VolumesListBySubscription(ctx=self.ctx)() + if condition_1: + self.VolumesListByResourceGroup(ctx=self.ctx)() self.post_operations() @register_callback @@ -76,7 +76,7 @@ def _output(self, *args, **kwargs): next_link = self.deserialize_output(self.ctx.vars.instance.next_link) return result, next_link - class VolumesListByResourceGroup(AAZHttpOperation): + class VolumesListBySubscription(AAZHttpOperation): CLIENT_TYPE = "MgmtClient" def __call__(self, *args, **kwargs): @@ -90,7 +90,7 @@ def __call__(self, *args, **kwargs): @property def url(self): return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/volumes", + "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/volumes", **self.url_parameters ) @@ -105,10 +105,6 @@ def error_format(self): @property def url_parameters(self): parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), **self.serialize_url_param( "subscriptionId", self.ctx.subscription_id, required=True, @@ -249,7 +245,7 @@ def _build_schema_on_200(cls): return cls._schema_on_200 - class VolumesListBySubscription(AAZHttpOperation): + class VolumesListByResourceGroup(AAZHttpOperation): CLIENT_TYPE = "MgmtClient" def __call__(self, *args, **kwargs): @@ -263,7 +259,7 @@ def __call__(self, *args, **kwargs): @property def url(self): return self.client.format_url( - "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/volumes", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/volumes", **self.url_parameters ) @@ -278,6 +274,10 @@ def error_format(self): @property def url_parameters(self): parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), **self.serialize_url_param( "subscriptionId", self.ctx.subscription_id, required=True, diff --git a/src/networkcloud/azext_networkcloud/azext_metadata.json b/src/networkcloud/azext_networkcloud/azext_metadata.json index b1e08d1f4b1..c0a5eb4c840 100644 --- a/src/networkcloud/azext_networkcloud/azext_metadata.json +++ b/src/networkcloud/azext_networkcloud/azext_metadata.json @@ -1,4 +1,4 @@ { "azext.isPreview": true, - "azext.minCliCoreVersion": "2.61.0" + "azext.minCliCoreVersion": "2.66.0" } \ No newline at end of file diff --git a/src/networkcloud/azext_networkcloud/operations/cluster/_create.py b/src/networkcloud/azext_networkcloud/operations/cluster/_create.py index 894161a47c4..c39f5aea954 100644 --- a/src/networkcloud/azext_networkcloud/operations/cluster/_create.py +++ b/src/networkcloud/azext_networkcloud/operations/cluster/_create.py @@ -11,6 +11,7 @@ from azext_networkcloud.aaz.latest.networkcloud.cluster._create import Create as _Create from azure.cli.core.aaz import register_callback +from ..common_commandoutputsettings import CommandOutputSettings from ..common_managedidentity import ManagedIdentity @@ -25,3 +26,4 @@ def _build_arguments_schema(cls, *args, **kwargs): @register_callback def pre_operations(self): ManagedIdentity.pre_operations_create(self.ctx.args) + CommandOutputSettings.pre_operations_create(self.ctx.args) diff --git a/src/networkcloud/azext_networkcloud/operations/cluster/_update.py b/src/networkcloud/azext_networkcloud/operations/cluster/_update.py index 492904a4aba..b82d19a3a6c 100644 --- a/src/networkcloud/azext_networkcloud/operations/cluster/_update.py +++ b/src/networkcloud/azext_networkcloud/operations/cluster/_update.py @@ -11,6 +11,7 @@ from azext_networkcloud.aaz.latest.networkcloud.cluster._update import Update as _Update from azure.cli.core.aaz import register_callback +from ..common_commandoutputsettings import CommandOutputSettings from ..common_managedidentity import ManagedIdentity @@ -25,3 +26,4 @@ def _build_arguments_schema(cls, *args, **kwargs): @register_callback def pre_operations(self): ManagedIdentity.pre_operations_update(self.ctx.args) + CommandOutputSettings.pre_operations_update(self.ctx.args) diff --git a/src/networkcloud/azext_networkcloud/operations/common_commandoutputsettings.py b/src/networkcloud/azext_networkcloud/operations/common_commandoutputsettings.py new file mode 100644 index 00000000000..46447dea3d8 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/operations/common_commandoutputsettings.py @@ -0,0 +1,44 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: disable=protected-access, too-few-public-methods +# pylint: disable=duplicate-code,no-member + +""" +This is custom code for command output settings +""" + +from azure.cli.core.aaz._base import has_value +from azure.cli.core.azclierror import InvalidArgumentValueError +from knack.log import get_logger + +logger = get_logger(__name__) + + +class CommandOutputSettings: + @classmethod + def pre_operations_create(cls, args): + # unsure yet if anything between create and update needs to + # be different + + cls.pre_operations_update(args) + + @classmethod + def pre_operations_update(cls, args): + if args.command_output_settings: + # if system assigned is provided, user assigned should not also be provided + if args.command_output_settings.identity_type == "SystemAssignedIdentity": + if has_value(args.command_output_settings.identity_resource_id): + logger.warning( + "SystemAssignedIdentity type is mutually exclusive with UserAssignedIdentity type. Ignoring " + "provided user-assigned identity %s", + args.command_output_settings.identity_resource_id, + ) + args.command_output_settings.identity_resource_id = None + + if args.command_output_settings.identity_type == "UserAssignedIdentity": + if not has_value(args.command_output_settings.identity_resource_id): + raise InvalidArgumentValueError( + "User-assigned identity resource ID is missing for command output settings." + ) diff --git a/src/networkcloud/azext_networkcloud/operations/custom_properties.py b/src/networkcloud/azext_networkcloud/operations/custom_properties.py index cc34dde5197..3de4fb6237a 100644 --- a/src/networkcloud/azext_networkcloud/operations/custom_properties.py +++ b/src/networkcloud/azext_networkcloud/operations/custom_properties.py @@ -86,7 +86,7 @@ def _output(parent_cmd, *args, **kwargs): # pylint: disable=unused-argument raise AzureInternalError(error_message) from ex logger.warning( - "Script execution result can be download from storage account using the " + "Script execution result can be downloaded from storage account using the " "command: \n az storage blob download --blob-url %s --file %s --auth-mode login > /dev/null 2>&1 \n", result_ref, downloaded_blob_name, diff --git a/src/networkcloud/azext_networkcloud/tests/unit/test_custom_commandoutputsettings.py b/src/networkcloud/azext_networkcloud/tests/unit/test_custom_commandoutputsettings.py new file mode 100644 index 00000000000..a5268fcc1fd --- /dev/null +++ b/src/networkcloud/azext_networkcloud/tests/unit/test_custom_commandoutputsettings.py @@ -0,0 +1,83 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +import unittest +from unittest.mock import Mock, patch + +from azext_networkcloud.operations.common_commandoutputsettings import ( + CommandOutputSettings, +) +from azure.cli.core.azclierror import InvalidArgumentValueError + + +class TestCommandOutputSettings(unittest.TestCase): + def setUp(self): + self.args_schema = Mock() + self.command_output_settings = CommandOutputSettings() + + @patch("azext_networkcloud.operations.common_commandoutputsettings.has_value") + def test_pre_operations_command_output_settings_system_assigned_only( + self, mock_has_value + ): + mock_has_value.return_value = True + args = Mock() + args.command_output_settings.identity_type = "SystemAssignedIdentity" + + self.command_output_settings.pre_operations_update(args) + + self.assertEqual( + args.command_output_settings.identity_type, "SystemAssignedIdentity" + ) + self.assertIsNone(args.command_output_settings.identity_resource_id) + + @patch("azext_networkcloud.operations.common_commandoutputsettings.has_value") + def test_pre_operations_command_output_settings_user_assigned_only( + self, mock_has_value + ): + mock_has_value.return_value = True + args = Mock() + args.command_output_settings.identity_type = "UserAssignedIdentity" + + # Mock the identity + mock_identity1 = Mock(return_value="id1") + + args.command_output_settings.identity_resource_id = mock_identity1 + + self.command_output_settings.pre_operations_update(args) + + self.assertEqual( + args.command_output_settings.identity_type, "UserAssignedIdentity" + ) + self.assertEqual(args.command_output_settings.identity_resource_id(), "id1") + + @patch("azext_networkcloud.operations.common_commandoutputsettings.has_value") + def test_pre_operations_command_output_settings_both_assigned(self, mock_has_value): + mock_has_value.return_value = True + args = Mock() + args.command_output_settings.identity_type = "SystemAssignedIdentity" + + # Mock the identity + mock_identity1 = Mock(return_value="id1") + + args.command_output_settings.identity_resource_id = mock_identity1 + + self.command_output_settings.pre_operations_update(args) + + self.assertEqual( + args.command_output_settings.identity_type, "SystemAssignedIdentity" + ) + self.assertIsNone(args.command_output_settings.identity_resource_id) + + @patch("azext_networkcloud.operations.common_commandoutputsettings.has_value") + def test_pre_operations_command_output_settings_user_no_id(self, mock_has_value): + mock_has_value.return_value = ( + False # UserAssigned identity resource ID is not passed + ) + args = Mock() + args.command_output_settings.identity_type = "UserAssignedIdentity" + args.command_output_settings.identity_resource_id = None + + with self.assertRaises(InvalidArgumentValueError): + self.command_output_settings.pre_operations_update(args) diff --git a/src/networkcloud/setup.py b/src/networkcloud/setup.py index 8f24ee9be81..3e798575600 100644 --- a/src/networkcloud/setup.py +++ b/src/networkcloud/setup.py @@ -10,7 +10,7 @@ # HISTORY.rst entry. -VERSION = '2.0.0b6' +VERSION = '2.0.0b7' # The full list of classifiers is available at # https://pypi.python.org/pypi?%3Aaction=list_classifiers