Skip to content

Commit

Permalink
networkcloud 20240701preview version updated (Azure#8291)
Browse files Browse the repository at this point in the history
Co-authored-by: priya shet <[email protected]>
  • Loading branch information
priyamshet and priya shet authored Nov 20, 2024
1 parent da7e2d4 commit b3165cc
Show file tree
Hide file tree
Showing 28 changed files with 399 additions and 171 deletions.
7 changes: 7 additions & 0 deletions src/networkcloud/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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):
Expand All @@ -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
)

Expand All @@ -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,
Expand Down Expand Up @@ -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):
Expand All @@ -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
)

Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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):
Expand All @@ -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
)

Expand All @@ -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,
Expand Down Expand Up @@ -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):
Expand All @@ -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
)

Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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"],
Expand Down Expand Up @@ -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")
Expand All @@ -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}}))
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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},
)
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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):
Expand All @@ -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
)

Expand All @@ -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,
Expand Down Expand Up @@ -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},
)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand All @@ -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
)

Expand All @@ -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,
Expand Down Expand Up @@ -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},
)
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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},
)
Expand Down Expand Up @@ -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
Expand Down
Loading

0 comments on commit b3165cc

Please sign in to comment.