def remote_add_service_endpoints(self, ss_api_config, security_server_conf,
                                  client_conf, service_description_conf,
                                  endpoint_conf):
     try:
         clients_api = ClientsApi(ApiClient(ss_api_config))
         client_controller = ClientController()
         client = client_controller.find_client(clients_api,
                                                security_server_conf,
                                                client_conf)
         if client:
             try:
                 service_description = ServiceController(
                 ).get_client_service_description(clients_api, client,
                                                  service_description_conf)
                 if service_description:
                     if service_description.type == ServiceType().WSDL:
                         BaseController.log_info(
                             "Wrong service description, endpoints for WSDL services are not"
                             " allowed, skipped endpoint creation " +
                             EndpointController.FOR_SERVICE + "'" +
                             service_description.url + "'")
                     else:
                         self.remote_add_endpoint(ss_api_config,
                                                  service_description,
                                                  service_description_conf,
                                                  endpoint_conf)
             except ApiException as find_err:
                 BaseController.log_api_error(
                     ClientController.
                     CLIENTS_API_GET_CLIENT_SERVICE_DESCRIPTION, find_err)
     except ApiException as find_err:
         BaseController.log_api_error(
             ClientController.CLIENTS_API_FIND_CLIENTS, find_err)
Exemple #2
0
 def remote_add_service_description(ss_api_config, security_server_conf, client_conf, service_description_conf):
     code = service_description_conf['rest_service_code'] if service_description_conf['rest_service_code'] else None
     description_add = ServiceDescriptionAdd(url=service_description_conf['url'],
                                             rest_service_code=code,
                                             ignore_warnings=True,
                                             type=service_description_conf['type'])
     clients_api = ClientsApi(ApiClient(ss_api_config))
     try:
         client_controller = ClientController()
         client = client_controller.find_client(clients_api, security_server_conf, client_conf)
         if client:
             try:
                 response = clients_api.add_client_service_description(client.id, body=description_add)
                 if response:
                     BaseController.log_info("Added service description with type '" + response.type + "' and url '" + response.url +
                                             "' (got full id " + response.id + ")")
             except ApiException as err:
                 if err.status == 409:
                     BaseController.log_info(ServiceController.SERVICE_DESCRIPTION_FOR + "'" + client_controller.partial_client_id(client_conf) +
                                             "' with url '" + description_add.url +
                                             "' and type '" + description_add.type + "' already exists.")
                 else:
                     BaseController.log_api_error('ClientsApi->add_client_service_description', err)
     except ApiException as find_err:
         BaseController.log_api_error(ClientController.CLIENTS_API_FIND_CLIENTS, find_err)
 def remote_add_endpoints_access(self, ss_api_config, security_server_conf,
                                 client_conf, service_description_conf):
     try:
         client_controller = ClientController()
         clients_api = ClientsApi(ApiClient(ss_api_config))
         client = client_controller.find_client(clients_api,
                                                security_server_conf,
                                                client_conf)
         if client:
             service_clients_candidates = client_controller.get_clients_service_client_candidates(
                 clients_api, client.id, [])
             try:
                 service_controller = ServiceController()
                 clients_api = ClientsApi(ApiClient(ss_api_config))
                 service_description = service_controller.get_client_service_description(
                     clients_api, client, service_description_conf)
                 if service_description.type != ServiceType().WSDL:
                     self.remote_add_endpoint_access(
                         ss_api_config, service_description,
                         service_description_conf,
                         service_clients_candidates)
             except ApiException as find_err:
                 BaseController.log_api_error(
                     ClientController.
                     CLIENTS_API_GET_CLIENT_SERVICE_DESCRIPTION, find_err)
     except ApiException as find_err:
         BaseController.log_api_error(
             ClientController.CLIENTS_API_FIND_CLIENTS, find_err)
Exemple #4
0
 def remote_update_service_parameters(self, ss_api_config, security_server_conf, client_conf, service_description_conf):
     clients_api = ClientsApi(ApiClient(ss_api_config))
     try:
         client_controller = ClientController()
         client = client_controller.find_client(clients_api, security_server_conf, client_conf)
         if client:
             try:
                 service_description = self.get_client_service_description(clients_api, client, service_description_conf)
                 if service_description:
                     for service in service_description.services:
                         self.remote_update_service_parameter(ss_api_config, service_description_conf, service)
             except ApiException as find_err:
                 BaseController.log_api_error(ClientController.CLIENTS_API_GET_CLIENT_SERVICE_DESCRIPTION, find_err)
     except ApiException as find_err:
         BaseController.log_api_error(ClientController.CLIENTS_API_FIND_CLIENTS, find_err)
Exemple #5
0
 def remote_enable_service_description(self, ss_api_config, security_server_conf, client_conf, service_description_conf):
     clients_api = ClientsApi(ApiClient(ss_api_config))
     service_descriptions_api = ServiceDescriptionsApi(ApiClient(ss_api_config))
     try:
         client_controller = ClientController()
         client = client_controller.find_client(clients_api, security_server_conf, client_conf)
         if client:
             try:
                 service_description = self.get_client_service_description(clients_api, client, service_description_conf)
                 if service_description:
                     try:
                         service_descriptions_api.enable_service_description(service_description.id)
                         BaseController.log_info(ServiceController.SERVICE_DESCRIPTION_FOR + "'" + client_controller.partial_client_id(client_conf) +
                                                 "' with id: '" + service_description.id + "' enabled successfully.")
                     except ApiException as err:
                         if err.status == 409:
                             BaseController.log_info(ServiceController.SERVICE_DESCRIPTION_FOR + "'" + client_controller.partial_client_id(client_conf) +
                                                     "' with id: '" + service_description.id + "' already enabled.")
                         else:
                             BaseController.log_api_error('ServiceDescriptionsApi->enable_service_description', err)
             except ApiException as find_err:
                 BaseController.log_api_error(ClientController.CLIENTS_API_GET_CLIENT_SERVICE_DESCRIPTION, find_err)
     except ApiException as find_err:
         BaseController.log_api_error(ClientController.CLIENTS_API_FIND_CLIENTS, find_err)