Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump databricks-sdk from 0.22.0 to 0.23.0 #1121

Merged
merged 1 commit into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ classifiers = [
"Topic :: Software Development :: Libraries",
"Topic :: Utilities",
]
dependencies = ["databricks-sdk==0.22.0",
dependencies = ["databricks-sdk==0.23.0",
"databricks-labs-lsql~=0.2.2",
"databricks-labs-blueprint~=0.4.3",
"PyYAML>=6.0.0,<7.0.0"]
Expand Down
4 changes: 2 additions & 2 deletions src/databricks/labs/ucx/aws/credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from databricks.sdk import WorkspaceClient
from databricks.sdk.errors.platform import InvalidParameterValue
from databricks.sdk.service.catalog import (
AwsIamRole,
AwsIamRoleRequest,
Privilege,
StorageCredentialInfo,
ValidationResultResult,
Expand Down Expand Up @@ -57,7 +57,7 @@ def list(self, include_names: set[str] | None = None) -> set[str]:
def create(self, role_action: AWSRoleAction) -> StorageCredentialInfo:
return self._ws.storage_credentials.create(
role_action.role_name,
aws_iam_role=AwsIamRole(role_action.role_arn),
aws_iam_role=AwsIamRoleRequest(role_action.role_arn),
comment=f"Created by UCX during migration to UC using AWS IAM Role: {role_action.role_name}",
read_only=role_action.privilege == Privilege.READ_FILES.value,
)
Expand Down
4 changes: 2 additions & 2 deletions src/databricks/labs/ucx/mixins/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from databricks.sdk.service import compute, iam, jobs, pipelines, sql, workspace
from databricks.sdk.service._internal import Wait
from databricks.sdk.service.catalog import (
AwsIamRole,
AwsIamRoleRequest,
AzureServicePrincipal,
CatalogInfo,
DataSourceFormat,
Expand Down Expand Up @@ -1104,7 +1104,7 @@ def create(
) -> StorageCredentialInfo:
if aws_iam_role_arn != "":
storage_credential = ws.storage_credentials.create(
credential_name, aws_iam_role=AwsIamRole(role_arn=aws_iam_role_arn), read_only=read_only
credential_name, aws_iam_role=AwsIamRoleRequest(role_arn=aws_iam_role_arn), read_only=read_only
)
else:
azure_service_principal = AzureServicePrincipal(directory_id, application_id, client_secret)
Expand Down
6 changes: 4 additions & 2 deletions tests/integration/aws/test_access.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from databricks.labs.blueprint.installation import Installation
from databricks.labs.blueprint.tui import MockPrompts
from databricks.sdk.service.catalog import AwsIamRole
from databricks.sdk.service.catalog import AwsIamRoleRequest

from databricks.labs.ucx.assessment.aws import AWSInstanceProfile, AWSResources
from databricks.labs.ucx.aws.access import AWSResourcePermissions
Expand Down Expand Up @@ -35,7 +35,9 @@ def test_create_external_location(ws, env_or_skip, make_random, inventory_schema
aws.create_uc_role(role_name)
aws.put_role_policy(role_name, policy_name, s3_prefixes, account_id)
ws.storage_credentials.create(
f"ucx_{rand}", aws_iam_role=AwsIamRole(role_arn=f"arn:aws:iam::{account_id}:role/{role_name}"), read_only=False
f"ucx_{rand}",
aws_iam_role=AwsIamRoleRequest(role_arn=f"arn:aws:iam::{account_id}:role/{role_name}"),
read_only=False,
)
installation = Installation(ws, rand)
aws_permissions = AWSResourcePermissions(
Expand Down
10 changes: 5 additions & 5 deletions tests/unit/aws/test_access.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from databricks.sdk.errors import ResourceDoesNotExist
from databricks.sdk.service import iam
from databricks.sdk.service.catalog import (
AwsIamRole,
AwsIamRoleResponse,
ExternalLocationInfo,
StorageCredentialInfo,
)
Expand Down Expand Up @@ -112,12 +112,12 @@ def test_create_external_locations(mock_ws, installation_multiple_roles, mock_aw
StorageCredentialInfo(
id="1",
name="cred1",
aws_iam_role=AwsIamRole("arn:aws:iam::12345:role/uc-role1"),
aws_iam_role=AwsIamRoleResponse("arn:aws:iam::12345:role/uc-role1"),
),
StorageCredentialInfo(
id="2",
name="credx",
aws_iam_role=AwsIamRole("arn:aws:iam::12345:role/uc-rolex"),
aws_iam_role=AwsIamRoleResponse("arn:aws:iam::12345:role/uc-rolex"),
),
]
aws_resource_permissions = AWSResourcePermissions(
Expand All @@ -142,12 +142,12 @@ def test_create_external_locations_skip_existing(mock_ws, mock_aws, backend, loc
StorageCredentialInfo(
id="1",
name="cred1",
aws_iam_role=AwsIamRole("arn:aws:iam::12345:role/uc-role1"),
aws_iam_role=AwsIamRoleResponse("arn:aws:iam::12345:role/uc-role1"),
),
StorageCredentialInfo(
id="2",
name="credx",
aws_iam_role=AwsIamRole("arn:aws:iam::12345:role/uc-rolex"),
aws_iam_role=AwsIamRoleResponse("arn:aws:iam::12345:role/uc-rolex"),
),
]
mock_ws.external_locations.list.return_value = [
Expand Down
14 changes: 9 additions & 5 deletions tests/unit/aws/test_credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from databricks.labs.blueprint.tui import MockPrompts
from databricks.sdk import WorkspaceClient
from databricks.sdk.service.catalog import (
AwsIamRole,
AwsIamRoleResponse,
AzureManagedIdentity,
AzureServicePrincipal,
Privilege,
Expand All @@ -32,17 +32,21 @@ def ws():


def side_effect_create_aws_storage_credential(name, aws_iam_role, comment, read_only):
return StorageCredentialInfo(name=name, aws_iam_role=aws_iam_role, comment=comment, read_only=read_only)
return StorageCredentialInfo(
name=name, aws_iam_role=AwsIamRoleResponse(role_arn=aws_iam_role.role_arn), comment=comment, read_only=read_only
)


@pytest.fixture
def credential_manager(ws):
ws.storage_credentials.list.return_value = [
StorageCredentialInfo(aws_iam_role=AwsIamRole(role_arn="arn:aws:iam::123456789012:role/example-role-name")),
StorageCredentialInfo(
aws_iam_role=AwsIamRoleResponse(role_arn="arn:aws:iam::123456789012:role/example-role-name")
),
StorageCredentialInfo(
azure_managed_identity=AzureManagedIdentity("/subscriptions/.../providers/Microsoft.Databricks/...")
),
StorageCredentialInfo(aws_iam_role=AwsIamRole("arn:aws:iam::123456789012:role/another-role-name")),
StorageCredentialInfo(aws_iam_role=AwsIamRoleResponse("arn:aws:iam::123456789012:role/another-role-name")),
StorageCredentialInfo(azure_service_principal=AzureServicePrincipal("directory_id_1", "app_secret2", "secret")),
]

Expand Down Expand Up @@ -134,7 +138,7 @@ def test_for_cli(ws, installation):
assert isinstance(IamRoleMigration.for_cli(ws, installation, aws, prompts), IamRoleMigration)


def test_print_action_plan(caplog, ws, instance_profile_migration):
def test_print_action_plan(caplog, ws, instance_profile_migration, credential_manager):
caplog.set_level(logging.INFO)

prompts = MockPrompts({"Above IAM roles will be migrated to UC storage credentials*": "Yes"})
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/azure/test_credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from databricks.sdk.errors import ResourceDoesNotExist
from databricks.sdk.errors.platform import InvalidParameterValue
from databricks.sdk.service.catalog import (
AwsIamRole,
AwsIamRoleResponse,
AzureManagedIdentity,
AzureServicePrincipal,
StorageCredentialInfo,
Expand Down Expand Up @@ -129,7 +129,7 @@ def side_effect_validate_storage_credential(storage_credential_name, url, read_o
@pytest.fixture
def credential_manager(ws):
ws.storage_credentials.list.return_value = [
StorageCredentialInfo(aws_iam_role=AwsIamRole("arn:aws:iam::123456789012:role/example-role-name")),
StorageCredentialInfo(aws_iam_role=AwsIamRoleResponse("arn:aws:iam::123456789012:role/example-role-name")),
StorageCredentialInfo(
azure_managed_identity=AzureManagedIdentity("/subscriptions/.../providers/Microsoft.Databricks/...")
),
Expand Down
Loading