Skip to content

Commit

Permalink
Merge pull request #49 from jupyter-naas/FlorentLvr-patch-1
Browse files Browse the repository at this point in the history
fix: rename domain function assets and storage
  • Loading branch information
Dr0p42 authored Jun 25, 2024
2 parents 39d0ac9 + 581a8dd commit b0b1198
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 28 deletions.
10 changes: 5 additions & 5 deletions naas_python/domains/asset/AssetDomain.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@ class AssetDomain(IAssetDomain):
def __init__(self, adaptor: IAssetAdaptor):
self.adaptor = adaptor

def create_asset(self, workspace_id:str, asset_creation:AssetCreation) -> Asset:
def create(self, workspace_id:str, asset_creation:AssetCreation) -> Asset:
asset = self.adaptor.create_asset(workspace_id, asset_creation)
return asset

def get_asset(self, workspace_id:str, asset_id:str) -> Asset:
def get(self, workspace_id:str, asset_id:str) -> Asset:
asset = self.adaptor.get_asset(workspace_id, asset_id)
return asset


def update_asset(self, workspace_id:str, asset_id:str, asset_update: AssetUpdate) -> Asset:
def update(self, workspace_id:str, asset_id:str, asset_update: AssetUpdate) -> Asset:
response = self.adaptor.update_asset(workspace_id, asset_id, asset_update)
return response

def delete_asset(self, workspace_id:str, asset_id:str) -> None:
def delete(self, workspace_id:str, asset_id:str) -> None:
self.adaptor.delete_asset(workspace_id, asset_id)
return None
return None
10 changes: 5 additions & 5 deletions naas_python/domains/asset/AssetSchema.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,21 @@ class IAssetDomain(metaclass=ABCMeta):
adaptor: IAssetAdaptor

@abstractmethod
def create_asset(self, workspace_id:str, asset_creation:AssetCreation) -> Asset:
def create(self, workspace_id:str, asset_creation:AssetCreation) -> Asset:
raise NotImplementedError()

@abstractmethod
def get_asset(self, workspace_id:str, asset_id:str) -> Asset:
def get(self, workspace_id:str, asset_id:str) -> Asset:
raise NotImplementedError()

@abstractmethod
def update_asset(self, workspace_id:str, asset_id:str, asset_update: AssetUpdate) -> Asset:
def update(self, workspace_id:str, asset_id:str, asset_update: AssetUpdate) -> Asset:
raise NotImplementedError()

@abstractmethod
def delete_asset(self, workspace_id:str, asset_id:str) -> None:
def delete(self, workspace_id:str, asset_id:str) -> None:
raise NotImplementedError()

# Primary Adaptor
class IAssetPrimaryAdaptor:
pass
pass
18 changes: 9 additions & 9 deletions naas_python/domains/storage/StorageDomain.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def __init__(self, adaptor: IStorageAdaptor, storage_provider_adaptors : Mapping
self.storage_provider_adaptors : Mapping[str, IStorageProviderAdaptor] = storage_provider_adaptors

############### API ###############
def create_workspace_storage(self,
def create(self,
workspace_id: str,
storage_name: Storage.__fields__['name'],
) -> dict:
Expand All @@ -28,7 +28,7 @@ def create_workspace_storage(self,
)
return response

def delete_workspace_storage(self,
def delete(self,
workspace_id: str,
storage_name: Storage.__fields__['name']
) -> dict:
Expand All @@ -38,15 +38,15 @@ def delete_workspace_storage(self,
)
return response

def list_workspace_storage(self,
def list(self,
workspace_id: str,
) -> dict:
response = self.adaptor.list_workspace_storage(
workspace_id=workspace_id,
)
return response

def list_workspace_storage_object(self,
def list_objects(self,
workspace_id: str,
storage_name: Storage.__fields__['name'],
storage_prefix: Object.__fields__['prefix'],
Expand All @@ -58,7 +58,7 @@ def list_workspace_storage_object(self,
)
return response

def delete_workspace_storage_object(self,
def delete_object(self,
workspace_id: str,
storage_name: Storage.__fields__['name'],
object_name: Object.__fields__['name'],
Expand All @@ -70,7 +70,7 @@ def delete_workspace_storage_object(self,
)
return response

def create_workspace_storage_credentials(self,
def create_credentials(self,
workspace_id: str,
storage_name: Storage.__fields__['name'],
) -> dict:
Expand All @@ -96,7 +96,7 @@ def __get_storage_provider_adaptor(self,
return self.storage_provider_adaptors[storage_provider_id]


def post_workspace_storage_object(self,
def post_object(self,
workspace_id: str,
storage_name: Storage.__fields__['name'],
src_file: str,
Expand All @@ -117,7 +117,7 @@ def post_workspace_storage_object(self,
response = storage_provider.post_workspace_storage_object(workspace_id=workspace_id, storage_name=storage_name, src_file=src_file, dst_file=dst_file)
return response

def get_workspace_storage_object(self,
def get_object(self,
workspace_id: str,
storage_name: Storage.__fields__['name'],
src_file: str,
Expand All @@ -136,4 +136,4 @@ def get_workspace_storage_object(self,
storage_provider.save_naas_credentials(workspace_id, storage_name, credentials)

response = storage_provider.get_workspace_storage_object(workspace_id=workspace_id, storage_name=storage_name, src_file=src_file, dst_file=dst_file)
return response
return response
18 changes: 9 additions & 9 deletions naas_python/domains/storage/StorageSchema.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,43 +86,43 @@ class IStorageDomain(metaclass=ABCMeta):
#TODO to be validated

@abstractmethod
def create_workspace_storage(self,
def create(self,
workspace_id: str,
storage_name: Storage.__fields__['name'],
) -> dict:
raise NotImplementedError

@abstractmethod
def delete_workspace_storage(self,
def delete(self,
workspace_id: str,
storage_name: Storage.__fields__['name'],
) -> dict:
raise NotImplementedError

@abstractmethod
def list_workspace_storage(self,
def list(self,
workspace_id: str,
) -> dict:
raise NotImplementedError

@abstractmethod
def list_workspace_storage_object(self,
def list_objects(self,
workspace_id: str,
storage_name: Storage.__fields__['name'],
storage_prefix: Object.__fields__['prefix'],
) -> dict:
raise NotImplementedError

@abstractmethod
def delete_workspace_storage_object(self,
def delete_object(self,
workspace_id: str,
storage_name: Storage.__fields__['name'],
object_name: Object.__fields__['name'],
) -> dict:
raise NotImplementedError

@abstractmethod
def post_workspace_storage_object(self,
def post_object(self,
workspace_id: str,
storage_name: Storage.__fields__['name'],
src_file: str,
Expand All @@ -131,7 +131,7 @@ def post_workspace_storage_object(self,
raise NotImplementedError

@abstractmethod
def get_workspace_storage_object(self,
def get_object(self,
workspace_id: str,
storage_name: Storage.__fields__['name'],
src_file: str,
Expand All @@ -141,7 +141,7 @@ def get_workspace_storage_object(self,


@abstractmethod
def create_workspace_storage_credentials(self,
def create_credentials(self,
workspace_id: str,
storage_name: Storage.__fields__['name'],
) -> dict:
Expand Down Expand Up @@ -213,4 +213,4 @@ class ServiceAuthenticationError(NaasException):
class ServiceStatusError(NaasException):
pass
class ObjectAlreadyExists(NaasException):
pass
pass

0 comments on commit b0b1198

Please sign in to comment.