Skip to content
Prev Previous commit
Next Next commit
update allow_roleassignment_on_rg to be boolean
  • Loading branch information
jiewe committed Jun 6, 2024
commit f7e9465a20bcd42d468ffd677a22ad638c44a671
Original file line number Diff line number Diff line change
Expand Up @@ -425,10 +425,10 @@
},
"allowRoleAssignmentOnRG": {
"type": "string",
"defaultValue": "Enabled",
"defaultValue": "true",
"allowedValues": [
"Disabled",
"Enabled"
"true",
"false"
],
"metadata": {
"description": "A flag to determine if workspace should be created/update with allow role assignment on resource group level."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@
"value": "false"
},
"allowRoleAssignmentOnRG": {
"value": "Enabled"
"value": "true"
},
"serverless_compute_settings": {
"value": {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31621,6 +31621,8 @@ class Workspace(Resource):
:vartype discovery_url: str
:ivar enable_data_isolation:
:vartype enable_data_isolation: bool
:ivar allow_roleassignment_on_rg: Determine whether we will allow workspace role assignment on resource group level.
:vartype allow_roleassignment_on_rg: bool
:ivar encryption:
:vartype encryption: ~azure.mgmt.machinelearningservices.models.EncryptionProperty
:ivar existing_workspaces:
Expand Down Expand Up @@ -31737,6 +31739,7 @@ class Workspace(Resource):
'description': {'key': 'properties.description', 'type': 'str'},
'discovery_url': {'key': 'properties.discoveryUrl', 'type': 'str'},
'enable_data_isolation': {'key': 'properties.enableDataIsolation', 'type': 'bool'},
'allow_roleassignment_on_rg': {'key': 'properties.allowRoleAssignmentOnRG', 'type': 'bool'},
'encryption': {'key': 'properties.encryption', 'type': 'EncryptionProperty'},
'existing_workspaces': {'key': 'properties.existingWorkspaces', 'type': '[str]'},
'feature_store_settings': {'key': 'properties.featureStoreSettings', 'type': 'FeatureStoreSettings'},
Expand Down Expand Up @@ -31804,6 +31807,8 @@ def __init__(
:paramtype discovery_url: str
:keyword enable_data_isolation:
:paramtype enable_data_isolation: bool
:keyword allow_roleassignment_on_rg: Determine whether we will allow workspace role assignment on resource group level.
:paramtype allow_roleassignment_on_rg: bool
:keyword encryption:
:paramtype encryption: ~azure.mgmt.machinelearningservices.models.EncryptionProperty
:keyword existing_workspaces:
Expand Down Expand Up @@ -31875,6 +31880,7 @@ def __init__(
self.description = kwargs.get('description', None)
self.discovery_url = kwargs.get('discovery_url', None)
self.enable_data_isolation = kwargs.get('enable_data_isolation', None)
self.allow_roleassignment_on_rg = kwargs.get('allow_roleassignment_on_rg', None)
self.encryption = kwargs.get('encryption', None)
self.existing_workspaces = kwargs.get('existing_workspaces', None)
self.feature_store_settings = kwargs.get('feature_store_settings', None)
Expand Down Expand Up @@ -32319,9 +32325,8 @@ class WorkspaceUpdateParameters(msrest.serialization.Model):
:vartype description: str
:ivar enable_data_isolation:
:vartype enable_data_isolation: bool
:ivar allow_roleassignment_on_rg: Determine whether we will allow workspace role assignment on resource group level.
include: "Enabled", "Disabled".
:vartype allow_roleassignment_on_rg: str
:ivar allow_roleassignment_on_rg: Determine whether we will allow workspace role assignment on resource group level.
:vartype allow_roleassignment_on_rg: bool
:ivar encryption:
:vartype encryption: ~azure.mgmt.machinelearningservices.models.EncryptionUpdateProperties
:ivar feature_store_settings: Settings for feature store type workspace.
Expand Down Expand Up @@ -32376,7 +32381,7 @@ class WorkspaceUpdateParameters(msrest.serialization.Model):
'soft_delete_retention_in_days': {'key': 'properties.softDeleteRetentionInDays', 'type': 'int'},
'v1_legacy_mode': {'key': 'properties.v1LegacyMode', 'type': 'bool'},
'system_datastores_auth_mode': {'key': 'properties.systemDatastoresAuthMode', 'type': 'str'},
'allow_roleassignment_on_rg' : {'Key': 'properties.allowRoleAssignmentOnRG', 'type': 'str'}
'allow_roleassignment_on_rg' : {'Key': 'properties.allowRoleAssignmentOnRG', 'type': 'bool'}
}

def __init__(
Expand All @@ -32400,9 +32405,8 @@ def __init__(
:paramtype description: str
:keyword enable_data_isolation:
:paramtype enable_data_isolation: bool
:ivar allow_roleassignment_on_rg: Determine whether we will allow workspace role assignment on resource group level.
include: "Enabled", "Disabled".
:vartype allow_roleassignment_on_rg: str
:keyword allow_roleassignment_on_rg: Determine whether we will allow workspace role assignment on resource group level.
:paramtype allow_roleassignment_on_rg: bool
:keyword encryption:
:paramtype encryption: ~azure.mgmt.machinelearningservices.models.EncryptionUpdateProperties
:keyword feature_store_settings: Settings for feature store type workspace.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34323,6 +34323,8 @@ class Workspace(Resource):
:vartype discovery_url: str
:ivar enable_data_isolation:
:vartype enable_data_isolation: bool
:ivar allow_roleassignment_on_rg: Determine whether we will allow workspace role assignment on resource group level.
:vartype allow_roleassignment_on_rg: bool
:ivar encryption:
:vartype encryption: ~azure.mgmt.machinelearningservices.models.EncryptionProperty
:ivar existing_workspaces:
Expand Down Expand Up @@ -34439,6 +34441,7 @@ class Workspace(Resource):
'description': {'key': 'properties.description', 'type': 'str'},
'discovery_url': {'key': 'properties.discoveryUrl', 'type': 'str'},
'enable_data_isolation': {'key': 'properties.enableDataIsolation', 'type': 'bool'},
'allow_roleassignment_on_rg': {'key': 'properties.allowRoleAssignmentOnRG', 'type': 'bool'},
'encryption': {'key': 'properties.encryption', 'type': 'EncryptionProperty'},
'existing_workspaces': {'key': 'properties.existingWorkspaces', 'type': '[str]'},
'feature_store_settings': {'key': 'properties.featureStoreSettings', 'type': 'FeatureStoreSettings'},
Expand Down Expand Up @@ -34487,6 +34490,7 @@ def __init__(
description: Optional[str] = None,
discovery_url: Optional[str] = None,
enable_data_isolation: Optional[bool] = None,
allow_roleassignment_on_rg: Optional[bool] = None,
encryption: Optional["EncryptionProperty"] = None,
existing_workspaces: Optional[List[str]] = None,
feature_store_settings: Optional["FeatureStoreSettings"] = None,
Expand Down Expand Up @@ -34541,6 +34545,8 @@ def __init__(
:paramtype discovery_url: str
:keyword enable_data_isolation:
:paramtype enable_data_isolation: bool
:keyword allow_roleassignment_on_rg: Determine whether we will allow workspace role assignment on resource group level.
:paramtype allow_roleassignment_on_rg: bool
:keyword encryption:
:paramtype encryption: ~azure.mgmt.machinelearningservices.models.EncryptionProperty
:keyword existing_workspaces:
Expand Down Expand Up @@ -34612,6 +34618,7 @@ def __init__(
self.description = description
self.discovery_url = discovery_url
self.enable_data_isolation = enable_data_isolation
self.allow_roleassignment_on_rg = allow_roleassignment_on_rg
self.encryption = encryption
self.existing_workspaces = existing_workspaces
self.feature_store_settings = feature_store_settings
Expand Down Expand Up @@ -35089,8 +35096,7 @@ class WorkspaceUpdateParameters(msrest.serialization.Model):
:ivar enable_data_isolation:
:vartype enable_data_isolation: bool
:ivar allow_roleassignment_on_rg: Determine whether we will allow workspace role assignment on resource group level.
include: "Enabled", "Disabled".
:vartype allow_roleassignment_on_rg: str
:vartype allow_roleassignment_on_rg: bool
:ivar encryption:
:vartype encryption: ~azure.mgmt.machinelearningservices.models.EncryptionUpdateProperties
:ivar feature_store_settings: Settings for feature store type workspace.
Expand Down Expand Up @@ -35145,7 +35151,7 @@ class WorkspaceUpdateParameters(msrest.serialization.Model):
'soft_delete_retention_in_days': {'key': 'properties.softDeleteRetentionInDays', 'type': 'int'},
'v1_legacy_mode': {'key': 'properties.v1LegacyMode', 'type': 'bool'},
'system_datastores_auth_mode': {'key': 'properties.systemDatastoresAuthMode', 'type': 'str'},
'allow_roleassignment_on_rg' : {'Key': 'properties.allowRoleAssignmentOnRG', 'type': 'str'}
'allow_roleassignment_on_rg' : {'Key': 'properties.allowRoleAssignmentOnRG', 'type': 'bool'}
}

def __init__(
Expand All @@ -35158,7 +35164,7 @@ def __init__(
container_registry: Optional[str] = None,
description: Optional[str] = None,
enable_data_isolation: Optional[bool] = None,
allow_roleassignment_on_rg: Optional[str] = None,
allow_roleassignment_on_rg: Optional[bool] = None,
encryption: Optional["EncryptionUpdateProperties"] = None,
feature_store_settings: Optional["FeatureStoreSettings"] = None,
friendly_name: Optional[str] = None,
Expand Down Expand Up @@ -35190,9 +35196,8 @@ def __init__(
:paramtype description: str
:keyword enable_data_isolation:
:paramtype enable_data_isolation: bool
:ivar allow_roleassignment_on_rg: Determine whether we will allow workspace role assignment on resource group level.
include: "Enabled", "Disabled".
:vartype allow_roleassignment_on_rg: str
:keyword allow_roleassignment_on_rg: Determine whether we will allow workspace role assignment on resource group level.
:paramtype allow_roleassignment_on_rg: bool
:keyword encryption:
:paramtype encryption: ~azure.mgmt.machinelearningservices.models.EncryptionUpdateProperties
:keyword feature_store_settings: Settings for feature store type workspace.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@ class WorkspaceSchema(PathAwareSchema):
workspace_hub = fields.Str(validate=validate_arm_str)
managed_network = ExperimentalField(NestedField(ManagedNetworkSchema, unknown=EXCLUDE))
enable_data_isolation = fields.Bool()
allow_roleassignment_on_rg = fields.Str()
allow_roleassignment_on_rg = fields.Bool()
serverless_compute = NestedField(ServerlessComputeSettingsSchema)
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class Workspace(Resource):
The flag can only be set at the creation phase, it can't be updated.
:type enable_data_isolation: bool
:param allow_roleassignment_on_rg: Determine whether we will allow workspace role assignment on resource group level.
:type allow_roleassignment_on_rg: str
:type allow_roleassignment_on_rg: bool
:param serverless_compute: The serverless compute settings for the workspace.
:type: ~azure.ai.ml.entities.ServerlessComputeSettings
:param workspace_hub: Deprecated resource ID of an existing workspace hub to help create project workspace.
Expand Down Expand Up @@ -126,7 +126,7 @@ def __init__(
managed_network: Optional[ManagedNetwork] = None,
system_datastores_auth_mode: Optional[str] = None,
enable_data_isolation: bool = False,
allow_roleassignment_on_rg: Optional[str] = None,
allow_roleassignment_on_rg: bool = True,
hub_id: Optional[str] = None, # Hidden input, surfaced by Project
workspace_hub: Optional[str] = None, # Deprecated input maintained for backwards compat.
serverless_compute: Optional[ServerlessComputeSettings] = None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -643,8 +643,8 @@ def _populate_arm_parameters(self, workspace: Workspace, **kwargs: Any) -> Tuple
if workspace.system_datastores_auth_mode:
_set_val(param["systemDatastoresAuthMode"], workspace.system_datastores_auth_mode)

if workspace.allow_roleassignment_on_rg:
_set_val(param["allowRoleAssignmentOnRG"], workspace.allow_roleassignment_on_rg)
if not workspace.allow_roleassignment_on_rg:
_set_val(param["allowRoleAssignmentOnRG"], "false")

if workspace.image_build_compute:
_set_val(param["imageBuildCompute"], workspace.image_build_compute)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3394,7 +3394,7 @@
},
"allowRoleAssignmentOnRG": {
"description": "Determine whether we will allow workspace role assignment on resource group level.",
"type": "string"
"type": "boolean"
},
"encryption": {
"$ref": "#/definitions/EncryptionProperty"
Expand Down Expand Up @@ -3596,7 +3596,7 @@
},
"allowRoleAssignmentOnRG": {
"description": "Determine whether we will allow workspace role assignment on resource group level.",
"type": "string"
"type": "boolean"
},
"encryption": {
"$ref": "#/definitions/EncryptionUpdateProperties"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4832,7 +4832,7 @@
},
"allowRoleAssignmentOnRG": {
"description": "Determine whether we will allow workspace role assignment on resource group level.",
"type": "string"
"type": "boolean"
},
"enableSoftwareBillOfMaterials": {
"description": "Flag to tell if SoftwareBillOfMaterial should be enabled for this workspace",
Expand Down Expand Up @@ -5045,7 +5045,7 @@
},
"allowRoleAssignmentOnRG": {
"description": "Determine whether we will allow workspace role assignment on resource group level.",
"type": "string"
"type": "boolean"
},
"enableSoftwareBillOfMaterials": {
"description": "Flag to tell if SoftwareBillOfMaterial should be enabled for this workspace",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6400,7 +6400,7 @@
},
"allowRoleAssignmentOnRG": {
"description": "Determine whether we will allow workspace role assignment on resource group level.",
"type": "string"
"type": "boolean"
},
"enableSoftwareBillOfMaterials": {
"description": "Flag to tell if SoftwareBillOfMaterials should be enabled for this workspace",
Expand Down Expand Up @@ -6613,7 +6613,7 @@
},
"allowRoleAssignmentOnRG": {
"description": "Determine whether we will allow workspace role assignment on resource group level.",
"type": "string"
"type": "boolean"
},
"enableSoftwareBillOfMaterials": {
"description": "Flag to tell if SoftwareBillOfMaterials should be enabled for this workspace",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2606,7 +2606,7 @@
},
"allowRoleAssignmentOnRG": {
"description": "Determine whether we will allow workspace role assignment on resource group level.",
"type": "string"
"type": "boolean"
},
"serverlessComputeSettings": {
"description": "Settings for serverless compute created in the workspace",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,15 +153,15 @@ def outgoing_get_call(rg, name):
],
)
ws.system_datastores_auth_mode = "identity"
ws.allow_roleassignment_on_rg = "Enabled"
ws.allow_roleassignment_on_rg = True
return ws._to_rest_object()

mock_workspace_operation_base._operation.get.side_effect = outgoing_get_call
ws = mock_workspace_operation_base.get(name="random_name", resource_group="rg")
mock_workspace_operation_base._operation.get.assert_called_once()

assert ws.system_datastores_auth_mode == "identity"
assert ws.allow_roleassignment_on_rg == "Enabled"
assert ws.allow_roleassignment_on_rg == True

assert ws.managed_network is not None
assert ws.managed_network.isolation_mode == IsolationMode.ALLOW_ONLY_APPROVED_OUTBOUND
Expand Down Expand Up @@ -223,7 +223,7 @@ def test_update(self, mock_workspace_operation_base: WorkspaceOperationsBase) ->
),
managed_network=ManagedNetwork(),
system_datastores_auth_mode="identity",
allow_roleassignment_on_rg="Enabled",
allow_roleassignment_on_rg=True,
primary_user_assigned_identity="resource2",
customer_managed_key=CustomerManagedKey(key_uri="new_cmk_uri"),
)
Expand All @@ -248,7 +248,7 @@ def outgoing_call(rg, name, params, polling, cls):
)
assert params.managed_network.isolation_mode == "Disabled"
assert params.system_datastores_auth_mode == "identity"
assert params.allow_roleassignment_on_rg == "Enabled"
assert params.allow_roleassignment_on_rg == True
assert params.managed_network.outbound_rules == {}
assert polling is True
assert callable(cls)
Expand Down