Skip to content
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
21 changes: 21 additions & 0 deletions src/sempy_labs/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
from sempy_labs._gateways import (
list_gateway_members,
list_gateway_role_assigments,
list_gateways,
delete_gateway,
delete_gateway_member,
delete_gateway_role_assignment,
create_vnet_gateway,
update_vnet_gateway,
update_on_premises_gateway,
)

from sempy_labs._authentication import (
ServicePrincipalTokenProvider,
)
Expand Down Expand Up @@ -435,4 +447,13 @@
"create_vnet_connection",
"create_on_prem_connection",
"create_cloud_connection",
"list_gateway_members",
"list_gateway_role_assigments",
"list_gateways",
"delete_gateway",
"delete_gateway_member",
"delete_gateway_role_assignment",
"create_vnet_gateway",
"update_vnet_gateway",
"update_on_premises_gateway",
]
7 changes: 5 additions & 2 deletions src/sempy_labs/_authentication.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from typing import Literal
from sempy.fabric._token_provider import TokenProvider
import notebookutils
from azure.identity import ClientSecretCredential


Expand All @@ -12,6 +11,7 @@ class ServicePrincipalTokenProvider(TokenProvider):
"""

def __init__(self, credential: ClientSecretCredential):

self.credential = credential

@classmethod
Expand Down Expand Up @@ -54,7 +54,7 @@ def with_azure_key_vault(
"""
Create the ServicePrincipalTokenProvider providing the information with the Service Principal information.

For more information on Azure Key Vault check `About Azure Key Vault <https://learn.microsoft.com/en-us/azure/key-vault/general/overview>`_
For more information on Azure Key Vault check `About Azure Key Vault <https://learn.microsoft.com/en-us/azure/key-vault/general/overview>`_.

Parameters
----------
Expand All @@ -72,6 +72,9 @@ def with_azure_key_vault(
sempy.fabric.TokenProvider
Token provider to be used with FabricRestClient or PowerBIRestClient.
"""

import notebookutils

tenant_id = notebookutils.credentials.getSecret(
key_vault_uri, key_vault_tenant_id
)
Expand Down
16 changes: 8 additions & 8 deletions src/sempy_labs/_connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
)
from uuid import UUID
import sempy_labs._icons as icons
from sempy_labs._gateways import resolve_gateway_id
from sempy_labs._gateways import _resolve_gateway_id


def delete_connection(connection: str | UUID):
Expand All @@ -23,7 +23,7 @@ def delete_connection(connection: str | UUID):
The connection name or ID.
"""

connection_id = resolve_connection_id(connection)
connection_id = _resolve_connection_id(connection)

client = fabric.FabricRestClient()
response = client.delete(f"/v1/connections/{connection_id}")
Expand All @@ -48,7 +48,7 @@ def delete_connection_role_assignment(connection: str | UUID, role_assignment_id
The role assignment ID.
"""

connection_id = resolve_connection_id(connection)
connection_id = _resolve_connection_id(connection)

client = fabric.FabricRestClient()
response = client.delete(
Expand All @@ -63,7 +63,7 @@ def delete_connection_role_assignment(connection: str | UUID, role_assignment_id
)


def resolve_connection_id(connection: str | UUID) -> UUID:
def _resolve_connection_id(connection: str | UUID) -> UUID:

dfC = list_connections()
if _is_valid_uuid(connection):
Expand Down Expand Up @@ -96,7 +96,7 @@ def list_connection_role_assignments(connection: str | UUID) -> pd.DataFrame:
A pandas dataframe showing a list of connection role assignments.
"""

connection_id = resolve_connection_id(connection)
connection_id = _resolve_connection_id(connection)

client = fabric.FabricRestClient()
response = client.get(f"/v1/connections/{connection_id}/roleAssignments")
Expand Down Expand Up @@ -277,7 +277,7 @@ def _list_supported_connection_types(

url = f"/v1/connections/supportedConnectionTypes?showAllCreationMethods={show_all_creation_methods}&"
if gateway is not None:
gateway_id = resolve_gateway_id(gateway)
gateway_id = _resolve_gateway_id(gateway)
url += f"gatewayId={gateway_id}"

df = pd.DataFrame(
Expand Down Expand Up @@ -434,7 +434,7 @@ def create_on_prem_connection(
If True, skips the test connection.
"""

gateway_id = resolve_gateway_id(gateway)
gateway_id = _resolve_gateway_id(gateway)

request_body = {
"connectivityType": "OnPremisesGateway",
Expand Down Expand Up @@ -515,7 +515,7 @@ def create_vnet_connection(
If True, skips the test connection.
"""

gateway_id = resolve_gateway_id(gateway)
gateway_id = _resolve_gateway_id(gateway)

request_body = {
"connectivityType": "VirtualNetworkGateway",
Expand Down
Loading
Loading