This is an automated email from the ASF dual-hosted git repository.

yasith pushed a commit to branch feat/grpc-armeria-migration
in repository https://gitbox.apache.org/repos/asf/airavata.git

commit de17212bbd204b61f0cfeada4b7fd46aab6b0bd8
Author: yasithdev <[email protected]>
AuthorDate: Tue Mar 31 19:55:10 2026 -0400

    fix: update SDK sample files to use proto types instead of Thrift
---
 .../samples/api_server_client_samples.py           | 160 ++++++++++-----------
 .../samples/group_manager_client_samples.py        |  44 +++---
 .../samples/iam_admin_client_samples.py            |  20 ++-
 .../samples/sharing_registry_client_samples.py     |  64 ++++-----
 .../samples/tenant_profile_client_samples.py       |  20 +--
 .../samples/user_profile_client_samples.py         |  44 +++---
 6 files changed, 169 insertions(+), 183 deletions(-)

diff --git 
a/airavata-python-sdk/airavata_sdk/samples/api_server_client_samples.py 
b/airavata-python-sdk/airavata_sdk/samples/api_server_client_samples.py
index 7ca737aae1..f66b6a113f 100644
--- a/airavata-python-sdk/airavata_sdk/samples/api_server_client_samples.py
+++ b/airavata-python-sdk/airavata_sdk/samples/api_server_client_samples.py
@@ -15,10 +15,9 @@
 #
 import logging
 
-from airavata.api.error.ttypes import AiravataClientException, 
AiravataSystemException, AuthorizationException, InvalidRequestException
-from airavata.model.appcatalog.groupresourceprofile.ttypes import 
GroupResourceProfile
-from airavata.model.experiment.ttypes import ExperimentModel, ExperimentType, 
ProjectSearchFields, UserConfigurationDataModel
-from airavata.model.workspace.ttypes import Gateway, GatewayApprovalStatus, 
Notification, Project
+from airavata_sdk.generated.org.apache.airavata.model.workspace import 
workspace_pb2
+from airavata_sdk.generated.org.apache.airavata.model.experiment import 
experiment_pb2
+from 
airavata_sdk.generated.org.apache.airavata.model.appcatalog.groupresourceprofile
 import group_resource_profile_pb2
 from airavata_sdk.clients.api_server_client import APIServerClient
 from airavata_sdk.clients.keycloak_token_fetcher import Authenticator
 
@@ -29,165 +28,166 @@ logger.setLevel(logging.DEBUG)
 handler = logging.StreamHandler()
 handler.setLevel(logging.DEBUG)
 
-authenticator = Authenticator();
+authenticator = Authenticator()
 token = authenticator.get_token_and_user_info_password_flow("default-admin", 
"123456", "default")
 
-# load APIServerClient with default configuration
-client = APIServerClient()
+# load APIServerClient with access token
+client = APIServerClient(access_token=token)
 
 
 # check for given gateway exists
 def is_gateway_exists():
     try:
-        is_exists = client.is_gateway_exist(token, "default")
+        is_exists = client.is_gateway_exist("default")
         print("Gateway exist: " + str(is_exists))
-    except (InvalidRequestException, AiravataClientException, 
AuthorizationException, AiravataSystemException):
+    except Exception:
         logger.exception("Error occurred")
 
 
 # check if given user exists in given gateway
 def is_user_exists():
     try:
-        is_exists = client.is_user_exists(token, "default", "default-admin")
+        is_exists = client.is_user_exists("default", "default-admin")
         print("User exist: " + str(is_exists))
-    except (InvalidRequestException, AiravataClientException, 
AuthorizationException, AiravataSystemException):
+    except Exception:
         logger.exception("Error occurred")
 
 
 # adding a new gateway
 def add_gateway():
     try:
-        gateway = Gateway()
-        gateway.gatewayId = "test-gw"
-        gateway.domain = "airavata.org"
-        gateway.gatewayAdminEmail = "[email protected]"
-        gateway.gatewayAdminFirstName = "isuru"
-        gateway.gatewayAdminLastName = "ranawaka"
-        gateway.gatewayName = "test-gw"
-        gateway.gatewayApprovalStatus = GatewayApprovalStatus.REQUESTED
-        gateway_id = client.add_gateway(token, gateway)
-        print("Gateway Id :" + gateway_id)
-    except (InvalidRequestException, AiravataClientException, 
AuthorizationException, AiravataSystemException):
+        gateway = workspace_pb2.Gateway(
+            gateway_id="test-gw",
+            domain="airavata.org",
+            gateway_admin_email="[email protected]",
+            gateway_admin_first_name="isuru",
+            gateway_admin_last_name="ranawaka",
+            gateway_name="test-gw",
+            gateway_approval_status=workspace_pb2.REQUESTED,
+        )
+        gateway_id = client.add_gateway(gateway)
+        print("Gateway Id :" + str(gateway_id))
+    except Exception:
         logger.exception("Error occurred")
 
 
 # delete gateway
 def delete_gateway():
     try:
-        gateway = client.delete_gateway(token, "test-gw")
+        gateway = client.delete_gateway("test-gw")
         print("Gateway deleted ", gateway)
-    except (InvalidRequestException, AiravataClientException, 
AuthorizationException, AiravataSystemException):
+    except Exception:
         logger.exception("Error occurred")
 
 
-# get all exisisting gateways
+# get all existing gateways
 def get_all_gateways():
     try:
-        gateway = client.get_all_gateways(token)
+        gateway = client.get_all_gateways()
         print("Get all gateways :", gateway)
-    except (InvalidRequestException, AiravataClientException, 
AuthorizationException, AiravataSystemException):
+    except Exception:
         logger.exception("Error occurred")
 
 
 def create_notification():
     try:
-        notification = Notification()
-        notification.gatewayId = "default"
-        notification.title = "default-gateway-notification"
-        notification.notificationMessage = "Hello gateway"
-        created_notification = client.create_notification(token, notification)
+        notification = workspace_pb2.Notification(
+            gateway_id="default",
+            title="default-gateway-notification",
+            notification_message="Hello gateway",
+        )
+        created_notification = client.create_notification(notification)
         print("Notification Created ", created_notification)
-    except (InvalidRequestException, AiravataClientException, 
AuthorizationException, AiravataSystemException):
+    except Exception:
         logger.exception("Error occurred")
 
 
 def get_all_notifications():
     try:
-        notifications = client.get_all_notifications(token, "default")
+        notifications = client.get_all_notifications("default")
         print("Notifications ", notifications)
-    except (InvalidRequestException, AiravataClientException, 
AuthorizationException, AiravataSystemException):
+    except Exception:
         logger.exception("Error occurred")
 
 
 def create_project():
     try:
-        project = Project()
-        project.projectID = "def1234"
-        project.owner = "default-admin"
-        project.gatewayId = "default"
-        project.name = "defaultProject"
-
-        pro = client.create_project(token, "default", project)
+        project = workspace_pb2.Project(
+            project_id="def1234",
+            owner="default-admin",
+            gateway_id="default",
+            name="defaultProject",
+        )
+        pro = client.create_project("default", project)
         print("Project created ", pro)
-
-    except (InvalidRequestException, AiravataClientException, 
AuthorizationException, AiravataSystemException):
+    except Exception:
         logger.exception("Error occurred")
 
 
 def search_projects():
     try:
-        filter = {ProjectSearchFields.PROJECT_DESCRIPTION: 'defaultProject'}
-        projects = client.search_projects(token, "default-gateway", 
"default-admin", filter, limit=0, offset=10)
+        filters = {experiment_pb2.PROJECT_DESCRIPTION: "defaultProject"}
+        projects = client.search_projects("default-gateway", "default-admin", 
filters, limit=10, offset=0)
         print(projects)
-    except (InvalidRequestException, AiravataClientException, 
AuthorizationException, AiravataSystemException):
+    except Exception:
         logger.exception("Error occurred")
 
 
 def create_experiment():
     try:
-        experiment_model = ExperimentModel()
-        experiment_model.experimentId = "exp123"
-        experiment_model.projectId = "def1234"
-        experiment_model.gatewayId = "default"
-        experiment_model.experimentType = ExperimentType.SINGLE_APPLICATION
-        experiment_model.userName = "default-admin"
-        experiment_model.experimentName = "test_exp"
-        exp = client.create_experiment(token, "default", experiment_model)
-    
+        experiment_model = experiment_pb2.ExperimentModel(
+            experiment_id="exp123",
+            project_id="def1234",
+            gateway_id="default",
+            experiment_type=experiment_pb2.SINGLE_APPLICATION,
+            user_name="default-admin",
+            experiment_name="test_exp",
+        )
+        exp = client.create_experiment("default", experiment_model)
         print("Experiment created ", exp)
-
-    except (InvalidRequestException, AiravataClientException, 
AuthorizationException, AiravataSystemException):
+    except Exception:
         logger.exception("Error occurred")
 
 
 def get_experiment():
     try:
-        experiment = client.get_experiment(token, 
'test_exp_26302f87-c8eb-4d44-8b6b-4a5c7b1ff014')
-        print("Experiment ", experiment);
-
-    except (InvalidRequestException, AiravataClientException, 
AuthorizationException, AiravataSystemException):
+        experiment = 
client.get_experiment("test_exp_26302f87-c8eb-4d44-8b6b-4a5c7b1ff014")
+        print("Experiment ", experiment)
+    except Exception:
         logger.exception("Error occurred")
 
 
 def create_group_resource_profile():
     try:
-        group_resource = GroupResourceProfile()
-        group_resource.gatewayId = "default"
-        group_resource.groupResourceProfileId = "default_profile"
-        group_resource.groupResourceProfileName = "default_profile_1"
-        resource = client.create_group_resource_profile(token, group_resource)
-        print("Group resource created ", group_resource)
-    except (InvalidRequestException, AiravataClientException, 
AuthorizationException, AiravataSystemException):
+        group_resource = group_resource_profile_pb2.GroupResourceProfile(
+            gateway_id="default",
+            group_resource_profile_id="default_profile",
+            group_resource_profile_name="default_profile_1",
+        )
+        resource = client.create_group_resource_profile(group_resource)
+        print("Group resource created ", resource)
+    except Exception:
         logger.exception("Error occurred")
 
 
 def update_experiment():
     try:
-        data_model = UserConfigurationDataModel()
-        data_model.groupResourceProfileId = "default_profile"
-        data_model.airavataAutoSchedule = True
-        data_model.overrideManualScheduledParams = True
-        experiment = client.get_experiment(token, 
'test_exp_26302f87-c8eb-4d44-8b6b-4a5c7b1ff014')
-        experiment.userConfigurationData = data_model
-        exp = client.update_experiment(token, 
'test_exp_26302f87-c8eb-4d44-8b6b-4a5c7b1ff014', experiment)
+        data_model = experiment_pb2.UserConfigurationDataModel(
+            group_resource_profile_id="default_profile",
+            airavata_auto_schedule=True,
+            override_manual_scheduled_params=True,
+        )
+        experiment = 
client.get_experiment("test_exp_26302f87-c8eb-4d44-8b6b-4a5c7b1ff014")
+        experiment.user_configuration_data.CopyFrom(data_model)
+        exp = 
client.update_experiment("test_exp_26302f87-c8eb-4d44-8b6b-4a5c7b1ff014", 
experiment)
         print("Updated Experiment ", exp)
-    except (InvalidRequestException, AiravataClientException, 
AuthorizationException, AiravataSystemException):
-         logger.exception("Error occurred")
+    except Exception:
+        logger.exception("Error occurred")
 
 
 def launch_experiment():
     try:
-        status = client.launch_experiment(token, 
'test_exp_26302f87-c8eb-4d44-8b6b-4a5c7b1ff014', 'default')
+        status = 
client.launch_experiment("test_exp_26302f87-c8eb-4d44-8b6b-4a5c7b1ff014", 
"default")
         print("Experiment Status ", status)
-    except (InvalidRequestException, AiravataClientException, 
AuthorizationException, AiravataSystemException):
+    except Exception:
         logger.exception("Error occurred")
diff --git 
a/airavata-python-sdk/airavata_sdk/samples/group_manager_client_samples.py 
b/airavata-python-sdk/airavata_sdk/samples/group_manager_client_samples.py
index 7185341732..742e3d0919 100644
--- a/airavata-python-sdk/airavata_sdk/samples/group_manager_client_samples.py
+++ b/airavata-python-sdk/airavata_sdk/samples/group_manager_client_samples.py
@@ -16,8 +16,7 @@
 
 import logging
 
-from airavata.api.error.ttypes import TException
-from airavata.model.group.ttypes import GroupModel
+from airavata_sdk.generated.org.apache.airavata.model.group import 
group_manager_pb2
 from airavata_sdk.clients.group_manager_client import GroupManagerClient
 from airavata_sdk.clients.keycloak_token_fetcher import Authenticator
 
@@ -25,55 +24,52 @@ logger = logging.getLogger(__name__)
 
 logger.setLevel(logging.DEBUG)
 
-authenticator = Authenticator();
+authenticator = Authenticator()
 token = authenticator.get_token_and_user_info_password_flow("default-admin", 
"123456", "default")
 
-# load GroupManagerClient with default configuration
-client = GroupManagerClient()
+# load GroupManagerClient with access token
+client = GroupManagerClient(access_token=token)
 
 
 # create group in airavata
 def create_group():
     try:
-        group_model = GroupModel()
-        group_model.id = "testing_group"
-        group_model.name = "testing_group_name"
-        group_model.ownerId = "default-admin"
-        group_model.description = "This group is used for testing users"
-
-        users = ['default-admin']
-
-        group_model.members = users
-        group_model.admins = users
-
-        created_group = client.create_group(token, group_model)
+        group_model = group_manager_pb2.GroupModel(
+            id="testing_group",
+            name="testing_group_name",
+            owner_id="default-admin",
+            description="This group is used for testing users",
+            members=["default-admin"],
+            admins=["default-admin"],
+        )
+        created_group = client.create_group(group_model)
         print(created_group)
-    except TException:
+    except Exception:
         logger.exception("Exception occurred")
 
 
 # get all groups
 def get_groups():
     try:
-        created_group = client.get_groups(token)
+        created_group = client.get_groups()
         print("Groups :", created_group)
-    except TException:
+    except Exception:
         logger.exception("Exception occurred")
 
 
 def add_group_admin():
     try:
-        created_group = client.add_group_admins(token, "testing_group", 
["default-admin"])
+        created_group = client.add_group_admins("testing_group", 
["default-admin"])
         print("Groups :", created_group)
-    except TException:
+    except Exception:
         logger.exception("Exception occurred")
 
 
 def has_owner_access():
     try:
-        has_access = client.has_owner_access(token, "testing_group", 
"default-admin")
+        has_access = client.has_owner_access("testing_group", "default-admin")
         print("Is have accesss ", has_access)
-    except TException:
+    except Exception:
         logger.exception("Exception occurred")
 
 get_groups()
diff --git 
a/airavata-python-sdk/airavata_sdk/samples/iam_admin_client_samples.py 
b/airavata-python-sdk/airavata_sdk/samples/iam_admin_client_samples.py
index 1c0c84de5d..db00833942 100644
--- a/airavata-python-sdk/airavata_sdk/samples/iam_admin_client_samples.py
+++ b/airavata-python-sdk/airavata_sdk/samples/iam_admin_client_samples.py
@@ -16,7 +16,6 @@
 
 import logging
 
-from airavata.api.error.ttypes import TException
 from airavata_sdk.clients.iam_admin_client import IAMAdminClient
 from airavata_sdk.clients.keycloak_token_fetcher import Authenticator
 
@@ -24,33 +23,32 @@ logger = logging.getLogger(__name__)
 
 logger.setLevel(logging.DEBUG)
 
-authenticator = Authenticator();
+authenticator = Authenticator()
 token = authenticator.get_token_and_user_info_password_flow("default-admin", 
"123456", "default")
 
-# load GroupManagerClient with default configuration
-client = IAMAdminClient()
+# load IAMAdminClient with access token
+client = IAMAdminClient(access_token=token)
 
 
 def is_user_exisits():
     try:
-        user = client.is_user_exist(token, "default-admin")
+        user = client.is_user_exist("default-admin")
         print("Is user exists :", user)
-    except TException:
+    except Exception:
         logger.exception("Error occurred")
 
 
 def get_user():
     try:
-        user = client.get_user(token, "default-admin")
+        user = client.get_user("default-admin")
         print("User :", user)
-    except TException:
+    except Exception:
         logger.exception("Error occurred")
 
 
 def get_users_with_role():
     try:
-        user = client.get_users_with_role(token, "admin")
+        user = client.get_users_with_role("admin")
         print("Users :", user)
-    except TException:
+    except Exception:
         logger.exception("Error occurred")
-
diff --git 
a/airavata-python-sdk/airavata_sdk/samples/sharing_registry_client_samples.py 
b/airavata-python-sdk/airavata_sdk/samples/sharing_registry_client_samples.py
index 8b77352c8a..be92a8e84f 100644
--- 
a/airavata-python-sdk/airavata_sdk/samples/sharing_registry_client_samples.py
+++ 
b/airavata-python-sdk/airavata_sdk/samples/sharing_registry_client_samples.py
@@ -17,8 +17,7 @@
 
 import logging
 
-from airavata.api.error.ttypes import TException
-from airavata.model.sharing.ttypes import Domain, Entity, EntityType
+from airavata_sdk.generated.org.apache.airavata.model.sharing import 
sharing_pb2
 from airavata_sdk.clients.keycloak_token_fetcher import Authenticator
 from airavata_sdk.clients.sharing_registry_client import SharingRegistryClient
 
@@ -26,60 +25,59 @@ logger = logging.getLogger(__name__)
 
 logger.setLevel(logging.DEBUG)
 
-authenticator = Authenticator();
+authenticator = Authenticator()
 token = authenticator.get_token_and_user_info_password_flow("default-admin", 
"123456", "default")
 
-# load GroupManagerClient with default configuration
-client = SharingRegistryClient()
+# load SharingRegistryClient with access token
+client = SharingRegistryClient(access_token=token)
 
-# create domian
+
+# create domain
 def create_domain():
     try:
-        domain = Domain()
-        domain.domainId = "[email protected]"
-        domain.name = "gw"
-        domain.description = "this domain is used by testing server"
-
-        domain = client.create_domain(domain)
-        print("Domian created :", domain)
-
-    except TException:
+        domain = sharing_pb2.Domain(
+            domain_id="[email protected]",
+            name="gw",
+            description="this domain is used by testing server",
+        )
+        domain_id = client.create_domain(domain)
+        print("Domain created :", domain_id)
+    except Exception:
         logger.exception("Error occurred")
 
 
 # get domain
 def get_domain():
     try:
-
-        domains = client.get_domain("gw")
-        print("Domians created :", domains)
-
-    except TException:
+        domain = client.get_domain("gw")
+        print("Domain :", domain)
+    except Exception:
         logger.exception("Error occurred")
 
 
 def create_entity_type():
     try:
-        entity_type = EntityType()
-        entity_type.domainId = "[email protected]"
-        entity_type.description = "project entity type"
-        entity_type.name = "PROJECT"
-        entity_type.entityTypeId = "[email protected]:PROJECT"
+        entity_type = sharing_pb2.EntityType(
+            domain_id="[email protected]",
+            description="project entity type",
+            name="PROJECT",
+            entity_type_id="[email protected]:PROJECT",
+        )
         en_type = client.create_entity_type(entity_type)
         print("Entity Type ", en_type)
-    except TException:
+    except Exception:
         logger.exception("Error occurred")
 
 
 def create_entity():
     try:
-        entity = Entity()
-        entity.entityTypeId = "[email protected]:PROJECT"
-        entity.name = "PROJECT_ENTITY"
-        entity.domainId = "gw"
-        entity.ownerId = "default-admin"
+        entity = sharing_pb2.Entity(
+            entity_type_id="[email protected]:PROJECT",
+            name="PROJECT_ENTITY",
+            domain_id="gw",
+            owner_id="default-admin",
+        )
         en_type = client.create_entity(entity)
         print("Entity Type ", en_type)
-    except TException:
+    except Exception:
         logger.exception("Error occurred")
-
diff --git 
a/airavata-python-sdk/airavata_sdk/samples/tenant_profile_client_samples.py 
b/airavata-python-sdk/airavata_sdk/samples/tenant_profile_client_samples.py
index 4eee41674e..7faf978810 100644
--- a/airavata-python-sdk/airavata_sdk/samples/tenant_profile_client_samples.py
+++ b/airavata-python-sdk/airavata_sdk/samples/tenant_profile_client_samples.py
@@ -16,7 +16,6 @@
 
 import logging
 
-from airavata.api.error.ttypes import TException
 from airavata_sdk.clients.keycloak_token_fetcher import Authenticator
 from airavata_sdk.clients.tenant_profile_client import TenantProfileClient
 
@@ -24,29 +23,24 @@ logger = logging.getLogger(__name__)
 
 logger.setLevel(logging.DEBUG)
 
-authenticator = Authenticator();
+authenticator = Authenticator()
 token = authenticator.get_token_and_user_info_password_flow("default-admin", 
"123456", "default")
 
-# load GroupManagerClient with default configuration
-#client = TenantProfileClient()
-
-
-# load client with given configuration file (e.g customized_settings.ini)
-client = TenantProfileClient()
+# load TenantProfileClient with access token
+client = TenantProfileClient(access_token=token)
 
 
 def get_all_gateways():
     try:
-        gws = client.get_all_gateways(token)
+        gws = client.get_all_gateways()
         print("Gateways ", gws)
-    except TException:
+    except Exception:
         logger.exception("Error occurred")
 
 
 def is_gateway_exsist():
     try:
-        gw_exisist = client.is_gateway_exist(token, "default")
+        gw_exisist = client.is_gateway_exist("default")
         print("Gateways ", gw_exisist)
-    except TException:
+    except Exception:
         logger.exception("Error occurred")
-
diff --git 
a/airavata-python-sdk/airavata_sdk/samples/user_profile_client_samples.py 
b/airavata-python-sdk/airavata_sdk/samples/user_profile_client_samples.py
index e42542889c..4305c2cb8c 100644
--- a/airavata-python-sdk/airavata_sdk/samples/user_profile_client_samples.py
+++ b/airavata-python-sdk/airavata_sdk/samples/user_profile_client_samples.py
@@ -16,8 +16,7 @@
 
 import logging
 
-from airavata.api.error.ttypes import TException
-from airavata.model.user.ttypes import Status, UserProfile
+from airavata_sdk.generated.org.apache.airavata.model.user import 
user_profile_pb2
 from airavata_sdk.clients.keycloak_token_fetcher import Authenticator
 from airavata_sdk.clients.user_profile_client import UserProfileClient
 
@@ -25,36 +24,37 @@ logger = logging.getLogger(__name__)
 
 logger.setLevel(logging.DEBUG)
 
-authenticator = Authenticator();
+authenticator = Authenticator()
 token = authenticator.get_token_and_user_info_password_flow("default-admin", 
"123456", "default")
 
-# load GroupManagerClient with default configuration
-client = UserProfileClient()
+# load UserProfileClient with access token
+client = UserProfileClient(access_token=token)
 
 
 def add_user_profile():
     try:
-        profile = UserProfile()
-        profile.gatewayId = "default"
-        profile.userId = "default-admin"
-        profile.emails = ['[email protected]']
-        profile.airavataInternalUserId = "default-admin"
-        profile.userModelVersion = "1.0.0"
-        profile.firstName = "Isuru"
-        profile.lastName = "Ranawaka"
-        profile.creationTime = 1576103354
-        profile.lastAccessTime = 1576103296
-        profile.validUntil = 1607725696
-        profile.State = Status.ACTIVE
-        added_profile = client.add_user_profile(token, profile)
-        print("Add user proflile", added_profile)
-    except TException:
+        profile = user_profile_pb2.UserProfile(
+            gateway_id="default",
+            user_id="default-admin",
+            emails=["[email protected]"],
+            airavata_internal_user_id="default-admin",
+            user_model_version="1.0.0",
+            first_name="Isuru",
+            last_name="Ranawaka",
+            creation_time=1576103354,
+            last_access_time=1576103296,
+            valid_until=1607725696,
+            state=user_profile_pb2.ACTIVE,
+        )
+        added_profile = client.add_user_profile(profile)
+        print("Add user profile", added_profile)
+    except Exception:
         logger.exception("Error Occurred")
 
 
 def get_all_user_profiles_in_gateway():
     try:
-        profiles = client.get_all_user_profiles_in_gateway(token, "default", 
0, -1)
+        profiles = client.get_all_user_profiles_in_gateway("default", 
offset=0, limit=20)
         print("User Profiles ", profiles)
-    except TException:
+    except Exception:
         logger.exception("Error Occurred")

Reply via email to