Skip to content
Snippets Groups Projects
Verified Commit 5fece9ca authored by Karel van Klink's avatar Karel van Klink :smiley_cat:
Browse files

rename SPClient to SharePointClient

parent e59ecad2
No related branches found
No related tags found
1 merge request!211Feature/add sharepoint service
...@@ -13,7 +13,7 @@ from msgraph.generated.sites.item.lists.item.items.items_request_builder import ...@@ -13,7 +13,7 @@ from msgraph.generated.sites.item.lists.item.items.items_request_builder import
from gso.settings import load_oss_params from gso.settings import load_oss_params
class SPClient: class SharePointClient:
"""A client for interaction with SharePoint lists.""" """A client for interaction with SharePoint lists."""
def __init__(self) -> None: def __init__(self) -> None:
...@@ -32,7 +32,7 @@ class SPClient: ...@@ -32,7 +32,7 @@ class SPClient:
def get_site(self) -> Site | None: def get_site(self) -> Site | None:
"""Get the SharePoint site that this orchestrator connects to.""" """Get the SharePoint site that this orchestrator connects to."""
async def _get_site(): async def _get_site() -> Site | None:
return await self.client.sites.by_site_id(self.site_id).get() return await self.client.sites.by_site_id(self.site_id).get()
return asyncio.run(_get_site()) return asyncio.run(_get_site())
...@@ -43,7 +43,7 @@ class SPClient: ...@@ -43,7 +43,7 @@ class SPClient:
:param str list_name: The name of the list. :param str list_name: The name of the list.
""" """
async def _get_list_items(): async def _get_list_items() -> ListItemCollectionResponse | None:
query_params = ItemsRequestBuilder.ItemsRequestBuilderGetQueryParameters(expand=["fields"]) query_params = ItemsRequestBuilder.ItemsRequestBuilderGetQueryParameters(expand=["fields"])
request_configuration = ItemsRequestBuilder.ItemsRequestBuilderGetRequestConfiguration( request_configuration = ItemsRequestBuilder.ItemsRequestBuilderGetRequestConfiguration(
query_parameters=query_params query_parameters=query_params
...@@ -65,7 +65,7 @@ class SPClient: ...@@ -65,7 +65,7 @@ class SPClient:
:return str: The URL of the list in which a new item has been created. :return str: The URL of the list in which a new item has been created.
""" """
async def _new_list_item(): async def _new_list_item() -> str:
request_body = ListItem(fields=FieldValueSet(additional_data=fields)) request_body = ListItem(fields=FieldValueSet(additional_data=fields))
new_item = ( new_item = (
await self.client.sites.by_site_id(self.site_id) await self.client.sites.by_site_id(self.site_id)
......
...@@ -20,7 +20,7 @@ from gso.services import infoblox, subscriptions ...@@ -20,7 +20,7 @@ from gso.services import infoblox, subscriptions
from gso.services.lso_client import lso_interaction from gso.services.lso_client import lso_interaction
from gso.services.netbox_client import NetboxClient from gso.services.netbox_client import NetboxClient
from gso.services.partners import get_partner_by_name from gso.services.partners import get_partner_by_name
from gso.services.sharepoint import SPClient from gso.services.sharepoint import SharePointClient
from gso.utils.helpers import generate_fqdn, iso_from_ipv4 from gso.utils.helpers import generate_fqdn, iso_from_ipv4
from gso.utils.shared_enums import PortNumber, Vendor from gso.utils.shared_enums import PortNumber, Vendor
from gso.utils.workflow_steps import deploy_base_config_dry, deploy_base_config_real, run_checks_after_base_config from gso.utils.workflow_steps import deploy_base_config_dry, deploy_base_config_real, run_checks_after_base_config
...@@ -221,7 +221,7 @@ def prompt_insert_in_radius(subscription: RouterInactive) -> FormGenerator: ...@@ -221,7 +221,7 @@ def prompt_insert_in_radius(subscription: RouterInactive) -> FormGenerator:
@step("Create a new SharePoint checklist") @step("Create a new SharePoint checklist")
def create_new_sharepoint_checklist(subscription: RouterProvisioning) -> State: def create_new_sharepoint_checklist(subscription: RouterProvisioning) -> State:
"""Create a new checklist in SharePoint for approving this router.""" """Create a new checklist in SharePoint for approving this router."""
new_list_item_url = SPClient().add_list_item("p_router", {"Title": subscription.router.router_fqdn}) new_list_item_url = SharePointClient().add_list_item("p_router", {"Title": subscription.router.router_fqdn})
return {"checklist_url": new_list_item_url} return {"checklist_url": new_list_item_url}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment