def __init__(self, func: Callable): self.service_instance = Service.make( service_definition, service_uri, protocol, access_policy, payload_format, ) self.method = method self.service_definition = service_definition self.func = func
async def add_orchestration_rule( # type: ignore self, service_definition: str, method: str, protocol: str = '', access_policy: str = '', payload_format: str = '', orchestration_flags: OrchestrationFlags = OrchestrationFlags.OVERRIDE_STORE, **kwargs, ): """ Add orchestration rule for provided_service definition Args: service_definition: Service definition that is looked up from the orchestrator. method: The HTTP method given in uppercase that is used to consume the provided_service. access_policy: Service access policy. """ requested_service = Service.make( service_definition, protocol=protocol, access_policy=access_policy, payload_format=payload_format, ) orchestration_form = arrowhead_client.client.core_service_forms.client.OrchestrationForm.make( self.system, requested_service, orchestration_flags, **kwargs ) # TODO: Add an argument for arrowhead forms in consume_service, and one for the ssl-files orchestration_response = await self.consume_service( CoreServices.ORCHESTRATION.service_definition, json=orchestration_form.dto(), # cert=self.cert, ) rules = responses.process_orchestration(orchestration_response, method) for rule in rules: self.orchestration_rules.store(rule)