From b429fb1ddb432770657fa5f36c1cec8eea376e62 Mon Sep 17 00:00:00 2001 From: slinkydeveloper Date: Mon, 22 Apr 2024 11:06:29 +0200 Subject: [PATCH 1/3] Update Admin API OpenAPI --- admin-client/src/main/openapi/meta.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin-client/src/main/openapi/meta.json b/admin-client/src/main/openapi/meta.json index a9efc1e8..8607afcf 100644 --- a/admin-client/src/main/openapi/meta.json +++ b/admin-client/src/main/openapi/meta.json @@ -1 +1 @@ -{"openapi":"3.0.0","info":{"title":"Admin API","version":"0.9.0"},"paths":{"/components":{"get":{"tags":["component"],"summary":"List components","description":"List all registered components.","operationId":"list_components","responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListComponentsResponse"}}}},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"403":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"409":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"500":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"503":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}}}}},"/components/{component}/state":{"post":{"tags":["component"],"summary":"Modify a component state","description":"Modify component state","operationId":"modify_component_state","parameters":[{"name":"component","in":"path","description":"Fully qualified component name.","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ModifyComponentStateRequest"}}},"required":true},"responses":{"202":{"description":"Accepted"},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"403":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"409":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"500":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"503":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}}}}},"/subscriptions/{subscription}":{"get":{"tags":["subscription"],"summary":"Get subscription","description":"Get subscription","operationId":"get_subscription","parameters":[{"name":"subscription","in":"path","description":"Subscription identifier","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionResponse"}}}},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"403":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"409":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"500":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"503":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}}}},"delete":{"tags":["subscription"],"summary":"Delete subscription","description":"Delete subscription.","operationId":"delete_subscription","parameters":[{"name":"subscription","in":"path","description":"Subscription identifier","required":true,"schema":{"type":"string"}}],"responses":{"202":{"description":"Accepted"},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"403":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"409":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"500":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"503":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}}}}},"/deployments":{"get":{"tags":["deployment"],"summary":"List deployments","description":"List all registered deployments.","operationId":"list_deployments","responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListDeploymentsResponse"}}}}}},"post":{"tags":["deployment"],"summary":"Create deployment","description":"Create deployment. Restate will invoke the endpoint to gather additional information required for registration, such as the components exposed by the deployment. If the deployment is already registered, this method will fail unless `force` is set to `true`.","operationId":"create_deployment","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegisterDeploymentRequest"}}},"required":true},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegisterDeploymentResponse"}}}},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"403":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"409":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"500":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"503":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}}}}},"/components/{component}":{"get":{"tags":["component"],"summary":"Get component","description":"Get a registered component.","operationId":"get_component","parameters":[{"name":"component","in":"path","description":"Fully qualified component name.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ComponentMetadata"}}}},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"403":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"409":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"500":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"503":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}}}},"patch":{"tags":["component"],"summary":"Modify a component","description":"Modify a registered component.","operationId":"modify_component","parameters":[{"name":"component","in":"path","description":"Fully qualified component name.","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ModifyComponentRequest"}}},"required":true},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ComponentMetadata"}}}},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"403":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"409":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"500":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"503":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}}}}},"/health":{"get":{"tags":["health"],"summary":"Health check","description":"Check REST API Health.","operationId":"health","responses":{"200":{"description":"OK"}}}},"/subscriptions":{"get":{"tags":["subscription"],"summary":"List subscriptions","description":"List all subscriptions.","operationId":"list_subscriptions","parameters":[{"name":"sink","in":"query","description":"Filter by the exact specified sink.","style":"simple","schema":{"type":"string"}},{"name":"source","in":"query","description":"Filter by the exact specified source.","style":"simple","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListSubscriptionsResponse"}}}}}},"post":{"tags":["subscription"],"summary":"Create subscription","description":"Create subscription.","operationId":"create_subscription","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateSubscriptionRequest"}}},"required":true},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionResponse"}}}},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"403":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"409":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"500":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"503":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}}}}},"/openapi":{"get":{"tags":["openapi"],"summary":"OpenAPI specification","externalDocs":{"url":"https://swagger.io/specification/"},"operationId":"openapi_spec","responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"type":"string"}}}}}}}},"/invocations/{invocation_id}":{"delete":{"tags":["invocation"],"summary":"Terminate an invocation","description":"Terminate the given invocation. By default, an invocation is terminated by gracefully cancelling it. This ensures virtual object state consistency. Alternatively, an invocation can be killed which does not guarantee consistency for virtual object instance state, in-flight invocations to other components, etc.","operationId":"terminate_invocation","parameters":[{"name":"invocation_id","in":"path","description":"Invocation identifier.","required":true,"schema":{"type":"string"}},{"name":"mode","in":"query","description":"If cancel, it will gracefully terminate the invocation. If kill, it will terminate the invocation with a hard stop.","style":"simple","schema":{"$ref":"#/components/schemas/TerminationMode"}}],"responses":{"202":{"description":"Accepted"},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"403":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"409":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"500":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"503":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}}}}},"/deployments/{deployment}":{"get":{"tags":["deployment"],"summary":"Get deployment","description":"Get deployment metadata","operationId":"get_deployment","parameters":[{"name":"deployment","in":"path","description":"Deployment identifier","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DetailedDeploymentResponse"}}}},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"403":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"409":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"500":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"503":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}}}},"delete":{"tags":["deployment"],"summary":"Delete deployment","description":"Delete deployment. Currently it's supported to remove a deployment only using the force flag","operationId":"delete_deployment","parameters":[{"name":"deployment","in":"path","description":"Deployment identifier","required":true,"schema":{"type":"string"}},{"name":"force","in":"query","description":"If true, the deployment will be forcefully deleted. This might break in-flight invocations, use with caution.","style":"simple","schema":{"type":"boolean"}}],"responses":{"202":{"description":"Accepted"},"501":{"description":"Not implemented. Only using the force flag is supported at the moment."},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"403":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"409":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"500":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"503":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}}}}},"/components/{component}/handlers/{handler}":{"get":{"tags":["component_handler"],"summary":"Get component handler","description":"Get the handler of a component","operationId":"get_component_handler","parameters":[{"name":"component","in":"path","description":"Fully qualified component name.","required":true,"schema":{"type":"string"}},{"name":"handler","in":"path","description":"Handler name.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HandlerMetadata"}}}},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"403":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"409":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"500":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"503":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}}}}},"/components/{component}/handlers":{"get":{"tags":["component_handler"],"summary":"List component handlers","description":"List all the handlers of the given component.","operationId":"list_component_handlers","parameters":[{"name":"component","in":"path","description":"Fully qualified component name.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListComponentHandlersResponse"}}}},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"403":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"409":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"500":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"503":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}}}}}},"components":{"schemas":{"ListComponentsResponse":{"type":"object","required":["components"],"properties":{"components":{"type":"array","items":{"$ref":"#/components/schemas/ComponentMetadata"}}}},"ComponentMetadata":{"type":"object","required":["deployment_id","handlers","idempotency_retention","name","public","revision","ty"],"properties":{"name":{"title":"Name","description":"Fully qualified name of the component","type":"string"},"handlers":{"type":"array","items":{"$ref":"#/components/schemas/HandlerMetadata"}},"ty":{"$ref":"#/components/schemas/ComponentType"},"deployment_id":{"title":"Deployment Id","description":"Deployment exposing the latest revision of the component.","type":"string"},"revision":{"title":"Revision","description":"Latest revision of the component.","type":"integer","format":"uint32","minimum":0.0},"public":{"title":"Public","description":"If true, the component can be invoked through the ingress. If false, the component can be invoked only from another Restate service.","type":"boolean"},"idempotency_retention":{"title":"Idempotency retention","description":"The retention duration of idempotent requests for this component.","type":"string"}}},"HandlerMetadata":{"type":"object","required":["input_description","name","output_description","ty"],"properties":{"name":{"type":"string"},"ty":{"$ref":"#/components/schemas/HandlerType"},"input_description":{"type":"string"},"output_description":{"type":"string"}}},"HandlerType":{"type":"string","enum":["Exclusive","Shared"]},"ComponentType":{"type":"string","enum":["Service","VirtualObject"]},"ErrorDescriptionResponse":{"title":"Error description response","description":"Error details of the response","type":"object","required":["message"],"properties":{"message":{"type":"string"},"restate_code":{"title":"Restate code","description":"Restate error code describing this error","type":"string","nullable":true}}},"ModifyComponentStateRequest":{"type":"object","required":["new_state","object_key"],"properties":{"version":{"title":"Version","description":"If set, the latest version of the state is compared with this value and the operation will fail when the versions differ.","type":"string","nullable":true},"object_key":{"title":"Component key","description":"To what virtual object key to apply this change","type":"string"},"new_state":{"title":"New State","description":"The new state to replace the previous state with","type":"object","additionalProperties":{"type":"array","items":{"type":"integer","format":"uint8","minimum":0.0}}}}},"ListDeploymentsResponse":{"type":"object","required":["deployments"],"properties":{"deployments":{"type":"array","items":{"$ref":"#/components/schemas/DeploymentResponse"}}}},"DeploymentResponse":{"type":"object","anyOf":[{"type":"object","required":["created_at","protocol_type","uri"],"properties":{"uri":{"type":"string"},"protocol_type":{"$ref":"#/components/schemas/ProtocolType"},"additional_headers":{"type":"object","additionalProperties":{"type":"string"}},"created_at":{"type":"string"}}},{"type":"object","required":["arn","created_at"],"properties":{"arn":{"$ref":"#/components/schemas/LambdaARN"},"assume_role_arn":{"type":"string","nullable":true},"additional_headers":{"type":"object","additionalProperties":{"type":"string"}},"created_at":{"type":"string"}}}],"required":["components","id"],"properties":{"id":{"$ref":"#/components/schemas/String"},"components":{"title":"Components","description":"List of components exposed by this deployment.","type":"array","items":{"$ref":"#/components/schemas/ComponentNameRevPair"}}}},"String":{"type":"string"},"ComponentNameRevPair":{"type":"object","required":["name","revision"],"properties":{"name":{"type":"string"},"revision":{"type":"integer","format":"uint32","minimum":0.0}}},"ProtocolType":{"type":"string","enum":["RequestResponse","BidiStream"]},"LambdaARN":{"type":"string","format":"arn"},"ModifyComponentRequest":{"type":"object","properties":{"public":{"title":"Public","description":"If true, the component can be invoked through the ingress. If false, the component can be invoked only from another Restate service.","default":null,"type":"boolean","nullable":true},"idempotency_retention":{"title":"Idempotency retention","description":"Modify the retention of idempotent requests for this component.","default":null,"type":"string","nullable":true}}},"CreateSubscriptionRequest":{"type":"object","required":["sink","source"],"properties":{"source":{"title":"Source","description":"Source uri. Accepted forms:\n\n* `kafka:///`, e.g. `kafka://my-cluster/my-topic`","type":"string"},"sink":{"title":"Sink","description":"Sink uri. Accepted forms:\n\n* `component:///`, e.g. `component://Counter/count`","type":"string"},"options":{"title":"Options","description":"Additional options to apply to the subscription.","type":"object","additionalProperties":{"type":"string"},"nullable":true}}},"SubscriptionResponse":{"type":"object","required":["id","options","sink","source"],"properties":{"id":{"$ref":"#/components/schemas/String"},"source":{"type":"string"},"sink":{"type":"string"},"options":{"type":"object","additionalProperties":{"type":"string"}}}},"TerminationMode":{"type":"string","enum":["Cancel","Kill"]},"RegisterDeploymentRequest":{"anyOf":[{"type":"object","required":["uri"],"properties":{"uri":{"title":"Uri","description":"Uri to use to discover/invoke the http deployment.","type":"string"},"additional_headers":{"title":"Additional headers","description":"Additional headers added to the discover/invoke requests to the deployment.","type":"object","additionalProperties":{"type":"string"},"nullable":true},"force":{"title":"Force","description":"If `true`, it will override, if existing, any deployment using the same `uri`. Beware that this can lead in-flight invocations to an unrecoverable error state.\n\nBy default, this is `true` but it might change in future to `false`.\n\nSee the [versioning documentation](https://docs.restate.dev/services/upgrades-removal) for more information.","default":true,"type":"boolean"},"dry_run":{"title":"Dry-run mode","description":"If `true`, discovery will run but the deployment will not be registered. This is useful to see the impact of a new deployment before registering it.","default":false,"type":"boolean"}}},{"type":"object","required":["arn"],"properties":{"arn":{"title":"ARN","description":"ARN to use to discover/invoke the lambda deployment.","type":"string"},"assume_role_arn":{"title":"Assume role ARN","description":"Optional ARN of a role to assume when invoking the addressed Lambda, to support role chaining","type":"string","nullable":true},"additional_headers":{"title":"Additional headers","description":"Additional headers added to the discover/invoke requests to the deployment.","type":"object","additionalProperties":{"type":"string"},"nullable":true},"force":{"title":"Force","description":"If `true`, it will override, if existing, any deployment using the same `uri`. Beware that this can lead in-flight invocations to an unrecoverable error state.\n\nBy default, this is `true` but it might change in future to `false`.\n\nSee the [versioning documentation](https://docs.restate.dev/services/upgrades-removal) for more information.","default":true,"type":"boolean"},"dry_run":{"title":"Dry-run mode","description":"If `true`, discovery will run but the deployment will not be registered. This is useful to see the impact of a new deployment before registering it.","default":false,"type":"boolean"}}}]},"RegisterDeploymentResponse":{"type":"object","required":["components","id"],"properties":{"id":{"$ref":"#/components/schemas/String"},"components":{"type":"array","items":{"$ref":"#/components/schemas/ComponentMetadata"}}}},"ListComponentHandlersResponse":{"type":"object","required":["handlers"],"properties":{"handlers":{"type":"array","items":{"$ref":"#/components/schemas/HandlerMetadata"}}}},"ListSubscriptionsResponse":{"type":"object","required":["subscriptions"],"properties":{"subscriptions":{"type":"array","items":{"$ref":"#/components/schemas/SubscriptionResponse"}}}},"DetailedDeploymentResponse":{"type":"object","anyOf":[{"type":"object","required":["created_at","protocol_type","uri"],"properties":{"uri":{"type":"string"},"protocol_type":{"$ref":"#/components/schemas/ProtocolType"},"additional_headers":{"type":"object","additionalProperties":{"type":"string"}},"created_at":{"type":"string"}}},{"type":"object","required":["arn","created_at"],"properties":{"arn":{"$ref":"#/components/schemas/LambdaARN"},"assume_role_arn":{"type":"string","nullable":true},"additional_headers":{"type":"object","additionalProperties":{"type":"string"}},"created_at":{"type":"string"}}}],"required":["components","id"],"properties":{"id":{"$ref":"#/components/schemas/String"},"components":{"title":"Components","description":"List of components exposed by this deployment.","type":"array","items":{"$ref":"#/components/schemas/ComponentMetadata"}}}}}}} +{"openapi":"3.0.0","info":{"title":"Admin API","version":"0.9.0"},"paths":{"/invocations/{invocation_id}":{"delete":{"tags":["invocation"],"summary":"Terminate an invocation","description":"Terminate the given invocation. By default, an invocation is terminated by gracefully cancelling it. This ensures virtual object state consistency. Alternatively, an invocation can be killed which does not guarantee consistency for virtual object instance state, in-flight invocations to other services, etc.","operationId":"terminate_invocation","parameters":[{"name":"invocation_id","in":"path","description":"Invocation identifier.","required":true,"schema":{"type":"string"}},{"name":"mode","in":"query","description":"If cancel, it will gracefully terminate the invocation. If kill, it will terminate the invocation with a hard stop.","style":"simple","schema":{"$ref":"#/components/schemas/TerminationMode"}}],"responses":{"202":{"description":"Accepted"},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"403":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"409":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"500":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"503":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}}}}},"/deployments":{"get":{"tags":["deployment"],"summary":"List deployments","description":"List all registered deployments.","operationId":"list_deployments","responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListDeploymentsResponse"}}}}}},"post":{"tags":["deployment"],"summary":"Create deployment","description":"Create deployment. Restate will invoke the endpoint to gather additional information required for registration, such as the services exposed by the deployment. If the deployment is already registered, this method will fail unless `force` is set to `true`.","operationId":"create_deployment","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegisterDeploymentRequest"}}},"required":true},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegisterDeploymentResponse"}}}},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"403":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"409":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"500":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"503":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}}}}},"/health":{"get":{"tags":["health"],"summary":"Health check","description":"Check REST API Health.","operationId":"health","responses":{"200":{"description":"OK"}}}},"/services/{service}/handlers/{handler}":{"get":{"tags":["service_handler"],"summary":"Get service handler","description":"Get the handler of a service","operationId":"get_service_handler","parameters":[{"name":"service","in":"path","description":"Fully qualified service name.","required":true,"schema":{"type":"string"}},{"name":"handler","in":"path","description":"Handler name.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HandlerMetadata"}}}},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"403":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"409":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"500":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"503":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}}}}},"/deployments/{deployment}":{"get":{"tags":["deployment"],"summary":"Get deployment","description":"Get deployment metadata","operationId":"get_deployment","parameters":[{"name":"deployment","in":"path","description":"Deployment identifier","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DetailedDeploymentResponse"}}}},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"403":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"409":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"500":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"503":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}}}},"delete":{"tags":["deployment"],"summary":"Delete deployment","description":"Delete deployment. Currently it's supported to remove a deployment only using the force flag","operationId":"delete_deployment","parameters":[{"name":"deployment","in":"path","description":"Deployment identifier","required":true,"schema":{"type":"string"}},{"name":"force","in":"query","description":"If true, the deployment will be forcefully deleted. This might break in-flight invocations, use with caution.","style":"simple","schema":{"type":"boolean"}}],"responses":{"202":{"description":"Accepted"},"501":{"description":"Not implemented. Only using the force flag is supported at the moment."},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"403":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"409":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"500":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"503":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}}}}},"/subscriptions":{"get":{"tags":["subscription"],"summary":"List subscriptions","description":"List all subscriptions.","operationId":"list_subscriptions","parameters":[{"name":"sink","in":"query","description":"Filter by the exact specified sink.","style":"simple","schema":{"type":"string"}},{"name":"source","in":"query","description":"Filter by the exact specified source.","style":"simple","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListSubscriptionsResponse"}}}}}},"post":{"tags":["subscription"],"summary":"Create subscription","description":"Create subscription.","operationId":"create_subscription","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateSubscriptionRequest"}}},"required":true},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionResponse"}}}},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"403":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"409":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"500":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"503":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}}}}},"/openapi":{"get":{"tags":["openapi"],"summary":"OpenAPI specification","externalDocs":{"url":"https://swagger.io/specification/"},"operationId":"openapi_spec","responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"type":"string"}}}}}}}},"/services/{service}/handlers":{"get":{"tags":["service_handler"],"summary":"List service handlers","description":"List all the handlers of the given service.","operationId":"list_service_handlers","parameters":[{"name":"service","in":"path","description":"Fully qualified service name.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListServiceHandlersResponse"}}}},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"403":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"409":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"500":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"503":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}}}}},"/services/{service}":{"get":{"tags":["service"],"summary":"Get service","description":"Get a registered service.","operationId":"get_service","parameters":[{"name":"service","in":"path","description":"Fully qualified service name.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ServiceMetadata"}}}},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"403":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"409":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"500":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"503":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}}}},"patch":{"tags":["service"],"summary":"Modify a service","description":"Modify a registered service.","operationId":"modify_service","parameters":[{"name":"service","in":"path","description":"Fully qualified service name.","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ModifyServiceRequest"}}},"required":true},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ServiceMetadata"}}}},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"403":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"409":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"500":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"503":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}}}}},"/services/{service}/state":{"post":{"tags":["service"],"summary":"Modify a service state","description":"Modify service state","operationId":"modify_service_state","parameters":[{"name":"service","in":"path","description":"Fully qualified service name.","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ModifyServiceStateRequest"}}},"required":true},"responses":{"202":{"description":"Accepted"},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"403":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"409":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"500":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"503":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}}}}},"/subscriptions/{subscription}":{"get":{"tags":["subscription"],"summary":"Get subscription","description":"Get subscription","operationId":"get_subscription","parameters":[{"name":"subscription","in":"path","description":"Subscription identifier","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionResponse"}}}},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"403":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"409":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"500":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"503":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}}}},"delete":{"tags":["subscription"],"summary":"Delete subscription","description":"Delete subscription.","operationId":"delete_subscription","parameters":[{"name":"subscription","in":"path","description":"Subscription identifier","required":true,"schema":{"type":"string"}}],"responses":{"202":{"description":"Accepted"},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"403":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"409":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"500":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"503":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}}}}},"/services":{"get":{"tags":["service"],"summary":"List services","description":"List all registered services.","operationId":"list_services","responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListServicesResponse"}}}},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"403":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"409":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"500":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}},"503":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDescriptionResponse"}}}}}}}},"components":{"schemas":{"ErrorDescriptionResponse":{"title":"Error description response","description":"Error details of the response","type":"object","required":["message"],"properties":{"message":{"type":"string"},"restate_code":{"title":"Restate code","description":"Restate error code describing this error","type":"string","nullable":true}}},"TerminationMode":{"type":"string","enum":["Cancel","Kill"]},"RegisterDeploymentRequest":{"anyOf":[{"type":"object","required":["uri"],"properties":{"uri":{"title":"Uri","description":"Uri to use to discover/invoke the http deployment.","type":"string"},"additional_headers":{"title":"Additional headers","description":"Additional headers added to the discover/invoke requests to the deployment.","type":"object","additionalProperties":{"type":"string"},"nullable":true},"force":{"title":"Force","description":"If `true`, it will override, if existing, any deployment using the same `uri`. Beware that this can lead in-flight invocations to an unrecoverable error state.\n\nBy default, this is `true` but it might change in future to `false`.\n\nSee the [versioning documentation](https://docs.restate.dev/services/upgrades-removal) for more information.","default":true,"type":"boolean"},"dry_run":{"title":"Dry-run mode","description":"If `true`, discovery will run but the deployment will not be registered. This is useful to see the impact of a new deployment before registering it.","default":false,"type":"boolean"}}},{"type":"object","required":["arn"],"properties":{"arn":{"title":"ARN","description":"ARN to use to discover/invoke the lambda deployment.","type":"string"},"assume_role_arn":{"title":"Assume role ARN","description":"Optional ARN of a role to assume when invoking the addressed Lambda, to support role chaining","type":"string","nullable":true},"additional_headers":{"title":"Additional headers","description":"Additional headers added to the discover/invoke requests to the deployment.","type":"object","additionalProperties":{"type":"string"},"nullable":true},"force":{"title":"Force","description":"If `true`, it will override, if existing, any deployment using the same `uri`. Beware that this can lead in-flight invocations to an unrecoverable error state.\n\nBy default, this is `true` but it might change in future to `false`.\n\nSee the [versioning documentation](https://docs.restate.dev/services/upgrades-removal) for more information.","default":true,"type":"boolean"},"dry_run":{"title":"Dry-run mode","description":"If `true`, discovery will run but the deployment will not be registered. This is useful to see the impact of a new deployment before registering it.","default":false,"type":"boolean"}}}]},"RegisterDeploymentResponse":{"type":"object","required":["id","services"],"properties":{"id":{"$ref":"#/components/schemas/String"},"services":{"type":"array","items":{"$ref":"#/components/schemas/ServiceMetadata"}}}},"String":{"type":"string"},"ServiceMetadata":{"type":"object","required":["deployment_id","handlers","idempotency_retention","name","public","revision","ty"],"properties":{"name":{"title":"Name","description":"Fully qualified name of the service","type":"string"},"handlers":{"type":"array","items":{"$ref":"#/components/schemas/HandlerMetadata"}},"ty":{"$ref":"#/components/schemas/ServiceType"},"deployment_id":{"title":"Deployment Id","description":"Deployment exposing the latest revision of the service.","type":"string"},"revision":{"title":"Revision","description":"Latest revision of the service.","type":"integer","format":"uint32","minimum":0.0},"public":{"title":"Public","description":"If true, the service can be invoked through the ingress. If false, the service can be invoked only from another Restate service.","type":"boolean"},"idempotency_retention":{"title":"Idempotency retention","description":"The retention duration of idempotent requests for this service.","type":"string"}}},"HandlerMetadata":{"type":"object","required":["input_description","name","output_description","ty"],"properties":{"name":{"type":"string"},"ty":{"$ref":"#/components/schemas/HandlerType"},"input_description":{"type":"string"},"output_description":{"type":"string"}}},"HandlerType":{"type":"string","enum":["Exclusive","Shared"]},"ServiceType":{"type":"string","enum":["Service","VirtualObject"]},"DetailedDeploymentResponse":{"type":"object","anyOf":[{"type":"object","required":["created_at","protocol_type","uri"],"properties":{"uri":{"type":"string"},"protocol_type":{"$ref":"#/components/schemas/ProtocolType"},"additional_headers":{"type":"object","additionalProperties":{"type":"string"}},"created_at":{"type":"string"}}},{"type":"object","required":["arn","created_at"],"properties":{"arn":{"$ref":"#/components/schemas/LambdaARN"},"assume_role_arn":{"type":"string","nullable":true},"additional_headers":{"type":"object","additionalProperties":{"type":"string"}},"created_at":{"type":"string"}}}],"required":["id","services"],"properties":{"id":{"$ref":"#/components/schemas/String"},"services":{"title":"Services","description":"List of services exposed by this deployment.","type":"array","items":{"$ref":"#/components/schemas/ServiceMetadata"}}}},"ProtocolType":{"type":"string","enum":["RequestResponse","BidiStream"]},"LambdaARN":{"type":"string","format":"arn"},"CreateSubscriptionRequest":{"type":"object","required":["sink","source"],"properties":{"source":{"title":"Source","description":"Source uri. Accepted forms:\n\n* `kafka:///`, e.g. `kafka://my-cluster/my-topic`","type":"string"},"sink":{"title":"Sink","description":"Sink uri. Accepted forms:\n\n* `service:///`, e.g. `service://Counter/count`","type":"string"},"options":{"title":"Options","description":"Additional options to apply to the subscription.","type":"object","additionalProperties":{"type":"string"},"nullable":true}}},"SubscriptionResponse":{"type":"object","required":["id","options","sink","source"],"properties":{"id":{"$ref":"#/components/schemas/String"},"source":{"type":"string"},"sink":{"type":"string"},"options":{"type":"object","additionalProperties":{"type":"string"}}}},"ListServiceHandlersResponse":{"type":"object","required":["handlers"],"properties":{"handlers":{"type":"array","items":{"$ref":"#/components/schemas/HandlerMetadata"}}}},"ModifyServiceRequest":{"type":"object","properties":{"public":{"title":"Public","description":"If true, the service can be invoked through the ingress. If false, the service can be invoked only from another Restate service.","default":null,"type":"boolean","nullable":true},"idempotency_retention":{"title":"Idempotency retention","description":"Modify the retention of idempotent requests for this service.","default":null,"type":"string","nullable":true}}},"ListDeploymentsResponse":{"type":"object","required":["deployments"],"properties":{"deployments":{"type":"array","items":{"$ref":"#/components/schemas/DeploymentResponse"}}}},"DeploymentResponse":{"type":"object","anyOf":[{"type":"object","required":["created_at","protocol_type","uri"],"properties":{"uri":{"type":"string"},"protocol_type":{"$ref":"#/components/schemas/ProtocolType"},"additional_headers":{"type":"object","additionalProperties":{"type":"string"}},"created_at":{"type":"string"}}},{"type":"object","required":["arn","created_at"],"properties":{"arn":{"$ref":"#/components/schemas/LambdaARN"},"assume_role_arn":{"type":"string","nullable":true},"additional_headers":{"type":"object","additionalProperties":{"type":"string"}},"created_at":{"type":"string"}}}],"required":["id","services"],"properties":{"id":{"$ref":"#/components/schemas/String"},"services":{"title":"Services","description":"List of services exposed by this deployment.","type":"array","items":{"$ref":"#/components/schemas/ServiceNameRevPair"}}}},"ServiceNameRevPair":{"type":"object","required":["name","revision"],"properties":{"name":{"type":"string"},"revision":{"type":"integer","format":"uint32","minimum":0.0}}},"ListSubscriptionsResponse":{"type":"object","required":["subscriptions"],"properties":{"subscriptions":{"type":"array","items":{"$ref":"#/components/schemas/SubscriptionResponse"}}}},"ModifyServiceStateRequest":{"type":"object","required":["new_state","object_key"],"properties":{"version":{"title":"Version","description":"If set, the latest version of the state is compared with this value and the operation will fail when the versions differ.","type":"string","nullable":true},"object_key":{"title":"Service key","description":"To what virtual object key to apply this change","type":"string"},"new_state":{"title":"New State","description":"The new state to replace the previous state with","type":"object","additionalProperties":{"type":"array","items":{"type":"integer","format":"uint8","minimum":0.0}}}}},"ListServicesResponse":{"type":"object","required":["services"],"properties":{"services":{"type":"array","items":{"$ref":"#/components/schemas/ServiceMetadata"}}}}}}} From bc722b598bd43d302caad0643b455adccd712022 Mon Sep 17 00:00:00 2001 From: slinkydeveloper Date: Mon, 22 Apr 2024 11:06:41 +0200 Subject: [PATCH 2/3] Squashed 'sdk-core/src/main/service-protocol/' changes from a4a8596e..552361ef 552361ef handlerType -> ty f38562fd Rename entries and manifest to have names closer to the concept names we use everywhere else (#88) 57a9437c Make the 3 additional fields about related entry in ErrorMessage optional git-subtree-dir: sdk-core/src/main/service-protocol git-subtree-split: 552361ef45340173e8beb361e35fb7b6e5d6effe --- deployment_manifest_schema.json | 16 ++++++++-------- dev/restate/service/protocol.proto | 20 ++++++++++---------- service-invocation-protocol.md | 6 +++--- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/deployment_manifest_schema.json b/deployment_manifest_schema.json index 6695b595..8523e407 100644 --- a/deployment_manifest_schema.json +++ b/deployment_manifest_schema.json @@ -17,18 +17,18 @@ "type": "integer", "maximum": 0 }, - "components": { + "services": { "type": "array", "items": { "type": "object", - "title": "Component", + "title": "Service", "properties": { - "fullyQualifiedComponentName": { + "name": { "type": "string", "pattern": "^([a-zA-Z]|_[a-zA-Z0-9])[a-zA-Z0-9._-]*$" }, - "componentType": { - "title": "ComponentType", + "ty": { + "title": "ServiceType", "enum": ["VIRTUAL_OBJECT", "SERVICE"] }, "handlers": { @@ -41,7 +41,7 @@ "type": "string", "pattern": "^([a-zA-Z]|_[a-zA-Z0-9])[a-zA-Z0-9_]*$" }, - "handlerType": { + "ty": { "title": "HandlerType", "enum": ["EXCLUSIVE", "SHARED"], "description": "If unspecified, defaults to EXCLUSIVE for Virtual Object. This should be unset for Services." @@ -125,11 +125,11 @@ } } }, - "required": ["fullyQualifiedComponentName", "componentType", "handlers"], + "required": ["name", "ty", "handlers"], "additionalProperties": false } } }, - "required": ["minProtocolVersion", "maxProtocolVersion", "components"], + "required": ["minProtocolVersion", "maxProtocolVersion", "services"], "additionalProperties": false } diff --git a/dev/restate/service/protocol.proto b/dev/restate/service/protocol.proto index 3a5a6ea0..3f31ebf7 100644 --- a/dev/restate/service/protocol.proto +++ b/dev/restate/service/protocol.proto @@ -78,11 +78,11 @@ message ErrorMessage { // Entry that caused the failure. This may be outside the current stored journal size. // If no specific entry caused the failure, the current replayed/processed entry can be used. - uint32 related_entry_index = 4; - // Name of the entry that caused the failure. Empty if no name was set. - string related_entry_name = 5; - // Entry type. 0 if unknown. - uint32 related_entry_type = 6; + optional uint32 related_entry_index = 4; + // Name of the entry that caused the failure. + optional string related_entry_name = 5; + // Entry type. + optional uint32 related_entry_type = 6; } // Type: 0x0000 + 4 @@ -222,9 +222,9 @@ message SleepEntryMessage { // Completable: Yes // Fallible: Yes // Type: 0x0C00 + 1 -message InvokeEntryMessage { +message CallEntryMessage { string service_name = 1; - string method_name = 2; + string handler_name = 2; bytes parameter = 3; @@ -245,9 +245,9 @@ message InvokeEntryMessage { // Completable: No // Fallible: Yes // Type: 0x0C00 + 2 -message BackgroundInvokeEntryMessage { +message OneWayCallEntryMessage { string service_name = 1; - string method_name = 2; + string handler_name = 2; bytes parameter = 3; @@ -300,7 +300,7 @@ message CompleteAwakeableEntryMessage { // Fallible: No // Type: 0x0C00 + 5 // Flag: RequiresRuntimeAck -message SideEffectEntryMessage { +message RunEntryMessage { oneof result { bytes value = 14; dev.restate.service.protocol.Failure failure = 15; diff --git a/service-invocation-protocol.md b/service-invocation-protocol.md index e0aea9e1..f7a1a0b4 100644 --- a/service-invocation-protocol.md +++ b/service-invocation-protocol.md @@ -310,15 +310,15 @@ descriptions in [`protocol.proto`](dev/restate/service/protocol.proto). | `GetStateEntryMessage` | `0x0800` | Yes | No | Get the value of a service instance state key. | | `GetStateKeysEntryMessage` | `0x0804` | Yes | No | Get all the known state keys for this service instance. Note: the completion value for this message is a protobuf of type `GetStateKeysEntryMessage.StateKeys`. | | `SleepEntryMessage` | `0x0C00` | Yes | No | Initiate a timer that completes after the given time. | -| `InvokeEntryMessage` | `0x0C01` | Yes | Yes | Invoke another Restate service. | +| `CallEntryMessage` | `0x0C01` | Yes | Yes | Invoke another Restate service. | | `AwakeableEntryMessage` | `0x0C03` | Yes | No | Arbitrary result container which can be completed from another service, given a specific id. See [Awakeable identifier](#awakeable-identifier) for more details. | -| `BackgroundInvokeEntryMessage` | `0x0C02` | No | Yes | Invoke another Restate service at the given time, without waiting for the response. | +| `OneWayCallEntryMessage` | `0x0C02` | No | Yes | Invoke another Restate service at the given time, without waiting for the response. | | `CompleteAwakeableEntryMessage` | `0x0C04` | No | Yes | Complete an `Awakeable`, given its id. See [Awakeable identifier](#awakeable-identifier) for more details. | | `OutputEntryMessage` | `0x0401` | No | No | Carries the invocation output message(s) or terminal failure of the invocation. | | `SetStateEntryMessage` | `0x0800` | No | No | Set the value of a service instance state key. | | `ClearStateEntryMessage` | `0x0801` | No | No | Clear the value of a service instance state key. | | `ClearAllStateEntryMessage` | `0x0802` | No | No | Clear all the values of the service instance state. | -| `SideEffectEntryMessage` | `0x0C05` | No | No | Run non-deterministic user provided code and persist the result. | +| `RunEntryMessage` | `0x0C05` | No | No | Run non-deterministic user provided code and persist the result. | #### Awakeable identifier From 04e8ffb71538616b17e604187b3214ca4a98150e Mon Sep 17 00:00:00 2001 From: slinkydeveloper Date: Mon, 22 Apr 2024 11:15:31 +0200 Subject: [PATCH 3/3] Updates with renamings --- .../restate/sdk/core/DeploymentManifest.java | 24 +++++------ .../java/dev/restate/sdk/core/Entries.java | 33 +++++++-------- .../sdk/core/InvocationStateMachine.java | 12 +++--- .../dev/restate/sdk/core/MessageHeader.java | 12 +++--- .../dev/restate/sdk/core/MessageType.java | 42 +++++++++---------- .../dev/restate/sdk/core/RestateEndpoint.java | 6 +-- .../dev/restate/sdk/core/SyscallsImpl.java | 16 +++---- .../main/java/dev/restate/sdk/core/Util.java | 6 +-- .../dev/restate/service/protocol.proto | 2 +- .../core/ComponentDiscoveryHandlerTest.java | 6 +-- .../restate/sdk/core/MessageHeaderTest.java | 2 +- .../java/dev/restate/sdk/core/ProtoUtils.java | 16 +++---- .../restate/sdk/core/SideEffectTestSuite.java | 22 +++++----- .../core/StateMachineFailuresTestSuite.java | 3 +- .../sdk/core/UserFailuresTestSuite.java | 4 +- .../sdk/http/vertx/RestateHttpEndpointTest.kt | 4 +- .../sdk/http/vertx/VertxExecutorsTest.kt | 4 +- .../restate/sdk/lambda/LambdaHandlerTest.java | 6 +-- .../sdk/testing/ManualRestateRunner.java | 4 +- 19 files changed, 109 insertions(+), 115 deletions(-) diff --git a/sdk-core/src/main/java/dev/restate/sdk/core/DeploymentManifest.java b/sdk-core/src/main/java/dev/restate/sdk/core/DeploymentManifest.java index bbe8d1fe..32cd3b57 100644 --- a/sdk-core/src/main/java/dev/restate/sdk/core/DeploymentManifest.java +++ b/sdk-core/src/main/java/dev/restate/sdk/core/DeploymentManifest.java @@ -11,9 +11,9 @@ import dev.restate.sdk.common.HandlerType; import dev.restate.sdk.common.ServiceType; import dev.restate.sdk.common.syscalls.ServiceDefinition; -import dev.restate.sdk.core.manifest.Component; import dev.restate.sdk.core.manifest.DeploymentManifestSchema; import dev.restate.sdk.core.manifest.Handler; +import dev.restate.sdk.core.manifest.Service; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -28,19 +28,19 @@ public DeploymentManifest( .withMinProtocolVersion(1) .withMaxProtocolVersion(1) .withProtocolMode(protocolMode) - .withComponents( + .withServices( components .map( svc -> - new Component() - .withFullyQualifiedComponentName(svc.getServiceName()) - .withComponentType(convertServiceType(svc.getServiceType())) + new Service() + .withName(svc.getServiceName()) + .withTy(convertServiceType(svc.getServiceType())) .withHandlers( svc.getHandlers().stream() .map( method -> new Handler() - .withHandlerType( + .withTy( convertHandlerType(method.getHandlerType())) .withName(method.getName())) .collect(Collectors.toList()))) @@ -51,23 +51,23 @@ public DeploymentManifestSchema manifest() { return this.manifest; } - private static Component.ComponentType convertServiceType(ServiceType serviceType) { + private static Service.Ty convertServiceType(ServiceType serviceType) { switch (serviceType) { case WORKFLOW: case SERVICE: - return Component.ComponentType.SERVICE; + return Service.Ty.SERVICE; case VIRTUAL_OBJECT: - return Component.ComponentType.VIRTUAL_OBJECT; + return Service.Ty.VIRTUAL_OBJECT; } throw new IllegalStateException(); } - private static Handler.HandlerType convertHandlerType(HandlerType handlerType) { + private static Handler.Ty convertHandlerType(HandlerType handlerType) { switch (handlerType) { case EXCLUSIVE: - return Handler.HandlerType.EXCLUSIVE; + return Handler.Ty.EXCLUSIVE; case SHARED: - return Handler.HandlerType.SHARED; + return Handler.Ty.SHARED; } throw new IllegalStateException(); } diff --git a/sdk-core/src/main/java/dev/restate/sdk/core/Entries.java b/sdk-core/src/main/java/dev/restate/sdk/core/Entries.java index 2e7f7706..ad98d6e9 100644 --- a/sdk-core/src/main/java/dev/restate/sdk/core/Entries.java +++ b/sdk-core/src/main/java/dev/restate/sdk/core/Entries.java @@ -375,7 +375,7 @@ public Result parseCompletionResult(CompletionMessage actual) { } } - static final class InvokeEntry extends CompletableJournalEntry { + static final class InvokeEntry extends CompletableJournalEntry { private final Function> valueParser; @@ -384,43 +384,42 @@ static final class InvokeEntry extends CompletableJournalEntry parseEntryResult(InvokeEntryMessage actual) { + public Result parseEntryResult(CallEntryMessage actual) { if (actual.hasValue()) { return valueParser.apply(actual.getValue()); } @@ -439,30 +438,30 @@ public Result parseCompletionResult(CompletionMessage actual) { } } - static final class BackgroundInvokeEntry extends JournalEntry { + static final class BackgroundInvokeEntry extends JournalEntry { static final BackgroundInvokeEntry INSTANCE = new BackgroundInvokeEntry(); private BackgroundInvokeEntry() {} @Override - public void trace(BackgroundInvokeEntryMessage expected, Span span) { + public void trace(OneWayCallEntryMessage expected, Span span) { span.addEvent( "BackgroundInvoke", Attributes.of( Tracing.RESTATE_COORDINATION_CALL_SERVICE, expected.getServiceName(), Tracing.RESTATE_COORDINATION_CALL_METHOD, - expected.getMethodName())); + expected.getHandlerName())); } @Override - String getName(BackgroundInvokeEntryMessage expected) { + String getName(OneWayCallEntryMessage expected) { return expected.getName(); } @Override - void checkEntryHeader(BackgroundInvokeEntryMessage expected, MessageLite actual) + void checkEntryHeader(OneWayCallEntryMessage expected, MessageLite actual) throws ProtocolException { Util.assertEntryEquals(expected, actual); } diff --git a/sdk-core/src/main/java/dev/restate/sdk/core/InvocationStateMachine.java b/sdk-core/src/main/java/dev/restate/sdk/core/InvocationStateMachine.java index d912395c..f5da7783 100644 --- a/sdk-core/src/main/java/dev/restate/sdk/core/InvocationStateMachine.java +++ b/sdk-core/src/main/java/dev/restate/sdk/core/InvocationStateMachine.java @@ -404,7 +404,7 @@ void processJournalEntry( void enterSideEffectBlock(String name, EnterSideEffectSyscallCallback callback) { checkInsideSideEffectGuard(); - this.nextJournalEntry(name, MessageType.SideEffectEntryMessage); + this.nextJournalEntry(name, MessageType.RunEntryMessage); if (this.invocationState == InvocationState.CLOSED) { callback.onCancel(AbortedExecutionException.INSTANCE); @@ -412,10 +412,10 @@ void enterSideEffectBlock(String name, EnterSideEffectSyscallCallback callback) // Retrieve the entry this.readEntry( msg -> { - Util.assertEntryClass(Protocol.SideEffectEntryMessage.class, msg); + Util.assertEntryClass(Protocol.RunEntryMessage.class, msg); // We have a result already, complete the callback - completeSideEffectCallbackWithEntry((Protocol.SideEffectEntryMessage) msg, callback); + completeSideEffectCallbackWithEntry((Protocol.RunEntryMessage) msg, callback); }, callback::onCancel); } else if (this.invocationState == InvocationState.PROCESSING) { @@ -431,7 +431,7 @@ void enterSideEffectBlock(String name, EnterSideEffectSyscallCallback callback) } void exitSideEffectBlock( - Protocol.SideEffectEntryMessage sideEffectEntry, ExitSideEffectSyscallCallback callback) { + Protocol.RunEntryMessage sideEffectEntry, ExitSideEffectSyscallCallback callback) { this.insideSideEffect = false; if (this.invocationState == InvocationState.CLOSED) { callback.onCancel(AbortedExecutionException.INSTANCE); @@ -454,7 +454,7 @@ void exitSideEffectBlock( this.writeEntry(sideEffectEntry); // Wait for entry to be acked - Protocol.SideEffectEntryMessage finalSideEffectEntry = sideEffectEntry; + Protocol.RunEntryMessage finalSideEffectEntry = sideEffectEntry; this.sideEffectAckStateMachine.waitLastSideEffectAck( new SideEffectAckStateMachine.SideEffectAckCallback() { @Override @@ -480,7 +480,7 @@ public void onError(Throwable e) { } void completeSideEffectCallbackWithEntry( - Protocol.SideEffectEntryMessage sideEffectEntry, ExitSideEffectSyscallCallback callback) { + Protocol.RunEntryMessage sideEffectEntry, ExitSideEffectSyscallCallback callback) { if (sideEffectEntry.hasFailure()) { callback.onFailure(Util.toRestateException(sideEffectEntry.getFailure())); } else { diff --git a/sdk-core/src/main/java/dev/restate/sdk/core/MessageHeader.java b/sdk-core/src/main/java/dev/restate/sdk/core/MessageHeader.java index 7e871da6..292526a3 100644 --- a/sdk-core/src/main/java/dev/restate/sdk/core/MessageHeader.java +++ b/sdk-core/src/main/java/dev/restate/sdk/core/MessageHeader.java @@ -78,11 +78,11 @@ public static MessageHeader fromMessage(MessageLite msg) { ? DONE_FLAG : 0, msg.getSerializedSize()); - } else if (msg instanceof Protocol.InvokeEntryMessage) { + } else if (msg instanceof Protocol.CallEntryMessage) { return new MessageHeader( - MessageType.InvokeEntryMessage, - ((Protocol.InvokeEntryMessage) msg).getResultCase() - != Protocol.InvokeEntryMessage.ResultCase.RESULT_NOT_SET + MessageType.CallEntryMessage, + ((Protocol.CallEntryMessage) msg).getResultCase() + != Protocol.CallEntryMessage.ResultCase.RESULT_NOT_SET ? DONE_FLAG : 0, msg.getSerializedSize()); @@ -94,9 +94,9 @@ public static MessageHeader fromMessage(MessageLite msg) { ? DONE_FLAG : 0, msg.getSerializedSize()); - } else if (msg instanceof Protocol.SideEffectEntryMessage) { + } else if (msg instanceof Protocol.RunEntryMessage) { return new MessageHeader( - MessageType.SideEffectEntryMessage, REQUIRES_ACK_FLAG, msg.getSerializedSize()); + MessageType.RunEntryMessage, REQUIRES_ACK_FLAG, msg.getSerializedSize()); } // Messages with no flags return new MessageHeader(MessageType.fromMessage(msg), 0, msg.getSerializedSize()); diff --git a/sdk-core/src/main/java/dev/restate/sdk/core/MessageType.java b/sdk-core/src/main/java/dev/restate/sdk/core/MessageType.java index 486756c6..69fe5bd0 100644 --- a/sdk-core/src/main/java/dev/restate/sdk/core/MessageType.java +++ b/sdk-core/src/main/java/dev/restate/sdk/core/MessageType.java @@ -34,11 +34,11 @@ public enum MessageType { // Syscalls SleepEntryMessage, - InvokeEntryMessage, - BackgroundInvokeEntryMessage, + CallEntryMessage, + OneWayCallEntryMessage, AwakeableEntryMessage, CompleteAwakeableEntryMessage, - SideEffectEntryMessage, + RunEntryMessage, // SDK specific CombinatorAwaitableEntryMessage; @@ -94,18 +94,18 @@ public Parser messageParser() { return Protocol.GetStateKeysEntryMessage.parser(); case SleepEntryMessage: return Protocol.SleepEntryMessage.parser(); - case InvokeEntryMessage: - return Protocol.InvokeEntryMessage.parser(); - case BackgroundInvokeEntryMessage: - return Protocol.BackgroundInvokeEntryMessage.parser(); + case CallEntryMessage: + return Protocol.CallEntryMessage.parser(); + case OneWayCallEntryMessage: + return Protocol.OneWayCallEntryMessage.parser(); case AwakeableEntryMessage: return Protocol.AwakeableEntryMessage.parser(); case CompleteAwakeableEntryMessage: return Protocol.CompleteAwakeableEntryMessage.parser(); case CombinatorAwaitableEntryMessage: return Java.CombinatorAwaitableEntryMessage.parser(); - case SideEffectEntryMessage: - return Protocol.SideEffectEntryMessage.parser(); + case RunEntryMessage: + return Protocol.RunEntryMessage.parser(); } throw new IllegalStateException(); } @@ -140,9 +140,9 @@ public short encode() { return GET_STATE_KEYS_ENTRY_MESSAGE_TYPE; case SleepEntryMessage: return SLEEP_ENTRY_MESSAGE_TYPE; - case InvokeEntryMessage: + case CallEntryMessage: return INVOKE_ENTRY_MESSAGE_TYPE; - case BackgroundInvokeEntryMessage: + case OneWayCallEntryMessage: return BACKGROUND_INVOKE_ENTRY_MESSAGE_TYPE; case AwakeableEntryMessage: return AWAKEABLE_ENTRY_MESSAGE_TYPE; @@ -150,7 +150,7 @@ public short encode() { return COMPLETE_AWAKEABLE_ENTRY_MESSAGE_TYPE; case CombinatorAwaitableEntryMessage: return COMBINATOR_AWAITABLE_ENTRY_MESSAGE_TYPE; - case SideEffectEntryMessage: + case RunEntryMessage: return SIDE_EFFECT_ENTRY_MESSAGE_TYPE; } throw new IllegalStateException(); @@ -187,9 +187,9 @@ public static MessageType decode(short value) throws ProtocolException { case SLEEP_ENTRY_MESSAGE_TYPE: return SleepEntryMessage; case INVOKE_ENTRY_MESSAGE_TYPE: - return InvokeEntryMessage; + return CallEntryMessage; case BACKGROUND_INVOKE_ENTRY_MESSAGE_TYPE: - return BackgroundInvokeEntryMessage; + return OneWayCallEntryMessage; case AWAKEABLE_ENTRY_MESSAGE_TYPE: return AwakeableEntryMessage; case COMPLETE_AWAKEABLE_ENTRY_MESSAGE_TYPE: @@ -197,7 +197,7 @@ public static MessageType decode(short value) throws ProtocolException { case COMBINATOR_AWAITABLE_ENTRY_MESSAGE_TYPE: return CombinatorAwaitableEntryMessage; case SIDE_EFFECT_ENTRY_MESSAGE_TYPE: - return SideEffectEntryMessage; + return RunEntryMessage; } throw ProtocolException.unknownMessageType(value); } @@ -227,18 +227,18 @@ public static MessageType fromMessage(MessageLite msg) { return MessageType.GetStateKeysEntryMessage; } else if (msg instanceof Protocol.SleepEntryMessage) { return MessageType.SleepEntryMessage; - } else if (msg instanceof Protocol.InvokeEntryMessage) { - return MessageType.InvokeEntryMessage; - } else if (msg instanceof Protocol.BackgroundInvokeEntryMessage) { - return MessageType.BackgroundInvokeEntryMessage; + } else if (msg instanceof Protocol.CallEntryMessage) { + return MessageType.CallEntryMessage; + } else if (msg instanceof Protocol.OneWayCallEntryMessage) { + return MessageType.OneWayCallEntryMessage; } else if (msg instanceof Protocol.AwakeableEntryMessage) { return MessageType.AwakeableEntryMessage; } else if (msg instanceof Protocol.CompleteAwakeableEntryMessage) { return MessageType.CompleteAwakeableEntryMessage; } else if (msg instanceof Java.CombinatorAwaitableEntryMessage) { return MessageType.CombinatorAwaitableEntryMessage; - } else if (msg instanceof Protocol.SideEffectEntryMessage) { - return MessageType.SideEffectEntryMessage; + } else if (msg instanceof Protocol.RunEntryMessage) { + return MessageType.RunEntryMessage; } else if (msg instanceof Protocol.CompletionMessage) { throw new IllegalArgumentException("SDK should never send a CompletionMessage"); } diff --git a/sdk-core/src/main/java/dev/restate/sdk/core/RestateEndpoint.java b/sdk-core/src/main/java/dev/restate/sdk/core/RestateEndpoint.java index 54a67063..8e32f507 100644 --- a/sdk-core/src/main/java/dev/restate/sdk/core/RestateEndpoint.java +++ b/sdk-core/src/main/java/dev/restate/sdk/core/RestateEndpoint.java @@ -11,8 +11,8 @@ import dev.restate.sdk.common.BindableServiceFactory; import dev.restate.sdk.common.syscalls.HandlerDefinition; import dev.restate.sdk.common.syscalls.ServiceDefinition; -import dev.restate.sdk.core.manifest.Component; import dev.restate.sdk.core.manifest.DeploymentManifestSchema; +import dev.restate.sdk.core.manifest.Service; import io.opentelemetry.api.OpenTelemetry; import io.opentelemetry.api.trace.Span; import io.opentelemetry.api.trace.SpanKind; @@ -94,9 +94,7 @@ public DeploymentManifestSchema handleDiscoveryRequest() { DeploymentManifestSchema response = this.deploymentManifest.manifest(); LOG.info( "Replying to discovery request with services [{}]", - response.getComponents().stream() - .map(Component::getFullyQualifiedComponentName) - .collect(Collectors.joining(","))); + response.getServices().stream().map(Service::getName).collect(Collectors.joining(","))); return response; } diff --git a/sdk-core/src/main/java/dev/restate/sdk/core/SyscallsImpl.java b/sdk-core/src/main/java/dev/restate/sdk/core/SyscallsImpl.java index ce5ecdb0..31cfc338 100644 --- a/sdk-core/src/main/java/dev/restate/sdk/core/SyscallsImpl.java +++ b/sdk-core/src/main/java/dev/restate/sdk/core/SyscallsImpl.java @@ -174,10 +174,10 @@ public void call( () -> { LOG.trace("call {}", target); - Protocol.InvokeEntryMessage.Builder builder = - Protocol.InvokeEntryMessage.newBuilder() + Protocol.CallEntryMessage.Builder builder = + Protocol.CallEntryMessage.newBuilder() .setServiceName(target.getService()) - .setMethodName(target.getHandler()) + .setHandlerName(target.getHandler()) .setParameter(parameter); if (target.getKey() != null) { builder.setKey(target.getKey()); @@ -199,10 +199,10 @@ public void send( () -> { LOG.trace("backgroundCall {}", target); - Protocol.BackgroundInvokeEntryMessage.Builder builder = - Protocol.BackgroundInvokeEntryMessage.newBuilder() + Protocol.OneWayCallEntryMessage.Builder builder = + Protocol.OneWayCallEntryMessage.newBuilder() .setServiceName(target.getService()) - .setMethodName(target.getHandler()) + .setHandlerName(target.getHandler()) .setParameter(parameter); if (target.getKey() != null) { builder.setKey(target.getKey()); @@ -233,7 +233,7 @@ public void exitSideEffectBlock(ByteString toWrite, ExitSideEffectSyscallCallbac () -> { LOG.trace("exitSideEffectBlock with success"); this.stateMachine.exitSideEffectBlock( - Protocol.SideEffectEntryMessage.newBuilder().setValue(toWrite).build(), callback); + Protocol.RunEntryMessage.newBuilder().setValue(toWrite).build(), callback); }, callback); } @@ -245,7 +245,7 @@ public void exitSideEffectBlockWithTerminalException( () -> { LOG.trace("exitSideEffectBlock with failure"); this.stateMachine.exitSideEffectBlock( - Protocol.SideEffectEntryMessage.newBuilder() + Protocol.RunEntryMessage.newBuilder() .setFailure(Util.toProtocolFailure(toWrite)) .build(), callback); diff --git a/sdk-core/src/main/java/dev/restate/sdk/core/Util.java b/sdk-core/src/main/java/dev/restate/sdk/core/Util.java index ba3da434..96613044 100644 --- a/sdk-core/src/main/java/dev/restate/sdk/core/Util.java +++ b/sdk-core/src/main/java/dev/restate/sdk/core/Util.java @@ -149,11 +149,11 @@ static boolean isEntry(MessageLite msg) { || msg instanceof Protocol.ClearStateEntryMessage || msg instanceof Protocol.ClearAllStateEntryMessage || msg instanceof Protocol.SleepEntryMessage - || msg instanceof Protocol.InvokeEntryMessage - || msg instanceof Protocol.BackgroundInvokeEntryMessage + || msg instanceof Protocol.CallEntryMessage + || msg instanceof Protocol.OneWayCallEntryMessage || msg instanceof Protocol.AwakeableEntryMessage || msg instanceof Protocol.CompleteAwakeableEntryMessage || msg instanceof Java.CombinatorAwaitableEntryMessage - || msg instanceof Protocol.SideEffectEntryMessage; + || msg instanceof Protocol.RunEntryMessage; } } diff --git a/sdk-core/src/main/service-protocol/dev/restate/service/protocol.proto b/sdk-core/src/main/service-protocol/dev/restate/service/protocol.proto index 3f31ebf7..2518c5d2 100644 --- a/sdk-core/src/main/service-protocol/dev/restate/service/protocol.proto +++ b/sdk-core/src/main/service-protocol/dev/restate/service/protocol.proto @@ -313,7 +313,7 @@ message RunEntryMessage { // --- Nested messages // This failure object carries user visible errors, -// e.g. invocation failure return value or failure result of an InvokeEntryMessage. +// e.g. invocation failure return value or failure result of an CallEntryMessage. message Failure { // The code can be any HTTP status code, as described https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml. uint32 code = 1; diff --git a/sdk-core/src/test/java/dev/restate/sdk/core/ComponentDiscoveryHandlerTest.java b/sdk-core/src/test/java/dev/restate/sdk/core/ComponentDiscoveryHandlerTest.java index e095dbb3..ca860d4a 100644 --- a/sdk-core/src/test/java/dev/restate/sdk/core/ComponentDiscoveryHandlerTest.java +++ b/sdk-core/src/test/java/dev/restate/sdk/core/ComponentDiscoveryHandlerTest.java @@ -14,9 +14,9 @@ import dev.restate.sdk.common.ServiceType; import dev.restate.sdk.common.syscalls.HandlerDefinition; import dev.restate.sdk.common.syscalls.ServiceDefinition; -import dev.restate.sdk.core.manifest.Component; import dev.restate.sdk.core.manifest.DeploymentManifestSchema; import dev.restate.sdk.core.manifest.DeploymentManifestSchema.ProtocolMode; +import dev.restate.sdk.core.manifest.Service; import java.util.List; import java.util.stream.Stream; import org.junit.jupiter.api.Test; @@ -38,9 +38,7 @@ void handleWithMultipleServices() { DeploymentManifestSchema manifest = deploymentManifest.manifest(); - assertThat(manifest.getComponents()) - .extracting(Component::getFullyQualifiedComponentName) - .containsOnly("MyGreeter"); + assertThat(manifest.getServices()).extracting(Service::getName).containsOnly("MyGreeter"); assertThat(manifest.getProtocolMode()).isEqualTo(ProtocolMode.REQUEST_RESPONSE); } } diff --git a/sdk-core/src/test/java/dev/restate/sdk/core/MessageHeaderTest.java b/sdk-core/src/test/java/dev/restate/sdk/core/MessageHeaderTest.java index 3de3267d..7f48cb39 100644 --- a/sdk-core/src/test/java/dev/restate/sdk/core/MessageHeaderTest.java +++ b/sdk-core/src/test/java/dev/restate/sdk/core/MessageHeaderTest.java @@ -19,7 +19,7 @@ public class MessageHeaderTest { void requiresAckFlag() { assertThat( new MessageHeader( - MessageType.InvokeEntryMessage, + MessageType.CallEntryMessage, MessageHeader.DONE_FLAG | MessageHeader.REQUIRES_ACK_FLAG, 2) .encode()) diff --git a/sdk-core/src/test/java/dev/restate/sdk/core/ProtoUtils.java b/sdk-core/src/test/java/dev/restate/sdk/core/ProtoUtils.java index 431895b4..b96d5289 100644 --- a/sdk-core/src/test/java/dev/restate/sdk/core/ProtoUtils.java +++ b/sdk-core/src/test/java/dev/restate/sdk/core/ProtoUtils.java @@ -190,11 +190,11 @@ public static Protocol.ClearStateEntryMessage clearStateMessage(String key) { .build(); } - public static Protocol.InvokeEntryMessage.Builder invokeMessage(Target target) { - Protocol.InvokeEntryMessage.Builder builder = - Protocol.InvokeEntryMessage.newBuilder() + public static Protocol.CallEntryMessage.Builder invokeMessage(Target target) { + Protocol.CallEntryMessage.Builder builder = + Protocol.CallEntryMessage.newBuilder() .setServiceName(target.getService()) - .setMethodName(target.getHandler()); + .setHandlerName(target.getHandler()); if (target.getKey() != null) { builder.setKey(target.getKey()); } @@ -202,23 +202,23 @@ public static Protocol.InvokeEntryMessage.Builder invokeMessage(Target target) { return builder; } - public static Protocol.InvokeEntryMessage.Builder invokeMessage( + public static Protocol.CallEntryMessage.Builder invokeMessage( Target target, Serde reqSerde, T parameter) { return invokeMessage(target).setParameter(reqSerde.serializeToByteString(parameter)); } - public static Protocol.InvokeEntryMessage invokeMessage( + public static Protocol.CallEntryMessage invokeMessage( Target target, Serde reqSerde, T parameter, Serde resSerde, R result) { return invokeMessage(target, reqSerde, parameter) .setValue(resSerde.serializeToByteString(result)) .build(); } - public static Protocol.InvokeEntryMessage.Builder invokeMessage(Target target, String parameter) { + public static Protocol.CallEntryMessage.Builder invokeMessage(Target target, String parameter) { return invokeMessage(target, CoreSerdes.JSON_STRING, parameter); } - public static Protocol.InvokeEntryMessage invokeMessage( + public static Protocol.CallEntryMessage invokeMessage( Target target, String parameter, String result) { return invokeMessage(target, CoreSerdes.JSON_STRING, parameter, CoreSerdes.JSON_STRING, result); } diff --git a/sdk-core/src/test/java/dev/restate/sdk/core/SideEffectTestSuite.java b/sdk-core/src/test/java/dev/restate/sdk/core/SideEffectTestSuite.java index 7394a675..756188e3 100644 --- a/sdk-core/src/test/java/dev/restate/sdk/core/SideEffectTestSuite.java +++ b/sdk-core/src/test/java/dev/restate/sdk/core/SideEffectTestSuite.java @@ -40,14 +40,14 @@ public Stream definitions() { this.sideEffect("Francesco") .withInput(startMessage(1), inputMessage("Till")) .expectingOutput( - Protocol.SideEffectEntryMessage.newBuilder() + Protocol.RunEntryMessage.newBuilder() .setValue(CoreSerdes.JSON_STRING.serializeToByteString("Francesco")), suspensionMessage(1)) .named("Without optimization suspends"), this.sideEffect("Francesco") .withInput(startMessage(1), inputMessage("Till"), ackMessage(1)) .expectingOutput( - Protocol.SideEffectEntryMessage.newBuilder() + Protocol.RunEntryMessage.newBuilder() .setValue(CoreSerdes.JSON_STRING.serializeToByteString("Francesco")), outputMessage("Hello Francesco"), END_MESSAGE) @@ -55,14 +55,14 @@ public Stream definitions() { this.namedSideEffect("get-my-name", "Francesco") .withInput(startMessage(1), inputMessage("Till")) .expectingOutput( - Protocol.SideEffectEntryMessage.newBuilder() + Protocol.RunEntryMessage.newBuilder() .setName("get-my-name") .setValue(CoreSerdes.JSON_STRING.serializeToByteString("Francesco")), suspensionMessage(1)), this.consecutiveSideEffect("Francesco") .withInput(startMessage(1), inputMessage("Till")) .expectingOutput( - Protocol.SideEffectEntryMessage.newBuilder() + Protocol.RunEntryMessage.newBuilder() .setValue(CoreSerdes.JSON_STRING.serializeToByteString("Francesco")), suspensionMessage(1)) .named("With optimization and without ack on first side effect will suspend"), @@ -70,9 +70,9 @@ public Stream definitions() { .withInput(startMessage(1), inputMessage("Till"), ackMessage(1)) .onlyUnbuffered() .expectingOutput( - Protocol.SideEffectEntryMessage.newBuilder() + Protocol.RunEntryMessage.newBuilder() .setValue(CoreSerdes.JSON_STRING.serializeToByteString("Francesco")), - Protocol.SideEffectEntryMessage.newBuilder() + Protocol.RunEntryMessage.newBuilder() .setValue(CoreSerdes.JSON_STRING.serializeToByteString("FRANCESCO")), suspensionMessage(2)) .named("With optimization and ack on first side effect will suspend"), @@ -80,9 +80,9 @@ public Stream definitions() { .withInput(startMessage(1), inputMessage("Till"), ackMessage(1), ackMessage(2)) .onlyUnbuffered() .expectingOutput( - Protocol.SideEffectEntryMessage.newBuilder() + Protocol.RunEntryMessage.newBuilder() .setValue(CoreSerdes.JSON_STRING.serializeToByteString("Francesco")), - Protocol.SideEffectEntryMessage.newBuilder() + Protocol.RunEntryMessage.newBuilder() .setValue(CoreSerdes.JSON_STRING.serializeToByteString("FRANCESCO")), outputMessage("Hello FRANCESCO"), END_MESSAGE) @@ -100,7 +100,7 @@ public Stream definitions() { Protocol.ErrorMessage::getCode) .returns(1, Protocol.ErrorMessage::getRelatedEntryIndex) .returns( - (int) MessageType.SideEffectEntryMessage.encode(), + (int) MessageType.RunEntryMessage.encode(), Protocol.ErrorMessage::getRelatedEntryType) .returns( "my-side-effect", Protocol.ErrorMessage::getRelatedEntryName) @@ -116,8 +116,8 @@ public Stream definitions() { assertThat(actualOutputMessages).hasSize(3); assertThat(actualOutputMessages) .element(0) - .asInstanceOf(type(Protocol.SideEffectEntryMessage.class)) - .returns(true, Protocol.SideEffectEntryMessage::hasValue); + .asInstanceOf(type(Protocol.RunEntryMessage.class)) + .returns(true, Protocol.RunEntryMessage::hasValue); assertThat(actualOutputMessages).element(1).isEqualTo(outputMessage("Hello")); assertThat(actualOutputMessages).element(2).isEqualTo(END_MESSAGE); }), diff --git a/sdk-core/src/test/java/dev/restate/sdk/core/StateMachineFailuresTestSuite.java b/sdk-core/src/test/java/dev/restate/sdk/core/StateMachineFailuresTestSuite.java index 300b3b8a..cbf1beae 100644 --- a/sdk-core/src/test/java/dev/restate/sdk/core/StateMachineFailuresTestSuite.java +++ b/sdk-core/src/test/java/dev/restate/sdk/core/StateMachineFailuresTestSuite.java @@ -77,8 +77,7 @@ public Stream definitions() { errorMessageStartingWith(IllegalStateException.class.getCanonicalName()))) .named("Serde serialization error"), this.sideEffectFailure(FAILING_DESERIALIZATION_INTEGER_TYPE_TAG) - .withInput( - startMessage(2), inputMessage("Till"), Protocol.SideEffectEntryMessage.newBuilder()) + .withInput(startMessage(2), inputMessage("Till"), Protocol.RunEntryMessage.newBuilder()) .assertingOutput( AssertUtils.containsOnly( errorMessageStartingWith(IllegalStateException.class.getCanonicalName()))) diff --git a/sdk-core/src/test/java/dev/restate/sdk/core/UserFailuresTestSuite.java b/sdk-core/src/test/java/dev/restate/sdk/core/UserFailuresTestSuite.java index 95963156..beab7bce 100644 --- a/sdk-core/src/test/java/dev/restate/sdk/core/UserFailuresTestSuite.java +++ b/sdk-core/src/test/java/dev/restate/sdk/core/UserFailuresTestSuite.java @@ -69,7 +69,7 @@ public Stream definitions() { TerminalException.INTERNAL_SERVER_ERROR_CODE, MY_ERROR) .withInput(startMessage(1), inputMessage(), ackMessage(1)) .expectingOutput( - Protocol.SideEffectEntryMessage.newBuilder() + Protocol.RunEntryMessage.newBuilder() .setFailure( Util.toProtocolFailure( TerminalException.INTERNAL_SERVER_ERROR_CODE, MY_ERROR)), @@ -79,7 +79,7 @@ public Stream definitions() { this.sideEffectThrowTerminalException(501, WHATEVER) .withInput(startMessage(1), inputMessage(), ackMessage(1)) .expectingOutput( - Protocol.SideEffectEntryMessage.newBuilder() + Protocol.RunEntryMessage.newBuilder() .setFailure(Util.toProtocolFailure(501, WHATEVER)), outputMessage(501, WHATEVER), END_MESSAGE) diff --git a/sdk-http-vertx/src/test/kotlin/dev/restate/sdk/http/vertx/RestateHttpEndpointTest.kt b/sdk-http-vertx/src/test/kotlin/dev/restate/sdk/http/vertx/RestateHttpEndpointTest.kt index 27658729..4f121a70 100644 --- a/sdk-http-vertx/src/test/kotlin/dev/restate/sdk/http/vertx/RestateHttpEndpointTest.kt +++ b/sdk-http-vertx/src/test/kotlin/dev/restate/sdk/http/vertx/RestateHttpEndpointTest.kt @@ -215,8 +215,8 @@ internal class RestateHttpEndpointTest { val discoveryResponse: DeploymentManifestSchema = ObjectMapper().readValue(responseBody.bytes, DeploymentManifestSchema::class.java) - assertThat(discoveryResponse.components) - .map { it.fullyQualifiedComponentName } + assertThat(discoveryResponse.services) + .map { it.name } .containsOnly(BlockingGreeter::class.java.simpleName) } diff --git a/sdk-http-vertx/src/test/kotlin/dev/restate/sdk/http/vertx/VertxExecutorsTest.kt b/sdk-http-vertx/src/test/kotlin/dev/restate/sdk/http/vertx/VertxExecutorsTest.kt index d87ef256..0040a7b6 100644 --- a/sdk-http-vertx/src/test/kotlin/dev/restate/sdk/http/vertx/VertxExecutorsTest.kt +++ b/sdk-http-vertx/src/test/kotlin/dev/restate/sdk/http/vertx/VertxExecutorsTest.kt @@ -76,7 +76,7 @@ class VertxExecutorsTest : TestDefinitions.TestSuite { .withInput(startMessage(1), inputMessage(), ackMessage(1)) .onlyUnbuffered() .expectingOutput( - Protocol.SideEffectEntryMessage.newBuilder().setValue(ByteString.EMPTY), + Protocol.RunEntryMessage.newBuilder().setValue(ByteString.EMPTY), outputMessage(), END_MESSAGE), testInvocation( @@ -90,7 +90,7 @@ class VertxExecutorsTest : TestDefinitions.TestSuite { .withInput(startMessage(1), inputMessage(), ackMessage(1)) .onlyUnbuffered() .expectingOutput( - Protocol.SideEffectEntryMessage.newBuilder().setValue(ByteString.EMPTY), + Protocol.RunEntryMessage.newBuilder().setValue(ByteString.EMPTY), outputMessage(), END_MESSAGE)) } diff --git a/sdk-lambda/src/test/java/dev/restate/sdk/lambda/LambdaHandlerTest.java b/sdk-lambda/src/test/java/dev/restate/sdk/lambda/LambdaHandlerTest.java index 5b797c40..6333ef2c 100644 --- a/sdk-lambda/src/test/java/dev/restate/sdk/lambda/LambdaHandlerTest.java +++ b/sdk-lambda/src/test/java/dev/restate/sdk/lambda/LambdaHandlerTest.java @@ -21,8 +21,8 @@ import com.google.protobuf.MessageLite; import dev.restate.generated.service.protocol.Protocol; import dev.restate.sdk.core.ProtoUtils; -import dev.restate.sdk.core.manifest.Component; import dev.restate.sdk.core.manifest.DeploymentManifestSchema; +import dev.restate.sdk.core.manifest.Service; import dev.restate.sdk.lambda.testservices.JavaCounterClient; import dev.restate.sdk.lambda.testservices.MyServicesHandler; import java.io.ByteArrayOutputStream; @@ -95,8 +95,8 @@ public void testDiscovery() throws IOException { DeploymentManifestSchema discoveryResponse = new ObjectMapper().readValue(decodedStringResponse, DeploymentManifestSchema.class); - assertThat(discoveryResponse.getComponents()) - .map(Component::getFullyQualifiedComponentName) + assertThat(discoveryResponse.getServices()) + .map(Service::getName) .containsOnly(JavaCounterClient.SERVICE_NAME, "KtCounter"); } diff --git a/sdk-testing/src/main/java/dev/restate/sdk/testing/ManualRestateRunner.java b/sdk-testing/src/main/java/dev/restate/sdk/testing/ManualRestateRunner.java index cf62c52b..5f4726e5 100644 --- a/sdk-testing/src/main/java/dev/restate/sdk/testing/ManualRestateRunner.java +++ b/sdk-testing/src/main/java/dev/restate/sdk/testing/ManualRestateRunner.java @@ -103,8 +103,8 @@ public void run() { .uri("http://host.testcontainers.internal:" + serviceEndpointPort))); LOG.debug( "Registered services {}", - response.getComponents().stream() - .map(dev.restate.admin.model.ComponentMetadata::getName) + response.getServices().stream() + .map(dev.restate.admin.model.ServiceMetadata::getName) .collect(Collectors.toList())); } catch (ApiException e) { throw new RuntimeException(e);