Exemplo n.º 1
0
def update_workspace(cmd,
                     client,
                     resource_group_name,
                     workspace_name,
                     sql_admin_login_password=None,
                     allowed_aad_tenant_ids=None,
                     tags=None,
                     key_name=None,
                     no_wait=False):
    encryption = None
    tenant_ids_list = None

    if key_name:
        workspace_key_detail = WorkspaceKeyDetails(name=key_name)
        encryption = EncryptionDetails(cmk=CustomerManagedKeyDetails(
            key=workspace_key_detail))

    if allowed_aad_tenant_ids and '' in allowed_aad_tenant_ids:
        tenant_ids_list = []
    else:
        tenant_ids_list = allowed_aad_tenant_ids

    updated_vnet_settings = ManagedVirtualNetworkSettings(
        allowed_aad_tenant_ids_for_linking=tenant_ids_list
    ) if allowed_aad_tenant_ids is not None else None
    workspace_patch_info = WorkspacePatchInfo(
        tags=tags,
        sql_admin_login_password=sql_admin_login_password,
        encryption=encryption,
        managed_virtual_network_settings=updated_vnet_settings)
    return sdk_no_wait(no_wait, client.begin_update, resource_group_name,
                       workspace_name, workspace_patch_info)
Exemplo n.º 2
0
def update_workspace(cmd,
                     client,
                     resource_group_name,
                     workspace_name,
                     sql_admin_login_password=None,
                     tags=None,
                     no_wait=False):
    workspace_patch_info = WorkspacePatchInfo(
        tags=tags, sql_admin_login_password=sql_admin_login_password)
    return sdk_no_wait(no_wait, client.update, resource_group_name,
                       workspace_name, workspace_patch_info)
Exemplo n.º 3
0
def update_workspace(cmd,
                     client,
                     resource_group_name,
                     workspace_name,
                     sql_admin_login_password=None,
                     allowed_aad_tenant_ids=None,
                     tags=None,
                     key_name=None,
                     repository_type=None,
                     host_name=None,
                     account_name=None,
                     collaboration_branch=None,
                     repository_name=None,
                     root_folder=None,
                     project_name=None,
                     tenant_id=None,
                     no_wait=False):
    encryption = None
    tenant_ids_list = None
    workspace_repository_configuration = None

    if key_name:
        workspace_key_detail = WorkspaceKeyDetails(name=key_name)
        encryption = EncryptionDetails(cmk=CustomerManagedKeyDetails(
            key=workspace_key_detail))

    if allowed_aad_tenant_ids and '' in allowed_aad_tenant_ids:
        tenant_ids_list = []
    else:
        tenant_ids_list = allowed_aad_tenant_ids

    if repository_type:
        if repository_type == 'AzureDevOpsGit':
            repository_type = 'WorkspaceVSTSConfiguration'
        else:
            repository_type = 'WorkspaceGitHubConfiguration'
        if repository_type == 'WorkspaceVSTSConfiguration' and tenant_id is None:
            from ..util import get_tenant_id
            tenant_id = get_tenant_id()
        if repository_type == 'WorkspaceVSTSConfiguration' and project_name is None:
            from azure.cli.core.azclierror import RequiredArgumentMissingError
            err_msg = 'project_name argument is missing'
            recommendation = 'provide a project name by --project-name'
            raise RequiredArgumentMissingError(err_msg, recommendation)
        workspace_repository_configuration = WorkspaceRepositoryConfiguration(
            type=repository_type,
            host_name=host_name,
            account_name=account_name,
            project_name=project_name,
            repository_name=repository_name,
            collaboration_branch=collaboration_branch,
            root_folder=root_folder,
            tenant_id=tenant_id)

    updated_vnet_settings = ManagedVirtualNetworkSettings(
        allowed_aad_tenant_ids_for_linking=tenant_ids_list
    ) if allowed_aad_tenant_ids is not None else None
    workspace_patch_info = WorkspacePatchInfo(
        tags=tags,
        sql_admin_login_password=sql_admin_login_password,
        encryption=encryption,
        managed_virtual_network_settings=updated_vnet_settings,
        workspace_repository_configuration=workspace_repository_configuration)
    return sdk_no_wait(no_wait, client.begin_update, resource_group_name,
                       workspace_name, workspace_patch_info)