in infra/userportal/gateway/topology.py [0:0]
def __bind_state_machine(self,resource_name:str,handler:RivStateMachineConstruct,model_in:api.Model,model_out:api.Model)->None:
'''
Configure the service integration
:param resource_name: The UserPortal's URL fragment.
:param handler: The user flows implementing Step Function Express instance
:param model_in: The request's data contract definition
:param model_out: The response's data contract definition
'''
integration = api.AwsIntegration(
service='states',
action='StartSyncExecution',
integration_http_method='POST',
options= api.IntegrationOptions(
credentials_role= self.role,
request_templates={
"application/json": make_template(handler.state_machine.state_machine_arn)
},
# TODO: These default templates do not match the GatewayModel definition.
# Ideally, these would use Velocity Templating to return the expected "OperationResponse" definition
integration_responses=[
api.IntegrationResponse(
status_code='200',
selection_pattern='200',
response_templates={
'application/json':'''$input.json('$')'''
}),
api.IntegrationResponse(
status_code='500',
selection_pattern='500',
response_templates={
'application/json':'''$input.json('$')'''
})
],
passthrough_behavior= api.PassthroughBehavior.NEVER))
'''
Configure the /resource-name...
'''
resource = self.rest_api.root.add_resource(
path_part=resource_name,
default_method_options=api.MethodOptions(
request_models= {
"application/json": model_in
}))
resource.add_method(http_method='POST',
integration=integration,
method_responses=[
api.MethodResponse(status_code='200', response_models={
'application/json': model_out
}),
api.MethodResponse(status_code='500', response_models={
'application/json': api.Model.ERROR_MODEL