isururanawaka commented on a change in pull request #11: User Profile SDK URL: https://github.com/apache/airavata-custos/pull/11#discussion_r340076083
########## File path: clients/python/airavata_custos/profile/profile.py ########## @@ -0,0 +1,81 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +from airavata_custos import utils +from custos.commons.model.security.ttypes import AuthzToken +from custos.profile.model.User.ttypes import UserProfile +from airavata_custos.configuration import Configuration + + +class Profile(object): + + def __init__(self, configuration: Configuration): + """ + + :param configuration: object of class Configuration which has hosts/ports of custos services + """ + self.profile_service_pool = utils.initialize_userprofile_client_pool(configuration.PROFILE_SERVICE_HOST, + configuration.PROFILE_SERVICE_PORT) + + def create_user(self, authorization_token: AuthzToken) -> UserProfile: + """ + This method creates a new user in custos profile service + :param authorization_token: object of class AuthzToken + :return: boolean true if user is created successfully otherwise false + """ + return self.profile_service_pool.initializeUserProfile(authorization_token) Review comment: Is there any chance to fail the profile_service_pool initialization and raise a None Exeception profile_service_pool.initializeUserProfile(authorization_token) ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
